[arm64] Explicit commuted conditions in unittests
authorpierre.langlois <pierre.langlois@arm.com>
Thu, 24 Sep 2015 09:27:20 +0000 (02:27 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 24 Sep 2015 09:27:30 +0000 (09:27 +0000)
This patch explicitly names commuted conditions for floating point
comparisons, instead of relying on CommuteFlagsCondition.  Otherwise, a
bug in this function would not be caught.

BUG=

Review URL: https://codereview.chromium.org/1364773002

Cr-Commit-Position: refs/heads/master@{#30905}

test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc

index c26ad72..154645c 100644 (file)
@@ -220,6 +220,7 @@ const MachInst2 kFPArithInstructions[] = {
 struct FPCmp {
   MachInst2 mi;
   FlagsCondition cond;
+  FlagsCondition commuted_cond;
 };
 
 
@@ -232,22 +233,22 @@ std::ostream& operator<<(std::ostream& os, const FPCmp& cmp) {
 const FPCmp kFPCmpInstructions[] = {
     {{&RawMachineAssembler::Float64Equal, "Float64Equal", kArm64Float64Cmp,
       kMachFloat64},
-     kEqual},
+     kEqual, kEqual},
     {{&RawMachineAssembler::Float64LessThan, "Float64LessThan",
       kArm64Float64Cmp, kMachFloat64},
-     kFloatLessThan},
+     kFloatLessThan, kFloatGreaterThan},
     {{&RawMachineAssembler::Float64LessThanOrEqual, "Float64LessThanOrEqual",
       kArm64Float64Cmp, kMachFloat64},
-     kFloatLessThanOrEqual},
+     kFloatLessThanOrEqual, kFloatGreaterThanOrEqual},
     {{&RawMachineAssembler::Float32Equal, "Float32Equal", kArm64Float32Cmp,
       kMachFloat32},
-     kEqual},
+     kEqual, kEqual},
     {{&RawMachineAssembler::Float32LessThan, "Float32LessThan",
       kArm64Float32Cmp, kMachFloat32},
-     kFloatLessThan},
+     kFloatLessThan, kFloatGreaterThan},
     {{&RawMachineAssembler::Float32LessThanOrEqual, "Float32LessThanOrEqual",
       kArm64Float32Cmp, kMachFloat32},
-     kFloatLessThanOrEqual}};
+     kFloatLessThanOrEqual, kFloatGreaterThanOrEqual}};
 
 
 struct Conversion {
@@ -1953,7 +1954,7 @@ TEST_P(InstructionSelectorFPCmpTest, WithImmediateZeroOnLeft) {
   EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate());
   EXPECT_EQ(1U, s[0]->OutputCount());
   EXPECT_EQ(kFlags_set, s[0]->flags_mode());
-  EXPECT_EQ(CommuteFlagsCondition(cmp.cond), s[0]->flags_condition());
+  EXPECT_EQ(cmp.commuted_cond, s[0]->flags_condition());
 }