Bug 1254500 - IonMonkey: MIPS: Implement ma_ctz. r=arai
authorHeiher <r@hev.cc>
Mon, 21 Mar 2016 13:49:00 +0800
changeset 289616 95ac2b55d2961613a79859fbd3e1dc4b9b6684a1
parent 289615 5eb1f8858a31136b13e9de2cf165d7569c770063
child 289617 1a39a59c9103363b9b00c815187181801f07ffe9
push id30108
push usercbook@mozilla.com
push dateTue, 22 Mar 2016 11:14:31 +0000
treeherdermozilla-central@ea6298e1b4f7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersarai
bugs1254500
milestone48.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 1254500 - IonMonkey: MIPS: Implement ma_ctz. r=arai --- js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp | 11 +++++++++++ js/src/jit/mips-shared/MacroAssembler-mips-shared.h | 2 ++ 2 files changed, 13 insertions(+)
js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp
js/src/jit/mips-shared/MacroAssembler-mips-shared.h
--- a/js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp
+++ b/js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp
@@ -179,16 +179,27 @@ MacroAssemblerMIPSShared::ma_xor(Registe
     if (Imm16::IsInUnsignedRange(imm.value)) {
         as_xori(rd, rs, imm.value);
     } else {
         ma_li(ScratchRegister, imm);
         as_xor(rd, rs, ScratchRegister);
     }
 }
 
+void
+MacroAssemblerMIPSShared::ma_ctz(Register rd, Register rs)
+{
+    ma_negu(ScratchRegister, rs);
+    as_and(rd, ScratchRegister, rs);
+    as_clz(rd, rd);
+    ma_negu(SecondScratchReg, rd);
+    ma_addu(SecondScratchReg, Imm32(0x1f));
+    as_movn(rd, SecondScratchReg, ScratchRegister);
+}
+
 // Arithmetic-based ops.
 
 // Add.
 void
 MacroAssemblerMIPSShared::ma_addu(Register rd, Register rs, Imm32 imm)
 {
     if (Imm16::IsInSignedRange(imm.value)) {
         as_addiu(rd, rs, imm.value);
--- a/js/src/jit/mips-shared/MacroAssembler-mips-shared.h
+++ b/js/src/jit/mips-shared/MacroAssembler-mips-shared.h
@@ -94,16 +94,18 @@ class MacroAssemblerMIPSShared : public 
     void ma_or(Register rd, Imm32 imm);
     void ma_or(Register rd, Register rs, Imm32 imm);
 
     // xor
     void ma_xor(Register rd, Register rs);
     void ma_xor(Register rd, Imm32 imm);
     void ma_xor(Register rd, Register rs, Imm32 imm);
 
+    void ma_ctz(Register rd, Register rs);
+
     // load
     void ma_load(Register dest, const BaseIndex& src, LoadStoreSize size = SizeWord,
                  LoadStoreExtension extension = SignExtend);
 
     // store
     void ma_store(Register data, const BaseIndex& dest, LoadStoreSize size = SizeWord,
                   LoadStoreExtension extension = SignExtend);
     void ma_store(Imm32 imm, const BaseIndex& dest, LoadStoreSize size = SizeWord,