summaryrefslogtreecommitdiffstats
path: root/hw/xen/xen-host-pci-device.c
diff options
context:
space:
mode:
authorAurelien Jarno2015-07-05 18:50:09 +0200
committerAurelien Jarno2015-09-13 23:08:51 +0200
commiteb6ca2b4a69325e95526bc0f2897791df04e44dc (patch)
tree1501d1dabef3ec5639070bec1ad1bd54deb8d3a5 /hw/xen/xen-host-pci-device.c
parenttarget-sh4: use deposit in swap.b instruction (diff)
downloadqemu-eb6ca2b4a69325e95526bc0f2897791df04e44dc.tar.gz
qemu-eb6ca2b4a69325e95526bc0f2897791df04e44dc.tar.xz
qemu-eb6ca2b4a69325e95526bc0f2897791df04e44dc.zip
target-sh4: improve cmp/str instruction
Instead of testing bytes one by one, we can use the following trick from https://graphics.stanford.edu/~seander/bithacks.html: haszero(v) = (v - 0x01010101) & ~v & 0x80808080 The subexpression v - 0x01010101, evaluates to a high bit set in any byte whenever the corresponding byte in v is zero or greater than 0x80. The sub-expression ~v & 0x80808080 evaluates to high bits set in bytes where the byte of v doesn't have its high bit set (so the byte was less than 0x80). Finally, by ANDing these two sub-expressions the result is the high bits set where the bytes in v were zero, since the high bits set due to a value greater than 0x80 in the first sub-expression are masked off by the second. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'hw/xen/xen-host-pci-device.c')
0 files changed, 0 insertions, 0 deletions