Skip to content

Commit 5af6d4e

Browse files
committed
Use ISD::FP_TO_SINT
1 parent 7138270 commit 5af6d4e

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4374,11 +4374,6 @@ SDValue AArch64TargetLowering::LowerVectorXRINT(SDValue Op,
43744374

43754375
assert(VT.isVector() && "Expected vector type");
43764376

4377-
// We can't custom-lower ISD::[L]LRINT without SVE, since it requires
4378-
// AArch64ISD::FCVTZS_MERGE_PASSTHRU.
4379-
if (!Subtarget->isSVEAvailable())
4380-
return SDValue();
4381-
43824377
EVT ContainerVT = VT;
43834378
EVT SrcVT = Src.getValueType();
43844379
EVT CastVT =
@@ -4394,24 +4389,9 @@ SDValue AArch64TargetLowering::LowerVectorXRINT(SDValue Op,
43944389
// the current rounding mode.
43954390
SDValue FOp = DAG.getNode(ISD::FRINT, DL, CastVT, Src);
43964391

4397-
// In the case of vector filled with f32, ftrunc will convert it to an i32,
4398-
// but a vector filled with i32 isn't legal. So, FP_EXTEND the f32 into the
4399-
// required size.
4400-
size_t SrcSz = SrcVT.getScalarSizeInBits();
4401-
size_t ContainerSz = ContainerVT.getScalarSizeInBits();
4402-
if (ContainerSz > SrcSz) {
4403-
EVT SizedVT = MVT::getVectorVT(MVT::getFloatingPointVT(ContainerSz),
4404-
ContainerVT.getVectorElementCount());
4405-
FOp = DAG.getNode(ISD::FP_EXTEND, DL, SizedVT, FOp.getOperand(0));
4406-
}
4407-
44084392
// Finally, truncate the rounded floating point to an integer, rounding to
44094393
// zero.
4410-
SDValue Pred = getPredicateForVector(DAG, DL, ContainerVT);
4411-
SDValue Undef = DAG.getUNDEF(ContainerVT);
4412-
SDValue Truncated =
4413-
DAG.getNode(AArch64ISD::FCVTZS_MERGE_PASSTHRU, DL, ContainerVT,
4414-
{Pred, FOp.getOperand(0), Undef}, FOp->getFlags());
4394+
SDValue Truncated = DAG.getNode(ISD::FP_TO_SINT, DL, ContainerVT, FOp.getOperand(0));
44154395

44164396
if (VT.isScalableVector())
44174397
return Truncated;

0 commit comments

Comments
 (0)