Bug 1301400: Baseline Wasm Compiler: Part 11: Implement ShiftI64, r=lth
authorHannes Verschore <hv1989@gmail.com>
Thu, 29 Sep 2016 22:33:23 +0200
changeset 315903 e4decf2703b2e925b6a7f864fc800c8945881f27
parent 315902 64597bec5f4ee761798acbbe3f9690831ec7f5c7
child 315904 f5bbefafb7c43160f1aa813a3e9f55fede76fd8d
push id30757
push usercbook@mozilla.com
push dateFri, 30 Sep 2016 10:02:43 +0000
treeherdermozilla-central@5ffed033557e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslth
bugs1301400
milestone52.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 1301400: Baseline Wasm Compiler: Part 11: Implement ShiftI64, r=lth
js/src/asmjs/WasmBaselineCompile.cpp
--- a/js/src/asmjs/WasmBaselineCompile.cpp
+++ b/js/src/asmjs/WasmBaselineCompile.cpp
@@ -2496,40 +2496,37 @@ class BaseCompiler
     void andI64(RegI64 rhs, RegI64 srcDest) {
         masm.and64(rhs.reg, srcDest.reg);
     }
 
     void xorI64(RegI64 rhs, RegI64 srcDest) {
         masm.xor64(rhs.reg, srcDest.reg);
     }
 
-    void lshiftI64(RegI64 rhs, RegI64 srcDest) {
-#if defined(JS_CODEGEN_X64)
-        MOZ_ASSERT(rhs.reg.reg == rcx);
-        masm.shlq_cl(srcDest.reg.reg);
+    void lshiftI64(RegI64 shift, RegI64 srcDest) {
+#ifdef JS_PUNBOX64
+        masm.lshift64(shift.reg.reg, srcDest.reg);
 #else
-        MOZ_CRASH("BaseCompiler platform hook: lshiftI64");
+        masm.lshift64(shift.reg.low, srcDest.reg);
 #endif
     }
 
-    void rshiftI64(RegI64 rhs, RegI64 srcDest) {
-#if defined(JS_CODEGEN_X64)
-        MOZ_ASSERT(rhs.reg.reg == rcx);
-        masm.sarq_cl(srcDest.reg.reg);
+    void rshiftI64(RegI64 shift, RegI64 srcDest) {
+#ifdef JS_PUNBOX64
+        masm.rshift64Arithmetic(shift.reg.reg, srcDest.reg);
 #else
-        MOZ_CRASH("BaseCompiler platform hook: rshiftI64");
+        masm.rshift64Arithmetic(shift.reg.low, srcDest.reg);
 #endif
     }
 
-    void rshiftU64(RegI64 rhs, RegI64 srcDest) {
-#if defined(JS_CODEGEN_X64)
-        MOZ_ASSERT(rhs.reg.reg == rcx);
-        masm.shrq_cl(srcDest.reg.reg);
+    void rshiftU64(RegI64 shift, RegI64 srcDest) {
+#ifdef JS_PUNBOX64
+        masm.rshift64(shift.reg.reg, srcDest.reg);
 #else
-        MOZ_CRASH("BaseCompiler platform hook: rshiftU64");
+        masm.rshift64(shift.reg.low, srcDest.reg);
 #endif
     }
 
     void rotateRightI64(RegI64 rhs, RegI64 srcDest) {
 #if defined(JS_CODEGEN_X64)
         MOZ_ASSERT(rhs.reg.reg == rcx);
         masm.rorq_cl(srcDest.reg.reg);
 #else
@@ -3972,21 +3969,21 @@ BaseCompiler::emitShlI32()
     }
 }
 
 void
 BaseCompiler::emitShlI64()
 {
     // TODO / OPTIMIZE: Constant rhs
     RegI64 r0, r1;
-#if defined(JS_CODEGEN_X64)
-    r1 = popI64(specific_rcx);
+#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
+    needI32(specific_ecx);
+    r1 = fromI32(specific_ecx);
+    r1 = popI64ToSpecific(r1);
     r0 = popI64();
-#elif defined(JS_CODEGEN_X86)
-    MOZ_CRASH("BaseCompiler platform hook: emitShlI64");
 #else
     pop2xI64(&r0, &r1);
 #endif
     lshiftI64(r1, r0);
     freeI64(r1);
     pushI64(r0);
 }
 
@@ -4012,21 +4009,21 @@ BaseCompiler::emitShrI32()
     }
 }
 
 void
 BaseCompiler::emitShrI64()
 {
     // TODO / OPTIMIZE: Constant rhs
     RegI64 r0, r1;
-#if defined(JS_CODEGEN_X64)
-    r1 = popI64(specific_rcx);
+#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
+    needI32(specific_ecx);
+    r1 = fromI32(specific_ecx);
+    r1 = popI64ToSpecific(r1);
     r0 = popI64();
-#elif defined(JS_CODEGEN_X86)
-    MOZ_CRASH("BaseCompiler platform hook: emitShrI64");
 #else
     pop2xI64(&r0, &r1);
 #endif
     rshiftI64(r1, r0);
     freeI64(r1);
     pushI64(r0);
 }
 
@@ -4052,21 +4049,21 @@ BaseCompiler::emitShrU32()
     }
 }
 
 void
 BaseCompiler::emitShrU64()
 {
     // TODO / OPTIMIZE: Constant rhs
     RegI64 r0, r1;
-#if defined(JS_CODEGEN_X64)
-    r1 = popI64(specific_rcx);
+#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
+    needI32(specific_ecx);
+    r1 = fromI32(specific_ecx);
+    r1 = popI64ToSpecific(r1);
     r0 = popI64();
-#elif defined(JS_CODEGEN_X86)
-    MOZ_CRASH("BaseCompiler platform hook: emitShrUI64");
 #else
     pop2xI64(&r0, &r1);
 #endif
     rshiftU64(r1, r0);
     freeI64(r1);
     pushI64(r0);
 }