Commit 3b677563 authored by bjaideep's avatar bjaideep Committed by Commit bot

PPC: [turbofan] Prevent storing signalling NaNs into holey double arrays.

Port 6470ddad

Original commit message:

    This introduces SilenceNaN operator, which makes sure that we only
    store quiet NaNs into holey arrays. We omit the NaN silencing code
    at instruction selection time if the input is an operation that
    cannot possibly produce signalling NaNs.

R=jarin@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/2069883002
Cr-Commit-Position: refs/heads/master@{#36981}
parent 201cd479
......@@ -1351,6 +1351,12 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
DCHECK_EQ(SetRC, i.OutputRCBit());
break;
#endif
case kPPC_Float64SilenceNaN: {
DoubleRegister value = i.InputDoubleRegister(0);
DoubleRegister result = i.OutputDoubleRegister();
__ CanonicalizeNaN(result, value);
break;
}
case kPPC_Push:
if (instr->InputAt(0)->IsFPRegister()) {
__ stfdu(i.InputDoubleRegister(0), MemOperand(sp, -kDoubleSize));
......
......@@ -93,6 +93,7 @@ namespace compiler {
V(PPC_Uint32ToFloat32) \
V(PPC_Uint32ToDouble) \
V(PPC_Float32ToDouble) \
V(PPC_Float64SilenceNaN) \
V(PPC_DoubleToInt32) \
V(PPC_DoubleToUint32) \
V(PPC_DoubleToInt64) \
......
......@@ -92,6 +92,7 @@ int InstructionScheduler::GetTargetInstructionFlags(
case kPPC_Uint32ToFloat32:
case kPPC_Uint32ToDouble:
case kPPC_Float32ToDouble:
case kPPC_Float64SilenceNaN:
case kPPC_DoubleToInt32:
case kPPC_DoubleToUint32:
case kPPC_DoubleToInt64:
......
......@@ -1294,6 +1294,10 @@ void InstructionSelector::VisitFloat32Max(Node* node) { UNREACHABLE(); }
void InstructionSelector::VisitFloat64Max(Node* node) { UNREACHABLE(); }
void InstructionSelector::VisitFloat64SilenceNaN(Node* node) {
VisitRR(this, kPPC_Float64SilenceNaN, node);
}
void InstructionSelector::VisitFloat32Min(Node* node) { UNREACHABLE(); }
......
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