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

Unified Diff: src/compiler/simplified-lowering.cc

Issue 2253293005: [turbofan] Unify Int32Add/Sub representation selection rules. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address nit. Created 4 years, 4 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 | test/mjsunit/compiler/integral32-add-sub.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/simplified-lowering.cc
diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc
index cc226447c21542b22e69689c1f119e2410180c6e..de64de3e1fd7cf0c15b72f21a6fa2a6baad36a27 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -1124,19 +1124,11 @@ class RepresentationSelector {
if (BothInputsAre(node, Type::PlainPrimitive())) {
if (truncation.IsUnused()) return VisitUnused(node);
}
- if (BothInputsAre(node, Type::Signed32OrMinusZero()) &&
- NodeProperties::GetType(node)->Is(Type::Signed32())) {
- // int32 + int32 = int32 ==> signed Int32Add/Sub
- VisitInt32Binop(node);
- if (lower()) ChangeToPureOp(node, Int32Op(node));
- return;
- }
-
- // Use truncation if available.
if (BothInputsAre(node, type_cache_.kAdditiveSafeIntegerOrMinusZero) &&
- truncation.IsUsedAsWord32()) {
- // safe-int + safe-int = x (truncated to int32)
- // => signed Int32Add/Sub (truncated)
+ (GetUpperBound(node)->Is(Type::Signed32()) ||
+ GetUpperBound(node)->Is(Type::Unsigned32()) ||
+ truncation.IsUsedAsWord32())) {
+ // => Int32Add/Sub
VisitWord32TruncatingBinop(node);
if (lower()) ChangeToPureOp(node, Int32Op(node));
return;
@@ -1387,23 +1379,17 @@ class RepresentationSelector {
case IrOpcode::kNumberAdd:
case IrOpcode::kNumberSubtract: {
- if (BothInputsAre(node, Type::Signed32()) &&
- NodeProperties::GetType(node)->Is(Type::Signed32())) {
- // int32 + int32 = int32
- // => signed Int32Add/Sub
- VisitInt32Binop(node);
- if (lower()) NodeProperties::ChangeOp(node, Int32Op(node));
- } else if (BothInputsAre(node,
- type_cache_.kAdditiveSafeIntegerOrMinusZero) &&
- truncation.IsUsedAsWord32()) {
- // safe-int + safe-int = x (truncated to int32)
- // => signed Int32Add/Sub (truncated)
+ if (BothInputsAre(node, type_cache_.kAdditiveSafeIntegerOrMinusZero) &&
+ (GetUpperBound(node)->Is(Type::Signed32()) ||
+ GetUpperBound(node)->Is(Type::Unsigned32()) ||
+ truncation.IsUsedAsWord32())) {
+ // => Int32Add/Sub
VisitWord32TruncatingBinop(node);
- if (lower()) NodeProperties::ChangeOp(node, Int32Op(node));
+ if (lower()) ChangeToPureOp(node, Int32Op(node));
} else {
// => Float64Add/Sub
VisitFloat64Binop(node);
- if (lower()) NodeProperties::ChangeOp(node, Float64Op(node));
+ if (lower()) ChangeToPureOp(node, Float64Op(node));
}
return;
}
« no previous file with comments | « no previous file | test/mjsunit/compiler/integral32-add-sub.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698