MachineOperatorBuilder::Flags
InstructionSelector::SupportedMachineOperatorFlags() {
MachineOperatorBuilder::Flags flags =
- MachineOperatorBuilder::kFloat32Abs |
- MachineOperatorBuilder::kFloat64Abs |
MachineOperatorBuilder::kInt32DivIsSafe |
MachineOperatorBuilder::kUint32DivIsSafe;
-
if (CpuFeatures::IsSupported(ARMv8)) {
flags |= MachineOperatorBuilder::kFloat64RoundDown |
MachineOperatorBuilder::kFloat64RoundTruncate |
// static
MachineOperatorBuilder::Flags
InstructionSelector::SupportedMachineOperatorFlags() {
- return MachineOperatorBuilder::kFloat32Abs |
- MachineOperatorBuilder::kFloat32Max |
+ return MachineOperatorBuilder::kFloat32Max |
MachineOperatorBuilder::kFloat32Min |
- MachineOperatorBuilder::kFloat64Abs |
MachineOperatorBuilder::kFloat64Max |
MachineOperatorBuilder::kFloat64Min |
MachineOperatorBuilder::kFloat64RoundDown |
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);
} 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);
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);
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);
MachineOperatorBuilder::Flags
InstructionSelector::SupportedMachineOperatorFlags() {
MachineOperatorBuilder::Flags flags =
- MachineOperatorBuilder::kFloat32Abs |
MachineOperatorBuilder::kFloat32Max |
MachineOperatorBuilder::kFloat32Min |
- MachineOperatorBuilder::kFloat64Abs |
MachineOperatorBuilder::kFloat64Max |
MachineOperatorBuilder::kFloat64Min |
MachineOperatorBuilder::kWord32ShiftIsSafe;
// 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;
// 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();
// 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 |
// static
MachineOperatorBuilder::Flags
InstructionSelector::SupportedMachineOperatorFlags() {
- return MachineOperatorBuilder::kFloat32Abs |
- MachineOperatorBuilder::kFloat64Abs |
- MachineOperatorBuilder::kFloat64RoundDown |
+ return MachineOperatorBuilder::kFloat64RoundDown |
MachineOperatorBuilder::kFloat64RoundTruncate;
}
// static
MachineOperatorBuilder::Flags
InstructionSelector::SupportedMachineOperatorFlags() {
- return MachineOperatorBuilder::kFloat32Abs |
- MachineOperatorBuilder::kFloat32Max |
+ return MachineOperatorBuilder::kFloat32Max |
MachineOperatorBuilder::kFloat32Min |
- MachineOperatorBuilder::kFloat64Abs |
MachineOperatorBuilder::kFloat64Max |
MachineOperatorBuilder::kFloat64Min |
MachineOperatorBuilder::kFloat64RoundDown |
MachineOperatorBuilder::Flags
InstructionSelector::SupportedMachineOperatorFlags() {
MachineOperatorBuilder::Flags flags =
- MachineOperatorBuilder::kFloat32Abs |
MachineOperatorBuilder::kFloat32Max |
MachineOperatorBuilder::kFloat32Min |
- MachineOperatorBuilder::kFloat64Abs |
MachineOperatorBuilder::kFloat64Max |
MachineOperatorBuilder::kFloat64Min |
MachineOperatorBuilder::kWord32ShiftIsSafe;
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));
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));
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));
}
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));
}
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));
}
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));
}