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

Unified Diff: test/unittests/compiler/machine-operator-reducer-unittest.cc

Issue 1365623002: [turbofan] Elide fp32 convert for const compares (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address pointer->reference nit Created 5 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 | « src/compiler/machine-operator-reducer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/compiler/machine-operator-reducer-unittest.cc
diff --git a/test/unittests/compiler/machine-operator-reducer-unittest.cc b/test/unittests/compiler/machine-operator-reducer-unittest.cc
index 90b8d4daa235271632a8277fa1b7e26098db5afe..13a5b6f3bbafad9a5c0ffda177dae716b93db4a1 100644
--- a/test/unittests/compiler/machine-operator-reducer-unittest.cc
+++ b/test/unittests/compiler/machine-operator-reducer-unittest.cc
@@ -1454,6 +1454,19 @@ TEST_F(MachineOperatorReducerTest, Float64EqualWithFloat32Conversions) {
}
+TEST_F(MachineOperatorReducerTest, Float64EqualWithFloat32Constant) {
+ Node* const p0 = Parameter(0);
+ TRACED_FOREACH(float, x, kFloat32Values) {
+ Reduction r = Reduce(graph()->NewNode(
+ machine()->Float64Equal(),
+ graph()->NewNode(machine()->ChangeFloat32ToFloat64(), p0),
+ Float64Constant(x)));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(r.replacement(), IsFloat32Equal(p0, IsFloat32Constant(x)));
+ }
+}
+
+
// -----------------------------------------------------------------------------
// Float64LessThan
@@ -1470,6 +1483,30 @@ TEST_F(MachineOperatorReducerTest, Float64LessThanWithFloat32Conversions) {
}
+TEST_F(MachineOperatorReducerTest, Float64LessThanWithFloat32Constant) {
+ Node* const p0 = Parameter(0);
+ {
+ TRACED_FOREACH(float, x, kFloat32Values) {
+ Reduction r = Reduce(graph()->NewNode(
+ machine()->Float64LessThan(),
+ graph()->NewNode(machine()->ChangeFloat32ToFloat64(), p0),
+ Float64Constant(x)));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(r.replacement(), IsFloat32LessThan(p0, IsFloat32Constant(x)));
+ }
+ }
+ {
+ TRACED_FOREACH(float, x, kFloat32Values) {
+ Reduction r = Reduce(graph()->NewNode(
+ machine()->Float64LessThan(), Float64Constant(x),
+ graph()->NewNode(machine()->ChangeFloat32ToFloat64(), p0)));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(r.replacement(), IsFloat32LessThan(IsFloat32Constant(x), p0));
+ }
+ }
+}
+
+
// -----------------------------------------------------------------------------
// Float64LessThanOrEqual
@@ -1487,6 +1524,32 @@ TEST_F(MachineOperatorReducerTest,
}
+TEST_F(MachineOperatorReducerTest, Float64LessThanOrEqualWithFloat32Constant) {
+ Node* const p0 = Parameter(0);
+ {
+ TRACED_FOREACH(float, x, kFloat32Values) {
+ Reduction r = Reduce(graph()->NewNode(
+ machine()->Float64LessThanOrEqual(),
+ graph()->NewNode(machine()->ChangeFloat32ToFloat64(), p0),
+ Float64Constant(x)));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(r.replacement(),
+ IsFloat32LessThanOrEqual(p0, IsFloat32Constant(x)));
+ }
+ }
+ {
+ TRACED_FOREACH(float, x, kFloat32Values) {
+ Reduction r = Reduce(graph()->NewNode(
+ machine()->Float64LessThanOrEqual(), Float64Constant(x),
+ graph()->NewNode(machine()->ChangeFloat32ToFloat64(), p0)));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(r.replacement(),
+ IsFloat32LessThanOrEqual(IsFloat32Constant(x), p0));
+ }
+ }
+}
+
+
// -----------------------------------------------------------------------------
// Store
« no previous file with comments | « src/compiler/machine-operator-reducer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698