Bug 1301400: Baseline Wasm Compiler: Part 14: Implement PopcntI64, r=lth
authorHannes Verschore <hv1989@gmail.com>
Thu, 29 Sep 2016 22:33:23 +0200
changeset 315914 e3245fe9958ea375e1d9471ad933cd3b44704be1
parent 315913 f2347550ce3615df67a42265afdcbc3223b381b0
child 315915 1acadee786e9c7fb213339159546826d419a350f
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 14: Implement PopcntI64, r=lth
js/src/asmjs/WasmBaselineCompile.cpp
--- a/js/src/asmjs/WasmBaselineCompile.cpp
+++ b/js/src/asmjs/WasmBaselineCompile.cpp
@@ -2571,29 +2571,25 @@ class BaseCompiler
 #if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
         masm.popcnt32(srcDest.reg, srcDest.reg, tmp.reg);
 #else
         MOZ_CRASH("BaseCompiler platform hook: popcntI32");
 #endif
     }
 
     bool popcnt64NeedsTemp() const {
-#if defined(JS_CODEGEN_X64)
+#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
         return !AssemblerX86Shared::HasPOPCNT();
 #else
         MOZ_CRASH("BaseCompiler platform hook: popcnt64NeedsTemp");
 #endif
     }
 
-    void popcntI64(RegI64 srcDest, RegI64 tmp) {
-#if defined(JS_CODEGEN_X64)
-        masm.popcnt64(srcDest.reg, srcDest.reg, tmp.reg.reg);
-#else
-        MOZ_CRASH("BaseCompiler platform hook: popcntI64");
-#endif
+    void popcntI64(RegI64 srcDest, RegI32 tmp) {
+        masm.popcnt64(srcDest.reg, srcDest.reg, tmp.reg);
     }
 
     void reinterpretI64AsF64(RegI64 src, RegF64 dest) {
 #if defined(JS_CODEGEN_X64)
         masm.vmovq(src.reg.reg, dest.reg);
 #else
         MOZ_CRASH("BaseCompiler platform hook: reinterpretI64AsF64");
 #endif
@@ -4204,21 +4200,21 @@ BaseCompiler::emitPopcntI32()
     pushI32(r0);
 }
 
 void
 BaseCompiler::emitPopcntI64()
 {
     RegI64 r0 = popI64();
     if (popcnt64NeedsTemp()) {
-        RegI64 tmp = needI64();
+        RegI32 tmp = needI32();
         popcntI64(r0, tmp);
-        freeI64(tmp);
+        freeI32(tmp);
     } else {
-        popcntI64(r0, invalidI64());
+        popcntI64(r0, invalidI32());
     }
     pushI64(r0);
 }
 
 void
 BaseCompiler::emitBitNotI32()
 {
     RegI32 r0 = popI32();