summaryrefslogtreecommitdiff
path: root/deps/v8/test/unittests/compiler/machine-operator-reducer-unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/unittests/compiler/machine-operator-reducer-unittest.cc')
-rw-r--r--deps/v8/test/unittests/compiler/machine-operator-reducer-unittest.cc45
1 files changed, 32 insertions, 13 deletions
diff --git a/deps/v8/test/unittests/compiler/machine-operator-reducer-unittest.cc b/deps/v8/test/unittests/compiler/machine-operator-reducer-unittest.cc
index 1d29d9733f..4f1946c379 100644
--- a/deps/v8/test/unittests/compiler/machine-operator-reducer-unittest.cc
+++ b/deps/v8/test/unittests/compiler/machine-operator-reducer-unittest.cc
@@ -1183,12 +1183,16 @@ TEST_F(MachineOperatorReducerTest, Int32ModWithConstant) {
ASSERT_TRUE(r.Changed());
EXPECT_THAT(
r.replacement(),
- IsSelect(MachineRepresentation::kWord32,
- IsInt32LessThan(p0, IsInt32Constant(0)),
- IsInt32Sub(IsInt32Constant(0),
- IsWord32And(IsInt32Sub(IsInt32Constant(0), p0),
- IsInt32Constant(mask))),
- IsWord32And(p0, IsInt32Constant(mask))));
+ IsPhi(
+ MachineRepresentation::kWord32,
+ IsInt32Sub(IsInt32Constant(0),
+ IsWord32And(IsInt32Sub(IsInt32Constant(0), p0),
+ IsInt32Constant(mask))),
+ IsWord32And(p0, IsInt32Constant(mask)),
+ IsMerge(IsIfTrue(IsBranch(IsInt32LessThan(p0, IsInt32Constant(0)),
+ graph()->start())),
+ IsIfFalse(IsBranch(IsInt32LessThan(p0, IsInt32Constant(0)),
+ graph()->start())))));
}
TRACED_FORRANGE(int32_t, shift, 1, 31) {
Reduction const r = Reduce(graph()->NewNode(
@@ -1199,12 +1203,16 @@ TEST_F(MachineOperatorReducerTest, Int32ModWithConstant) {
ASSERT_TRUE(r.Changed());
EXPECT_THAT(
r.replacement(),
- IsSelect(MachineRepresentation::kWord32,
- IsInt32LessThan(p0, IsInt32Constant(0)),
- IsInt32Sub(IsInt32Constant(0),
- IsWord32And(IsInt32Sub(IsInt32Constant(0), p0),
- IsInt32Constant(mask))),
- IsWord32And(p0, IsInt32Constant(mask))));
+ IsPhi(
+ MachineRepresentation::kWord32,
+ IsInt32Sub(IsInt32Constant(0),
+ IsWord32And(IsInt32Sub(IsInt32Constant(0), p0),
+ IsInt32Constant(mask))),
+ IsWord32And(p0, IsInt32Constant(mask)),
+ IsMerge(IsIfTrue(IsBranch(IsInt32LessThan(p0, IsInt32Constant(0)),
+ graph()->start())),
+ IsIfFalse(IsBranch(IsInt32LessThan(p0, IsInt32Constant(0)),
+ graph()->start())))));
}
TRACED_FOREACH(int32_t, divisor, kInt32Values) {
if (divisor == 0 || base::bits::IsPowerOfTwo32(Abs(divisor))) continue;
@@ -2077,8 +2085,19 @@ TEST_F(MachineOperatorReducerTest, Float64LessThanOrEqualWithFloat32Constant) {
// -----------------------------------------------------------------------------
-// Store
+// Float64RoundDown
+TEST_F(MachineOperatorReducerTest, Float64RoundDownWithConstant) {
+ TRACED_FOREACH(double, x, kFloat64Values) {
+ Reduction r = Reduce(graph()->NewNode(
+ machine()->Float64RoundDown().placeholder(), Float64Constant(x)));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(r.replacement(), IsFloat64Constant(Floor(x)));
+ }
+}
+
+// -----------------------------------------------------------------------------
+// Store
TEST_F(MachineOperatorReducerTest, StoreRepWord8WithWord32And) {
const StoreRepresentation rep(MachineRepresentation::kWord8, kNoWriteBarrier);