Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Unified Diff: src/compiler/x64/instruction-selector-x64.cc

Issue 2338263004: [turbofan] Int32Add/Sub/MulWithOverflow also zero extend to 64bit. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698