handle constants larger than 8 bits in subtractBorrowCR

This commit is contained in:
Joel Dice 2012-03-11 04:58:15 -06:00
parent 6c9a1e1643
commit 71295e54c7
2 changed files with 50 additions and 1 deletions

View File

@ -1478,7 +1478,8 @@ subtractBorrowCR(Context* c, unsigned size UNUSED, Assembler::Constant* a,
opcode(c, 0x83, 0xd8 + regCode(b));
c->code.append(v);
} else {
abort(c);
opcode(c, 0x81, 0xd8 + regCode(b));
c->code.append4(v);
}
}

View File

@ -234,6 +234,54 @@ public class Longs {
expect((a ^ 25214903884L) == (2L ^ 25214903884L));
}
{ long b = 2;
expect((-281474976710656L) >> b == -281474976710656L >> 2);
expect((-281474976710656L) >>> b == -281474976710656L >>> 2);
expect((-281474976710656L) << b == -281474976710656L << 2);
expect((-281474976710656L) + b == -281474976710656L + 2L);
expect((-281474976710656L) - b == -281474976710656L - 2L);
expect((-281474976710656L) * b == -281474976710656L * 2L);
expect((-281474976710656L) / b == -281474976710656L / 2L);
expect((-281474976710656L) % b == -281474976710656L % 2L);
expect(((-281474976710656L) & b) == (-281474976710656L & 2L));
expect(((-281474976710656L) | b) == (-281474976710656L | 2L));
expect(((-281474976710656L) ^ b) == (-281474976710656L ^ 2L));
b = 2;
expect(281474976710656L >> b == 281474976710656L >> 2);
expect(281474976710656L >>> b == 281474976710656L >>> 2);
expect(281474976710656L << b == 281474976710656L << 2);
expect(281474976710656L + b == 281474976710656L + 2L);
expect(281474976710656L - b == 281474976710656L - 2L);
expect(281474976710656L * b == 281474976710656L * 2L);
expect(281474976710656L / b == 281474976710656L / 2L);
expect(281474976710656L % b == 281474976710656L % 2L);
expect((281474976710656L & b) == (281474976710656L & 2L));
expect((281474976710656L | b) == (281474976710656L | 2L));
expect((281474976710656L ^ b) == (281474976710656L ^ 2L));
}
{ long a = 2L;
expect(a + (-281474976710656L) == 2L + (-281474976710656L));
expect(a - (-281474976710656L) == 2L - (-281474976710656L));
expect(a * (-281474976710656L) == 2L * (-281474976710656L));
expect(a / (-281474976710656L) == 2L / (-281474976710656L));
expect(a % (-281474976710656L) == 2L % (-281474976710656L));
expect((a & (-281474976710656L)) == (2L & (-281474976710656L)));
expect((a | (-281474976710656L)) == (2L | (-281474976710656L)));
expect((a ^ (-281474976710656L)) == (2L ^ (-281474976710656L)));
a = 2L;
expect(a + 281474976710656L == 2L + 281474976710656L);
expect(a - 281474976710656L == 2L - 281474976710656L);
expect(a * 281474976710656L == 2L * 281474976710656L);
expect(a / 281474976710656L == 2L / 281474976710656L);
expect(a % 281474976710656L == 2L % 281474976710656L);
expect((a & 281474976710656L) == (2L & 281474976710656L));
expect((a | 281474976710656L) == (2L | 281474976710656L));
expect((a ^ 281474976710656L) == (2L ^ 281474976710656L));
}
{ long x = 231;
expect((x >> 32) == 0);
expect((x >>> 32) == 0);