[llvm] [SLP][NFC]Add a test with the masked non-power-of-2 stores, NFC (PR #207275)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 2 13:46:33 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Alexey Bataev (alexey-bataev)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/207275.diff
1 Files Affected:
- (added) llvm/test/Transforms/SLPVectorizer/X86/store-expand-non-pow2.ll (+24)
``````````diff
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/store-expand-non-pow2.ll b/llvm/test/Transforms/SLPVectorizer/X86/store-expand-non-pow2.ll
new file mode 100644
index 0000000000000..5196bf5cca882
--- /dev/null
+++ b/llvm/test/Transforms/SLPVectorizer/X86/store-expand-non-pow2.ll
@@ -0,0 +1,24 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
+; RUN: opt -mtriple=x86_64-apple-macosx10.8.0 -mcpu=skylake-avx512 -passes=slp-vectorizer -S -slp-vectorize-non-power-of-2 %s | FileCheck %s
+; RUN: opt -mtriple=x86_64-apple-macosx10.8.0 -mcpu=skylake-avx512 -passes=slp-vectorizer -slp-enable-masked-stores=false -slp-vectorize-non-power-of-2 -S %s | FileCheck %s
+
+; A tight (gap-free), non-power-of-2 run of 3 consecutive stores. On AVX512 a
+; direct <3 x float> vector store is more expensive than a masked store of the
+; next full width (<4 x float>) with the last lane disabled
+define void @test_v4f32_v3f32_store(<4 x float> %f, ptr %p) {
+; CHECK-LABEL: define void @test_v4f32_v3f32_store(
+; CHECK-SAME: <4 x float> [[F:%.*]], ptr [[P:%.*]]) #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <4 x float> [[F]], <4 x float> poison, <3 x i32> <i32 0, i32 1, i32 2>
+; CHECK-NEXT: store <3 x float> [[TMP1]], ptr [[P]], align 4
+; CHECK-NEXT: ret void
+;
+ %x0 = extractelement <4 x float> %f, i64 0
+ %x1 = extractelement <4 x float> %f, i64 1
+ %x2 = extractelement <4 x float> %f, i64 2
+ %p1 = getelementptr inbounds float, ptr %p, i64 1
+ %p2 = getelementptr inbounds float, ptr %p, i64 2
+ store float %x0, ptr %p, align 4
+ store float %x1, ptr %p1, align 4
+ store float %x2, ptr %p2, align 4
+ ret void
+}
``````````
</details>
https://github.com/llvm/llvm-project/pull/207275
More information about the llvm-commits
mailing list