diff options
| author | Craig Topper <craig.topper@gmail.com> | 2019-11-17 19:58:11 -0800 |
|---|---|---|
| committer | Craig Topper <craig.topper@gmail.com> | 2019-11-17 20:03:05 -0800 |
| commit | af435286e53d769d14d7a7fff6b1e3a075bfefca (patch) | |
| tree | a73daedcd30a7daf02a9ca55a840a5197bb8a97a /llvm/lib | |
| parent | a0337d269b7c3305d4e0a729d39d389a0aaec928 (diff) | |
| download | bcm5719-llvm-af435286e53d769d14d7a7fff6b1e3a075bfefca.tar.gz bcm5719-llvm-af435286e53d769d14d7a7fff6b1e3a075bfefca.zip | |
[LegalizeTypes][X86] Add support for expanding the result type of STRICT_LLROUND and STRICT_LLRINT.
This doesn't handle softening the input type, but we don't handle
softening any of the strict nodes yet. Skipping that made it easy
to reuse an existing function for creating a libcall from a node
with a chain.
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp index d8e04e9b435..36d66606de1 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp @@ -1698,6 +1698,8 @@ void DAGTypeLegalizer::ExpandIntegerResult(SDNode *N, unsigned ResNo) { case ISD::FLT_ROUNDS_: ExpandIntRes_FLT_ROUNDS(N, Lo, Hi); break; case ISD::FP_TO_SINT: ExpandIntRes_FP_TO_SINT(N, Lo, Hi); break; case ISD::FP_TO_UINT: ExpandIntRes_FP_TO_UINT(N, Lo, Hi); break; + case ISD::STRICT_LLROUND: + case ISD::STRICT_LLRINT: case ISD::LLROUND: case ISD::LLRINT: ExpandIntRes_LLROUND_LLRINT(N, Lo, Hi); break; case ISD::LOAD: ExpandIntRes_LOAD(cast<LoadSDNode>(N), Lo, Hi); break; @@ -2586,7 +2588,7 @@ void DAGTypeLegalizer::ExpandIntRes_FP_TO_UINT(SDNode *N, SDValue &Lo, void DAGTypeLegalizer::ExpandIntRes_LLROUND_LLRINT(SDNode *N, SDValue &Lo, SDValue &Hi) { - SDValue Op = N->getOperand(0); + SDValue Op = N->getOperand(N->isStrictFPOpcode() ? 1 : 0); assert(getTypeAction(Op.getValueType()) != TargetLowering::TypePromoteFloat && "Input type needs to be promoted!"); @@ -2594,7 +2596,8 @@ void DAGTypeLegalizer::ExpandIntRes_LLROUND_LLRINT(SDNode *N, SDValue &Lo, EVT VT = Op.getValueType(); RTLIB::Libcall LC = RTLIB::UNKNOWN_LIBCALL; - if (N->getOpcode() == ISD::LLROUND) { + if (N->getOpcode() == ISD::LLROUND || + N->getOpcode() == ISD::STRICT_LLROUND) { if (VT == MVT::f32) LC = RTLIB::LLROUND_F32; else if (VT == MVT::f64) @@ -2606,7 +2609,8 @@ void DAGTypeLegalizer::ExpandIntRes_LLROUND_LLRINT(SDNode *N, SDValue &Lo, else if (VT == MVT::ppcf128) LC = RTLIB::LLROUND_PPCF128; assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unexpected llround input type!"); - } else if (N->getOpcode() == ISD::LLRINT) { + } else if (N->getOpcode() == ISD::LLRINT || + N->getOpcode() == ISD::STRICT_LLRINT) { if (VT == MVT::f32) LC = RTLIB::LLRINT_F32; else if (VT == MVT::f64) @@ -2623,6 +2627,17 @@ void DAGTypeLegalizer::ExpandIntRes_LLROUND_LLRINT(SDNode *N, SDValue &Lo, SDLoc dl(N); EVT RetVT = N->getValueType(0); + + if (N->isStrictFPOpcode()) { + // FIXME: Support softening for strict fp! + assert(getTypeAction(VT) != TargetLowering::TypeSoftenFloat && + "Softening strict fp calls not supported yet!"); + std::pair<SDValue, SDValue> Tmp = ExpandChainLibCall(LC, N, true); + SplitInteger(Tmp.first, Lo, Hi); + ReplaceValueWith(SDValue(N, 1), Tmp.second); + return; + } + TargetLowering::MakeLibCallOptions CallOptions; CallOptions.setSExt(true); |

