Skip to content

Commit de41eae

Browse files
authored
[SelectionDAG][RISCV] Use FP type for legality query for LRINT/LLRINT in LegalizeVectorOps. (llvm#82728)
This matches how LRINT/LLRINT is queried for scalar types in LegalizeDAG. It's confusing if they do different things since a "Legal" vector LRINT/LLRINT would get through to LegalizeDAG which would then consider it illegal. This doesn't happen currently because RISC-V uses Custom.
1 parent ca09e08 commit de41eae

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,6 @@ SDValue VectorLegalizer::LegalizeOp(SDValue Op) {
404404
case ISD::FCEIL:
405405
case ISD::FTRUNC:
406406
case ISD::FRINT:
407-
case ISD::LRINT:
408-
case ISD::LLRINT:
409407
case ISD::FNEARBYINT:
410408
case ISD::FROUND:
411409
case ISD::FROUNDEVEN:
@@ -455,6 +453,8 @@ SDValue VectorLegalizer::LegalizeOp(SDValue Op) {
455453
Node->getValueType(0), Scale);
456454
break;
457455
}
456+
case ISD::LRINT:
457+
case ISD::LLRINT:
458458
case ISD::SINT_TO_FP:
459459
case ISD::UINT_TO_FP:
460460
case ISD::VECREDUCE_ADD:

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,6 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
830830
VT, Custom);
831831
setOperationAction({ISD::FP_TO_SINT_SAT, ISD::FP_TO_UINT_SAT}, VT,
832832
Custom);
833-
setOperationAction({ISD::LRINT, ISD::LLRINT}, VT, Custom);
834833
setOperationAction({ISD::AVGFLOORU, ISD::AVGCEILU, ISD::SADDSAT,
835834
ISD::UADDSAT, ISD::SSUBSAT, ISD::USUBSAT},
836835
VT, Legal);
@@ -956,6 +955,7 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
956955
// between vXf16 and vXf64 must be lowered as sequences which convert via
957956
// vXf32.
958957
setOperationAction({ISD::FP_ROUND, ISD::FP_EXTEND}, VT, Custom);
958+
setOperationAction({ISD::LRINT, ISD::LLRINT}, VT, Custom);
959959
// Custom-lower insert/extract operations to simplify patterns.
960960
setOperationAction({ISD::INSERT_VECTOR_ELT, ISD::EXTRACT_VECTOR_ELT}, VT,
961961
Custom);

0 commit comments

Comments
 (0)