Bug 1209132 - Check for SSE3 in MacroAssemblerX86::convertUInt64ToDouble. r=sstangl
authorTooru Fujisawa <arai_a@mac.com>
Tue, 29 Sep 2015 07:33:43 +0900
changeset 264797 ef04c494e2edfb074a9033f3a2ad1cda5551567b
parent 264796 f4eba21be138e39ecf979bb7a9039633f2281bda
child 264798 8a905fb2619eff29cbd2bbbf9f91dc517b0922ef
push id65749
push userarai_a@mac.com
push dateMon, 28 Sep 2015 23:05:34 +0000
treeherdermozilla-inbound@ef04c494e2ed [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssstangl
bugs1209132
milestone44.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1209132 - Check for SSE3 in MacroAssemblerX86::convertUInt64ToDouble. r=sstangl
js/src/jit/x86/MacroAssembler-x86.cpp
--- a/js/src/jit/x86/MacroAssembler-x86.cpp
+++ b/js/src/jit/x86/MacroAssembler-x86.cpp
@@ -25,19 +25,32 @@ using namespace js::jit;
 // See convertUInt64ToDouble for the details.
 MOZ_ALIGNED_DECL(static const uint64_t, 16) TO_DOUBLE[4] = {
     0x4530000043300000LL,
     0x0LL,
     0x4330000000000000LL,
     0x4530000000000000LL
 };
 
+static const double TO_DOUBLE_HIGH_SCALE = 0x100000000;
+
 void
 MacroAssemblerX86::convertUInt64ToDouble(Register64 src, Register temp, FloatRegister dest)
 {
+    // SUBPD needs SSE2, HADDPD needs SSE3.
+    if (!HasSSE3()) {
+        convertUInt32ToDouble(src.high, dest);
+        movePtr(ImmPtr(&TO_DOUBLE_HIGH_SCALE), temp);
+        loadDouble(Address(temp, 0), ScratchDoubleReg);
+        mulDouble(ScratchDoubleReg, dest);
+        convertUInt32ToDouble(src.low, ScratchDoubleReg);
+        addDouble(ScratchDoubleReg, dest);
+        return;
+    }
+
     // Following operation uses entire 128-bit of dest XMM register.
     // Currently higher 64-bit is free when we have access to lower 64-bit.
     MOZ_ASSERT(dest.size() == 8);
     FloatRegister dest128 = FloatRegister(dest.encoding(), FloatRegisters::Int32x4);
 
     // Assume that src is represented as following:
     //   src      = 0x HHHHHHHH LLLLLLLL