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: '-7'
12 ; YAML-NEXT: - String: ' and with tree size '
13 ; YAML-NEXT: - TreeSize: '5'
15 define void @test(ptr noalias %p, ptr noalias %p1) {
18 ; CHECK-NEXT: [[I:%.*]] = load i32, ptr [[P:%.*]], align 4
19 ; CHECK-NEXT: [[ARRAYIDX4:%.*]] = getelementptr i32, ptr [[P]], i64 32
20 ; CHECK-NEXT: [[I2:%.*]] = load i32, ptr [[ARRAYIDX4]], align 4
21 ; CHECK-NEXT: [[ARRAYIDX11:%.*]] = getelementptr i32, ptr [[P]], i64 33
22 ; CHECK-NEXT: [[TMP0:%.*]] = load <2 x i32>, ptr [[ARRAYIDX11]], align 4
23 ; CHECK-NEXT: [[TMP1:%.*]] = load <4 x i32>, ptr [[P]], align 4
24 ; CHECK-NEXT: [[TMP2:%.*]] = insertelement <4 x i32> poison, i32 [[I]], i32 0
25 ; CHECK-NEXT: [[TMP3:%.*]] = insertelement <4 x i32> [[TMP2]], i32 [[I2]], i32 1
26 ; CHECK-NEXT: [[TMP4:%.*]] = call <4 x i32> @llvm.vector.insert.v4i32.v2i32(<4 x i32> [[TMP3]], <2 x i32> [[TMP0]], i64 2)
27 ; CHECK-NEXT: [[TMP5:%.*]] = add nsw <4 x i32> [[TMP4]], [[TMP1]]
28 ; CHECK-NEXT: store <4 x i32> [[TMP5]], ptr [[P1:%.*]], align 4
29 ; CHECK-NEXT: ret void
32 %i = load i32, ptr %p, align 4
33 %i1 = load i32, ptr %p, align 4
34 %add = add nsw i32 %i, %i1
35 store i32 %add, ptr %p1, align 4
36 %arrayidx4 = getelementptr i32, ptr %p, i64 32
37 %i2 = load i32, ptr %arrayidx4, align 4
38 %arrayidx6 = getelementptr i32, ptr %p, i64 1
39 %i3 = load i32, ptr %arrayidx6, align 4
40 %add7 = add nsw i32 %i2, %i3
41 %arrayidx9 = getelementptr i32, ptr %p1, i64 1
42 store i32 %add7, ptr %arrayidx9, align 4
43 %arrayidx11 = getelementptr i32, ptr %p, i64 33
44 %i4 = load i32, ptr %arrayidx11, align 4
45 %arrayidx13 = getelementptr i32, ptr %p, i64 2
46 %i5 = load i32, ptr %arrayidx13, align 4
47 %add14 = add nsw i32 %i4, %i5
48 %arrayidx16 = getelementptr i32, ptr %p1, i64 2
49 store i32 %add14, ptr %arrayidx16, align 4
50 %arrayidx18 = getelementptr i32, ptr %p, i64 34
51 %i6 = load i32, ptr %arrayidx18, align 4
52 %arrayidx19 = getelementptr i32, ptr %p, i64 3
53 %i7 = load i32, ptr %arrayidx19, align 4
54 %add21 = add nsw i32 %i6, %i7
55 %arrayidx23 = getelementptr i32, ptr %p1, i64 3
56 store i32 %add21, ptr %arrayidx23, align 4