Index: test/unittests/compiler/x64/instruction-selector-x64-unittest.cc |
diff --git a/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc b/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc |
index 6d0e589e3bf04d4607229e8cbfe64d1ade73943c..226b55abdfe272814c402dcc3ff8a16859d85c42 100644 |
--- a/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc |
+++ b/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc |
@@ -996,6 +996,40 @@ TEST_F(InstructionSelectorTest, Int32Shl4BecomesLea) { |
// Floating point operations. |
+TEST_F(InstructionSelectorTest, Float32Abs) { |
+ StreamBuilder m(this, kMachFloat32, kMachFloat32); |
+ Node* const p0 = m.Parameter(0); |
+ Node* const n = m.Float32Abs(p0); |
+ m.Return(n); |
+ Stream s = m.Build(); |
+ ASSERT_EQ(1U, s.size()); |
+ EXPECT_EQ(kSSEFloat32Abs, s[0]->arch_opcode()); |
+ ASSERT_EQ(1U, s[0]->InputCount()); |
+ EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
+ ASSERT_EQ(1U, s[0]->OutputCount()); |
+ EXPECT_TRUE(s.IsSameAsFirst(s[0]->Output())); |
+ EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
+ EXPECT_EQ(kFlags_none, s[0]->flags_mode()); |
+} |
+ |
+ |
+TEST_F(InstructionSelectorTest, Float64Abs) { |
+ StreamBuilder m(this, kMachFloat64, kMachFloat64); |
+ Node* const p0 = m.Parameter(0); |
+ Node* const n = m.Float64Abs(p0); |
+ m.Return(n); |
+ Stream s = m.Build(); |
+ ASSERT_EQ(1U, s.size()); |
+ EXPECT_EQ(kSSEFloat64Abs, s[0]->arch_opcode()); |
+ ASSERT_EQ(1U, s[0]->InputCount()); |
+ EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
+ ASSERT_EQ(1U, s[0]->OutputCount()); |
+ EXPECT_TRUE(s.IsSameAsFirst(s[0]->Output())); |
+ EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
+ EXPECT_EQ(kFlags_none, s[0]->flags_mode()); |
+} |
+ |
+ |
TEST_F(InstructionSelectorTest, Float64BinopArithmetic) { |
{ |
StreamBuilder m(this, kMachFloat64, kMachFloat64, kMachFloat64); |
@@ -1028,6 +1062,22 @@ TEST_F(InstructionSelectorTest, Float64BinopArithmetic) { |
} |
+TEST_F(InstructionSelectorTest, Float32SubWithMinusZeroAndParameter) { |
+ StreamBuilder m(this, kMachFloat32, kMachFloat32); |
+ Node* const p0 = m.Parameter(0); |
+ Node* const n = m.Float32Sub(m.Float32Constant(-0.0f), p0); |
+ m.Return(n); |
+ Stream s = m.Build(); |
+ ASSERT_EQ(1U, s.size()); |
+ EXPECT_EQ(kSSEFloat32Neg, s[0]->arch_opcode()); |
+ ASSERT_EQ(1U, s[0]->InputCount()); |
+ EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); |
+ ASSERT_EQ(1U, s[0]->OutputCount()); |
+ EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); |
+ EXPECT_EQ(kFlags_none, s[0]->flags_mode()); |
+} |
+ |
+ |
TEST_F(InstructionSelectorTest, Float64SubWithMinusZeroAndParameter) { |
StreamBuilder m(this, kMachFloat64, kMachFloat64); |
Node* const p0 = m.Parameter(0); |