[llvm] [RISCV][TTI] Model the cost of insert/extractelt when the vector split into multiple register group and idx exceed single group. (PR #118401)
Elvis Wang via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 10 22:50:27 PST 2024
================
@@ -926,10 +926,10 @@ define void @extractelement_int_lmul(i32 %x) {
; RV64ZVE64X-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v32i32_15 = extractelement <32 x i32> undef, i32 15
; RV64ZVE64X-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v32i32_31 = extractelement <32 x i32> undef, i32 31
; RV64ZVE64X-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v64i32_63 = extractelement <64 x i32> undef, i32 63
-; RV64ZVE64X-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v128i8 = extractelement <128 x i8> undef, i32 %x
-; RV64ZVE64X-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v256i8 = extractelement <256 x i8> undef, i32 %x
-; RV64ZVE64X-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v32i32 = extractelement <32 x i32> undef, i32 %x
-; RV64ZVE64X-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v64i32 = extractelement <64 x i32> undef, i32 %x
+; RV64ZVE64X-NEXT: Cost Model: Found an estimated cost of 33 for instruction: %v128i8 = extractelement <128 x i8> undef, i32 %x
+; RV64ZVE64X-NEXT: Cost Model: Found an estimated cost of 129 for instruction: %v256i8 = extractelement <256 x i8> undef, i32 %x
----------------
ElvisWang123 wrote:
I think 256 x i8 need 32 register under zve64x. 256 / 64 * 8 = 32
The cost of 128 x i8 is `18` and that is close to your expectation.
https://github.com/llvm/llvm-project/pull/118401
More information about the llvm-commits
mailing list