@@ -1304,6 +1304,12 @@ AArch64TargetLowering::AArch64TargetLowering(const TargetMachine &TM,
1304
1304
setOperationAction(Op, Ty, Legal);
1305
1305
}
1306
1306
1307
+ // LRINT and LLRINT.
1308
+ for (auto VT : MVT::fp_fixedlen_vector_valuetypes()) {
1309
+ setOperationAction(ISD::LRINT, VT, Custom);
1310
+ setOperationAction(ISD::LLRINT, VT, Custom);
1311
+ }
1312
+
1307
1313
setTruncStoreAction(MVT::v4i16, MVT::v4i8, Custom);
1308
1314
1309
1315
setOperationAction(ISD::BITCAST, MVT::i2, Custom);
@@ -1419,6 +1425,12 @@ AArch64TargetLowering::AArch64TargetLowering(const TargetMachine &TM,
1419
1425
setOperationAction(ISD::OR, VT, Custom);
1420
1426
}
1421
1427
1428
+ // LRINT and LLRINT.
1429
+ for (auto VT : MVT::fp_scalable_vector_valuetypes()) {
1430
+ setOperationAction(ISD::LRINT, VT, Custom);
1431
+ setOperationAction(ISD::LLRINT, VT, Custom);
1432
+ }
1433
+
1422
1434
// Illegal unpacked integer vector types.
1423
1435
for (auto VT : {MVT::nxv8i8, MVT::nxv4i16, MVT::nxv2i32}) {
1424
1436
setOperationAction(ISD::EXTRACT_SUBVECTOR, VT, Custom);
@@ -1526,8 +1538,6 @@ AArch64TargetLowering::AArch64TargetLowering(const TargetMachine &TM,
1526
1538
setOperationAction(ISD::FNEARBYINT, VT, Custom);
1527
1539
setOperationAction(ISD::FRINT, VT, Custom);
1528
1540
setOperationAction(ISD::FROUND, VT, Custom);
1529
- setOperationAction(ISD::LRINT, VT, Custom);
1530
- setOperationAction(ISD::LLRINT, VT, Custom);
1531
1541
setOperationAction(ISD::FROUNDEVEN, VT, Custom);
1532
1542
setOperationAction(ISD::FTRUNC, VT, Custom);
1533
1543
setOperationAction(ISD::FSQRT, VT, Custom);
@@ -1667,6 +1677,11 @@ AArch64TargetLowering::AArch64TargetLowering(const TargetMachine &TM,
1667
1677
setOperationAction(ISD::MULHU, VT, Custom);
1668
1678
}
1669
1679
1680
+ // LRINT and LLRINT.
1681
+ for (auto VT : MVT::fp_fixedlen_vector_valuetypes()) {
1682
+ setOperationAction(ISD::LRINT, VT, Custom);
1683
+ setOperationAction(ISD::LLRINT, VT, Custom);
1684
+ }
1670
1685
1671
1686
// Use SVE for vectors with more than 2 elements.
1672
1687
for (auto VT : {MVT::v4f16, MVT::v8f16, MVT::v4f32})
@@ -1942,8 +1957,6 @@ void AArch64TargetLowering::addTypeForFixedLengthSVE(MVT VT) {
1942
1957
setOperationAction(ISD::FP_TO_UINT, VT, Default);
1943
1958
setOperationAction(ISD::FRINT, VT, Default);
1944
1959
setOperationAction(ISD::FROUND, VT, Default);
1945
- setOperationAction(ISD::LRINT, VT, Default);
1946
- setOperationAction(ISD::LLRINT, VT, Default);
1947
1960
setOperationAction(ISD::FROUNDEVEN, VT, Default);
1948
1961
setOperationAction(ISD::FSQRT, VT, Default);
1949
1962
setOperationAction(ISD::FSUB, VT, Default);
@@ -4374,30 +4387,15 @@ SDValue AArch64TargetLowering::LowerVectorXRINT(SDValue Op,
4374
4387
4375
4388
assert(VT.isVector() && "Expected vector type");
4376
4389
4377
- EVT ContainerVT = VT;
4378
- EVT SrcVT = Src.getValueType();
4379
4390
EVT CastVT =
4380
- ContainerVT .changeVectorElementType(SrcVT .getVectorElementType());
4391
+ VT .changeVectorElementType(Src.getValueType() .getVectorElementType());
4381
4392
4382
- if (VT.isFixedLengthVector()) {
4383
- ContainerVT = getContainerForFixedLengthVector(DAG, VT);
4384
- CastVT = ContainerVT.changeVectorElementType(SrcVT.getVectorElementType());
4385
- Src = convertToScalableVector(DAG, CastVT, Src);
4386
- }
4387
-
4388
- // First, round the floating-point value into a floating-point register with
4389
- // the current rounding mode.
4393
+ // Round the floating-point value into a floating-point register with the
4394
+ // current rounding mode.
4390
4395
SDValue FOp = DAG.getNode(ISD::FRINT, DL, CastVT, Src);
4391
4396
4392
- // Finally, truncate the rounded floating point to an integer, rounding to
4393
- // zero.
4394
- SDValue Truncated =
4395
- DAG.getNode(ISD::FP_TO_SINT, DL, ContainerVT, FOp.getOperand(0));
4396
-
4397
- if (VT.isScalableVector())
4398
- return Truncated;
4399
-
4400
- return convertFromScalableVector(DAG, VT, Truncated);
4397
+ // Truncate the rounded floating point to an integer, rounding to zero.
4398
+ return DAG.getNode(ISD::FP_TO_SINT, DL, VT, FOp);
4401
4399
}
4402
4400
4403
4401
SDValue AArch64TargetLowering::LowerVectorINT_TO_FP(SDValue Op,
0 commit comments