From 29964eceb52e9c8e3db6f07454def35f7c28ff57 Mon Sep 17 00:00:00 2001 From: Branislav Rankov Date: Tue, 26 Aug 2014 15:36:39 +0200 Subject: [PATCH] Bug 1058582 - IonMonkey MIPS: Implemented visitClzI r=dougc --- js/src/jit/mips/Assembler-mips.cpp | 4 ++-- js/src/jit/mips/Assembler-mips.h | 2 +- js/src/jit/mips/CodeGenerator-mips.cpp | 10 ++++++++++ js/src/jit/mips/CodeGenerator-mips.h | 2 ++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/js/src/jit/mips/Assembler-mips.cpp b/js/src/jit/mips/Assembler-mips.cpp index 268cf02a9c5..85703d639f7 100644 --- a/js/src/jit/mips/Assembler-mips.cpp +++ b/js/src/jit/mips/Assembler-mips.cpp @@ -961,9 +961,9 @@ Assembler::as_movf(Register rd, Register rs, uint16_t cc) // Bit twiddling. BufferOffset -Assembler::as_clz(Register rd, Register rs, Register rt) +Assembler::as_clz(Register rd, Register rs) { - return writeInst(InstReg(op_special2, rs, rt, rd, ff_clz).encode()); + return writeInst(InstReg(op_special2, rs, rs, rd, ff_clz).encode()); } BufferOffset diff --git a/js/src/jit/mips/Assembler-mips.h b/js/src/jit/mips/Assembler-mips.h index 8f2f321873f..705caf6bf39 100644 --- a/js/src/jit/mips/Assembler-mips.h +++ b/js/src/jit/mips/Assembler-mips.h @@ -898,7 +898,7 @@ class Assembler : public AssemblerShared BufferOffset as_movf(Register rd, Register rs, uint16_t cc = 0); // Bit twiddling. - BufferOffset as_clz(Register rd, Register rs, Register rt = Register::FromCode(0)); + BufferOffset as_clz(Register rd, Register rs); BufferOffset as_ins(Register rt, Register rs, uint16_t pos, uint16_t size); BufferOffset as_ext(Register rt, Register rs, uint16_t pos, uint16_t size); diff --git a/js/src/jit/mips/CodeGenerator-mips.cpp b/js/src/jit/mips/CodeGenerator-mips.cpp index 4de32dad1a1..b84e7fa6b25 100644 --- a/js/src/jit/mips/CodeGenerator-mips.cpp +++ b/js/src/jit/mips/CodeGenerator-mips.cpp @@ -911,6 +911,16 @@ CodeGeneratorMIPS::visitUrshD(LUrshD *ins) return true; } +bool +CodeGeneratorMIPS::visitClzI(LClzI *ins) +{ + Register input = ToRegister(ins->input()); + Register output = ToRegister(ins->output()); + + masm.as_clz(output, input); + return true; +} + bool CodeGeneratorMIPS::visitPowHalfD(LPowHalfD *ins) { diff --git a/js/src/jit/mips/CodeGenerator-mips.h b/js/src/jit/mips/CodeGenerator-mips.h index 5547f6b200d..b81a19b61a4 100644 --- a/js/src/jit/mips/CodeGenerator-mips.h +++ b/js/src/jit/mips/CodeGenerator-mips.h @@ -182,6 +182,8 @@ class CodeGeneratorMIPS : public CodeGeneratorShared virtual bool visitShiftI(LShiftI *ins); virtual bool visitUrshD(LUrshD *ins); + virtual bool visitClzI(LClzI *ins); + virtual bool visitTestIAndBranch(LTestIAndBranch *test); virtual bool visitCompare(LCompare *comp); virtual bool visitCompareAndBranch(LCompareAndBranch *comp);