From fb5796b740097c2968dd8bfbda0d541843b17002 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Wed, 4 Nov 2009 00:02:38 +0000 Subject: [PATCH] don't use SSE for long-to-double conversion on 32-bit systems --- src/x86.cpp | 2 +- test/Floats.java | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/x86.cpp b/src/x86.cpp index 97e85dfb41..310aa8350f 100644 --- a/src/x86.cpp +++ b/src/x86.cpp @@ -2931,7 +2931,7 @@ class MyArchitecture: public Assembler::Architecture { break; case Int2Float: - if (useSSE(&c)) { + if (useSSE(&c) and (aSize <= BytesPerWord)) { *aTypeMask = (1 << RegisterOperand) | (1 << MemoryOperand); *aRegisterMask = GeneralRegisterMask | (static_cast(GeneralRegisterMask) << 32); diff --git a/test/Floats.java b/test/Floats.java index 33c30145fd..bd85a74d10 100644 --- a/test/Floats.java +++ b/test/Floats.java @@ -46,11 +46,13 @@ public class Floats { expect(subtract(0.5d, 0.1d) == 0.4d); - double d = 1d; - expect(((int) d) == 1); + { double d = 1d; + expect(((int) d) == 1); + } - float f = 1f; - expect(((int) f) == 1); + { float f = 1f; + expect(((int) f) == 1); + } expect(Math.round(0.4f) == 0); expect(Math.round(0.5f) == 1); @@ -62,8 +64,14 @@ public class Floats { expect(Math.round(1.0d) == 1); expect(Math.round(1.9d) == 2); - float b = 1.0f; - int blue = (int)(b * 255 + 0.5); - expect(blue == 255); + { float b = 1.0f; + int blue = (int)(b * 255 + 0.5); + expect(blue == 255); + } + + { long z = 6553311036568663L; + double d = (double) z; + expect(d == 6553311036568663.0); + } } }