diff options
author | Craig Topper <craig.topper@gmail.com> | 2020-01-04 18:14:33 -0800 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2020-01-04 18:15:20 -0800 |
commit | 16a67d252c72332423bae6597a0685248fc3501f (patch) | |
tree | 34ac9ad844dce32f04a036887dfe8df488fb361f /llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | |
parent | 285d5e6b8b1ecc70c25468b6c7458d2adadeddf3 (diff) | |
download | bcm5719-llvm-16a67d252c72332423bae6597a0685248fc3501f.tar.gz bcm5719-llvm-16a67d252c72332423bae6597a0685248fc3501f.zip |
[TargetLowering] In expandFP_TO_UINT, add proper extend or truncate for the condition to feed the DstVT select.
Previously, for vectors we created a vselect with a condition that
didn't match what the target wanted according to getSetCCResultType.
To make up for this, X86 had a special DAG combine to detect if
the condition was all sign bits and then insert its own truncate
or extend. By adding the extend/truncate here explicitly we can
avoid that.
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp index c2f98458cc2..f6e96d22c77 100644 --- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -6067,6 +6067,8 @@ bool TargetLowering::expandFP_TO_UINT(SDNode *Node, SDValue &Result, EVT DstVT = Node->getValueType(0); EVT SetCCVT = getSetCCResultType(DAG.getDataLayout(), *DAG.getContext(), SrcVT); + EVT DstSetCCVT = + getSetCCResultType(DAG.getDataLayout(), *DAG.getContext(), DstVT); // Only expand vector types if we have the appropriate vector bit operations. unsigned SIntOpcode = Node->isStrictFPOpcode() ? ISD::STRICT_FP_TO_SINT : @@ -6115,6 +6117,7 @@ bool TargetLowering::expandFP_TO_UINT(SDNode *Node, SDValue &Result, // TODO: Should any fast-math-flags be set for the FSUB? SDValue FltOfs = DAG.getSelect(dl, SrcVT, Sel, DAG.getConstantFP(0.0, dl, SrcVT), Cst); + Sel = DAG.getBoolExtOrTrunc(Sel, dl, DstSetCCVT, DstVT); SDValue IntOfs = DAG.getSelect(dl, DstVT, Sel, DAG.getConstant(0, dl, DstVT), DAG.getConstant(SignMask, dl, DstVT)); @@ -6142,6 +6145,7 @@ bool TargetLowering::expandFP_TO_UINT(SDNode *Node, SDValue &Result, DAG.getNode(ISD::FSUB, dl, SrcVT, Src, Cst)); False = DAG.getNode(ISD::XOR, dl, DstVT, False, DAG.getConstant(SignMask, dl, DstVT)); + Sel = DAG.getBoolExtOrTrunc(Sel, dl, DstSetCCVT, DstVT); Result = DAG.getSelect(dl, DstVT, Sel, True, False); } return true; |