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 6f7ed3aca48df98ad15a36510582cb44563a85b6..9e1ed6efdc0aee8e0eef8d3378d214cd424b3124 100644 |
--- a/test/unittests/compiler/machine-operator-reducer-unittest.cc |
+++ b/test/unittests/compiler/machine-operator-reducer-unittest.cc |
@@ -1649,13 +1649,34 @@ TEST_F(MachineOperatorReducerTest, StoreRepWord16WithWord32SarAndWord32Shl) { |
TEST_F(MachineOperatorReducerTest, RoundPlusTruncate) { |
Node* p0 = Parameter(0); |
+ |
+ Type* p0_range = Type::Range(0x0, 0xFFFFFF8000001ULL, graph()->zone()); |
+ NodeProperties::SetType( |
+ p0, Type::Intersect(p0_range, Type::Number(), graph()->zone())); |
+ |
Node* t0 = graph()->NewNode(machine()->RoundInt64ToFloat64(), p0); |
Node* t1 = graph()->NewNode( |
machine()->TruncateFloat64ToInt32(TruncationMode::kJavaScript), t0); |
Reduction r = Reduce(t1); |
ASSERT_TRUE(r.Changed()); |
- EXPECT_THAT(r.replacement(), p0); |
+ EXPECT_THAT(r.replacement(), IsTruncateInt64ToInt32(p0)); |
+} |
+ |
+ |
+TEST_F(MachineOperatorReducerTest, OverflowingRoundPlusTruncate) { |
+ Node* p0 = Parameter(0); |
+ |
+ Type* p0_range = Type::Range(0x0, 0x10000000000000ULL, graph()->zone()); |
+ NodeProperties::SetType( |
+ p0, Type::Intersect(p0_range, Type::Number(), graph()->zone())); |
+ |
+ Node* t0 = graph()->NewNode(machine()->RoundInt64ToFloat64(), p0); |
+ Node* t1 = graph()->NewNode( |
+ machine()->TruncateFloat64ToInt32(TruncationMode::kJavaScript), t0); |
+ |
+ Reduction r = Reduce(t1); |
+ ASSERT_TRUE(!r.Changed()); |
} |
} // namespace compiler |