Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Unified Diff: test/unittests/compiler/arm/instruction-selector-arm-unittest.cc

Issue 1361913003: [arm] Optimize vcmp when lhs operand is #0.0 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/arm/instruction-selector-arm.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/compiler/arm/instruction-selector-arm-unittest.cc
diff --git a/test/unittests/compiler/arm/instruction-selector-arm-unittest.cc b/test/unittests/compiler/arm/instruction-selector-arm-unittest.cc
index 1bc23e6e0aeab7dea31bd0b0b47ea4410ee87558..941fa26e00d435d327a9cf0855fe808ebbba7f52 100644
--- a/test/unittests/compiler/arm/instruction-selector-arm-unittest.cc
+++ b/test/unittests/compiler/arm/instruction-selector-arm-unittest.cc
@@ -1392,6 +1392,7 @@ struct Comparison {
const char* constructor_name;
FlagsCondition flags_condition;
FlagsCondition negated_flags_condition;
+ FlagsCondition commuted_flags_condition;
};
@@ -1401,15 +1402,17 @@ std::ostream& operator<<(std::ostream& os, const Comparison& cmp) {
const Comparison kComparisons[] = {
- {&RawMachineAssembler::Word32Equal, "Word32Equal", kEqual, kNotEqual},
+ {&RawMachineAssembler::Word32Equal, "Word32Equal", kEqual, kNotEqual,
+ kEqual},
{&RawMachineAssembler::Int32LessThan, "Int32LessThan", kSignedLessThan,
- kSignedGreaterThanOrEqual},
+ kSignedGreaterThanOrEqual, kSignedGreaterThan},
{&RawMachineAssembler::Int32LessThanOrEqual, "Int32LessThanOrEqual",
- kSignedLessThanOrEqual, kSignedGreaterThan},
+ kSignedLessThanOrEqual, kSignedGreaterThan, kSignedGreaterThanOrEqual},
{&RawMachineAssembler::Uint32LessThan, "Uint32LessThan", kUnsignedLessThan,
- kUnsignedGreaterThanOrEqual},
+ kUnsignedGreaterThanOrEqual, kUnsignedGreaterThan},
{&RawMachineAssembler::Uint32LessThanOrEqual, "Uint32LessThanOrEqual",
- kUnsignedLessThanOrEqual, kUnsignedGreaterThan}};
+ kUnsignedLessThanOrEqual, kUnsignedGreaterThan,
+ kUnsignedGreaterThanOrEqual}};
} // namespace
@@ -1495,11 +1498,13 @@ INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
namespace {
const Comparison kF32Comparisons[] = {
- {&RawMachineAssembler::Float32Equal, "Float32Equal", kEqual, kNotEqual},
+ {&RawMachineAssembler::Float32Equal, "Float32Equal", kEqual, kNotEqual,
+ kEqual},
{&RawMachineAssembler::Float32LessThan, "Float32LessThan",
- kUnsignedLessThan, kUnsignedGreaterThanOrEqual},
+ kFloatLessThan, kFloatGreaterThanOrEqualOrUnordered, kFloatGreaterThan},
{&RawMachineAssembler::Float32LessThanOrEqual, "Float32LessThanOrEqual",
- kUnsignedLessThanOrEqual, kUnsignedGreaterThan}};
+ kFloatLessThanOrEqual, kFloatGreaterThanOrUnordered,
+ kFloatGreaterThanOrEqual}};
} // namespace
@@ -1551,33 +1556,36 @@ TEST_P(InstructionSelectorF32ComparisonTest, WithImmediateZeroOnRight) {
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorF32ComparisonTest,
- ::testing::ValuesIn(kF32Comparisons));
-
-
-TEST_F(InstructionSelectorTest, Float32EqualWithImmediateZeroOnLeft) {
+TEST_P(InstructionSelectorF32ComparisonTest, WithImmediateZeroOnLeft) {
+ const Comparison& cmp = GetParam();
StreamBuilder m(this, kMachInt32, kMachFloat32);
- m.Return(m.Float32Equal(m.Float32Constant(0.0f), m.Parameter(0)));
- Stream s = m.Build();
+ m.Return((m.*cmp.constructor)(m.Float32Constant(0.0f), m.Parameter(0)));
+ Stream const s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArmVcmpF32, s[0]->arch_opcode());
- EXPECT_EQ(2U, s[0]->InputCount());
+ ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate());
- EXPECT_EQ(1U, s[0]->OutputCount());
+ ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
- EXPECT_EQ(kEqual, s[0]->flags_condition());
+ EXPECT_EQ(cmp.commuted_flags_condition, s[0]->flags_condition());
}
+INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
+ InstructionSelectorF32ComparisonTest,
+ ::testing::ValuesIn(kF32Comparisons));
+
+
namespace {
const Comparison kF64Comparisons[] = {
- {&RawMachineAssembler::Float64Equal, "Float64Equal", kEqual, kNotEqual},
+ {&RawMachineAssembler::Float64Equal, "Float64Equal", kEqual, kNotEqual,
+ kEqual},
{&RawMachineAssembler::Float64LessThan, "Float64LessThan",
- kUnsignedLessThan, kUnsignedGreaterThanOrEqual},
+ kFloatLessThan, kFloatGreaterThanOrEqualOrUnordered, kFloatGreaterThan},
{&RawMachineAssembler::Float64LessThanOrEqual, "Float64LessThanOrEqual",
- kUnsignedLessThanOrEqual, kUnsignedGreaterThan}};
+ kFloatLessThanOrEqual, kFloatGreaterThanOrUnordered,
+ kFloatGreaterThanOrEqual}};
} // namespace
@@ -1629,25 +1637,26 @@ TEST_P(InstructionSelectorF64ComparisonTest, WithImmediateZeroOnRight) {
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorF64ComparisonTest,
- ::testing::ValuesIn(kF64Comparisons));
-
-
-TEST_F(InstructionSelectorTest, Float64EqualWithImmediateZeroOnLeft) {
+TEST_P(InstructionSelectorF64ComparisonTest, WithImmediateZeroOnLeft) {
+ const Comparison& cmp = GetParam();
StreamBuilder m(this, kMachInt32, kMachFloat64);
- m.Return(m.Float64Equal(m.Float64Constant(0.0), m.Parameter(0)));
- Stream s = m.Build();
+ m.Return((m.*cmp.constructor)(m.Float64Constant(0.0), m.Parameter(0)));
+ Stream const s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArmVcmpF64, s[0]->arch_opcode());
- EXPECT_EQ(2U, s[0]->InputCount());
+ ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate());
- EXPECT_EQ(1U, s[0]->OutputCount());
+ ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
- EXPECT_EQ(kEqual, s[0]->flags_condition());
+ EXPECT_EQ(cmp.commuted_flags_condition, s[0]->flags_condition());
}
+INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
+ InstructionSelectorF64ComparisonTest,
+ ::testing::ValuesIn(kF64Comparisons));
+
+
// -----------------------------------------------------------------------------
// Floating point arithmetic.
« no previous file with comments | « src/compiler/arm/instruction-selector-arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698