Skip to content

Commit 75e77f2

Browse files
[X86] Combine uitofp <v x i32> to <v x half>
Closes #121793
1 parent ca603d2 commit 75e77f2

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56098,8 +56098,19 @@ static SDValue combineUIntToFP(SDNode *N, SelectionDAG &DAG,
5609856098
if (InVT.isVector() && VT.getVectorElementType() == MVT::f16) {
5609956099
unsigned ScalarSize = InVT.getScalarSizeInBits();
5610056100
if ((ScalarSize == 16 && Subtarget.hasFP16()) || ScalarSize == 32 ||
56101-
ScalarSize >= 64)
56102-
return SDValue();
56101+
ScalarSize >= 64) {
56102+
if (ScalarSize != 32 || VT.getScalarSizeInBits() != 16 ||
56103+
Subtarget.hasFP16())
56104+
return SDValue();
56105+
// UINT_TO_FP(vXi32 to vXf16) -> FP_ROUND(UINT_TO_FP(vXi32 to vXf32), 0)
56106+
return DAG.getNode(
56107+
ISD::FP_ROUND, SDLoc(N), VT,
56108+
DAG.getNode(ISD::UINT_TO_FP, SDLoc(N),
56109+
InVT.changeVectorElementType(MVT::f32), Op0),
56110+
DAG.getTargetConstant(
56111+
0, SDLoc(N),
56112+
DAG.getTargetLoweringInfo().getPointerTy(DAG.getDataLayout())));
56113+
}
5610356114
SDLoc dl(N);
5610456115
EVT DstVT =
5610556116
EVT::getVectorVT(*DAG.getContext(),

0 commit comments

Comments
 (0)