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

Unified Diff: test/cctest/compiler/test-representation-change.cc

Issue 2410883003: [turbofan] Remove minus zero check for rhs of CheckedInt32Sub. (Closed)
Patch Set: Adding TODO. Created 4 years, 2 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/simplified-lowering.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/compiler/test-representation-change.cc
diff --git a/test/cctest/compiler/test-representation-change.cc b/test/cctest/compiler/test-representation-change.cc
index 242793340ea809fd3f2ac78040b2266b31912871..2994daf6941209fbb35f5df36d01d6080ce05433 100644
--- a/test/cctest/compiler/test-representation-change.cc
+++ b/test/cctest/compiler/test-representation-change.cc
@@ -443,19 +443,31 @@ TEST(ToUint32_constant) {
}
static void CheckChange(IrOpcode::Value expected, MachineRepresentation from,
- Type* from_type, MachineRepresentation to) {
+ Type* from_type, UseInfo use_info) {
RepresentationChangerTester r;
Node* n = r.Parameter();
Node* use = r.Return(n);
- Node* c = r.changer()->GetRepresentationFor(n, from, from_type, use,
- UseInfo(to, Truncation::None()));
+ Node* c =
+ r.changer()->GetRepresentationFor(n, from, from_type, use, use_info);
CHECK_NE(c, n);
CHECK_EQ(expected, c->opcode());
CHECK_EQ(n, c->InputAt(0));
+
+ if (expected == IrOpcode::kCheckedFloat64ToInt32) {
+ CheckForMinusZeroMode mode =
+ from_type->Maybe(Type::MinusZero())
+ ? use_info.minus_zero_check()
+ : CheckForMinusZeroMode::kDontCheckForMinusZero;
+ CHECK_EQ(mode, CheckMinusZeroModeOf(c->op()));
+ }
}
+static void CheckChange(IrOpcode::Value expected, MachineRepresentation from,
+ Type* from_type, MachineRepresentation to) {
+ CheckChange(expected, from, from_type, UseInfo(to, Truncation::None()));
+}
static void CheckTwoChanges(IrOpcode::Value expected2,
IrOpcode::Value expected1,
@@ -604,6 +616,32 @@ TEST(SignednessInWord32) {
MachineRepresentation::kWord32);
}
+static void TestMinusZeroCheck(IrOpcode::Value expected, Type* from_type) {
+ RepresentationChangerTester r;
+
+ CheckChange(expected, MachineRepresentation::kFloat64, from_type,
+ UseInfo::CheckedSignedSmallAsWord32(
+ CheckForMinusZeroMode::kCheckForMinusZero));
+
+ CheckChange(expected, MachineRepresentation::kFloat64, from_type,
+ UseInfo::CheckedSignedSmallAsWord32(
+ CheckForMinusZeroMode::kDontCheckForMinusZero));
+
+ CheckChange(expected, MachineRepresentation::kFloat64, from_type,
+ UseInfo::CheckedSigned32AsWord32(
+ CheckForMinusZeroMode::kCheckForMinusZero));
+
+ CheckChange(expected, MachineRepresentation::kFloat64, from_type,
+ UseInfo::CheckedSigned32AsWord32(
+ CheckForMinusZeroMode::kDontCheckForMinusZero));
+}
+
+TEST(MinusZeroCheck) {
+ TestMinusZeroCheck(IrOpcode::kCheckedFloat64ToInt32, Type::NumberOrOddball());
+ // PlainNumber cannot be minus zero so the minus zero check should be
+ // eliminated.
+ TestMinusZeroCheck(IrOpcode::kCheckedFloat64ToInt32, Type::PlainNumber());
+}
TEST(Nops) {
RepresentationChangerTester r;
« no previous file with comments | « src/compiler/simplified-lowering.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698