mirror of
https://github.com/corda/corda.git
synced 2025-03-17 17:45:17 +00:00
various bugfixes for SSE-based floating-point support
This commit is contained in:
parent
d25da6116a
commit
4f78783ef1
@ -5357,11 +5357,11 @@ finish(MyThread* t, Allocator* allocator, Context* context)
|
||||
::strcmp
|
||||
(reinterpret_cast<const char*>
|
||||
(&byteArrayBody(t, className(t, methodClass(t, context->method)), 0)),
|
||||
"AllFloats") == 0 and
|
||||
"Floats") == 0 and
|
||||
::strcmp
|
||||
(reinterpret_cast<const char*>
|
||||
(&byteArrayBody(t, methodName(t, context->method), 0)),
|
||||
"i2d") == 0)
|
||||
"main") == 0)
|
||||
{
|
||||
trap();
|
||||
}
|
||||
|
@ -17,13 +17,13 @@ namespace {
|
||||
|
||||
namespace local {
|
||||
|
||||
const bool DebugAppend = true;
|
||||
const bool DebugCompile = true;
|
||||
const bool DebugResources = true;
|
||||
const bool DebugAppend = false;
|
||||
const bool DebugCompile = false;
|
||||
const bool DebugResources = false;
|
||||
const bool DebugFrame = false;
|
||||
const bool DebugControl = true;
|
||||
const bool DebugReads = true;
|
||||
const bool DebugSites = true;
|
||||
const bool DebugControl = false;
|
||||
const bool DebugReads = false;
|
||||
const bool DebugSites = false;
|
||||
const bool DebugMoves = false;
|
||||
const bool DebugBuddies = false;
|
||||
|
||||
@ -3900,8 +3900,9 @@ pop(Context* c, unsigned footprint)
|
||||
low = high->next;
|
||||
}
|
||||
|
||||
assert(c, low->value->next == high->value
|
||||
and ((BytesPerWord == 8) xor (low->value->next != 0)));
|
||||
assert(c, (BytesPerWord == 8
|
||||
and low->value->next == low->value and high->value == 0)
|
||||
or (BytesPerWord == 4 and low->value->next == high->value));
|
||||
#endif // not NDEBUG
|
||||
|
||||
popWord(c);
|
||||
@ -5739,8 +5740,9 @@ class MyCompiler: public Compiler {
|
||||
low = s->next;
|
||||
}
|
||||
|
||||
assert(&c, low->value->next == high->value
|
||||
and ((BytesPerWord == 8) xor (low->value->next != 0)));
|
||||
assert(&c, (BytesPerWord == 8
|
||||
and low->value->next == low->value and high->value == 0)
|
||||
or (BytesPerWord == 4 and low->value->next == high->value));
|
||||
#endif // not NDEBUG
|
||||
|
||||
if (not bigEndian) {
|
||||
|
11
src/x86.cpp
11
src/x86.cpp
@ -2169,20 +2169,21 @@ unsignedShiftRightCR(Context* c, unsigned aSize UNUSED, Assembler::Constant* a,
|
||||
}
|
||||
|
||||
inline void floatRegOp(Context* c, unsigned aSize, Assembler::Register* a,
|
||||
unsigned bSize UNUSED, Assembler::Register* b, uint8_t op, uint8_t mod = 0xc0)
|
||||
unsigned bSize, Assembler::Register* b, uint8_t op,
|
||||
uint8_t mod = 0xc0)
|
||||
{
|
||||
if(aSize == 4) {
|
||||
opcode(c, 0xf3);
|
||||
} else {
|
||||
opcode(c, 0xf2);
|
||||
}
|
||||
maybeRex(c, bSize, a, b);
|
||||
maybeRex(c, bSize, b, a);
|
||||
opcode(c, 0x0f, op);
|
||||
modrm(c, mod, a, b);
|
||||
}
|
||||
|
||||
inline void floatMemOp(Context* c, unsigned aSize, Assembler::Memory* a,
|
||||
unsigned bSize UNUSED, Assembler::Register* b, uint8_t op)
|
||||
unsigned bSize, Assembler::Register* b, uint8_t op)
|
||||
{
|
||||
if(aSize == 4) {
|
||||
opcode(c, 0xf3);
|
||||
@ -2867,7 +2868,7 @@ class MyArchitecture: public Assembler::Architecture {
|
||||
|
||||
case Float2Int:
|
||||
if (supportsSSE() and (bSize <= BytesPerWord)) {
|
||||
*aTypeMask = (1 << RegisterOperand);
|
||||
*aTypeMask = (1 << RegisterOperand) | (1 << MemoryOperand);
|
||||
*aRegisterMask = (static_cast<uint64_t>(FloatRegisterMask) << 32)
|
||||
| FloatRegisterMask;
|
||||
} else {
|
||||
@ -2877,7 +2878,7 @@ class MyArchitecture: public Assembler::Architecture {
|
||||
|
||||
case Int2Float:
|
||||
if (supportsSSE()) {
|
||||
*aTypeMask = (1 << RegisterOperand);
|
||||
*aTypeMask = (1 << RegisterOperand) | (1 << MemoryOperand);
|
||||
*aRegisterMask = GeneralRegisterMask
|
||||
| (static_cast<uint64_t>(GeneralRegisterMask) << 32);
|
||||
} else {
|
||||
|
@ -49,6 +49,9 @@ public class Floats {
|
||||
double d = 1d;
|
||||
expect(((int) d) == 1);
|
||||
|
||||
float f = 1f;
|
||||
expect(((int) f) == 1);
|
||||
|
||||
expect(Math.round(0.4f) == 0);
|
||||
expect(Math.round(0.5f) == 1);
|
||||
expect(Math.round(1.0f) == 1);
|
||||
|
@ -118,7 +118,7 @@ public class Subroutine {
|
||||
try {
|
||||
switch (path) {
|
||||
case 1:
|
||||
return 42L;
|
||||
return 0xFFFFFFFFFFL;
|
||||
|
||||
case 2: {
|
||||
int a = 42;
|
||||
@ -186,6 +186,8 @@ public class Subroutine {
|
||||
String.valueOf(test4(1));
|
||||
String.valueOf(test4(2));
|
||||
String.valueOf(test4(3));
|
||||
|
||||
expect(test4(1) == 0xFFFFFFFFFFL);
|
||||
}
|
||||
|
||||
private static class DummyException extends RuntimeException { }
|
||||
|
Loading…
x
Reference in New Issue
Block a user