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

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

Issue 1235663002: [turbofan] Reduce Float64 comparison to Float32. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « src/compiler/machine-operator-reducer.cc ('k') | test/unittests/compiler/node-test-utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/base/bits.h" 5 #include "src/base/bits.h"
6 #include "src/base/division-by-constant.h" 6 #include "src/base/division-by-constant.h"
7 #include "src/compiler/js-graph.h" 7 #include "src/compiler/js-graph.h"
8 #include "src/compiler/machine-operator-reducer.h" 8 #include "src/compiler/machine-operator-reducer.h"
9 #include "src/compiler/typer.h" 9 #include "src/compiler/typer.h"
10 #include "test/unittests/compiler/graph-unittest.h" 10 #include "test/unittests/compiler/graph-unittest.h"
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 EXPECT_THAT(r.replacement(), 1431 EXPECT_THAT(r.replacement(),
1432 IsFloat64Constant(BitEq(bit_cast<double>( 1432 IsFloat64Constant(BitEq(bit_cast<double>(
1433 (bit_cast<uint64_t>(x) & V8_UINT64_C(0xFFFFFFFF)) | 1433 (bit_cast<uint64_t>(x) & V8_UINT64_C(0xFFFFFFFF)) |
1434 (static_cast<uint64_t>(y) << 32))))); 1434 (static_cast<uint64_t>(y) << 32)))));
1435 } 1435 }
1436 } 1436 }
1437 } 1437 }
1438 1438
1439 1439
1440 // ----------------------------------------------------------------------------- 1440 // -----------------------------------------------------------------------------
1441 // Float64Equal
1442
1443
1444 TEST_F(MachineOperatorReducerTest, Float64EqualWithFloat32Conversions) {
1445 Node* const p0 = Parameter(0);
1446 Node* const p1 = Parameter(1);
1447 Reduction const r = Reduce(graph()->NewNode(
1448 machine()->Float64Equal(),
1449 graph()->NewNode(machine()->ChangeFloat32ToFloat64(), p0),
1450 graph()->NewNode(machine()->ChangeFloat32ToFloat64(), p1)));
1451 ASSERT_TRUE(r.Changed());
1452 EXPECT_THAT(r.replacement(), IsFloat32Equal(p0, p1));
1453 }
1454
1455
1456 // -----------------------------------------------------------------------------
1457 // Float64LessThan
1458
1459
1460 TEST_F(MachineOperatorReducerTest, Float64LessThanWithFloat32Conversions) {
1461 Node* const p0 = Parameter(0);
1462 Node* const p1 = Parameter(1);
1463 Reduction const r = Reduce(graph()->NewNode(
1464 machine()->Float64LessThan(),
1465 graph()->NewNode(machine()->ChangeFloat32ToFloat64(), p0),
1466 graph()->NewNode(machine()->ChangeFloat32ToFloat64(), p1)));
1467 ASSERT_TRUE(r.Changed());
1468 EXPECT_THAT(r.replacement(), IsFloat32LessThan(p0, p1));
1469 }
1470
1471
1472 // -----------------------------------------------------------------------------
1473 // Float64LessThanOrEqual
1474
1475
1476 TEST_F(MachineOperatorReducerTest,
1477 Float64LessThanOrEqualWithFloat32Conversions) {
1478 Node* const p0 = Parameter(0);
1479 Node* const p1 = Parameter(1);
1480 Reduction const r = Reduce(graph()->NewNode(
1481 machine()->Float64LessThanOrEqual(),
1482 graph()->NewNode(machine()->ChangeFloat32ToFloat64(), p0),
1483 graph()->NewNode(machine()->ChangeFloat32ToFloat64(), p1)));
1484 ASSERT_TRUE(r.Changed());
1485 EXPECT_THAT(r.replacement(), IsFloat32LessThanOrEqual(p0, p1));
1486 }
1487
1488
1489 // -----------------------------------------------------------------------------
1441 // Store 1490 // Store
1442 1491
1443 1492
1444 TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32And) { 1493 TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32And) {
1445 const StoreRepresentation rep(kRepWord8, kNoWriteBarrier); 1494 const StoreRepresentation rep(kRepWord8, kNoWriteBarrier);
1446 Node* const base = Parameter(0); 1495 Node* const base = Parameter(0);
1447 Node* const index = Parameter(1); 1496 Node* const index = Parameter(1);
1448 Node* const value = Parameter(2); 1497 Node* const value = Parameter(2);
1449 Node* const effect = graph()->start(); 1498 Node* const effect = graph()->start();
1450 Node* const control = graph()->start(); 1499 Node* const control = graph()->start();
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 Reduction r = Reduce(node); 1577 Reduction r = Reduce(node);
1529 ASSERT_TRUE(r.Changed()); 1578 ASSERT_TRUE(r.Changed());
1530 EXPECT_THAT(r.replacement(), 1579 EXPECT_THAT(r.replacement(),
1531 IsStore(rep, base, index, value, effect, control)); 1580 IsStore(rep, base, index, value, effect, control));
1532 } 1581 }
1533 } 1582 }
1534 1583
1535 } // namespace compiler 1584 } // namespace compiler
1536 } // namespace internal 1585 } // namespace internal
1537 } // namespace v8 1586 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/machine-operator-reducer.cc ('k') | test/unittests/compiler/node-test-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698