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 368f4b492121092e3138587d4a57fddd5be6280d..dc96c1a8e35ab586ea5d01cdb10552bac3612b85 100644 |
--- a/src/compiler/x64/instruction-selector-x64.cc |
+++ b/src/compiler/x64/instruction-selector-x64.cc |
@@ -1193,11 +1193,10 @@ void InstructionSelector::VisitChangeInt32ToInt64(Node* node) { |
} |
} |
+namespace { |
-void InstructionSelector::VisitChangeUint32ToUint64(Node* node) { |
- X64OperandGenerator g(this); |
- Node* value = node->InputAt(0); |
- switch (value->opcode()) { |
+bool ZeroExtendsWord32ToWord64(Node* node) { |
+ switch (node->opcode()) { |
case IrOpcode::kWord32And: |
case IrOpcode::kWord32Or: |
case IrOpcode::kWord32Xor: |
@@ -1218,14 +1217,36 @@ void InstructionSelector::VisitChangeUint32ToUint64(Node* node) { |
case IrOpcode::kUint32LessThan: |
case IrOpcode::kUint32LessThanOrEqual: |
case IrOpcode::kUint32Mod: |
- case IrOpcode::kUint32MulHigh: { |
+ case IrOpcode::kUint32MulHigh: |
// These 32-bit operations implicitly zero-extend to 64-bit on x64, so the |
// zero-extension is a no-op. |
- Emit(kArchNop, g.DefineSameAsFirst(node), g.Use(value)); |
- return; |
+ return true; |
+ case IrOpcode::kProjection: { |
+ Node* const value = node->InputAt(0); |
+ switch (value->opcode()) { |
+ case IrOpcode::kInt32AddWithOverflow: |
+ case IrOpcode::kInt32SubWithOverflow: |
+ case IrOpcode::kInt32MulWithOverflow: |
+ return true; |
+ default: |
+ return false; |
+ } |
} |
default: |
- break; |
+ return false; |
+ } |
+} |
+ |
+} // namespace |
+ |
+void InstructionSelector::VisitChangeUint32ToUint64(Node* node) { |
+ X64OperandGenerator g(this); |
+ Node* value = node->InputAt(0); |
+ if (ZeroExtendsWord32ToWord64(value)) { |
+ // These 32-bit operations implicitly zero-extend to 64-bit on x64, so the |
+ // zero-extension is a no-op. |
+ Emit(kArchNop, g.DefineSameAsFirst(node), g.Use(value)); |
+ return; |
} |
Emit(kX64Movl, g.DefineAsRegister(node), g.Use(value)); |
} |