Index: src/compiler/x64/instruction-selector-x64.cc |
diff --git a/src/compiler/x64/instruction-selector-x64.cc b/src/compiler/x64/instruction-selector-x64.cc |
index 14c8f4db1464c44e32983a74e6482323d307d1e3..bbf76993c5aef3f6717b51cb8329ff7fbad0b167 100644 |
--- a/src/compiler/x64/instruction-selector-x64.cc |
+++ b/src/compiler/x64/instruction-selector-x64.cc |
@@ -430,33 +430,6 @@ void InstructionSelector::VisitInt32Add(Node* node) { |
// case that there are only two operands to the add and one of them isn't |
// live, use a plain "addl". |
if (m.matches() && (m.constant() == NULL || g.CanBeImmediate(m.constant()))) { |
- if (m.offset() != NULL) { |
- if (m.constant() == NULL) { |
- if (m.scaled() != NULL && m.scale_exponent() == 0) { |
- if (!IsLive(m.offset())) { |
- Emit(kX64Add32, g.DefineSameAsFirst(node), |
- g.UseRegister(m.offset()), g.Use(m.scaled())); |
- return; |
- } else if (!IsLive(m.scaled())) { |
- Emit(kX64Add32, g.DefineSameAsFirst(node), |
- g.UseRegister(m.scaled()), g.Use(m.offset())); |
- return; |
- } |
- } |
- } else { |
- if (m.scale_exponent() == 0) { |
- if (m.scaled() == NULL || m.offset() == NULL) { |
- Node* non_constant = m.scaled() == NULL ? m.offset() : m.scaled(); |
- if (!IsLive(non_constant)) { |
- Emit(kX64Add32, g.DefineSameAsFirst(node), |
- g.UseRegister(non_constant), g.UseImmediate(m.constant())); |
- return; |
- } |
- } |
- } |
- } |
- } |
- |
InstructionOperand* inputs[4]; |
size_t input_count = 0; |
AddressingMode mode = GenerateMemoryOperandInputs( |
@@ -491,15 +464,12 @@ void InstructionSelector::VisitInt32Sub(Node* node) { |
Emit(kX64Neg32, g.DefineSameAsFirst(node), g.UseRegister(m.right().node())); |
} else { |
if (m.right().HasValue() && g.CanBeImmediate(m.right().node())) { |
- if (IsLive(m.left().node())) { |
- // Special handling for subtraction of constants where the non-constant |
- // input is used elsewhere. To eliminate the gap move before the sub to |
- // copy the destination register, use a "leal" instead. |
- Emit(kX64Lea32 | AddressingModeField::encode(kMode_MRI), |
- g.DefineAsRegister(node), g.UseRegister(m.left().node()), |
- g.TempImmediate(-m.right().Value())); |
- return; |
- } |
+ // Turn subtractions of constant values into immediate "leal" instructions |
+ // by negating the value. |
+ Emit(kX64Lea32 | AddressingModeField::encode(kMode_MRI), |
+ g.DefineAsRegister(node), g.UseRegister(m.left().node()), |
+ g.TempImmediate(-m.right().Value())); |
+ return; |
} |
VisitBinop(this, node, kX64Sub32); |
} |