Commit 2b15dd52 authored by bjaideep's avatar bjaideep Committed by Commit bot

PPC/s390: [turbofan] Remove the FloatXXSubPreserveNan operators.

Port f8938e50

Original commit message:

    This CL changes the semantics of FloatXXSub to match the semantics of
    the semantics of FloatXXSubPreserveNan. Therefore there is no need
    anymore for the FloatXXSubPreserveNan operators.

    The optimizations in VisitFloatXXSub which are removed in this CL have
    already been moved to machine-operator-reducer.cc in
    https://codereview.chromium.org/2226663002

R=ahaas@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com, mbrandy@us.ibm.com

BUG=
LOG=N

Review-Url: https://codereview.chromium.org/2228973002
Cr-Commit-Position: refs/heads/master@{#38524}
parent da2a5355
......@@ -1261,47 +1261,11 @@ void InstructionSelector::VisitFloat64Add(Node* node) {
void InstructionSelector::VisitFloat32Sub(Node* node) {
PPCOperandGenerator g(this);
Float32BinopMatcher m(node);
if (m.left().IsMinusZero()) {
Emit(kPPC_NegDouble | MiscField::encode(1), g.DefineAsRegister(node),
g.UseRegister(m.right().node()));
return;
}
VisitRRR(this, kPPC_SubDouble | MiscField::encode(1), node);
}
void InstructionSelector::VisitFloat32SubPreserveNan(Node* node) {
PPCOperandGenerator g(this);
VisitRRR(this, kPPC_SubDouble | MiscField::encode(1), node);
}
void InstructionSelector::VisitFloat64Sub(Node* node) {
// TODO(mbrandy): detect multiply-subtract
PPCOperandGenerator g(this);
Float64BinopMatcher m(node);
if (m.left().IsMinusZero()) {
if (m.right().IsFloat64RoundDown() &&
CanCover(m.node(), m.right().node())) {
if (m.right().InputAt(0)->opcode() == IrOpcode::kFloat64Sub &&
CanCover(m.right().node(), m.right().InputAt(0))) {
Float64BinopMatcher mright0(m.right().InputAt(0));
if (mright0.left().IsMinusZero()) {
// -floor(-x) = ceil(x)
Emit(kPPC_CeilDouble, g.DefineAsRegister(node),
g.UseRegister(mright0.right().node()));
return;
}
}
}
Emit(kPPC_NegDouble, g.DefineAsRegister(node),
g.UseRegister(m.right().node()));
return;
}
VisitRRR(this, kPPC_SubDouble, node);
}
void InstructionSelector::VisitFloat64SubPreserveNan(Node* node) {
VisitRRR(this, kPPC_SubDouble, node);
}
......
......@@ -1132,47 +1132,11 @@ void InstructionSelector::VisitFloat64Add(Node* node) {
}
void InstructionSelector::VisitFloat32Sub(Node* node) {
S390OperandGenerator g(this);
Float32BinopMatcher m(node);
if (m.left().IsMinusZero()) {
Emit(kS390_NegDouble, g.DefineAsRegister(node),
g.UseRegister(m.right().node()));
return;
}
VisitRRR(this, kS390_SubFloat, node);
}
void InstructionSelector::VisitFloat32SubPreserveNan(Node* node) {
S390OperandGenerator g(this);
VisitRRR(this, kS390_SubFloat, node);
}
void InstructionSelector::VisitFloat64Sub(Node* node) {
// TODO(mbrandy): detect multiply-subtract
S390OperandGenerator g(this);
Float64BinopMatcher m(node);
if (m.left().IsMinusZero()) {
if (m.right().IsFloat64RoundDown() &&
CanCover(m.node(), m.right().node())) {
if (m.right().InputAt(0)->opcode() == IrOpcode::kFloat64Sub &&
CanCover(m.right().node(), m.right().InputAt(0))) {
Float64BinopMatcher mright0(m.right().InputAt(0));
if (mright0.left().IsMinusZero()) {
// -floor(-x) = ceil(x)
Emit(kS390_CeilDouble, g.DefineAsRegister(node),
g.UseRegister(mright0.right().node()));
return;
}
}
}
Emit(kS390_NegDouble, g.DefineAsRegister(node),
g.UseRegister(m.right().node()));
return;
}
VisitRRR(this, kS390_SubDouble, node);
}
void InstructionSelector::VisitFloat64SubPreserveNan(Node* node) {
VisitRRR(this, kS390_SubDouble, node);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment