1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -slp-vectorizer -S -mtriple=x86_64-unknown-linux -mcpu=corei7-avx -pass-remarks-output=%t < %s | FileCheck %s
3; RUN: FileCheck %s --input-file=%t --check-prefix=YAML
4
5; YAML-LABEL: --- !Passed
6; YAML-NEXT: Pass:            slp-vectorizer
7; YAML-NEXT: Name:            StoresVectorized
8; YAML-NEXT: Function:        bcast_long
9; YAML-NEXT: Args:
10; YAML-NEXT:  - String:          'Stores SLP vectorized with cost '
11; YAML-NEXT:  - Cost:            '-4'
12; YAML-NEXT:  - String:          ' and with tree size '
13; YAML-NEXT:  - TreeSize:        '2'
14
15define void @bcast_long(i32 *%A, i32 *%S) {
16; CHECK-LABEL: @bcast_long(
17; CHECK-NEXT:  entry:
18; CHECK-NEXT:    [[A0:%.*]] = load i32, i32* [[A:%.*]], align 8
19; CHECK-NEXT:    [[IDXS0:%.*]] = getelementptr inbounds i32, i32* [[S:%.*]], i64 0
20; CHECK-NEXT:    [[TMP0:%.*]] = insertelement <8 x i32> poison, i32 [[A0]], i32 0
21; 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>
22; CHECK-NEXT:    [[TMP1:%.*]] = bitcast i32* [[IDXS0]] to <8 x i32>*
23; CHECK-NEXT:    store <8 x i32> [[SHUFFLE]], <8 x i32>* [[TMP1]], align 8
24; CHECK-NEXT:    ret void
25;
26entry:
27  %A0 = load i32, i32 *%A, align 8
28
29  %idxS0 = getelementptr inbounds i32, i32* %S, i64 0
30  %idxS1 = getelementptr inbounds i32, i32* %S, i64 1
31  %idxS2 = getelementptr inbounds i32, i32* %S, i64 2
32  %idxS3 = getelementptr inbounds i32, i32* %S, i64 3
33  %idxS4 = getelementptr inbounds i32, i32* %S, i64 4
34  %idxS5 = getelementptr inbounds i32, i32* %S, i64 5
35  %idxS6 = getelementptr inbounds i32, i32* %S, i64 6
36  %idxS7 = getelementptr inbounds i32, i32* %S, i64 7
37
38  store i32 %A0, i32 *%idxS0, align 8
39  store i32 %A0, i32 *%idxS1, align 8
40  store i32 undef, i32 *%idxS2, align 8
41  store i32 %A0, i32 *%idxS3, align 8
42  store i32 %A0, i32 *%idxS4, align 8
43  store i32 %A0, i32 *%idxS5, align 8
44  store i32 %A0, i32 *%idxS6, align 8
45  store i32 %A0, i32 *%idxS7, align 8
46  ret void
47}
48