diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp --- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp +++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp @@ -527,7 +527,9 @@ // RISC-V target uses at least 5 instructions to lower rounding intrinsics. unsigned Cost = 5; auto LT = getTypeLegalizationCost(RetTy); - return Cost * LT.first; + if (TLI->isOperationCustom(ISD::VP_FRINT, LT.second)) + return Cost * LT.first; + break; } }