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 776605c069c85357543f522aab5ff39cff97180f..571dbecd14071425b0eb05215a3430790398fdf4 100644 |
--- a/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc |
+++ b/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc |
@@ -1518,10 +1518,39 @@ TEST_P(InstructionSelectorFPCmpTest, Parameter) { |
} |
+TEST_P(InstructionSelectorFPCmpTest, WithImmediateZeroOnRight) { |
+ const FPCmp cmp = GetParam(); |
+ StreamBuilder m(this, kMachInt32, cmp.mi.machine_type); |
+ m.Return((m.*cmp.mi.constructor)(m.Parameter(0), m.Float64Constant(0.0))); |
+ Stream s = m.Build(); |
+ ASSERT_EQ(1U, s.size()); |
+ EXPECT_EQ(cmp.mi.arch_opcode, s[0]->arch_opcode()); |
+ EXPECT_EQ(2U, s[0]->InputCount()); |
+ EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate()); |
+ EXPECT_EQ(1U, s[0]->OutputCount()); |
+ EXPECT_EQ(kFlags_set, s[0]->flags_mode()); |
+ EXPECT_EQ(cmp.cond, s[0]->flags_condition()); |
+} |
+ |
+ |
INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorFPCmpTest, |
::testing::ValuesIn(kFPCmpInstructions)); |
+TEST_F(InstructionSelectorTest, Float64EqualWithImmediateZeroOnLeft) { |
+ StreamBuilder m(this, kMachInt32, kMachFloat64); |
+ m.Return(m.Float64Equal(m.Float64Constant(0.0), m.Parameter(0))); |
+ Stream s = m.Build(); |
+ ASSERT_EQ(1U, s.size()); |
+ EXPECT_EQ(kArm64Float64Cmp, s[0]->arch_opcode()); |
+ EXPECT_EQ(2U, s[0]->InputCount()); |
+ EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate()); |
+ EXPECT_EQ(1U, s[0]->OutputCount()); |
+ EXPECT_EQ(kFlags_set, s[0]->flags_mode()); |
+ EXPECT_EQ(kEqual, s[0]->flags_condition()); |
+} |
+ |
+ |
// ----------------------------------------------------------------------------- |
// Conversions. |