[llvm] 46bbd25 - [SLP][NFC]Add a test for broadcast cost with undefs, NFC.

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 15 06:01:53 PST 2021


Author: Alexey Bataev
Date: 2021-12-15T05:58:47-08:00
New Revision: 46bbd254c1c6d5619afd739e396aca1a717c87cc

URL: https://github.com/llvm/llvm-project/commit/46bbd254c1c6d5619afd739e396aca1a717c87cc
DIFF: https://github.com/llvm/llvm-project/commit/46bbd254c1c6d5619afd739e396aca1a717c87cc.diff

LOG: [SLP][NFC]Add a test for broadcast cost with undefs, NFC.

Added: 
    llvm/test/Transforms/SLPVectorizer/X86/broadcast_long.ll

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/SLPVectorizer/X86/broadcast_long.ll b/llvm/test/Transforms/SLPVectorizer/X86/broadcast_long.ll
new file mode 100644
index 000000000000..290edbeeaf46
--- /dev/null
+++ b/llvm/test/Transforms/SLPVectorizer/X86/broadcast_long.ll
@@ -0,0 +1,54 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -slp-vectorizer -S -mtriple=x86_64-unknown-linux -mcpu=corei7-avx -pass-remarks-output=%t < %s | FileCheck %s
+; RUN: FileCheck %s --input-file=%t --check-prefix=YAML
+
+; YAML-LABEL: --- !Passed
+; YAML-NEXT: Pass:            slp-vectorizer
+; YAML-NEXT: Name:            StoresVectorized
+; YAML-NEXT: Function:        bcast_long
+; YAML-NEXT: Args:
+; YAML-NEXT:  - String:          'Stores SLP vectorized with cost '
+; YAML-NEXT:  - Cost:            '-5'
+; YAML-NEXT:  - String:          ' and with tree size '
+; YAML-NEXT:  - TreeSize:        '2'
+
+define void @bcast_long(i32 *%A, i32 *%S) {
+; CHECK-LABEL: @bcast_long(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    [[A0:%.*]] = load i32, i32* [[A:%.*]], align 8
+; CHECK-NEXT:    [[IDXS0:%.*]] = getelementptr inbounds i32, i32* [[S:%.*]], i64 0
+; CHECK-NEXT:    [[IDXS1:%.*]] = getelementptr inbounds i32, i32* [[S]], i64 1
+; CHECK-NEXT:    [[IDXS2:%.*]] = getelementptr inbounds i32, i32* [[S]], i64 2
+; CHECK-NEXT:    [[IDXS3:%.*]] = getelementptr inbounds i32, i32* [[S]], i64 3
+; CHECK-NEXT:    [[IDXS4:%.*]] = getelementptr inbounds i32, i32* [[S]], i64 4
+; CHECK-NEXT:    [[IDXS5:%.*]] = getelementptr inbounds i32, i32* [[S]], i64 5
+; CHECK-NEXT:    [[IDXS6:%.*]] = getelementptr inbounds i32, i32* [[S]], i64 6
+; CHECK-NEXT:    [[IDXS7:%.*]] = getelementptr inbounds i32, i32* [[S]], i64 7
+; CHECK-NEXT:    [[TMP0:%.*]] = insertelement <8 x i32> poison, i32 [[A0]], i32 0
+; CHECK-NEXT:    [[SHUFFLE:%.*]] = shufflevector <8 x i32> [[TMP0]], <8 x i32> poison, <8 x i32> <i32 0, i32 0, i32 undef, i32 0, i32 0, i32 0, i32 0, i32 0>
+; CHECK-NEXT:    [[TMP1:%.*]] = bitcast i32* [[IDXS0]] to <8 x i32>*
+; CHECK-NEXT:    store <8 x i32> [[SHUFFLE]], <8 x i32>* [[TMP1]], align 8
+; CHECK-NEXT:    ret void
+;
+entry:
+  %A0 = load i32, i32 *%A, align 8
+
+  %idxS0 = getelementptr inbounds i32, i32* %S, i64 0
+  %idxS1 = getelementptr inbounds i32, i32* %S, i64 1
+  %idxS2 = getelementptr inbounds i32, i32* %S, i64 2
+  %idxS3 = getelementptr inbounds i32, i32* %S, i64 3
+  %idxS4 = getelementptr inbounds i32, i32* %S, i64 4
+  %idxS5 = getelementptr inbounds i32, i32* %S, i64 5
+  %idxS6 = getelementptr inbounds i32, i32* %S, i64 6
+  %idxS7 = getelementptr inbounds i32, i32* %S, i64 7
+
+  store i32 %A0, i32 *%idxS0, align 8
+  store i32 %A0, i32 *%idxS1, align 8
+  store i32 undef, i32 *%idxS2, align 8
+  store i32 %A0, i32 *%idxS3, align 8
+  store i32 %A0, i32 *%idxS4, align 8
+  store i32 %A0, i32 *%idxS5, align 8
+  store i32 %A0, i32 *%idxS6, align 8
+  store i32 %A0, i32 *%idxS7, align 8
+  ret void
+}


        


More information about the llvm-commits mailing list