From 83da00f71687519d413ac42e4d23ec837576a501 Mon Sep 17 00:00:00 2001 From: Heiher Date: Thu, 24 Mar 2016 11:51:30 +0800 Subject: [PATCH] Bug 1258910 - OdinMonkey: MIPS64: Implement AsmSelectI64. r=bbouvier --- js/src/jit/mips64/CodeGenerator-mips64.cpp | 21 +++++++++++++++++++++ js/src/jit/mips64/CodeGenerator-mips64.h | 1 + 2 files changed, 22 insertions(+) --- js/src/jit/mips64/CodeGenerator-mips64.cpp | 21 +++++++++++++++++++++ js/src/jit/mips64/CodeGenerator-mips64.h | 1 + 2 files changed, 22 insertions(+) diff --git a/js/src/jit/mips64/CodeGenerator-mips64.cpp b/js/src/jit/mips64/CodeGenerator-mips64.cpp index 88847a6e124c..6adb180bf1a6 100644 --- a/js/src/jit/mips64/CodeGenerator-mips64.cpp +++ b/js/src/jit/mips64/CodeGenerator-mips64.cpp @@ -278,6 +278,27 @@ CodeGeneratorMIPS64::visitCompareBitwiseAndBranch(LCompareBitwiseAndBranch* lir) emitBranch(lhs.valueReg(), rhs.valueReg(), cond, lir->ifTrue(), lir->ifFalse()); } +void +CodeGeneratorMIPS64::visitAsmSelectI64(LAsmSelectI64* lir) +{ + MOZ_ASSERT(lir->mir()->type() == MIRType_Int64); + + Register cond = ToRegister(lir->condExpr()); + Operand falseExpr = ToOperand(lir->falseExpr()); + + Register out = ToRegister(lir->output()); + MOZ_ASSERT(ToRegister(lir->trueExpr()) == out, "true expr is reused for input"); + + if (falseExpr.getTag() == Operand::REG) { + masm.as_movz(out, falseExpr.toReg(), cond); + } else { + Label done; + masm.ma_b(cond, cond, &done, Assembler::NonZero, ShortJump); + masm.loadPtr(falseExpr.toAddress(), out); + masm.bind(&done); + } +} + void CodeGeneratorMIPS64::setReturnDoubleRegs(LiveRegisterSet* regs) { diff --git a/js/src/jit/mips64/CodeGenerator-mips64.h b/js/src/jit/mips64/CodeGenerator-mips64.h index c1ed1e62c55e..fdb8db936de2 100644 --- a/js/src/jit/mips64/CodeGenerator-mips64.h +++ b/js/src/jit/mips64/CodeGenerator-mips64.h @@ -44,6 +44,7 @@ class CodeGeneratorMIPS64 : public CodeGeneratorMIPSShared virtual void visitCompareBAndBranch(LCompareBAndBranch* lir); virtual void visitCompareBitwise(LCompareBitwise* lir); virtual void visitCompareBitwiseAndBranch(LCompareBitwiseAndBranch* lir); + virtual void visitAsmSelectI64(LAsmSelectI64* ins); // Out of line visitors. void visitOutOfLineBailout(OutOfLineBailout* ool);