mirror of
https://github.com/corda/corda.git
synced 2025-01-08 14:03:06 +00:00
support 64-bit operands on 32-bit systems in compareCR
This commit is contained in:
parent
a07a189ddb
commit
7791b1df80
52
src/x86.cpp
52
src/x86.cpp
@ -1563,26 +1563,44 @@ void
|
|||||||
compareCR(Context* c, unsigned size UNUSED, Assembler::Constant* a,
|
compareCR(Context* c, unsigned size UNUSED, Assembler::Constant* a,
|
||||||
Assembler::Register* b)
|
Assembler::Register* b)
|
||||||
{
|
{
|
||||||
assert(c, BytesPerWord == 8 or size == 4);
|
|
||||||
|
|
||||||
int64_t v = a->value->value();
|
int64_t v = a->value->value();
|
||||||
|
|
||||||
if (isInt32(v)) {
|
if (BytesPerWord == 4 and size == 8) {
|
||||||
if (size == 8) rex(c);
|
ResolvedPromise low(v & 0xFFFFFFFF);
|
||||||
if (isInt8(v)) {
|
Assembler::Constant al(&low);
|
||||||
c->code.append(0x83);
|
|
||||||
c->code.append(0xf8 | b->low);
|
ResolvedPromise high((v >> 32) & 0xFFFFFFFF);
|
||||||
c->code.append(v);
|
Assembler::Constant ah(&high);
|
||||||
} else {
|
|
||||||
c->code.append(0x81);
|
Assembler::Register bh(b->high);
|
||||||
c->code.append(0xf8 | b->low);
|
|
||||||
c->code.append4(v);
|
compareCR(c, 4, &ah, &bh);
|
||||||
}
|
|
||||||
|
// if the high order bits are equal, we compare the low order
|
||||||
|
// bits; otherwise, we jump past that comparison
|
||||||
|
c->code.append(0x0f);
|
||||||
|
c->code.append(0x85); // jne
|
||||||
|
c->code.append4(2);
|
||||||
|
|
||||||
|
compareCR(c, 4, &al, b);
|
||||||
} else {
|
} else {
|
||||||
Assembler::Register tmp(c->client->acquireTemporary());
|
if (isInt32(v)) {
|
||||||
moveCR(c, size, a, &tmp);
|
if (size == 8) rex(c);
|
||||||
compareRR(c, size, &tmp, b);
|
if (isInt8(v)) {
|
||||||
c->client->releaseTemporary(tmp.low);
|
c->code.append(0x83);
|
||||||
|
c->code.append(0xf8 | b->low);
|
||||||
|
c->code.append(v);
|
||||||
|
} else {
|
||||||
|
c->code.append(0x81);
|
||||||
|
c->code.append(0xf8 | b->low);
|
||||||
|
c->code.append4(v);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Assembler::Register tmp(c->client->acquireTemporary());
|
||||||
|
moveCR(c, size, a, &tmp);
|
||||||
|
compareRR(c, size, &tmp, b);
|
||||||
|
c->client->releaseTemporary(tmp.low);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user