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

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

Issue 2333663002: [turbofan] Do constant folding for Float64Pow. (Closed)
Patch Set: Make sure to have exponent 0/-0 properly. 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 | « src/wasm/wasm-external-refs.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 b81ec2f3c568d41af52fa2a45f811ed851716408..127ddf355718cf677ce26f9a9630fc65fa39e63c 100644
--- a/test/unittests/compiler/machine-operator-reducer-unittest.cc
+++ b/test/unittests/compiler/machine-operator-reducer-unittest.cc
@@ -1772,6 +1772,37 @@ TEST_F(MachineOperatorReducerTest, Float64Log1pWithConstant) {
}
// -----------------------------------------------------------------------------
+// Float64Pow
+
+TEST_F(MachineOperatorReducerTest, Float64PowWithConstant) {
+ TRACED_FOREACH(double, x, kFloat64Values) {
+ TRACED_FOREACH(double, y, kFloat64Values) {
+ Reduction const r = Reduce(graph()->NewNode(
+ machine()->Float64Pow(), Float64Constant(x), Float64Constant(y)));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(r.replacement(),
+ IsFloat64Constant(NanSensitiveDoubleEq(Pow(x, y))));
+ }
+ }
+}
+
+TEST_F(MachineOperatorReducerTest, Float64PowWithZeroExponent) {
+ Node* const p0 = Parameter(0);
+ {
+ Reduction const r = Reduce(
+ graph()->NewNode(machine()->Float64Pow(), p0, Float64Constant(-0.0)));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(r.replacement(), IsFloat64Constant(1.0));
+ }
+ {
+ Reduction const r = Reduce(
+ graph()->NewNode(machine()->Float64Pow(), p0, Float64Constant(0.0)));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(r.replacement(), IsFloat64Constant(1.0));
+ }
+}
+
+// -----------------------------------------------------------------------------
// Float64Sin
TEST_F(MachineOperatorReducerTest, Float64SinWithConstant) {
« no previous file with comments | « src/wasm/wasm-external-refs.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698