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

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

Issue 974313002: [turbofan] Support for %_DoubleHi, %_DoubleLo and %_ConstructDouble. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed Svens comment. Created 5 years, 9 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/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 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after
1429 Reduction r = Reduce( 1429 Reduction r = Reduce(
1430 graph()->NewNode(machine()->Float64Mul(), Float64Constant(-1.0), p0)); 1430 graph()->NewNode(machine()->Float64Mul(), Float64Constant(-1.0), p0));
1431 ASSERT_TRUE(r.Changed()); 1431 ASSERT_TRUE(r.Changed());
1432 EXPECT_THAT(r.replacement(), 1432 EXPECT_THAT(r.replacement(),
1433 IsFloat64Sub(IsFloat64Constant(BitEq(-0.0)), p0)); 1433 IsFloat64Sub(IsFloat64Constant(BitEq(-0.0)), p0));
1434 } 1434 }
1435 } 1435 }
1436 1436
1437 1437
1438 // ----------------------------------------------------------------------------- 1438 // -----------------------------------------------------------------------------
1439 // Float64InsertLowWord32
1440
1441
1442 TEST_F(MachineOperatorReducerTest, Float64InsertLowWord32WithConstant) {
1443 TRACED_FOREACH(double, x, kFloat64Values) {
1444 TRACED_FOREACH(uint32_t, y, kUint32Values) {
1445 Reduction const r =
1446 Reduce(graph()->NewNode(machine()->Float64InsertLowWord32(),
1447 Float64Constant(x), Uint32Constant(y)));
1448 ASSERT_TRUE(r.Changed());
1449 EXPECT_THAT(
1450 r.replacement(),
1451 IsFloat64Constant(BitEq(bit_cast<double>(
1452 (bit_cast<uint64_t>(x) & V8_UINT64_C(0xFFFFFFFF00000000)) | y))));
1453 }
1454 }
1455 }
1456
1457
1458 // -----------------------------------------------------------------------------
1459 // Float64InsertHighWord32
1460
1461
1462 TEST_F(MachineOperatorReducerTest, Float64InsertHighWord32WithConstant) {
1463 TRACED_FOREACH(double, x, kFloat64Values) {
1464 TRACED_FOREACH(uint32_t, y, kUint32Values) {
1465 Reduction const r =
1466 Reduce(graph()->NewNode(machine()->Float64InsertHighWord32(),
1467 Float64Constant(x), Uint32Constant(y)));
1468 ASSERT_TRUE(r.Changed());
1469 EXPECT_THAT(r.replacement(),
1470 IsFloat64Constant(BitEq(bit_cast<double>(
1471 (bit_cast<uint64_t>(x) & V8_UINT64_C(0xFFFFFFFF)) |
1472 (static_cast<uint64_t>(y) << 32)))));
1473 }
1474 }
1475 }
1476
1477
1478 // -----------------------------------------------------------------------------
1439 // Store 1479 // Store
1440 1480
1441 1481
1442 TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32And) { 1482 TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32And) {
1443 const StoreRepresentation rep(kRepWord8, kNoWriteBarrier); 1483 const StoreRepresentation rep(kRepWord8, kNoWriteBarrier);
1444 Node* const base = Parameter(0); 1484 Node* const base = Parameter(0);
1445 Node* const index = Parameter(1); 1485 Node* const index = Parameter(1);
1446 Node* const value = Parameter(2); 1486 Node* const value = Parameter(2);
1447 Node* const effect = graph()->start(); 1487 Node* const effect = graph()->start();
1448 Node* const control = graph()->start(); 1488 Node* const control = graph()->start();
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1526 Reduction r = Reduce(node); 1566 Reduction r = Reduce(node);
1527 ASSERT_TRUE(r.Changed()); 1567 ASSERT_TRUE(r.Changed());
1528 EXPECT_THAT(r.replacement(), 1568 EXPECT_THAT(r.replacement(),
1529 IsStore(rep, base, index, value, effect, control)); 1569 IsStore(rep, base, index, value, effect, control));
1530 } 1570 }
1531 } 1571 }
1532 1572
1533 } // namespace compiler 1573 } // namespace compiler
1534 } // namespace internal 1574 } // namespace internal
1535 } // namespace v8 1575 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/js-intrinsic-lowering-unittest.cc ('k') | test/unittests/compiler/machine-operator-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698