Index: src/compiler/x87/code-generator-x87.cc |
diff --git a/src/compiler/x87/code-generator-x87.cc b/src/compiler/x87/code-generator-x87.cc |
index 96eddd05751f51f1e9d259baeca769db69740645..15755703e0d6cae5f39f58db0674f6ae4b60da50 100644 |
--- a/src/compiler/x87/code-generator-x87.cc |
+++ b/src/compiler/x87/code-generator-x87.cc |
@@ -615,17 +615,37 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
} |
break; |
case kX87Cmp: |
- if (HasImmediateInput(instr, 1)) { |
- __ cmp(i.InputOperand(0), i.InputImmediate(1)); |
+ if (AddressingModeField::decode(instr->opcode()) != kMode_None) { |
+ size_t index = 0; |
+ Operand operand = i.MemoryOperand(&index); |
+ if (HasImmediateInput(instr, index)) { |
+ __ cmp(operand, i.InputImmediate(index)); |
+ } else { |
+ __ cmp(operand, i.InputRegister(index)); |
+ } |
} else { |
- __ cmp(i.InputRegister(0), i.InputOperand(1)); |
+ if (HasImmediateInput(instr, 1)) { |
+ __ cmp(i.InputOperand(0), i.InputImmediate(1)); |
+ } else { |
+ __ cmp(i.InputRegister(0), i.InputOperand(1)); |
+ } |
} |
break; |
case kX87Test: |
- if (HasImmediateInput(instr, 1)) { |
- __ test(i.InputOperand(0), i.InputImmediate(1)); |
+ if (AddressingModeField::decode(instr->opcode()) != kMode_None) { |
+ size_t index = 0; |
+ Operand operand = i.MemoryOperand(&index); |
+ if (HasImmediateInput(instr, index)) { |
+ __ test(operand, i.InputImmediate(index)); |
+ } else { |
+ __ test(i.InputRegister(index), operand); |
+ } |
} else { |
- __ test(i.InputRegister(0), i.InputOperand(1)); |
+ if (HasImmediateInput(instr, 1)) { |
+ __ test(i.InputOperand(0), i.InputImmediate(1)); |
+ } else { |
+ __ test(i.InputRegister(0), i.InputOperand(1)); |
+ } |
} |
break; |
case kX87Imul: |