Bug 1549278 - [mips] Wasm/Ion: generate better code for wasmSelect in some cases. r=jandem
authorYu Yin <yuyin-hf@loongson.cn>
Wed, 08 May 2019 07:52:44 +0000
changeset 534926 b771a88efe40227ba5cce8f1880d755018c1871e
parent 534925 d6bc3bde65d6e4f99c5c5cd6be6898801bfd0549
child 534927 b5344f8392c0bae8dd62280f3b608b1f907f6568
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1549278
milestone68.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 1549278 - [mips] Wasm/Ion: generate better code for wasmSelect in some cases. r=jandem port https://phabricator.services.mozilla.com/D27071 to mips. Differential Revision: https://phabricator.services.mozilla.com/D29999
js/src/jit/MacroAssembler.h
js/src/jit/mips-shared/Lowering-mips-shared.cpp
js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h
--- a/js/src/jit/MacroAssembler.h
+++ b/js/src/jit/MacroAssembler.h
@@ -1631,21 +1631,21 @@ class MacroAssembler : public MacroAssem
       DEFINED_ON(arm, arm64, mips_shared, x86_shared);
 
   inline void cmp32Move32(Condition cond, Register lhs, const Address& rhs,
                           Register src, Register dest)
       DEFINED_ON(arm, arm64, mips_shared, x86_shared);
 
   inline void cmp32Load32(Condition cond, Register lhs, const Address& rhs,
                           const Address& src, Register dest)
-      DEFINED_ON(arm, arm64, x86_shared);
+      DEFINED_ON(arm, arm64, mips_shared, x86_shared);
 
   inline void cmp32Load32(Condition cond, Register lhs, Register rhs,
                           const Address& src, Register dest)
-      DEFINED_ON(arm, arm64, x86_shared);
+      DEFINED_ON(arm, arm64, mips_shared, x86_shared);
 
   inline void cmp32MovePtr(Condition cond, Register lhs, Imm32 rhs,
                            Register src, Register dest)
       DEFINED_ON(arm, arm64, mips_shared, x86, x64);
 
   inline void test32LoadPtr(Condition cond, const Address& addr, Imm32 mask,
                             const Address& src, Register dest)
       DEFINED_ON(arm, arm64, mips_shared, x86, x64);
--- a/js/src/jit/mips-shared/Lowering-mips-shared.cpp
+++ b/js/src/jit/mips-shared/Lowering-mips-shared.cpp
@@ -430,33 +430,16 @@ void LIRGenerator::visitWasmStore(MWasmS
   auto* lir = new (alloc()) LWasmStore(baseAlloc, valueAlloc);
   if (ins->access().offset()) {
     lir->setTemp(0, tempCopy(base, 0));
   }
 
   add(lir, ins);
 }
 
-void LIRGenerator::visitWasmSelect(MWasmSelect* ins) {
-  if (ins->type() == MIRType::Int64) {
-    auto* lir = new (alloc()) LWasmSelectI64(
-        useInt64RegisterAtStart(ins->trueExpr()), useInt64(ins->falseExpr()),
-        useRegister(ins->condExpr()));
-
-    defineInt64ReuseInput(lir, ins, LWasmSelectI64::TrueExprIndex);
-    return;
-  }
-
-  auto* lir = new (alloc())
-      LWasmSelect(useRegisterAtStart(ins->trueExpr()), use(ins->falseExpr()),
-                  useRegister(ins->condExpr()));
-
-  defineReuseInput(lir, ins, LWasmSelect::TrueExprIndex);
-}
-
 void LIRGeneratorMIPSShared::lowerUDiv(MDiv* div) {
   MDefinition* lhs = div->getOperand(0);
   MDefinition* rhs = div->getOperand(1);
 
   LUDivOrMod* lir = new (alloc()) LUDivOrMod;
   lir->setOperand(0, useRegister(lhs));
   lir->setOperand(1, useRegister(rhs));
   if (div->fallible()) {
--- a/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h
+++ b/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h
@@ -25,16 +25,20 @@ void MacroAssembler::moveGPRToFloat32(Re
 void MacroAssembler::move8SignExtend(Register src, Register dest) {
   ma_seb(dest, src);
 }
 
 void MacroAssembler::move16SignExtend(Register src, Register dest) {
   ma_seh(dest, src);
 }
 
+void MacroAssembler::loadAbiReturnAddress(Register dest) {
+  movePtr(ra, dest);
+}
+
 // ===============================================================
 // Logical instructions
 
 void MacroAssembler::not32(Register reg) { ma_not(reg, reg); }
 
 void MacroAssembler::and32(Register src, Register dest) {
   as_and(dest, dest, src);
 }
@@ -792,16 +796,29 @@ void MacroAssembler::cmp32MovePtr(Condit
 }
 
 void MacroAssembler::cmp32Move32(Condition cond, Register lhs,
                                  const Address& rhs, Register src,
                                  Register dest) {
   MOZ_CRASH();
 }
 
+void MacroAssembler::cmp32Load32(Condition cond, Register lhs,
+                                 const Address& rhs, const Address& src,
+                                 Register dest) {
+  // This is never used, but must be present to facilitate linking on mips(64).
+  MOZ_CRASH("No known use cases");
+}
+
+void MacroAssembler::cmp32Load32(Condition cond, Register lhs, Register rhs,
+                                 const Address& src, Register dest) {
+  // This is never used, but must be present to facilitate linking on mips(64).
+  MOZ_CRASH("No known use cases");
+}
+
 void MacroAssembler::test32LoadPtr(Condition cond, const Address& addr,
                                    Imm32 mask, const Address& src,
                                    Register dest) {
   MOZ_RELEASE_ASSERT(!JitOptions.spectreStringMitigations);
   Label skip;
   branchTest32(Assembler::InvertCondition(cond), addr, mask, &skip);
   loadPtr(src, dest);
   bind(&skip);