aboutsummaryrefslogtreecommitdiff
path: root/tcg
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2014-05-15 00:09:47 -0400
committerRichard Henderson <rth@twiddle.net>2014-05-15 00:09:47 -0400
commita1756896546fccf39eef6f282dcbd2f9292c1286 (patch)
tree6cc2c1a9712c9f169e1f6d7db35bf64be0c9e2f6 /tcg
parent450445d543a33fdb1d18a18ab7669a33dc1ca7ae (diff)
downloadqemu-a1756896546fccf39eef6f282dcbd2f9292c1286.zip
qemu-a1756896546fccf39eef6f282dcbd2f9292c1286.tar.gz
qemu-a1756896546fccf39eef6f282dcbd2f9292c1286.tar.bz2
tcg-s390: Fix off-by-one in wraparound andi
Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'tcg')
-rw-r--r--tcg/s390/tcg-target.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tcg/s390/tcg-target.c b/tcg/s390/tcg-target.c
index ebdd074..0f972ae 100644
--- a/tcg/s390/tcg-target.c
+++ b/tcg/s390/tcg-target.c
@@ -983,8 +983,8 @@ static void tgen_andi(TCGContext *s, TCGType type, TCGReg dest, uint64_t val)
int msb, lsb;
if ((val & 0x8000000000000001ull) == 0x8000000000000001ull) {
/* Achieve wraparound by swapping msb and lsb. */
- msb = 63 - ctz64(~val);
- lsb = clz64(~val) + 1;
+ msb = 64 - ctz64(~val);
+ lsb = clz64(~val) - 1;
} else {
msb = clz64(val);
lsb = 63 - ctz64(val);