mirror of
https://github.com/corda/corda.git
synced 2025-01-22 12:28:11 +00:00
fix addCR and subtractCR for cases of 64-bit constants on amd64
This commit is contained in:
parent
0f94bea5a6
commit
107ac01304
18
src/x86.cpp
18
src/x86.cpp
@ -959,6 +959,10 @@ addCM(Context* c, unsigned size UNUSED, Assembler::Constant* a,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
addRR(Context* c, unsigned size, Assembler::Register* a,
|
||||
Assembler::Register* b);
|
||||
|
||||
void
|
||||
addCR(Context* c, unsigned size, Assembler::Constant* a,
|
||||
Assembler::Register* b)
|
||||
@ -987,7 +991,10 @@ addCR(Context* c, unsigned size, Assembler::Constant* a,
|
||||
c->code.append(0xc0 | b->low);
|
||||
c->code.append4(v);
|
||||
} else {
|
||||
abort(c);
|
||||
Assembler::Register tmp(c->client->acquireTemporary());
|
||||
moveCR(c, size, a, &tmp);
|
||||
addRR(c, size, &tmp, b);
|
||||
c->client->releaseTemporary(tmp.low);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1009,6 +1016,10 @@ subtractBorrowCR(Context* c, unsigned size UNUSED, Assembler::Constant* a,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
subtractRR(Context* c, unsigned size, Assembler::Register* a,
|
||||
Assembler::Register* b);
|
||||
|
||||
void
|
||||
subtractCR(Context* c, unsigned size, Assembler::Constant* a,
|
||||
Assembler::Register* b)
|
||||
@ -1037,7 +1048,10 @@ subtractCR(Context* c, unsigned size, Assembler::Constant* a,
|
||||
c->code.append(0xe8 | b->low);
|
||||
c->code.append4(v);
|
||||
} else {
|
||||
abort(c);
|
||||
Assembler::Register tmp(c->client->acquireTemporary());
|
||||
moveCR(c, size, a, &tmp);
|
||||
subtractRR(c, size, &tmp, b);
|
||||
c->client->releaseTemporary(tmp.low);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -234,6 +234,54 @@ public class Misc {
|
||||
expect(~a == ~25214903884L);
|
||||
}
|
||||
|
||||
{ long b = 2;
|
||||
expect((-25214903884L) >> b == -25214903884L >> 2);
|
||||
expect((-25214903884L) >>> b == -25214903884L >>> 2);
|
||||
expect((-25214903884L) << b == -25214903884L << 2);
|
||||
expect((-25214903884L) + b == -25214903884L + 2L);
|
||||
expect((-25214903884L) - b == -25214903884L - 2L);
|
||||
expect((-25214903884L) * b == -25214903884L * 2L);
|
||||
expect((-25214903884L) / b == -25214903884L / 2L);
|
||||
expect((-25214903884L) % b == -25214903884L % 2L);
|
||||
expect(((-25214903884L) & b) == (-25214903884L & 2L));
|
||||
expect(((-25214903884L) | b) == (-25214903884L | 2L));
|
||||
expect(((-25214903884L) ^ b) == (-25214903884L ^ 2L));
|
||||
|
||||
b = 2;
|
||||
expect(25214903884L >> b == 25214903884L >> 2);
|
||||
expect(25214903884L >>> b == 25214903884L >>> 2);
|
||||
expect(25214903884L << b == 25214903884L << 2);
|
||||
expect(25214903884L + b == 25214903884L + 2L);
|
||||
expect(25214903884L - b == 25214903884L - 2L);
|
||||
expect(25214903884L * b == 25214903884L * 2L);
|
||||
expect(25214903884L / b == 25214903884L / 2L);
|
||||
expect(25214903884L % b == 25214903884L % 2L);
|
||||
expect((25214903884L & b) == (25214903884L & 2L));
|
||||
expect((25214903884L | b) == (25214903884L | 2L));
|
||||
expect((25214903884L ^ b) == (25214903884L ^ 2L));
|
||||
}
|
||||
|
||||
{ long a = 2L;
|
||||
expect(a + (-25214903884L) == 2L + (-25214903884L));
|
||||
expect(a - (-25214903884L) == 2L - (-25214903884L));
|
||||
expect(a * (-25214903884L) == 2L * (-25214903884L));
|
||||
expect(a / (-25214903884L) == 2L / (-25214903884L));
|
||||
expect(a % (-25214903884L) == 2L % (-25214903884L));
|
||||
expect((a & (-25214903884L)) == (2L & (-25214903884L)));
|
||||
expect((a | (-25214903884L)) == (2L | (-25214903884L)));
|
||||
expect((a ^ (-25214903884L)) == (2L ^ (-25214903884L)));
|
||||
|
||||
a = 2L;
|
||||
expect(a + 25214903884L == 2L + 25214903884L);
|
||||
expect(a - 25214903884L == 2L - 25214903884L);
|
||||
expect(a * 25214903884L == 2L * 25214903884L);
|
||||
expect(a / 25214903884L == 2L / 25214903884L);
|
||||
expect(a % 25214903884L == 2L % 25214903884L);
|
||||
expect((a & 25214903884L) == (2L & 25214903884L));
|
||||
expect((a | 25214903884L) == (2L | 25214903884L));
|
||||
expect((a ^ 25214903884L) == (2L ^ 25214903884L));
|
||||
}
|
||||
|
||||
byte2 = 0;
|
||||
expect(byte2 == 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user