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

Unified Diff: src/compiler/representation-change.cc

Issue 2734253002: [turbofan] Propagate minus-zero truncation in representation inference. (Closed)
Patch Set: Address reviewer comments Created 3 years, 9 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 | « src/compiler/representation-change.h ('k') | src/compiler/simplified-lowering.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/representation-change.cc
diff --git a/src/compiler/representation-change.cc b/src/compiler/representation-change.cc
index 6b532702958eda40cc9af09c70939e59580aa5fb..eca5650ba597ef06c2870b9ee21a98e850a6b431 100644
--- a/src/compiler/representation-change.cc
+++ b/src/compiler/representation-change.cc
@@ -27,9 +27,19 @@ const char* Truncation::description() const {
case TruncationKind::kWord64:
return "truncate-to-word64";
case TruncationKind::kFloat64:
- return "truncate-to-float64";
+ switch (identify_zeros()) {
+ case kIdentifyZeros:
+ return "truncate-to-float64 (identify zeros)";
+ case kDistinguishZeros:
+ return "truncate-to-float64 (distinguish zeros)";
+ }
case TruncationKind::kAny:
- return "no-truncation";
+ switch (identify_zeros()) {
+ case kIdentifyZeros:
+ return "no-truncation (but identify zeros)";
+ case kDistinguishZeros:
+ return "no-truncation (but distinguish zeros)";
+ }
}
UNREACHABLE();
return nullptr;
@@ -38,10 +48,10 @@ const char* Truncation::description() const {
// Partial order for truncations:
//
-// kWord64 kAny
-// ^ ^
-// \ |
-// \ kFloat64 <--+
+// kWord64 kAny <-------+
+// ^ ^ |
+// \ | |
+// \ kFloat64 |
// \ ^ |
// \ / |
// kWord32 kBool
@@ -52,6 +62,8 @@ const char* Truncation::description() const {
// \ /
// \ /
// kNone
+//
+// TODO(jarin) We might consider making kBool < kFloat64.
// static
Truncation::TruncationKind Truncation::Generalize(TruncationKind rep1,
@@ -73,6 +85,15 @@ Truncation::TruncationKind Truncation::Generalize(TruncationKind rep1,
return TruncationKind::kNone;
}
+// static
+IdentifyZeros Truncation::GeneralizeIdentifyZeros(IdentifyZeros i1,
+ IdentifyZeros i2) {
+ if (i1 == i2) {
+ return i1;
+ } else {
+ return kDistinguishZeros;
+ }
+}
// static
bool Truncation::LessGeneral(TruncationKind rep1, TruncationKind rep2) {
@@ -96,6 +117,10 @@ bool Truncation::LessGeneral(TruncationKind rep1, TruncationKind rep2) {
return false;
}
+// static
+bool Truncation::LessGeneralIdentifyZeros(IdentifyZeros i1, IdentifyZeros i2) {
+ return i1 == i2 || i1 == kIdentifyZeros;
+}
namespace {
« no previous file with comments | « src/compiler/representation-change.h ('k') | src/compiler/simplified-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698