From d733c7fa0dcd4b7912757b29eff84995d0420fdf Mon Sep 17 00:00:00 2001 From: Hannes Verschore Date: Thu, 29 Sep 2016 22:33:23 +0200 Subject: [PATCH] Bug 1301400: Baseline Wasm Compiler: Part 12: Implement RotateI64, r=lth --- js/src/asmjs/WasmBaselineCompile.cpp | 34 +++++++++++++--------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/js/src/asmjs/WasmBaselineCompile.cpp b/js/src/asmjs/WasmBaselineCompile.cpp index dbf1bdba2758..3bcc60b3c1de 100644 --- a/js/src/asmjs/WasmBaselineCompile.cpp +++ b/js/src/asmjs/WasmBaselineCompile.cpp @@ -2525,21 +2525,19 @@ class BaseCompiler #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 } @@ -4088,11 +4086,11 @@ 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 @@ -4122,11 +4120,11 @@ 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