Index: src/compiler/mips64/code-generator-mips64.cc |
diff --git a/src/compiler/mips64/code-generator-mips64.cc b/src/compiler/mips64/code-generator-mips64.cc |
index 053434eec9a916f4e9eb287ffbb712002d70fc85..7ccf0a774c5e5d548534fbddf4cca54c5ce4b6c4 100644 |
--- a/src/compiler/mips64/code-generator-mips64.cc |
+++ b/src/compiler/mips64/code-generator-mips64.cc |
@@ -1046,19 +1046,10 @@ void CodeGenerator::AssembleArchBoolean(Instruction* instr, |
if (instr->arch_opcode() == kMips64Tst) { |
cc = FlagsConditionToConditionTst(condition); |
__ And(kScratchReg, i.InputRegister(0), i.InputOperand(1)); |
- __ xori(result, zero_reg, 1); // Create 1 for true. |
- if (kArchVariant == kMips64r6) { |
- if (cc == eq) { |
- __ seleqz(result, result, kScratchReg); |
- } else { |
- __ selnez(result, result, kScratchReg); |
- } |
- } else { |
- if (cc == eq) { |
- __ Movn(result, zero_reg, kScratchReg); |
- } else { |
- __ Movz(result, zero_reg, kScratchReg); |
- } |
+ __ Sltu(result, zero_reg, kScratchReg); |
+ if (cc == eq) { |
+ // Sltu produces 0 for equality, invert the result. |
+ __ xori(result, result, 1); |
} |
return; |
} else if (instr->arch_opcode() == kMips64Dadd || |
@@ -1078,20 +1069,18 @@ void CodeGenerator::AssembleArchBoolean(Instruction* instr, |
case ne: { |
Register left = i.InputRegister(0); |
Operand right = i.InputOperand(1); |
- __ Dsubu(kScratchReg, left, right); |
- __ xori(result, zero_reg, 1); |
- if (kArchVariant == kMips64r6) { |
- if (cc == eq) { |
- __ seleqz(result, result, kScratchReg); |
- } else { |
- __ selnez(result, result, kScratchReg); |
- } |
+ Register select; |
+ if (instr->InputAt(1)->IsImmediate() && right.immediate() == 0) { |
+ // Pass left operand if right is zero. |
+ select = left; |
} else { |
- if (cc == eq) { |
- __ Movn(result, zero_reg, kScratchReg); |
- } else { |
- __ Movz(result, zero_reg, kScratchReg); |
- } |
+ __ Dsubu(kScratchReg, left, right); |
+ select = kScratchReg; |
+ } |
+ __ Sltu(result, zero_reg, select); |
+ if (cc == eq) { |
+ // Sltu produces 0 for equality, invert the result. |
+ __ xori(result, result, 1); |
} |
} break; |
case lt: |