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

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

Issue 2065503002: [builtins] Introduce proper Float64Atan and Float64Atan2 operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: [WIP] Fix GCC/Win32. Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/machine-operator-reducer.h" 5 #include "src/compiler/machine-operator-reducer.h"
6 #include "src/base/bits.h" 6 #include "src/base/bits.h"
7 #include "src/base/division-by-constant.h" 7 #include "src/base/division-by-constant.h"
8 #include "src/base/ieee754.h" 8 #include "src/base/ieee754.h"
9 #include "src/compiler/js-graph.h" 9 #include "src/compiler/js-graph.h"
10 #include "src/compiler/typer.h" 10 #include "src/compiler/typer.h"
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 Reduction r = Reduce( 1394 Reduction r = Reduce(
1395 graph()->NewNode(machine()->Float64Mul(), Float64Constant(-1.0), p0)); 1395 graph()->NewNode(machine()->Float64Mul(), Float64Constant(-1.0), p0));
1396 ASSERT_TRUE(r.Changed()); 1396 ASSERT_TRUE(r.Changed());
1397 EXPECT_THAT(r.replacement(), 1397 EXPECT_THAT(r.replacement(),
1398 IsFloat64Sub(IsFloat64Constant(BitEq(-0.0)), p0)); 1398 IsFloat64Sub(IsFloat64Constant(BitEq(-0.0)), p0));
1399 } 1399 }
1400 } 1400 }
1401 1401
1402 1402
1403 // ----------------------------------------------------------------------------- 1403 // -----------------------------------------------------------------------------
1404 // Float64Atan
1405
1406 TEST_F(MachineOperatorReducerTest, Float64AtanWithConstant) {
1407 TRACED_FOREACH(double, x, kFloat64Values) {
1408 Reduction const r =
1409 Reduce(graph()->NewNode(machine()->Float64Atan(), Float64Constant(x)));
1410 ASSERT_TRUE(r.Changed());
1411 EXPECT_THAT(
1412 r.replacement(),
1413 IsFloat64Constant(NanSensitiveDoubleEq(base::ieee754::atan(x))));
1414 }
1415 }
1416
1417 // -----------------------------------------------------------------------------
1418 // Float64Atan2
1419
1420 TEST_F(MachineOperatorReducerTest, Float64Atan2WithConstant) {
1421 TRACED_FOREACH(double, y, kFloat64Values) {
1422 TRACED_FOREACH(double, x, kFloat64Values) {
1423 Reduction const r = Reduce(graph()->NewNode(
1424 machine()->Float64Atan2(), Float64Constant(y), Float64Constant(x)));
1425 ASSERT_TRUE(r.Changed());
1426 EXPECT_THAT(
1427 r.replacement(),
1428 IsFloat64Constant(NanSensitiveDoubleEq(base::ieee754::atan2(y, x))));
1429 }
1430 }
1431 }
1432
1433 TEST_F(MachineOperatorReducerTest, Float64Atan2WithNaN) {
1434 Node* const p0 = Parameter(0);
1435 Node* const nan = Float64Constant(std::numeric_limits<double>::quiet_NaN());
1436 {
1437 Reduction const r =
1438 Reduce(graph()->NewNode(machine()->Float64Atan2(), p0, nan));
1439 ASSERT_TRUE(r.Changed());
1440 EXPECT_EQ(nan, r.replacement());
1441 }
1442 {
1443 Reduction const r =
1444 Reduce(graph()->NewNode(machine()->Float64Atan2(), nan, p0));
1445 ASSERT_TRUE(r.Changed());
1446 EXPECT_EQ(nan, r.replacement());
1447 }
1448 }
1449
1450 // -----------------------------------------------------------------------------
1404 // Float64Log 1451 // Float64Log
1405 1452
1406 TEST_F(MachineOperatorReducerTest, Float64LogWithConstant) { 1453 TEST_F(MachineOperatorReducerTest, Float64LogWithConstant) {
1407 TRACED_FOREACH(double, x, kFloat64Values) { 1454 TRACED_FOREACH(double, x, kFloat64Values) {
1408 Reduction const r = 1455 Reduction const r =
1409 Reduce(graph()->NewNode(machine()->Float64Log(), Float64Constant(x))); 1456 Reduce(graph()->NewNode(machine()->Float64Log(), Float64Constant(x)));
1410 ASSERT_TRUE(r.Changed()); 1457 ASSERT_TRUE(r.Changed());
1411 EXPECT_THAT(r.replacement(), 1458 EXPECT_THAT(r.replacement(),
1412 IsFloat64Constant(NanSensitiveDoubleEq(base::ieee754::log(x)))); 1459 IsFloat64Constant(NanSensitiveDoubleEq(base::ieee754::log(x))));
1413 } 1460 }
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1671 Reduction r = Reduce(node); 1718 Reduction r = Reduce(node);
1672 ASSERT_TRUE(r.Changed()); 1719 ASSERT_TRUE(r.Changed());
1673 EXPECT_THAT(r.replacement(), 1720 EXPECT_THAT(r.replacement(),
1674 IsStore(rep, base, index, value, effect, control)); 1721 IsStore(rep, base, index, value, effect, control));
1675 } 1722 }
1676 } 1723 }
1677 1724
1678 } // namespace compiler 1725 } // namespace compiler
1679 } // namespace internal 1726 } // namespace internal
1680 } // namespace v8 1727 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/js-builtin-reducer-unittest.cc ('k') | test/unittests/compiler/node-test-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698