[llvm] [RISCV][CostModel] Estimate cost of Extract/InsertElement with non-constant index when vector instructions are not available (PR #67334)

Sergey Kachkov via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 26 05:59:40 PDT 2023


================
@@ -1456,6 +1456,24 @@ InstructionCost RISCVTTIImpl::getVectorInstrCost(unsigned Opcode, Type *Val,
       Opcode != Instruction::InsertElement)
     return BaseT::getVectorInstrCost(Opcode, Val, CostKind, Index, Op0, Op1);
 
+  // Extract/InsertElement with non-constant index is very costly without
----------------
skachkov-sc wrote:

Thank you, after moving the code I've discovered one more missing case here: there are floating-point tests in rvv-insertelement.ll, rvv-extractelement.ll and with zve64x extension the reported cost was zero. However, the actual cost is much higher because in absence of zve64f/zve64d extensions it's also lowered via stack (proof: https://godbolt.org/z/aob3MEMPP). Now these cases are also processed (and reflected in tests)

https://github.com/llvm/llvm-project/pull/67334


More information about the llvm-commits mailing list