mirror of
https://github.com/corda/corda.git
synced 2025-01-23 12:58:35 +00:00
enable 64-bit various operations on 32-bit systems
This commit is contained in:
parent
9dafe37ff3
commit
4652b7aea0
61
src/x86.cpp
61
src/x86.cpp
@ -1042,13 +1042,23 @@ moveZRR(Context* c, unsigned size, Assembler::Register* a,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
addCR(Context* c, unsigned size UNUSED, Assembler::Constant* a,
|
addCR(Context* c, unsigned size, Assembler::Constant* a,
|
||||||
Assembler::Register* b)
|
Assembler::Register* b)
|
||||||
{
|
{
|
||||||
assert(c, BytesPerWord == 8 or size == 4); // todo
|
|
||||||
|
|
||||||
int64_t v = a->value->value();
|
int64_t v = a->value->value();
|
||||||
if (v) {
|
if (v) {
|
||||||
|
if (BytesPerWord == 4 and size == 8) {
|
||||||
|
ResolvedPromise high((v >> 32) & 0xFFFFFFFF);
|
||||||
|
Assembler::Constant ah(&high);
|
||||||
|
|
||||||
|
ResolvedPromise low(v & 0xFFFFFFFF);
|
||||||
|
Assembler::Constant al(&low);
|
||||||
|
|
||||||
|
Assembler::Register bh(b->high);
|
||||||
|
|
||||||
|
addCR(c, 4, &al, b);
|
||||||
|
addCarryCR(c, 4, &ah, &bh);
|
||||||
|
} else {
|
||||||
rex(c);
|
rex(c);
|
||||||
if (isInt8(v)) {
|
if (isInt8(v)) {
|
||||||
c->code.append(0x83);
|
c->code.append(0x83);
|
||||||
@ -1062,6 +1072,7 @@ addCR(Context* c, unsigned size UNUSED, Assembler::Constant* a,
|
|||||||
abort(c);
|
abort(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1340,13 +1351,23 @@ andRR(Context* c, unsigned size UNUSED, Assembler::Register* a,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
andCR(Context* c, unsigned size UNUSED, Assembler::Constant* a,
|
andCR(Context* c, unsigned size, Assembler::Constant* a,
|
||||||
Assembler::Register* b)
|
Assembler::Register* b)
|
||||||
{
|
{
|
||||||
assert(c, BytesPerWord == 8 or size == 4); // todo
|
|
||||||
|
|
||||||
int64_t v = a->value->value();
|
int64_t v = a->value->value();
|
||||||
|
|
||||||
|
if (BytesPerWord == 4 and size == 8) {
|
||||||
|
ResolvedPromise high((v >> 32) & 0xFFFFFFFF);
|
||||||
|
Assembler::Constant ah(&high);
|
||||||
|
|
||||||
|
ResolvedPromise low(v & 0xFFFFFFFF);
|
||||||
|
Assembler::Constant al(&low);
|
||||||
|
|
||||||
|
Assembler::Register bh(b->high);
|
||||||
|
|
||||||
|
andCR(c, 4, &al, b);
|
||||||
|
andCR(c, 4, &ah, &bh);
|
||||||
|
} else {
|
||||||
if (isInt32(v)) {
|
if (isInt32(v)) {
|
||||||
rex(c);
|
rex(c);
|
||||||
if (isInt8(v)) {
|
if (isInt8(v)) {
|
||||||
@ -1364,6 +1385,7 @@ andCR(Context* c, unsigned size UNUSED, Assembler::Constant* a,
|
|||||||
andRR(c, size, &tmp, b);
|
andRR(c, size, &tmp, b);
|
||||||
c->client->releaseTemporary(tmp.low);
|
c->client->releaseTemporary(tmp.low);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1396,24 +1418,40 @@ orRR(Context* c, unsigned size UNUSED, Assembler::Register* a,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xorRR(Context* c, unsigned size UNUSED, Assembler::Register* a,
|
xorRR(Context* c, unsigned size, Assembler::Register* a,
|
||||||
Assembler::Register* b)
|
Assembler::Register* b)
|
||||||
{
|
{
|
||||||
assert(c, BytesPerWord == 8 or size == 4); // todo
|
if (BytesPerWord == 4 and size == 8) {
|
||||||
|
Assembler::Register ah(a->high);
|
||||||
|
Assembler::Register bh(b->high);
|
||||||
|
|
||||||
|
xorRR(c, 4, a, b);
|
||||||
|
xorRR(c, 4, &ah, &bh);
|
||||||
|
} else {
|
||||||
rex(c);
|
rex(c);
|
||||||
c->code.append(0x31);
|
c->code.append(0x31);
|
||||||
c->code.append(0xc0 | (a->low << 3) | b->low);
|
c->code.append(0xc0 | (a->low << 3) | b->low);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xorCR(Context* c, unsigned size UNUSED, Assembler::Constant* a,
|
xorCR(Context* c, unsigned size, Assembler::Constant* a,
|
||||||
Assembler::Register* b)
|
Assembler::Register* b)
|
||||||
{
|
{
|
||||||
assert(c, BytesPerWord == 8 or size == 4); // todo
|
|
||||||
|
|
||||||
int64_t v = a->value->value();
|
int64_t v = a->value->value();
|
||||||
if (v) {
|
if (v) {
|
||||||
|
if (BytesPerWord == 4 and size == 8) {
|
||||||
|
ResolvedPromise high((v >> 32) & 0xFFFFFFFF);
|
||||||
|
Assembler::Constant ah(&high);
|
||||||
|
|
||||||
|
ResolvedPromise low(v & 0xFFFFFFFF);
|
||||||
|
Assembler::Constant al(&low);
|
||||||
|
|
||||||
|
Assembler::Register bh(b->high);
|
||||||
|
|
||||||
|
xorCR(c, 4, &al, b);
|
||||||
|
xorCR(c, 4, &ah, &bh);
|
||||||
|
} else {
|
||||||
if (isInt32(v)) {
|
if (isInt32(v)) {
|
||||||
rex(c);
|
rex(c);
|
||||||
if (isInt8(v)) {
|
if (isInt8(v)) {
|
||||||
@ -1432,6 +1470,7 @@ xorCR(Context* c, unsigned size UNUSED, Assembler::Constant* a,
|
|||||||
c->client->releaseTemporary(tmp.low);
|
c->client->releaseTemporary(tmp.low);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user