1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -slp-vectorizer -slp-vectorize-hor -slp-vectorize-hor-store -S < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=bdver2 | FileCheck %s
4 define void @i64_simplified(i64* noalias %st, i64* noalias %ld) {
5 ; CHECK-LABEL: @i64_simplified(
6 ; CHECK-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds i64, i64* [[LD:%.*]], i64 1
7 ; CHECK-NEXT: [[TMP1:%.*]] = bitcast i64* [[LD]] to <2 x i64>*
8 ; CHECK-NEXT: [[TMP2:%.*]] = load <2 x i64>, <2 x i64>* [[TMP1]], align 8
9 ; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <2 x i64> [[TMP2]], <2 x i64> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
10 ; CHECK-NEXT: [[ARRAYIDX3:%.*]] = getelementptr inbounds i64, i64* [[ST:%.*]], i64 1
11 ; CHECK-NEXT: [[ARRAYIDX4:%.*]] = getelementptr inbounds i64, i64* [[ST]], i64 2
12 ; CHECK-NEXT: [[ARRAYIDX5:%.*]] = getelementptr inbounds i64, i64* [[ST]], i64 3
13 ; CHECK-NEXT: [[TMP3:%.*]] = bitcast i64* [[ST]] to <4 x i64>*
14 ; CHECK-NEXT: store <4 x i64> [[SHUFFLE]], <4 x i64>* [[TMP3]], align 8
15 ; CHECK-NEXT: ret void
17 %arrayidx1 = getelementptr inbounds i64, i64* %ld, i64 1
19 %t0 = load i64, i64* %ld, align 8
20 %t1 = load i64, i64* %arrayidx1, align 8
22 %arrayidx3 = getelementptr inbounds i64, i64* %st, i64 1
23 %arrayidx4 = getelementptr inbounds i64, i64* %st, i64 2
24 %arrayidx5 = getelementptr inbounds i64, i64* %st, i64 3
26 store i64 %t0, i64* %st, align 8
27 store i64 %t1, i64* %arrayidx3, align 8
28 store i64 %t0, i64* %arrayidx4, align 8
29 store i64 %t1, i64* %arrayidx5, align 8
33 define void @i64_simplifiedi_reversed(i64* noalias %st, i64* noalias %ld) {
34 ; CHECK-LABEL: @i64_simplifiedi_reversed(
35 ; CHECK-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds i64, i64* [[LD:%.*]], i64 1
36 ; CHECK-NEXT: [[TMP1:%.*]] = bitcast i64* [[LD]] to <2 x i64>*
37 ; CHECK-NEXT: [[TMP2:%.*]] = load <2 x i64>, <2 x i64>* [[TMP1]], align 8
38 ; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <2 x i64> [[TMP2]], <2 x i64> poison, <4 x i32> <i32 1, i32 0, i32 1, i32 0>
39 ; CHECK-NEXT: [[ARRAYIDX3:%.*]] = getelementptr inbounds i64, i64* [[ST:%.*]], i64 1
40 ; CHECK-NEXT: [[ARRAYIDX4:%.*]] = getelementptr inbounds i64, i64* [[ST]], i64 2
41 ; CHECK-NEXT: [[ARRAYIDX5:%.*]] = getelementptr inbounds i64, i64* [[ST]], i64 3
42 ; CHECK-NEXT: [[TMP3:%.*]] = bitcast i64* [[ST]] to <4 x i64>*
43 ; CHECK-NEXT: store <4 x i64> [[SHUFFLE]], <4 x i64>* [[TMP3]], align 8
44 ; CHECK-NEXT: ret void
46 %arrayidx1 = getelementptr inbounds i64, i64* %ld, i64 1
48 %t0 = load i64, i64* %ld, align 8
49 %t1 = load i64, i64* %arrayidx1, align 8
51 %arrayidx3 = getelementptr inbounds i64, i64* %st, i64 1
52 %arrayidx4 = getelementptr inbounds i64, i64* %st, i64 2
53 %arrayidx5 = getelementptr inbounds i64, i64* %st, i64 3
55 store i64 %t1, i64* %st, align 8
56 store i64 %t0, i64* %arrayidx3, align 8
57 store i64 %t1, i64* %arrayidx4, align 8
58 store i64 %t0, i64* %arrayidx5, align 8
62 define void @i64_simplifiedi_extract(i64* noalias %st, i64* noalias %ld) {
63 ; CHECK-LABEL: @i64_simplifiedi_extract(
64 ; CHECK-NEXT: [[ARRAYIDX1:%.*]] = getelementptr inbounds i64, i64* [[LD:%.*]], i64 1
65 ; CHECK-NEXT: [[TMP1:%.*]] = bitcast i64* [[LD]] to <2 x i64>*
66 ; CHECK-NEXT: [[TMP2:%.*]] = load <2 x i64>, <2 x i64>* [[TMP1]], align 8
67 ; CHECK-NEXT: [[SHUFFLE:%.*]] = shufflevector <2 x i64> [[TMP2]], <2 x i64> poison, <4 x i32> <i32 0, i32 0, i32 0, i32 1>
68 ; CHECK-NEXT: [[ARRAYIDX3:%.*]] = getelementptr inbounds i64, i64* [[ST:%.*]], i64 1
69 ; CHECK-NEXT: [[ARRAYIDX4:%.*]] = getelementptr inbounds i64, i64* [[ST]], i64 2
70 ; CHECK-NEXT: [[ARRAYIDX5:%.*]] = getelementptr inbounds i64, i64* [[ST]], i64 3
71 ; CHECK-NEXT: [[TMP3:%.*]] = bitcast i64* [[ST]] to <4 x i64>*
72 ; CHECK-NEXT: store <4 x i64> [[SHUFFLE]], <4 x i64>* [[TMP3]], align 8
73 ; CHECK-NEXT: [[TMP4:%.*]] = extractelement <4 x i64> [[SHUFFLE]], i32 3
74 ; CHECK-NEXT: store i64 [[TMP4]], i64* [[LD]], align 8
75 ; CHECK-NEXT: ret void
77 %arrayidx1 = getelementptr inbounds i64, i64* %ld, i64 1
79 %t0 = load i64, i64* %ld, align 8
80 %t1 = load i64, i64* %arrayidx1, align 8
82 %arrayidx3 = getelementptr inbounds i64, i64* %st, i64 1
83 %arrayidx4 = getelementptr inbounds i64, i64* %st, i64 2
84 %arrayidx5 = getelementptr inbounds i64, i64* %st, i64 3
86 store i64 %t0, i64* %st, align 8
87 store i64 %t0, i64* %arrayidx3, align 8
88 store i64 %t0, i64* %arrayidx4, align 8
89 store i64 %t1, i64* %arrayidx5, align 8
90 store i64 %t1, i64* %ld, align 8