Index: src/compiler/x64/code-generator-x64.cc |
diff --git a/src/compiler/x64/code-generator-x64.cc b/src/compiler/x64/code-generator-x64.cc |
index 8a64744d5cfd0b38ae3ca3813e971ed1c093a6b8..621e785a16a5e0a127c21d61fee16ada6b117ef2 100644 |
--- a/src/compiler/x64/code-generator-x64.cc |
+++ b/src/compiler/x64/code-generator-x64.cc |
@@ -261,6 +261,32 @@ class OutOfLineRecordWrite final : public OutOfLineCode { |
} \ |
} while (0) |
+#define ASSEMBLE_COMPARE(asm_instr) \ |
+ do { \ |
+ if (AddressingModeField::decode(instr->opcode()) != kMode_None) { \ |
+ size_t index = 0; \ |
+ Operand left = i.MemoryOperand(&index); \ |
+ if (HasImmediateInput(instr, index)) { \ |
+ __ asm_instr(left, i.InputImmediate(index)); \ |
+ } else { \ |
+ __ asm_instr(left, i.InputRegister(index)); \ |
+ } \ |
+ } else { \ |
+ if (HasImmediateInput(instr, 1)) { \ |
+ if (instr->InputAt(0)->IsRegister()) { \ |
+ __ asm_instr(i.InputRegister(0), i.InputImmediate(1)); \ |
+ } else { \ |
+ __ asm_instr(i.InputOperand(0), i.InputImmediate(1)); \ |
+ } \ |
+ } else { \ |
+ if (instr->InputAt(1)->IsRegister()) { \ |
+ __ asm_instr(i.InputRegister(0), i.InputRegister(1)); \ |
+ } else { \ |
+ __ asm_instr(i.InputRegister(0), i.InputOperand(1)); \ |
+ } \ |
+ } \ |
+ } \ |
+ } while (0) |
#define ASSEMBLE_MULT(asm_instr) \ |
do { \ |
@@ -773,16 +799,16 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
ASSEMBLE_BINOP(andq); |
break; |
case kX64Cmp32: |
- ASSEMBLE_BINOP(cmpl); |
+ ASSEMBLE_COMPARE(cmpl); |
break; |
case kX64Cmp: |
- ASSEMBLE_BINOP(cmpq); |
+ ASSEMBLE_COMPARE(cmpq); |
break; |
case kX64Test32: |
- ASSEMBLE_BINOP(testl); |
+ ASSEMBLE_COMPARE(testl); |
break; |
case kX64Test: |
- ASSEMBLE_BINOP(testq); |
+ ASSEMBLE_COMPARE(testq); |
break; |
case kX64Imul32: |
ASSEMBLE_MULT(imull); |