From: bmeurer Date: Fri, 8 May 2015 08:24:59 +0000 (-0700) Subject: [turbofan] Float32Abs and Float64Abs are supported by all backends. X-Git-Tag: upstream/4.7.83~2730 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=189609e197d03369e0bcc4d32e88fe56ef2b6af1;p=platform%2Fupstream%2Fv8.git [turbofan] Float32Abs and Float64Abs are supported by all backends. 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} --- diff --git a/src/compiler/arm/instruction-selector-arm.cc b/src/compiler/arm/instruction-selector-arm.cc index 76a0acb41..56b155da4 100644 --- a/src/compiler/arm/instruction-selector-arm.cc +++ b/src/compiler/arm/instruction-selector-arm.cc @@ -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 | diff --git a/src/compiler/arm64/instruction-selector-arm64.cc b/src/compiler/arm64/instruction-selector-arm64.cc index f653520c3..52bd9790c 100644 --- a/src/compiler/arm64/instruction-selector-arm64.cc +++ b/src/compiler/arm64/instruction-selector-arm64.cc @@ -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 | diff --git a/src/compiler/common-operator-reducer.cc b/src/compiler/common-operator-reducer.cc index 2ade817c2..824cdbdab 100644 --- a/src/compiler/common-operator-reducer.cc +++ b/src/compiler/common-operator-reducer.cc @@ -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); diff --git a/src/compiler/ia32/instruction-selector-ia32.cc b/src/compiler/ia32/instruction-selector-ia32.cc index 1f569ad50..8343dc1a0 100644 --- a/src/compiler/ia32/instruction-selector-ia32.cc +++ b/src/compiler/ia32/instruction-selector-ia32.cc @@ -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; diff --git a/src/compiler/machine-operator.h b/src/compiler/machine-operator.h index 8a16fcaae..141586965 100644 --- a/src/compiler/machine-operator.h +++ b/src/compiler/machine-operator.h @@ -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 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(); diff --git a/src/compiler/mips/instruction-selector-mips.cc b/src/compiler/mips/instruction-selector-mips.cc index afddd0a50..b4e811f0f 100644 --- a/src/compiler/mips/instruction-selector-mips.cc +++ b/src/compiler/mips/instruction-selector-mips.cc @@ -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 | diff --git a/src/compiler/mips64/instruction-selector-mips64.cc b/src/compiler/mips64/instruction-selector-mips64.cc index 2f4349547..52da27f3a 100644 --- a/src/compiler/mips64/instruction-selector-mips64.cc +++ b/src/compiler/mips64/instruction-selector-mips64.cc @@ -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; } diff --git a/src/compiler/ppc/instruction-selector-ppc.cc b/src/compiler/ppc/instruction-selector-ppc.cc index e3003eddf..afe30d4c8 100644 --- a/src/compiler/ppc/instruction-selector-ppc.cc +++ b/src/compiler/ppc/instruction-selector-ppc.cc @@ -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 | diff --git a/src/compiler/x64/instruction-selector-x64.cc b/src/compiler/x64/instruction-selector-x64.cc index ccacc038d..26d8960b9 100644 --- a/src/compiler/x64/instruction-selector-x64.cc +++ b/src/compiler/x64/instruction-selector-x64.cc @@ -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; diff --git a/test/cctest/compiler/test-run-machops.cc b/test/cctest/compiler/test-run-machops.cc index 147bc8541..8d051bc90 100644 --- a/test/cctest/compiler/test-run-machops.cc +++ b/test/cctest/compiler/test-run-machops.cc @@ -4950,7 +4950,6 @@ TEST(RunFloat32Abs) { float input = -1.0; float result = 0.0; RawMachineAssemblerTester 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 m; - if (!m.machine()->HasFloat64Abs()) return; m.StoreToPointer(&result, kMachFloat64, m.Float64Abs(m.LoadFromPointer(&input, kMachFloat64))); m.Return(m.Int32Constant(0)); diff --git a/test/unittests/compiler/common-operator-reducer-unittest.cc b/test/unittests/compiler/common-operator-reducer-unittest.cc index 861cf2058..d6822e8b0 100644 --- a/test/unittests/compiler/common-operator-reducer-unittest.cc +++ b/test/unittests/compiler/common-operator-reducer-unittest.cc @@ -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)); }