summaryrefslogtreecommitdiff
path: root/js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp')
-rw-r--r--js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp b/js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp
index 38897de0d5..839664b8ce 100644
--- a/js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp
+++ b/js/src/jit/mips-shared/MacroAssembler-mips-shared.cpp
@@ -236,8 +236,14 @@ template <typename L>
void
MacroAssemblerMIPSShared::ma_addTestCarry(Register rd, Register rs, Register rt, L overflow)
{
- as_addu(rd, rs, rt);
- as_sltu(SecondScratchReg, rd, rs);
+ if (rd != rs) {
+ as_addu(rd, rs, rt);
+ as_sltu(SecondScratchReg, rd, rs);
+ } else {
+ ma_move(SecondScratchReg, rs);
+ as_addu(rd, rs, rt);
+ as_sltu(SecondScratchReg, rd, SecondScratchReg);
+ }
ma_b(SecondScratchReg, SecondScratchReg, overflow, Assembler::NonZero);
}