Skip to content

Commit 40ca7cf

Browse files
Update LegalizeVectorOps.cpp
1 parent 1dca40c commit 40ca7cf

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1784,16 +1784,24 @@ void VectorLegalizer::ExpandUINT_TO_FLOAT(SDNode *Node,
17841784
(IsStrict && TLI.getOperationAction(ISD::STRICT_FMUL, DstVT) ==
17851785
TargetLowering::Expand)) {
17861786
EVT FPVT = BW == 32 ? MVT::f32 : MVT::f64;
1787-
SDLoc DL(Node);
1788-
unsigned Round = IsStrict ? ISD::STRICT_FP_ROUND : ISD::FP_ROUND;
1789-
unsigned UIToFP = IsStrict ? ISD::STRICT_UINT_TO_FP : ISD::UINT_TO_FP;
1790-
SDValue Result = DAG.getNode(
1791-
Round, DL, DstVT,
1792-
DAG.getNode(UIToFP, DL, SrcVT.changeVectorElementType(FPVT), Src),
1793-
DAG.getTargetConstant(
1794-
0, DL,
1795-
DAG.getTargetLoweringInfo().getPointerTy(DAG.getDataLayout())));
1796-
Results.push_back(Result);
1787+
SDValue UIToFP;
1788+
SDValue Result;
1789+
SDValue TargetZero = DAG.getIntPtrConstant(0, DL, /*isTarget=*/true);
1790+
if (IsStrict) {
1791+
UIToFP = DAG.getNode(ISD::STRICT_UINT_TO_FP, DL,
1792+
{SrcVT.changeVectorElementType(FPVT), MVT::Other},
1793+
{Node->getOperand(0), Src});
1794+
Result = DAG.getNode(ISD::STRICT_FP_ROUND, DL, {DstVT, MVT::Other},
1795+
{Node->getOperand(0), UIToFP, TargetZero});
1796+
Results.push_back(Result);
1797+
Results.push_back(Result.getValue(1));
1798+
} else {
1799+
UIToFP = DAG.getNode(ISD::UINT_TO_FP, DL,
1800+
SrcVT.changeVectorElementType(FPVT), Src);
1801+
Result = DAG.getNode(ISD::FP_ROUND, DL, DstVT, UIToFP, TargetZero);
1802+
Results.push_back(Result);
1803+
}
1804+
17971805
return;
17981806
}
17991807

0 commit comments

Comments
 (0)