Bug 1316848 - Wasm baseline: Avoid using a zero temp register for EqzI64. r=lth
authorDavid Major <dmajor@mozilla.com>
Mon, 28 Nov 2016 15:41:09 -0600
changeset 324457 30798ceb7d632bbb8ec8a0a6901e55a1ef473024
parent 324456 fdcc35477bd0d4c6a13875c5cdb7e1a6c8ca98c6
child 324458 bc39d8cde9ab7f7615a0098f17396691c7354e86
push id31006
push usercbook@mozilla.com
push dateTue, 29 Nov 2016 10:40:01 +0000
treeherdermozilla-central@f8107cf96144 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslth
bugs1316848
milestone53.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 1316848 - Wasm baseline: Avoid using a zero temp register for EqzI64. r=lth MozReview-Commit-ID: CxTCYHQPP9g
js/src/wasm/WasmBaselineCompile.cpp
--- a/js/src/wasm/WasmBaselineCompile.cpp
+++ b/js/src/wasm/WasmBaselineCompile.cpp
@@ -3017,16 +3017,29 @@ class BaseCompiler
         masm.bind(&condTrue);
         masm.move32(Imm32(1), dest);
         masm.bind(&done);
 #else
         MOZ_CRASH("BaseCompiler platform hook: cmp64Set");
 #endif
     }
 
+    void eqz64(RegI64 src, RegI32 dest) {
+#if defined(JS_CODEGEN_X64)
+        masm.cmpq(Imm32(0), src.reg);
+        masm.emitSet(Assembler::Equal, dest);
+#elif defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_ARM)
+        masm.or32(src.high, src.low);
+        masm.cmp32(src.low, Imm32(0));
+        masm.emitSet(Assembler::Equal, dest);
+#else
+        MOZ_CRASH("BaseCompiler platform hook: eqz64");
+#endif
+    }
+
     void unreachableTrap()
     {
         masm.jump(trap(Trap::Unreachable));
 #ifdef DEBUG
         masm.breakpoint();
 #endif
     }
 
@@ -4579,23 +4592,19 @@ BaseCompiler::emitEqzI32()
 }
 
 void
 BaseCompiler::emitEqzI64()
 {
     if (sniffConditionalControlEqz(ValType::I64))
         return;
 
-    // TODO / OPTIMIZE: Avoid the temp register (Bug 1316848)
     RegI64 r0 = popI64();
-    RegI64 r1 = needI64();
-    setI64(0, r1);
     RegI32 i0 = fromI64(r0);
-    cmp64Set(Assembler::Equal, r0, r1, i0);
-    freeI64(r1);
+    eqz64(r0, i0);
     freeI64Except(r0, i0);
     pushI32(i0);
 }
 
 void
 BaseCompiler::emitClzI32()
 {
     RegI32 r0 = popI32();