@@ -1070,6 +1070,7 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
1070
1070
// vXf32.
1071
1071
setOperationAction({ISD::FP_ROUND, ISD::FP_EXTEND}, VT, Custom);
1072
1072
setOperationAction({ISD::LRINT, ISD::LLRINT}, VT, Custom);
1073
+ setOperationAction({ISD::LROUND, ISD::LLROUND}, VT, Custom);
1073
1074
// Custom-lower insert/extract operations to simplify patterns.
1074
1075
setOperationAction({ISD::INSERT_VECTOR_ELT, ISD::EXTRACT_VECTOR_ELT}, VT,
1075
1076
Custom);
@@ -1151,6 +1152,7 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
1151
1152
Custom);
1152
1153
setOperationAction({ISD::VP_FP_ROUND, ISD::VP_FP_EXTEND}, VT, Custom);
1153
1154
setOperationAction({ISD::LRINT, ISD::LLRINT}, VT, Custom);
1155
+ setOperationAction({ISD::LROUND, ISD::LLROUND}, VT, Custom);
1154
1156
setOperationAction({ISD::VP_MERGE, ISD::VP_SELECT, ISD::SELECT}, VT,
1155
1157
Custom);
1156
1158
setOperationAction(ISD::SELECT_CC, VT, Expand);
@@ -1453,6 +1455,7 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
1453
1455
setOperationAction({ISD::VP_SINT_TO_FP, ISD::VP_UINT_TO_FP}, VT,
1454
1456
Custom);
1455
1457
setOperationAction({ISD::LRINT, ISD::LLRINT}, VT, Custom);
1458
+ setOperationAction({ISD::LROUND, ISD::LLROUND}, VT, Custom);
1456
1459
if (Subtarget.hasStdExtZfhmin()) {
1457
1460
setOperationAction(ISD::BUILD_VECTOR, VT, Custom);
1458
1461
} else {
@@ -1478,6 +1481,7 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
1478
1481
setOperationAction(ISD::BITCAST, VT, Custom);
1479
1482
setOperationAction({ISD::VP_FP_ROUND, ISD::VP_FP_EXTEND}, VT, Custom);
1480
1483
setOperationAction({ISD::LRINT, ISD::LLRINT}, VT, Custom);
1484
+ setOperationAction({ISD::LROUND, ISD::LLROUND}, VT, Custom);
1481
1485
if (Subtarget.hasStdExtZfbfmin()) {
1482
1486
setOperationAction(ISD::BUILD_VECTOR, VT, Custom);
1483
1487
} else {
@@ -1511,7 +1515,8 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
1511
1515
1512
1516
setOperationAction({ISD::FTRUNC, ISD::FCEIL, ISD::FFLOOR, ISD::FROUND,
1513
1517
ISD::FROUNDEVEN, ISD::FRINT, ISD::LRINT,
1514
- ISD::LLRINT, ISD::FNEARBYINT},
1518
+ ISD::LLRINT, ISD::LROUND, ISD::LLROUND,
1519
+ ISD::FNEARBYINT},
1515
1520
VT, Custom);
1516
1521
1517
1522
setCondCodeAction(VFPCCToExpand, VT, Expand);
@@ -3211,7 +3216,11 @@ static RISCVFPRndMode::RoundingMode matchRoundingOp(unsigned Opc) {
3211
3216
case ISD::VP_FCEIL:
3212
3217
return RISCVFPRndMode::RUP;
3213
3218
case ISD::FROUND:
3219
+ case ISD::LROUND:
3220
+ case ISD::LLROUND:
3214
3221
case ISD::STRICT_FROUND:
3222
+ case ISD::STRICT_LROUND:
3223
+ case ISD::STRICT_LLROUND:
3215
3224
case ISD::VP_FROUND:
3216
3225
return RISCVFPRndMode::RMM;
3217
3226
case ISD::FRINT:
@@ -3469,9 +3478,9 @@ lowerFTRUNC_FCEIL_FFLOOR_FROUND(SDValue Op, SelectionDAG &DAG,
3469
3478
DAG.getTargetConstant(FRM, DL, Subtarget.getXLenVT()));
3470
3479
}
3471
3480
3472
- // Expand vector LRINT and LLRINT by converting to the integer domain.
3473
- static SDValue lowerVectorXRINT (SDValue Op, SelectionDAG &DAG,
3474
- const RISCVSubtarget &Subtarget) {
3481
+ // Expand vector [L] LRINT and [L]LROUND by converting to the integer domain.
3482
+ static SDValue lowerVectorXRINT_XROUND (SDValue Op, SelectionDAG &DAG,
3483
+ const RISCVSubtarget &Subtarget) {
3475
3484
SDLoc DL(Op);
3476
3485
MVT DstVT = Op.getSimpleValueType();
3477
3486
SDValue Src = Op.getOperand(0);
@@ -7711,11 +7720,10 @@ SDValue RISCVTargetLowering::LowerOperation(SDValue Op,
7711
7720
return lowerFTRUNC_FCEIL_FFLOOR_FROUND(Op, DAG, Subtarget);
7712
7721
case ISD::LRINT:
7713
7722
case ISD::LLRINT:
7714
- if (Op.getValueType().isVector())
7715
- return lowerVectorXRINT(Op, DAG, Subtarget);
7716
- [[fallthrough]];
7717
7723
case ISD::LROUND:
7718
7724
case ISD::LLROUND: {
7725
+ if (Op.getValueType().isVector())
7726
+ return lowerVectorXRINT_XROUND(Op, DAG, Subtarget);
7719
7727
assert(Op.getOperand(0).getValueType() == MVT::f16 &&
7720
7728
"Unexpected custom legalisation");
7721
7729
SDLoc DL(Op);
0 commit comments