Bug 1301400: Baseline Wasm Compiler: Part 12: Implement RotateI64, r=lth
authorHannes Verschore <hv1989@gmail.com>
Thu, 29 Sep 2016 22:33:23 +0200
changeset 315912 f5bbefafb7c43160f1aa813a3e9f55fede76fd8d
parent 315911 e4decf2703b2e925b6a7f864fc800c8945881f27
child 315913 f2347550ce3615df67a42265afdcbc3223b381b0
push id20634
push usercbook@mozilla.com
push dateFri, 30 Sep 2016 10:10:13 +0000
treeherderfx-team@afe79b010d13 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslth
bugs1301400
milestone52.0a1
Bug 1301400: Baseline Wasm Compiler: Part 12: Implement RotateI64, r=lth
js/src/asmjs/WasmBaselineCompile.cpp
--- a/js/src/asmjs/WasmBaselineCompile.cpp
+++ b/js/src/asmjs/WasmBaselineCompile.cpp
@@ -2520,31 +2520,29 @@ class BaseCompiler
     void rshiftU64(RegI64 shift, RegI64 srcDest) {
 #ifdef JS_PUNBOX64
         masm.rshift64(shift.reg.reg, srcDest.reg);
 #else
         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);
+    void rotateRightI64(RegI64 shift, RegI64 srcDest) {
+#ifdef JS_PUNBOX64
+        masm.rotateRight64(shift.reg.reg, srcDest.reg, srcDest.reg, Register::Invalid());
 #else
-        MOZ_CRASH("BaseCompiler platform hook: rotateRightI64");
+        masm.rotateRight64(shift.reg.low, srcDest.reg, srcDest.reg, shift.reg.high);
 #endif
     }
 
-    void rotateLeftI64(RegI64 rhs, RegI64 srcDest) {
-#if defined(JS_CODEGEN_X64)
-        MOZ_ASSERT(rhs.reg.reg == rcx);
-        masm.rolq_cl(srcDest.reg.reg);
+    void rotateLeftI64(RegI64 shift, RegI64 srcDest) {
+#ifdef JS_PUNBOX64
+        masm.rotateLeft64(shift.reg.reg, srcDest.reg, srcDest.reg, Register::Invalid());
 #else
-        MOZ_CRASH("BaseCompiler platform hook: rotateLeftI64");
+        masm.rotateLeft64(shift.reg.low, srcDest.reg, srcDest.reg, shift.reg.high);
 #endif
     }
 
     void clzI64(RegI64 srcDest) {
 #if defined(JS_CODEGEN_X64)
         masm.clz64(srcDest.reg, srcDest.reg.reg);
 #else
         MOZ_CRASH("BaseCompiler platform hook: clzI64");
@@ -4083,21 +4081,21 @@ BaseCompiler::emitRotrI32()
     pushI32(r0);
 }
 
 void
 BaseCompiler::emitRotrI64()
 {
     // 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: emitRotrI64");
 #else
     pop2xI64(&r0, &r1);
 #endif
     rotateRightI64(r1, r0);
     freeI64(r1);
     pushI64(r0);
 }
 
@@ -4117,21 +4115,21 @@ BaseCompiler::emitRotlI32()
     pushI32(r0);
 }
 
 void
 BaseCompiler::emitRotlI64()
 {
     // 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: emitRotlI64");
 #else
     pop2xI64(&r0, &r1);
 #endif
     rotateLeftI64(r1, r0);
     freeI64(r1);
     pushI64(r0);
 }