[llvm] [RISCV] Cost UDIV/UREM by a constant power of 2 as a SHL/AND in getArithmeticInstrCost() (PR #179570)
Ryan Buchner via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 4 10:47:37 PST 2026
================
@@ -1048,6 +1048,30 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
unsigned getMaxInterleaveFactor(ElementCount VF) const override { return 1; }
+ bool getConvertedArithmeticInstructionCost(unsigned ISDOpcode, Type *Ty,
----------------
bababuck wrote:
Updated but have couple of questions/concerns:
1. In `TargetTransformInfo::getArithmeticInstrCost()`, we don't have access to a `TargetLowering` object, so we cannot call `InstructionOpcodeToISD()`. I don't think it is an issue to just checking the `Instruction::` opcode.
2. The generic `getArithmeticInstrCost()` is bypassed when we call `getInstructionCost()`, in which cases the target specific `getArithmeticInstrCost()` is called directly. This is evidenced by the fact that this MR breaks the `CostAnalysis` tests.
https://github.com/llvm/llvm-project/pull/179570
More information about the llvm-commits
mailing list