1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=slp-vectorizer,instcombine -S -slp-revec -slp-max-reg-size=1024 -slp-threshold=-100 %s | FileCheck %s
4 define void @test1(ptr %in, ptr %out) {
7 ; CHECK-NEXT: [[TMP0:%.*]] = load <8 x i32>, ptr [[IN:%.*]], align 1
8 ; CHECK-NEXT: [[TMP1:%.*]] = zext <8 x i32> [[TMP0]] to <8 x i64>
9 ; CHECK-NEXT: store <8 x i64> [[TMP1]], ptr [[OUT:%.*]], align 8
10 ; CHECK-NEXT: ret void
13 %0 = load <8 x i32>, ptr %in, align 1
14 %1 = shufflevector <8 x i32> %0, <8 x i32> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
15 %2 = shufflevector <8 x i32> %0, <8 x i32> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
16 %3 = zext <4 x i32> %1 to <4 x i64>
17 %4 = zext <4 x i32> %2 to <4 x i64>
18 %5 = shufflevector <4 x i64> %3, <4 x i64> poison, <2 x i32> <i32 0, i32 1>
19 %6 = shufflevector <4 x i64> %3, <4 x i64> poison, <2 x i32> <i32 2, i32 3>
20 %7 = shufflevector <4 x i64> %4, <4 x i64> poison, <2 x i32> <i32 0, i32 1>
21 %8 = shufflevector <4 x i64> %4, <4 x i64> poison, <2 x i32> <i32 2, i32 3>
22 %9 = getelementptr inbounds i64, ptr %out, i64 0
23 %10 = getelementptr inbounds i64, ptr %out, i64 2
24 %11 = getelementptr inbounds i64, ptr %out, i64 4
25 %12 = getelementptr inbounds i64, ptr %out, i64 6
26 store <2 x i64> %5, ptr %9, align 8
27 store <2 x i64> %6, ptr %10, align 8
28 store <2 x i64> %7, ptr %11, align 8
29 store <2 x i64> %8, ptr %12, align 8
33 define void @test2(ptr %in, ptr %out) {
34 ; CHECK-LABEL: @test2(
36 ; CHECK-NEXT: [[TMP0:%.*]] = load <8 x i32>, ptr [[IN:%.*]], align 1
37 ; CHECK-NEXT: [[TMP1:%.*]] = zext <8 x i32> [[TMP0]] to <8 x i64>
38 ; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <8 x i64> [[TMP1]], <8 x i64> poison, <8 x i32> <i32 2, i32 3, i32 0, i32 1, i32 4, i32 5, i32 6, i32 7>
39 ; CHECK-NEXT: store <8 x i64> [[TMP2]], ptr [[OUT:%.*]], align 8
40 ; CHECK-NEXT: ret void
43 %0 = load <8 x i32>, ptr %in, align 1
44 %1 = shufflevector <8 x i32> %0, <8 x i32> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
45 %2 = shufflevector <8 x i32> %0, <8 x i32> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
46 %3 = zext <4 x i32> %1 to <4 x i64>
47 %4 = zext <4 x i32> %2 to <4 x i64>
48 %5 = shufflevector <4 x i64> %3, <4 x i64> poison, <2 x i32> <i32 2, i32 3>
49 %6 = shufflevector <4 x i64> %3, <4 x i64> poison, <2 x i32> <i32 0, i32 1>
50 %7 = shufflevector <4 x i64> %4, <4 x i64> poison, <2 x i32> <i32 0, i32 1>
51 %8 = shufflevector <4 x i64> %4, <4 x i64> poison, <2 x i32> <i32 2, i32 3>
52 %9 = getelementptr inbounds i64, ptr %out, i64 0
53 %10 = getelementptr inbounds i64, ptr %out, i64 2
54 %11 = getelementptr inbounds i64, ptr %out, i64 4
55 %12 = getelementptr inbounds i64, ptr %out, i64 6
56 store <2 x i64> %5, ptr %9, align 8
57 store <2 x i64> %6, ptr %10, align 8
58 store <2 x i64> %7, ptr %11, align 8
59 store <2 x i64> %8, ptr %12, align 8
63 define void @test3(<16 x i32> %0, ptr %out) {
64 ; CHECK-LABEL: @test3(
66 ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <16 x i32> [[TMP0:%.*]], <16 x i32> poison, <16 x i32> <i32 12, i32 13, i32 14, i32 15, i32 8, i32 9, i32 10, i32 11, i32 4, i32 5, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3>
67 ; CHECK-NEXT: store <16 x i32> [[TMP1]], ptr [[OUT:%.*]], align 4
68 ; CHECK-NEXT: ret void
71 %1 = shufflevector <16 x i32> %0, <16 x i32> poison, <4 x i32> <i32 12, i32 13, i32 14, i32 15>
72 %2 = shufflevector <16 x i32> %0, <16 x i32> poison, <4 x i32> <i32 8, i32 9, i32 10, i32 11>
73 %3 = shufflevector <16 x i32> %0, <16 x i32> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
74 %4 = shufflevector <16 x i32> %0, <16 x i32> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
75 %5 = getelementptr inbounds i32, ptr %out, i64 0
76 %6 = getelementptr inbounds i32, ptr %out, i64 4
77 %7 = getelementptr inbounds i32, ptr %out, i64 8
78 %8 = getelementptr inbounds i32, ptr %out, i64 12
79 store <4 x i32> %1, ptr %5, align 4
80 store <4 x i32> %2, ptr %6, align 4
81 store <4 x i32> %3, ptr %7, align 4
82 store <4 x i32> %4, ptr %8, align 4
86 define void @test4(ptr %in, ptr %out) {
87 ; CHECK-LABEL: @test4(
89 ; CHECK-NEXT: [[TMP0:%.*]] = load <8 x i32>, ptr [[IN:%.*]], align 4
90 ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <8 x i32> [[TMP0]], <8 x i32> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
91 ; CHECK-NEXT: store <16 x i32> [[TMP1]], ptr [[OUT:%.*]], align 4
92 ; CHECK-NEXT: ret void
95 %0 = load <8 x i32>, ptr %in, align 4
96 %1 = shufflevector <8 x i32> %0, <8 x i32> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
97 %2 = shufflevector <8 x i32> %0, <8 x i32> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
98 %3 = getelementptr inbounds i32, ptr %out, i64 0
99 %4 = getelementptr inbounds i32, ptr %out, i64 4
100 %5 = getelementptr inbounds i32, ptr %out, i64 8
101 %6 = getelementptr inbounds i32, ptr %out, i64 12
102 store <4 x i32> %1, ptr %3, align 4
103 store <4 x i32> %2, ptr %4, align 4
104 store <4 x i32> %1, ptr %5, align 4
105 store <4 x i32> %2, ptr %6, align 4
109 define void @test5(ptr %out) {
110 ; CHECK-LABEL: @test5(
112 ; CHECK-NEXT: store <8 x i32> zeroinitializer, ptr [[OUT:%.*]], align 4
113 ; CHECK-NEXT: ret void
116 %0 = shufflevector <8 x i32> zeroinitializer, <8 x i32> poison, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
117 %1 = shufflevector <8 x i32> zeroinitializer, <8 x i32> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
118 %2 = getelementptr inbounds i32, ptr %out, i64 0
119 %3 = getelementptr inbounds i32, ptr %out, i64 4
120 store <4 x i32> %0, ptr %2, align 4
121 store <4 x i32> %1, ptr %3, align 4