[llvm] [RISCV] Don't cost vector arithmetic fp ops as cheaper than scalar (PR #99594)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 23 22:59:26 PDT 2024
================
@@ -1739,8 +1738,14 @@ InstructionCost RISCVTTIImpl::getArithmeticInstrCost(
Op1Info, Op2Info,
Args, CxtI);
}
- return ConstantMatCost +
- LT.first * getRISCVInstructionCost(Op, LT.second, CostKind);
+
+ InstructionCost InstrCost = getRISCVInstructionCost(Op, LT.second, CostKind);
+ // We use BasicTTIImpl to calculate scalar costs, which assumes floating point
+ // ops are twice as expensive as integer ops. Do the same for vectors so
+ // scalar floating point ops aren't cheaper than their vector equivalents.
+ if (Ty->isFPOrFPVectorTy())
----------------
lukel97 wrote:
I might be missing something, if that's the case then shouldn't we also be doubling the vendor costs in getArithmeticInstrCost anyway? Otherwise they'll have the same issue before this patch where the vector ops are cheaper than scalars.
https://github.com/llvm/llvm-project/pull/99594
More information about the llvm-commits
mailing list