[llvm] [AMDGPU] Refine i8 extractelement cost model (PR #203932)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 15 09:03:21 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-analysis
Author: Brendon Cahoon (bcahoon)
<details>
<summary>Changes</summary>
Expand the cases when i8 extract elements are free. The extract elements should be free when they are part of a sequence that extract multiple consecutive elements the size of a register. This change enables the SLPVectorizer to keep extract elements over more costly shufflevectors.
This PR also undoes a previous change that made insert element free, but those require sequences of shift/or instructions so shouldn't be free.
---
Patch is 100.36 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/203932.diff
9 Files Affected:
- (modified) llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp (+10-10)
- (modified) llvm/test/Analysis/CostModel/AMDGPU/div.ll (+42-42)
- (modified) llvm/test/Analysis/CostModel/AMDGPU/extractelement.ll (+16-16)
- (modified) llvm/test/Analysis/CostModel/AMDGPU/insertelement.ll (+26-26)
- (modified) llvm/test/Analysis/CostModel/AMDGPU/rem.ll (+42-42)
- (modified) llvm/test/Transforms/SLPVectorizer/AMDGPU/vectorize-i8.ll (+8-10)
- (modified) llvm/test/Transforms/VectorCombine/AMDGPU/extract-insert-chain-to-shuffles.ll (+1-10)
- (modified) llvm/test/Transforms/VectorCombine/AMDGPU/extract-insert-i8.ll (+6-40)
- (modified) llvm/test/Transforms/VectorCombine/AMDGPU/no-scalarize-vector-extract.ll (+14-20)
``````````diff
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
index 7631bb2dc6828..862f8e646ceba 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
@@ -1026,16 +1026,16 @@ InstructionCost GCNTTIImpl::getVectorInstrCost(
if (EltSize < 32) {
if (EltSize == 16 && Index == 0 && ST->has16BitInsts())
return 0;
- // Some i8 inserts and extracts are free so we want to reduce the
- // cost to avoid scalarization. We limit the zero cost cases to avoid
- // adversely impacting all i8 vectorizing.
- if (EltSize == 8) {
- unsigned NumElts = cast<FixedVectorType>(ValTy)->getNumElements();
- if (NumElts >= 4 && isPowerOf2_32(NumElts)) {
- // Extracts at indices aligned to 32-bit boundaries (0, 4, 8, 12 for
- // v16i8) are free as they access the low byte of each VGPR. Other
- // indices require bit manipulation (shifts/byte selects) and cost 1.
- return Index % 4 == 0 ? 0 : 1;
+ // Extract element sequences of consecutive i8 values that match a
+ // register size are free most likely. It is not possible to know
+ // if this extract is part of a consecutive sequence so this may
+ // apply more generally.
+ if (Opcode == Instruction::ExtractElement && EltSize == 8) {
+ if (auto *FVTy = dyn_cast<FixedVectorType>(ValTy)) {
+ unsigned NumElts = FVTy->getNumElements();
+ if (NumElts >= 4 && isPowerOf2_32(NumElts)) {
+ return 0;
+ }
}
}
return BaseT::getVectorInstrCost(Opcode, ValTy, CostKind, Index, Op0, Op1,
diff --git a/llvm/test/Analysis/CostModel/AMDGPU/div.ll b/llvm/test/Analysis/CostModel/AMDGPU/div.ll
index bcb05e1f92503..e3cc8386f23aa 100644
--- a/llvm/test/Analysis/CostModel/AMDGPU/div.ll
+++ b/llvm/test/Analysis/CostModel/AMDGPU/div.ll
@@ -44,9 +44,9 @@ define i32 @sdiv() {
; SLOW-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %V16i16 = sdiv <16 x i16> poison, poison
; SLOW-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %V32i16 = sdiv <32 x i16> poison, poison
; SLOW-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I8 = sdiv i8 poison, poison
-; SLOW-NEXT: Cost Model: Found an estimated cost of 28 for instruction: %V16i8 = sdiv <16 x i8> poison, poison
-; SLOW-NEXT: Cost Model: Found an estimated cost of 56 for instruction: %V32i8 = sdiv <32 x i8> poison, poison
-; SLOW-NEXT: Cost Model: Found an estimated cost of 112 for instruction: %V64i8 = sdiv <64 x i8> poison, poison
+; SLOW-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %V16i8 = sdiv <16 x i8> poison, poison
+; SLOW-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %V32i8 = sdiv <32 x i8> poison, poison
+; SLOW-NEXT: Cost Model: Found an estimated cost of 128 for instruction: %V64i8 = sdiv <64 x i8> poison, poison
; SLOW-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret i32 poison
;
; ALL-SIZE-LABEL: 'sdiv'
@@ -125,9 +125,9 @@ define i32 @udiv() {
; SLOW-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %V16i16 = udiv <16 x i16> poison, poison
; SLOW-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %V32i16 = udiv <32 x i16> poison, poison
; SLOW-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I8 = udiv i8 poison, poison
-; SLOW-NEXT: Cost Model: Found an estimated cost of 28 for instruction: %V16i8 = udiv <16 x i8> poison, poison
-; SLOW-NEXT: Cost Model: Found an estimated cost of 56 for instruction: %V32i8 = udiv <32 x i8> poison, poison
-; SLOW-NEXT: Cost Model: Found an estimated cost of 112 for instruction: %V64i8 = udiv <64 x i8> poison, poison
+; SLOW-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %V16i8 = udiv <16 x i8> poison, poison
+; SLOW-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %V32i8 = udiv <32 x i8> poison, poison
+; SLOW-NEXT: Cost Model: Found an estimated cost of 128 for instruction: %V64i8 = udiv <64 x i8> poison, poison
; SLOW-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret i32 poison
;
; ALL-SIZE-LABEL: 'udiv'
@@ -206,9 +206,9 @@ define i32 @sdiv_const() {
; SLOW-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %V16i16 = sdiv <16 x i16> poison, <i16 4, i16 5, i16 6, i16 7, i16 8, i16 9, i16 10, i16 11, i16 12, i16 13, i16 14, i16 15, i16 16, i16 17, i16 18, i16 19>
; SLOW-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %V32i16 = sdiv <32 x i16> poison, <i16 4, i16 5, i16 6, i16 7, i16 8, i16 9, i16 10, i16 11, i16 12, i16 13, i16 14, i16 15, i16 16, i16 17, i16 18, i16 19, i16 4, i16 5, i16 6, i16 7, i16 8, i16 9, i16 10, i16 11, i16 12, i16 13, i16 14, i16 15, i16 16, i16 17, i16 18, i16 19>
; SLOW-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I8 = sdiv i8 poison, 7
-; SLOW-NEXT: Cost Model: Found an estimated cost of 28 for instruction: %V16i8 = sdiv <16 x i8> poison, <i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19>
-; SLOW-NEXT: Cost Model: Found an estimated cost of 56 for instruction: %V32i8 = sdiv <32 x i8> poison, <i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19>
-; SLOW-NEXT: Cost Model: Found an estimated cost of 112 for instruction: %V64i8 = sdiv <64 x i8> poison, <i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19>
+; SLOW-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %V16i8 = sdiv <16 x i8> poison, <i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19>
+; SLOW-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %V32i8 = sdiv <32 x i8> poison, <i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19>
+; SLOW-NEXT: Cost Model: Found an estimated cost of 128 for instruction: %V64i8 = sdiv <64 x i8> poison, <i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19>
; SLOW-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret i32 poison
;
; ALL-SIZE-LABEL: 'sdiv_const'
@@ -287,9 +287,9 @@ define i32 @udiv_const() {
; SLOW-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %V16i16 = udiv <16 x i16> poison, <i16 4, i16 5, i16 6, i16 7, i16 8, i16 9, i16 10, i16 11, i16 12, i16 13, i16 14, i16 15, i16 16, i16 17, i16 18, i16 19>
; SLOW-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %V32i16 = udiv <32 x i16> poison, <i16 4, i16 5, i16 6, i16 7, i16 8, i16 9, i16 10, i16 11, i16 12, i16 13, i16 14, i16 15, i16 16, i16 17, i16 18, i16 19, i16 4, i16 5, i16 6, i16 7, i16 8, i16 9, i16 10, i16 11, i16 12, i16 13, i16 14, i16 15, i16 16, i16 17, i16 18, i16 19>
; SLOW-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I8 = udiv i8 poison, 7
-; SLOW-NEXT: Cost Model: Found an estimated cost of 28 for instruction: %V16i8 = udiv <16 x i8> poison, <i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19>
-; SLOW-NEXT: Cost Model: Found an estimated cost of 56 for instruction: %V32i8 = udiv <32 x i8> poison, <i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19>
-; SLOW-NEXT: Cost Model: Found an estimated cost of 112 for instruction: %V64i8 = udiv <64 x i8> poison, <i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19>
+; SLOW-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %V16i8 = udiv <16 x i8> poison, <i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19>
+; SLOW-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %V32i8 = udiv <32 x i8> poison, <i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19>
+; SLOW-NEXT: Cost Model: Found an estimated cost of 128 for instruction: %V64i8 = udiv <64 x i8> poison, <i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15, i8 16, i8 17, i8 18, i8 19>
; SLOW-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret i32 poison
;
; ALL-SIZE-LABEL: 'udiv_const'
@@ -368,9 +368,9 @@ define i32 @sdiv_uniformconst() {
; SLOW-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %V16i16 = sdiv <16 x i16> poison, splat (i16 7)
; SLOW-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %V32i16 = sdiv <32 x i16> poison, splat (i16 7)
; SLOW-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I8 = sdiv i8 poison, 7
-; SLOW-NEXT: Cost Model: Found an estimated cost of 28 for instruction: %V16i8 = sdiv <16 x i8> poison, splat (i8 7)
-; SLOW-NEXT: Cost Model: Found an estimated cost of 56 for instruction: %V32i8 = sdiv <32 x i8> poison, splat (i8 7)
-; SLOW-NEXT: Cost Model: Found an estimated cost of 112 for instruction: %V64i8 = sdiv <64 x i8> poison, splat (i8 7)
+; SLOW-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %V16i8 = sdiv <16 x i8> poison, splat (i8 7)
+; SLOW-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %V32i8 = sdiv <32 x i8> poison, splat (i8 7)
+; SLOW-NEXT: Cost Model: Found an estimated cost of 128 for instruction: %V64i8 = sdiv <64 x i8> poison, splat (i8 7)
; SLOW-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret i32 poison
;
; ALL-SIZE-LABEL: 'sdiv_uniformconst'
@@ -449,9 +449,9 @@ define i32 @udiv_uniformconst() {
; SLOW-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %V16i16 = udiv <16 x i16> poison, splat (i16 7)
; SLOW-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %V32i16 = udiv <32 x i16> poison, splat (i16 7)
; SLOW-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I8 = udiv i8 poison, 7
-; SLOW-NEXT: Cost Model: Found an estimated cost of 28 for instruction: %V16i8 = udiv <16 x i8> poison, splat (i8 7)
-; SLOW-NEXT: Cost Model: Found an estimated cost of 56 for instruction: %V32i8 = udiv <32 x i8> poison, splat (i8 7)
-; SLOW-NEXT: Cost Model: Found an estimated cost of 112 for instruction: %V64i8 = udiv <64 x i8> poison, splat (i8 7)
+; SLOW-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %V16i8 = udiv <16 x i8> poison, splat (i8 7)
+; SLOW-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %V32i8 = udiv <32 x i8> poison, splat (i8 7)
+; SLOW-NEXT: Cost Model: Found an estimated cost of 128 for instruction: %V64i8 = udiv <64 x i8> poison, splat (i8 7)
; SLOW-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret i32 poison
;
; ALL-SIZE-LABEL: 'udiv_uniformconst'
@@ -530,9 +530,9 @@ define i32 @sdiv_constpow2() {
; SLOW-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %V16i16 = sdiv <16 x i16> poison, <i16 2, i16 4, i16 8, i16 16, i16 32, i16 64, i16 128, i16 256, i16 2, i16 4, i16 8, i16 16, i16 32, i16 64, i16 128, i16 256>
; SLOW-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %V32i16 = sdiv <32 x i16> poison, <i16 2, i16 4, i16 8, i16 16, i16 32, i16 64, i16 128, i16 256, i16 2, i16 4, i16 8, i16 16, i16 32, i16 64, i16 128, i16 256, i16 2, i16 4, i16 8, i16 16, i16 32, i16 64, i16 128, i16 256, i16 2, i16 4, i16 8, i16 16, i16 32, i16 64, i16 128, i16 256>
; SLOW-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I8 = sdiv i8 poison, 16
-; SLOW-NEXT: Cost Model: Found an estimated cost of 28 for instruction: %V16i8 = sdiv <16 x i8> poison, <i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16>
-; SLOW-NEXT: Cost Model: Found an estimated cost of 56 for instruction: %V32i8 = sdiv <32 x i8> poison, <i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16>
-; SLOW-NEXT: Cost Model: Found an estimated cost of 112 for instruction: %V64i8 = sdiv <64 x i8> poison, <i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16>
+; SLOW-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %V16i8 = sdiv <16 x i8> poison, <i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16>
+; SLOW-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %V32i8 = sdiv <32 x i8> poison, <i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16>
+; SLOW-NEXT: Cost Model: Found an estimated cost of 128 for instruction: %V64i8 = sdiv <64 x i8> poison, <i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16>
; SLOW-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret i32 poison
;
; ALL-SIZE-LABEL: 'sdiv_constpow2'
@@ -611,9 +611,9 @@ define i32 @udiv_constpow2() {
; SLOW-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %V16i16 = udiv <16 x i16> poison, <i16 2, i16 4, i16 8, i16 16, i16 32, i16 64, i16 128, i16 256, i16 2, i16 4, i16 8, i16 16, i16 32, i16 64, i16 128, i16 256>
; SLOW-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %V32i16 = udiv <32 x i16> poison, <i16 2, i16 4, i16 8, i16 16, i16 32, i16 64, i16 128, i16 256, i16 2, i16 4, i16 8, i16 16, i16 32, i16 64, i16 128, i16 256, i16 2, i16 4, i16 8, i16 16, i16 32, i16 64, i16 128, i16 256, i16 2, i16 4, i16 8, i16 16, i16 32, i16 64, i16 128, i16 256>
; SLOW-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I8 = udiv i8 poison, 16
-; SLOW-NEXT: Cost Model: Found an estimated cost of 28 for instruction: %V16i8 = udiv <16 x i8> poison, <i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16>
-; SLOW-NEXT: Cost Model: Found an estimated cost of 56 for instruction: %V32i8 = udiv <32 x i8> poison, <i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16>
-; SLOW-NEXT: Cost Model: Found an estimated cost of 112 for instruction: %V64i8 = udiv <64 x i8> poison, <i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16>
+; SLOW-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %V16i8 = udiv <16 x i8> poison, <i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16>
+; SLOW-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %V32i8 = udiv <32 x i8> poison, <i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16>
+; SLOW-NEXT: Cost Model: Found an estimated cost of 128 for instruction: %V64i8 = udiv <64 x i8> poison, <i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16, i8 2, i8 4, i8 8, i8 16>
; SLOW-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret i32 poison
;
; ALL-SIZE-LABEL: 'udiv_constpow2'
@@ -692,9 +692,9 @@ define i32 @sdiv_uniformconstpow2() {
; SLOW-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %V16i16 = sdiv <16 x i16> poison, splat (i16 16)
; SLOW-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %V32i16 = sdiv <32 x i16> poison, splat (i16 16)
; SLOW-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I8 = sdiv i8 poison, 16
-; SLOW-NEXT: Cost Model: Found an estimated cost of 28 for instruction: %V16i8 = sdiv <16 x i8> poison, splat (i8 16)
-; SLOW-NEXT: Cost Model: Found an estimated cost of 56 for instruction: %V32i8 = sdiv <32 x i8> poison, splat (i8 16)
-; SLOW-NEXT: Cost Model: Found an estimated cost of 112 for instruction: %V64i8 = sdiv <64 x i8> poison, splat (i8 16)
+; SLOW-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %V16i8 = sdiv <16 x i8> poison, splat (i8 16)
+; SLOW-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %V32i8 = sdiv <32 x i8> poison, splat (i8 16)
+; SLOW-NEXT: Cost Model: Found an estimated cost of 128 for instruction: %V64i8 = sdiv <64 x i8> poison, splat (i8 16)
; SLOW-NEXT: Cost Model: Found an estimated cost of 10 for instruction: ret i32 poison
;
; ALL-SIZE-LABEL: 'sdiv_uniformconstpow2'
@@ -773,9 +773,9 @@ define i32 @udiv_uniformconstpow2() {
; SLOW-NEXT: Cost Model: Found an estimated cost of 32 for instruction: %V16i16 = udiv <16 x i16> poison, splat (i16 16)
; SLOW-NEXT: Cost Model: Found an estimated cost of 64 for instruction: %V32i16 = udiv <32 x i16> poison, splat (i16 16)
; SLOW-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %I8 = udiv i8 poison, 16
-; SLOW-NEXT: Cost Model: Found an estimated cost of 28 for instruction: %V16i8 = udiv <16 x i8> poison, splat (i8 16)
-; SLOW-NEXT: Cost Model: Found an estimated cost of 56 for instruction: %V32i8 = udiv <32 x i8> poison, splat...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/203932
More information about the llvm-commits
mailing list