1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=slp-vectorizer -S -mtriple=x86_64-unknown-linux-gnu -mcpu=skylake-avx512 -pass-remarks-output=%t | FileCheck %s
3 ; RUN: FileCheck --input-file=%t --check-prefix=YAML %s
5 ; YAML-LABEL: --- !Passed
6 ; YAML-NEXT: Pass: slp-vectorizer
7 ; YAML-NEXT: Name: StoresVectorized
8 ; YAML-NEXT: Function: test
10 ; YAML-NEXT: - String: 'Stores SLP vectorized with cost '
11 ; YAML-NEXT: - Cost: '-5'
12 ; YAML-NEXT: - String: ' and with tree size '
13 ; YAML-NEXT: - TreeSize: '7'
15 define void @test(ptr noalias %p, ptr noalias %p1) {
18 ; CHECK-NEXT: [[TMP0:%.*]] = insertelement <4 x ptr> poison, ptr [[P:%.*]], i32 0
19 ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <4 x ptr> [[TMP0]], <4 x ptr> poison, <4 x i32> zeroinitializer
20 ; CHECK-NEXT: [[TMP2:%.*]] = getelementptr i32, <4 x ptr> [[TMP1]], <4 x i64> <i64 0, i64 32, i64 33, i64 34>
21 ; CHECK-NEXT: [[TMP3:%.*]] = call <4 x i32> @llvm.masked.gather.v4i32.v4p0(<4 x ptr> [[TMP2]], i32 4, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i32> poison)
22 ; CHECK-NEXT: [[TMP4:%.*]] = load <4 x i32>, ptr [[P]], align 4
23 ; CHECK-NEXT: [[TMP5:%.*]] = add nsw <4 x i32> [[TMP3]], [[TMP4]]
24 ; CHECK-NEXT: store <4 x i32> [[TMP5]], ptr [[P1:%.*]], align 4
25 ; CHECK-NEXT: ret void
28 %i = load i32, ptr %p, align 4
29 %i1 = load i32, ptr %p, align 4
30 %add = add nsw i32 %i, %i1
31 store i32 %add, ptr %p1, align 4
32 %arrayidx4 = getelementptr i32, ptr %p, i64 32
33 %i2 = load i32, ptr %arrayidx4, align 4
34 %arrayidx6 = getelementptr i32, ptr %p, i64 1
35 %i3 = load i32, ptr %arrayidx6, align 4
36 %add7 = add nsw i32 %i2, %i3
37 %arrayidx9 = getelementptr i32, ptr %p1, i64 1
38 store i32 %add7, ptr %arrayidx9, align 4
39 %arrayidx11 = getelementptr i32, ptr %p, i64 33
40 %i4 = load i32, ptr %arrayidx11, align 4
41 %arrayidx13 = getelementptr i32, ptr %p, i64 2
42 %i5 = load i32, ptr %arrayidx13, align 4
43 %add14 = add nsw i32 %i4, %i5
44 %arrayidx16 = getelementptr i32, ptr %p1, i64 2
45 store i32 %add14, ptr %arrayidx16, align 4
46 %arrayidx18 = getelementptr i32, ptr %p, i64 34
47 %i6 = load i32, ptr %arrayidx18, align 4
48 %arrayidx19 = getelementptr i32, ptr %p, i64 3
49 %i7 = load i32, ptr %arrayidx19, align 4
50 %add21 = add nsw i32 %i6, %i7
51 %arrayidx23 = getelementptr i32, ptr %p1, i64 3
52 store i32 %add21, ptr %arrayidx23, align 4