Index: src/compiler/ia32/code-generator-ia32.cc |
diff --git a/src/compiler/ia32/code-generator-ia32.cc b/src/compiler/ia32/code-generator-ia32.cc |
index 555667afaef848cc1b5dceb3b892aea41938368c..6a7d6a72d1b4115be9296d9109b17fd66e740c22 100644 |
--- a/src/compiler/ia32/code-generator-ia32.cc |
+++ b/src/compiler/ia32/code-generator-ia32.cc |
@@ -529,17 +529,37 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
} |
break; |
case kIA32Cmp: |
- 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 kIA32Test: |
- 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 kIA32Imul: |