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

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

Issue 1468313009: Revert of [machine-operator-reducer] fix float truncation (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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 | « test/mjsunit/math-52-mul-div.js ('k') | no next file » | 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 "src/conversions-inl.h" 10 #include "src/conversions-inl.h"
(...skipping 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after
1642 Reduction r = Reduce(node); 1642 Reduction r = Reduce(node);
1643 ASSERT_TRUE(r.Changed()); 1643 ASSERT_TRUE(r.Changed());
1644 EXPECT_THAT(r.replacement(), 1644 EXPECT_THAT(r.replacement(),
1645 IsStore(rep, base, index, value, effect, control)); 1645 IsStore(rep, base, index, value, effect, control));
1646 } 1646 }
1647 } 1647 }
1648 1648
1649 1649
1650 TEST_F(MachineOperatorReducerTest, RoundPlusTruncate) { 1650 TEST_F(MachineOperatorReducerTest, RoundPlusTruncate) {
1651 Node* p0 = Parameter(0); 1651 Node* p0 = Parameter(0);
1652
1653 Type* p0_range = Type::Range(0x0, 0xFFFFFF8000001ULL, graph()->zone());
1654 NodeProperties::SetType(
1655 p0, Type::Intersect(p0_range, Type::Number(), graph()->zone()));
1656
1657 Node* t0 = graph()->NewNode(machine()->RoundInt64ToFloat64(), p0); 1652 Node* t0 = graph()->NewNode(machine()->RoundInt64ToFloat64(), p0);
1658 Node* t1 = graph()->NewNode( 1653 Node* t1 = graph()->NewNode(
1659 machine()->TruncateFloat64ToInt32(TruncationMode::kJavaScript), t0); 1654 machine()->TruncateFloat64ToInt32(TruncationMode::kJavaScript), t0);
1660 1655
1661 Reduction r = Reduce(t1); 1656 Reduction r = Reduce(t1);
1662 ASSERT_TRUE(r.Changed()); 1657 ASSERT_TRUE(r.Changed());
1663 EXPECT_THAT(r.replacement(), IsTruncateInt64ToInt32(p0)); 1658 EXPECT_THAT(r.replacement(), p0);
1664 }
1665
1666
1667 TEST_F(MachineOperatorReducerTest, OverflowingRoundPlusTruncate) {
1668 Node* p0 = Parameter(0);
1669
1670 Type* p0_range = Type::Range(0x0, 0x10000000000000ULL, graph()->zone());
1671 NodeProperties::SetType(
1672 p0, Type::Intersect(p0_range, Type::Number(), graph()->zone()));
1673
1674 Node* t0 = graph()->NewNode(machine()->RoundInt64ToFloat64(), p0);
1675 Node* t1 = graph()->NewNode(
1676 machine()->TruncateFloat64ToInt32(TruncationMode::kJavaScript), t0);
1677
1678 Reduction r = Reduce(t1);
1679 ASSERT_TRUE(!r.Changed());
1680 } 1659 }
1681 1660
1682 } // namespace compiler 1661 } // namespace compiler
1683 } // namespace internal 1662 } // namespace internal
1684 } // namespace v8 1663 } // namespace v8
OLDNEW
« no previous file with comments | « test/mjsunit/math-52-mul-div.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698