[turbofan] Float32Abs and Float64Abs are supported by all backends.
authorbmeurer <bmeurer@chromium.org>
Fri, 8 May 2015 08:24:59 +0000 (01:24 -0700)
committerCommit bot <commit-bot@chromium.org>
Fri, 8 May 2015 08:25:05 +0000 (08:25 +0000)
The Float32Abs and Float64Abs operators are supported by all TurboFan
backends, so we no longer need the flags for them.

R=jarin@chromium.org

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

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

src/compiler/arm/instruction-selector-arm.cc
src/compiler/arm64/instruction-selector-arm64.cc
src/compiler/common-operator-reducer.cc
src/compiler/ia32/instruction-selector-ia32.cc
src/compiler/machine-operator.h
src/compiler/mips/instruction-selector-mips.cc
src/compiler/mips64/instruction-selector-mips64.cc
src/compiler/ppc/instruction-selector-ppc.cc
src/compiler/x64/instruction-selector-x64.cc
test/cctest/compiler/test-run-machops.cc
test/unittests/compiler/common-operator-reducer-unittest.cc

index 76a0acb410f0b8fcec908285b8935c94df6e8751..56b155da45bbc7b1ac0daece5c29c6074fb7e638 100644 (file)
@@ -1594,11 +1594,8 @@ void InstructionSelector::VisitFloat64InsertHighWord32(Node* node) {
 MachineOperatorBuilder::Flags
 InstructionSelector::SupportedMachineOperatorFlags() {
   MachineOperatorBuilder::Flags flags =
-      MachineOperatorBuilder::kFloat32Abs |
-      MachineOperatorBuilder::kFloat64Abs |
       MachineOperatorBuilder::kInt32DivIsSafe |
       MachineOperatorBuilder::kUint32DivIsSafe;
-
   if (CpuFeatures::IsSupported(ARMv8)) {
     flags |= MachineOperatorBuilder::kFloat64RoundDown |
              MachineOperatorBuilder::kFloat64RoundTruncate |
index f653520c36e95c6cd3524fd267af9affea43b26d..52bd9790c0b2a3a4bc201177b30c0990b5389071 100644 (file)
@@ -1871,10 +1871,8 @@ void InstructionSelector::VisitFloat64InsertHighWord32(Node* node) {
 // static
 MachineOperatorBuilder::Flags
 InstructionSelector::SupportedMachineOperatorFlags() {
-  return MachineOperatorBuilder::kFloat32Abs |
-         MachineOperatorBuilder::kFloat32Max |
+  return MachineOperatorBuilder::kFloat32Max |
          MachineOperatorBuilder::kFloat32Min |
-         MachineOperatorBuilder::kFloat64Abs |
          MachineOperatorBuilder::kFloat64Max |
          MachineOperatorBuilder::kFloat64Min |
          MachineOperatorBuilder::kFloat64RoundDown |
index 2ade817c234b1b3a564a27d080bcd8a446bdcdff..824cdbdab1a3cde20ca0582f4f7aeb3c15922a78 100644 (file)
@@ -58,8 +58,7 @@ Reduction CommonOperatorReducer::ReducePhi(Node* node) {
       if (cond->opcode() == IrOpcode::kFloat32LessThan) {
         Float32BinopMatcher mcond(cond);
         if (mcond.left().Is(0.0) && mcond.right().Equals(vtrue) &&
-            vfalse->opcode() == IrOpcode::kFloat32Sub &&
-            machine()->HasFloat32Abs()) {
+            vfalse->opcode() == IrOpcode::kFloat32Sub) {
           Float32BinopMatcher mvfalse(vfalse);
           if (mvfalse.left().IsZero() && mvfalse.right().Equals(vtrue)) {
             return Change(node, machine()->Float32Abs(), vtrue);
@@ -75,8 +74,7 @@ Reduction CommonOperatorReducer::ReducePhi(Node* node) {
       } else if (cond->opcode() == IrOpcode::kFloat64LessThan) {
         Float64BinopMatcher mcond(cond);
         if (mcond.left().Is(0.0) && mcond.right().Equals(vtrue) &&
-            vfalse->opcode() == IrOpcode::kFloat64Sub &&
-            machine()->HasFloat64Abs()) {
+            vfalse->opcode() == IrOpcode::kFloat64Sub) {
           Float64BinopMatcher mvfalse(vfalse);
           if (mvfalse.left().IsZero() && mvfalse.right().Equals(vtrue)) {
             return Change(node, machine()->Float64Abs(), vtrue);
@@ -117,8 +115,7 @@ Reduction CommonOperatorReducer::ReduceSelect(Node* node) {
     case IrOpcode::kFloat32LessThan: {
       Float32BinopMatcher mcond(cond);
       if (mcond.left().Is(0.0) && mcond.right().Equals(vtrue) &&
-          vfalse->opcode() == IrOpcode::kFloat32Sub &&
-          machine()->HasFloat32Abs()) {
+          vfalse->opcode() == IrOpcode::kFloat32Sub) {
         Float32BinopMatcher mvfalse(vfalse);
         if (mvfalse.left().IsZero() && mvfalse.right().Equals(vtrue)) {
           return Change(node, machine()->Float32Abs(), vtrue);
@@ -136,8 +133,7 @@ Reduction CommonOperatorReducer::ReduceSelect(Node* node) {
     case IrOpcode::kFloat64LessThan: {
       Float64BinopMatcher mcond(cond);
       if (mcond.left().Is(0.0) && mcond.right().Equals(vtrue) &&
-          vfalse->opcode() == IrOpcode::kFloat64Sub &&
-          machine()->HasFloat64Abs()) {
+          vfalse->opcode() == IrOpcode::kFloat64Sub) {
         Float64BinopMatcher mvfalse(vfalse);
         if (mvfalse.left().IsZero() && mvfalse.right().Equals(vtrue)) {
           return Change(node, machine()->Float64Abs(), vtrue);
index 1f569ad5066184b66c8b13ad9b3a65123f3d4e3f..8343dc1a09326f6d297a01e52521ed816ea5a499 100644 (file)
@@ -1306,10 +1306,8 @@ void InstructionSelector::VisitFloat64InsertHighWord32(Node* node) {
 MachineOperatorBuilder::Flags
 InstructionSelector::SupportedMachineOperatorFlags() {
   MachineOperatorBuilder::Flags flags =
-      MachineOperatorBuilder::kFloat32Abs |
       MachineOperatorBuilder::kFloat32Max |
       MachineOperatorBuilder::kFloat32Min |
-      MachineOperatorBuilder::kFloat64Abs |
       MachineOperatorBuilder::kFloat64Max |
       MachineOperatorBuilder::kFloat64Min |
       MachineOperatorBuilder::kWord32ShiftIsSafe;
index 8a16fcaae98a2614b33f7da284ea103664124262..141586965b0d249a6a3f362765c4448d504d9550 100644 (file)
@@ -74,18 +74,16 @@ class MachineOperatorBuilder final : public ZoneObject {
   // for operations that are unsupported by some back-ends.
   enum Flag {
     kNoFlags = 0u,
-    kFloat32Abs = 1u << 0,
-    kFloat32Max = 1u << 1,
-    kFloat32Min = 1u << 2,
-    kFloat64Abs = 1u << 3,
-    kFloat64Max = 1u << 4,
-    kFloat64Min = 1u << 5,
-    kFloat64RoundDown = 1u << 6,
-    kFloat64RoundTruncate = 1u << 7,
-    kFloat64RoundTiesAway = 1u << 8,
-    kInt32DivIsSafe = 1u << 9,
-    kUint32DivIsSafe = 1u << 10,
-    kWord32ShiftIsSafe = 1u << 11
+    kFloat32Max = 1u << 0,
+    kFloat32Min = 1u << 1,
+    kFloat64Max = 1u << 2,
+    kFloat64Min = 1u << 3,
+    kFloat64RoundDown = 1u << 4,
+    kFloat64RoundTruncate = 1u << 5,
+    kFloat64RoundTiesAway = 1u << 6,
+    kInt32DivIsSafe = 1u << 7,
+    kUint32DivIsSafe = 1u << 8,
+    kWord32ShiftIsSafe = 1u << 9
   };
   typedef base::Flags<Flag, unsigned> Flags;
 
@@ -201,11 +199,9 @@ class MachineOperatorBuilder final : public ZoneObject {
 
   // Floating point abs complying to IEEE 754 (single-precision).
   const Operator* Float32Abs();
-  bool HasFloat32Abs() const { return flags_ & kFloat32Abs; }
 
   // Floating point abs complying to IEEE 754 (double-precision).
   const Operator* Float64Abs();
-  bool HasFloat64Abs() const { return flags_ & kFloat64Abs; }
 
   // Floating point rounding.
   const Operator* Float64RoundDown();
index afddd0a5089a2c2704e9285f5ef6fc4023054fd3..b4e811f0f8a45051fc5a5935e018893b6e504bd1 100644 (file)
@@ -1058,9 +1058,7 @@ void InstructionSelector::VisitFloat64InsertHighWord32(Node* node) {
 // static
 MachineOperatorBuilder::Flags
 InstructionSelector::SupportedMachineOperatorFlags() {
-  MachineOperatorBuilder::Flags flags =
-      MachineOperatorBuilder::kFloat32Abs | MachineOperatorBuilder::kFloat64Abs;
-
+  MachineOperatorBuilder::Flags flags = MachineOperatorBuilder::kNoFlags;
   if ((IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) &&
       IsFp64Mode()) {
     flags |= MachineOperatorBuilder::kFloat64RoundDown |
index 2f434954786f2bd60b27f3c9a67ecc0b09e3b970..52da27f3ac67150b0e5cde91a3c92f4e5896b4c6 100644 (file)
@@ -1271,9 +1271,7 @@ void InstructionSelector::VisitFloat64InsertHighWord32(Node* node) {
 // static
 MachineOperatorBuilder::Flags
 InstructionSelector::SupportedMachineOperatorFlags() {
-  return MachineOperatorBuilder::kFloat32Abs |
-         MachineOperatorBuilder::kFloat64Abs |
-         MachineOperatorBuilder::kFloat64RoundDown |
+  return MachineOperatorBuilder::kFloat64RoundDown |
          MachineOperatorBuilder::kFloat64RoundTruncate;
 }
 
index e3003eddf837e2ed8d12a712c6b6c15fa0d459c2..afe30d4c8591b4673aad949e887ff06720490762 100644 (file)
@@ -1623,10 +1623,8 @@ void InstructionSelector::VisitFloat64InsertHighWord32(Node* node) {
 // static
 MachineOperatorBuilder::Flags
 InstructionSelector::SupportedMachineOperatorFlags() {
-  return MachineOperatorBuilder::kFloat32Abs |
-         MachineOperatorBuilder::kFloat32Max |
+  return MachineOperatorBuilder::kFloat32Max |
          MachineOperatorBuilder::kFloat32Min |
-         MachineOperatorBuilder::kFloat64Abs |
          MachineOperatorBuilder::kFloat64Max |
          MachineOperatorBuilder::kFloat64Min |
          MachineOperatorBuilder::kFloat64RoundDown |
index ccacc038d514e9d73e6c5e30c397d375ecf39290..26d8960b913f897c458f9de1ba0cad07959786d4 100644 (file)
@@ -1619,10 +1619,8 @@ void InstructionSelector::VisitFloat64InsertHighWord32(Node* node) {
 MachineOperatorBuilder::Flags
 InstructionSelector::SupportedMachineOperatorFlags() {
   MachineOperatorBuilder::Flags flags =
-      MachineOperatorBuilder::kFloat32Abs |
       MachineOperatorBuilder::kFloat32Max |
       MachineOperatorBuilder::kFloat32Min |
-      MachineOperatorBuilder::kFloat64Abs |
       MachineOperatorBuilder::kFloat64Max |
       MachineOperatorBuilder::kFloat64Min |
       MachineOperatorBuilder::kWord32ShiftIsSafe;
index 147bc85418f409fc3b6a04ae1cf46b9089520919..8d051bc90b2b65fe65c6a798b552fd4afc4204ec 100644 (file)
@@ -4950,7 +4950,6 @@ TEST(RunFloat32Abs) {
   float input = -1.0;
   float result = 0.0;
   RawMachineAssemblerTester<int32_t> m;
-  if (!m.machine()->HasFloat32Abs()) return;
   m.StoreToPointer(&result, kMachFloat32,
                    m.Float32Abs(m.LoadFromPointer(&input, kMachFloat32)));
   m.Return(m.Int32Constant(0));
@@ -4967,7 +4966,6 @@ TEST(RunFloat64Abs) {
   double input = -1.0;
   double result = 0.0;
   RawMachineAssemblerTester<int32_t> m;
-  if (!m.machine()->HasFloat64Abs()) return;
   m.StoreToPointer(&result, kMachFloat64,
                    m.Float64Abs(m.LoadFromPointer(&input, kMachFloat64)));
   m.Return(m.Int32Constant(0));
index 861cf20585b94b658c6a38f47eba4791933a0a74..d6822e8b0995f1bfc41f7463463ecdabfda1a0af 100644 (file)
@@ -120,7 +120,7 @@ TEST_F(CommonOperatorReducerTest, PhiToFloat32Abs) {
   Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
   Node* phi =
       graph()->NewNode(common()->Phi(kMachFloat32, 2), vtrue, vfalse, merge);
-  Reduction r = Reduce(phi, MachineOperatorBuilder::kFloat32Abs);
+  Reduction r = Reduce(phi);
   ASSERT_TRUE(r.Changed());
   EXPECT_THAT(r.replacement(), IsFloat32Abs(p0));
 }
@@ -138,7 +138,7 @@ TEST_F(CommonOperatorReducerTest, PhiToFloat64Abs) {
   Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
   Node* phi =
       graph()->NewNode(common()->Phi(kMachFloat64, 2), vtrue, vfalse, merge);
-  Reduction r = Reduce(phi, MachineOperatorBuilder::kFloat64Abs);
+  Reduction r = Reduce(phi);
   ASSERT_TRUE(r.Changed());
   EXPECT_THAT(r.replacement(), IsFloat64Abs(p0));
 }
@@ -250,7 +250,7 @@ TEST_F(CommonOperatorReducerTest, SelectToFloat32Abs) {
   Node* select =
       graph()->NewNode(common()->Select(kMachFloat32), check, p0,
                        graph()->NewNode(machine()->Float32Sub(), c0, p0));
-  Reduction r = Reduce(select, MachineOperatorBuilder::kFloat32Abs);
+  Reduction r = Reduce(select);
   ASSERT_TRUE(r.Changed());
   EXPECT_THAT(r.replacement(), IsFloat32Abs(p0));
 }
@@ -263,7 +263,7 @@ TEST_F(CommonOperatorReducerTest, SelectToFloat64Abs) {
   Node* select =
       graph()->NewNode(common()->Select(kMachFloat64), check, p0,
                        graph()->NewNode(machine()->Float64Sub(), c0, p0));
-  Reduction r = Reduce(select, MachineOperatorBuilder::kFloat64Abs);
+  Reduction r = Reduce(select);
   ASSERT_TRUE(r.Changed());
   EXPECT_THAT(r.replacement(), IsFloat64Abs(p0));
 }