Skip to content

Commit 5e1d81a

Browse files
authored
LegalizeIntegerTypes: implement PromoteIntRes for xrint (#71055)
Recently, 98c90a1 (ISel: introduce vector ISD::LRINT, ISD::LLRINT; custom RISCV lowering) introduced vector variants of llvm.lrint, llvm.llrint, and bundled several tests along with the code change. However, it forgot to test lrint and llrint on fixed vectors on RISC-V, and it turns out that that fixed-vectors-lrint.ll requires PromoteIntRes_XRINT to be implemented. Implement it, and add tests for fixed-vector lrint, llrint.
1 parent 43feb3e commit 5e1d81a

File tree

4 files changed

+1704
-0
lines changed

4 files changed

+1704
-0
lines changed

llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,11 @@ void DAGTypeLegalizer::PromoteIntegerResult(SDNode *N, unsigned ResNo) {
301301
case ISD::FFREXP:
302302
Res = PromoteIntRes_FFREXP(N);
303303
break;
304+
305+
case ISD::LRINT:
306+
case ISD::LLRINT:
307+
Res = PromoteIntRes_XRINT(N);
308+
break;
304309
}
305310

306311
// If the result is null then the sub-method took care of registering it.
@@ -783,6 +788,12 @@ SDValue DAGTypeLegalizer::PromoteIntRes_FP_TO_FP16_BF16(SDNode *N) {
783788
return DAG.getNode(N->getOpcode(), dl, NVT, N->getOperand(0));
784789
}
785790

791+
SDValue DAGTypeLegalizer::PromoteIntRes_XRINT(SDNode *N) {
792+
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
793+
SDLoc dl(N);
794+
return DAG.getNode(N->getOpcode(), dl, NVT, N->getOperand(0));
795+
}
796+
786797
SDValue DAGTypeLegalizer::PromoteIntRes_GET_ROUNDING(SDNode *N) {
787798
EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
788799
SDLoc dl(N);

llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ class LLVM_LIBRARY_VISIBILITY DAGTypeLegalizer {
326326
SDValue PromoteIntRes_FP_TO_XINT(SDNode *N);
327327
SDValue PromoteIntRes_FP_TO_XINT_SAT(SDNode *N);
328328
SDValue PromoteIntRes_FP_TO_FP16_BF16(SDNode *N);
329+
SDValue PromoteIntRes_XRINT(SDNode *N);
329330
SDValue PromoteIntRes_FREEZE(SDNode *N);
330331
SDValue PromoteIntRes_INT_EXTEND(SDNode *N);
331332
SDValue PromoteIntRes_LOAD(LoadSDNode *N);

0 commit comments

Comments
 (0)