| Index: test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc
|
| diff --git a/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc b/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc
|
| index 3bf2e05ffa4d2a2db0681e25bf77c4a1be31e734..f29b39b17979381ef1fb0429118a073f34eac1b0 100644
|
| --- a/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc
|
| +++ b/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc
|
| @@ -3113,6 +3113,78 @@ TEST_F(InstructionSelectorTest, Float64SubWithMinusZero) {
|
| EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
|
| }
|
|
|
| +
|
| +TEST_F(InstructionSelectorTest, Float32Max) {
|
| + StreamBuilder m(this, kMachFloat32, kMachFloat32, kMachFloat32);
|
| + Node* const p0 = m.Parameter(0);
|
| + Node* const p1 = m.Parameter(1);
|
| + Node* const n = m.Float32Max(p0, p1);
|
| + m.Return(n);
|
| + Stream s = m.Build();
|
| + // Float32Max is `(b < a) ? a : b`.
|
| + ASSERT_EQ(1U, s.size());
|
| + EXPECT_EQ(kArm64Float32TernaryMax, s[0]->arch_opcode());
|
| + ASSERT_EQ(2U, s[0]->InputCount());
|
| + EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
|
| + EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
|
| + ASSERT_EQ(1U, s[0]->OutputCount());
|
| + EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
|
| +}
|
| +
|
| +
|
| +TEST_F(InstructionSelectorTest, Float32Min) {
|
| + StreamBuilder m(this, kMachFloat32, kMachFloat32, kMachFloat32);
|
| + Node* const p0 = m.Parameter(0);
|
| + Node* const p1 = m.Parameter(1);
|
| + Node* const n = m.Float32Min(p0, p1);
|
| + m.Return(n);
|
| + Stream s = m.Build();
|
| + // Float32Min is `(a < b) ? a : b`.
|
| + ASSERT_EQ(1U, s.size());
|
| + EXPECT_EQ(kArm64Float32TernaryMin, s[0]->arch_opcode());
|
| + ASSERT_EQ(2U, s[0]->InputCount());
|
| + EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
|
| + EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
|
| + ASSERT_EQ(1U, s[0]->OutputCount());
|
| + EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
|
| +}
|
| +
|
| +
|
| +TEST_F(InstructionSelectorTest, Float64Max) {
|
| + StreamBuilder m(this, kMachFloat64, kMachFloat64, kMachFloat64);
|
| + Node* const p0 = m.Parameter(0);
|
| + Node* const p1 = m.Parameter(1);
|
| + Node* const n = m.Float64Max(p0, p1);
|
| + m.Return(n);
|
| + Stream s = m.Build();
|
| + // Float64Max is `(b < a) ? a : b`.
|
| + ASSERT_EQ(1U, s.size());
|
| + EXPECT_EQ(kArm64Float64TernaryMax, s[0]->arch_opcode());
|
| + ASSERT_EQ(2U, s[0]->InputCount());
|
| + EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
|
| + EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
|
| + ASSERT_EQ(1U, s[0]->OutputCount());
|
| + EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
|
| +}
|
| +
|
| +
|
| +TEST_F(InstructionSelectorTest, Float64Min) {
|
| + StreamBuilder m(this, kMachFloat64, kMachFloat64, kMachFloat64);
|
| + Node* const p0 = m.Parameter(0);
|
| + Node* const p1 = m.Parameter(1);
|
| + Node* const n = m.Float64Min(p0, p1);
|
| + m.Return(n);
|
| + Stream s = m.Build();
|
| + // Float64Min is `(a < b) ? a : b`.
|
| + ASSERT_EQ(1U, s.size());
|
| + EXPECT_EQ(kArm64Float64TernaryMin, s[0]->arch_opcode());
|
| + ASSERT_EQ(2U, s[0]->InputCount());
|
| + EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
|
| + EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
|
| + ASSERT_EQ(1U, s[0]->OutputCount());
|
| + EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
|
| +}
|
| +
|
| } // namespace compiler
|
| } // namespace internal
|
| } // namespace v8
|
|
|