fix 64-bit shifts on x86_32 (part 2)

My earlier attempt (fa5d76b) missed an important detail, and somehow I
forgot to test the 32-bit OpenJDK build which made that omission
obvious.  Here's the fix.
This commit is contained in:
Joel Dice 2012-09-03 08:44:13 -06:00
parent 3f039864d1
commit 24f682f5b6
2 changed files with 10 additions and 6 deletions

View File

@ -2186,9 +2186,9 @@ shiftLeftRR(Context* c, UNUSED unsigned aSize, Assembler::Register* a,
unsigned bSize, Assembler::Register* b)
{
if (TargetBytesPerWord == 4 and bSize == 8) {
Assembler::Register cx(rcx);
if (a->low != rcx) {
c->client->save(rcx);
Assembler::Register cx(rcx);
ResolvedPromise promise(0x3F);
Assembler::Constant mask(&promise);
moveRR(c, 4, a, 4, &cx);
@ -2204,7 +2204,7 @@ shiftLeftRR(Context* c, UNUSED unsigned aSize, Assembler::Register* a,
ResolvedPromise promise(32);
Assembler::Constant constant(&promise);
compareCR(c, aSize, &constant, aSize, a);
compareCR(c, aSize, &constant, aSize, &cx);
opcode(c, 0x7c); //jl
c->code.append(2 + 2);
@ -2232,9 +2232,9 @@ shiftRightRR(Context* c, UNUSED unsigned aSize, Assembler::Register* a,
unsigned bSize, Assembler::Register* b)
{
if (TargetBytesPerWord == 4 and bSize == 8) {
Assembler::Register cx(rcx);
if (a->low != rcx) {
c->client->save(rcx);
Assembler::Register cx(rcx);
ResolvedPromise promise(0x3F);
Assembler::Constant mask(&promise);
moveRR(c, 4, a, 4, &cx);
@ -2250,7 +2250,7 @@ shiftRightRR(Context* c, UNUSED unsigned aSize, Assembler::Register* a,
ResolvedPromise promise(32);
Assembler::Constant constant(&promise);
compareCR(c, aSize, &constant, aSize, a);
compareCR(c, aSize, &constant, aSize, &cx);
opcode(c, 0x7c); //jl
c->code.append(2 + 3);
@ -2281,9 +2281,9 @@ unsignedShiftRightRR(Context* c, UNUSED unsigned aSize, Assembler::Register* a,
unsigned bSize, Assembler::Register* b)
{
if (TargetBytesPerWord == 4 and bSize == 8) {
Assembler::Register cx(rcx);
if (a->low != rcx) {
c->client->save(rcx);
Assembler::Register cx(rcx);
ResolvedPromise promise(0x3F);
Assembler::Constant mask(&promise);
moveRR(c, 4, a, 4, &cx);
@ -2299,7 +2299,7 @@ unsignedShiftRightRR(Context* c, UNUSED unsigned aSize, Assembler::Register* a,
ResolvedPromise promise(32);
Assembler::Constant constant(&promise);
compareCR(c, aSize, &constant, aSize, a);
compareCR(c, aSize, &constant, aSize, &cx);
opcode(c, 0x7c); //jl
c->code.append(2 + 2);

View File

@ -385,6 +385,10 @@ public class Longs {
{ long b = 0xBEL; int x = 0; int y = 0xFF;
expect(((b >>> x) & y) == 0xBEL); }
{ long b = 0xFFFFFFFFFFFFFFFFL; int s = 20;
expect((b >>> -s) == 0xFFFFF);
}
}
}