Index: src/compiler/mips/code-generator-mips.cc |
diff --git a/src/compiler/mips/code-generator-mips.cc b/src/compiler/mips/code-generator-mips.cc |
index ee374798b1e309df37be2e6ee4ae767ed6e69a4d..17b27972861145451ebdd8b7c90ff3863f3d0b48 100644 |
--- a/src/compiler/mips/code-generator-mips.cc |
+++ b/src/compiler/mips/code-generator-mips.cc |
@@ -1716,8 +1716,13 @@ void CodeGenerator::AssembleArchBoolean(Instruction* instr, |
if (instr->arch_opcode() == kMipsTst) { |
cc = FlagsConditionToConditionTst(condition); |
- __ And(kScratchReg, i.InputRegister(0), i.InputOperand(1)); |
- __ Sltu(result, zero_reg, kScratchReg); |
+ if (instr->InputAt(1)->IsImmediate() && |
dusan.simicic
2016/11/09 12:40:49
I think this can be generalised for all 2^n consta
|
+ i.InputOperand(1).immediate() == 1) { |
+ __ Ext(result, i.InputRegister(0), 0, 1); |
+ } else { |
+ __ And(kScratchReg, i.InputRegister(0), i.InputOperand(1)); |
+ __ Sltu(result, zero_reg, kScratchReg); |
+ } |
if (cc == eq) { |
// Sltu produces 0 for equality, invert the result. |
__ xori(result, result, 1); |