1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -slp-vectorizer -S | FileCheck %s --check-prefix=DEFAULT
3 ; RUN: opt < %s -slp-schedule-budget=0 -slp-min-tree-size=0 -slp-threshold=-30 -slp-vectorizer -S | FileCheck %s --check-prefix=GATHER
4 ; RUN: opt < %s -slp-schedule-budget=0 -slp-threshold=-30 -slp-vectorizer -S | FileCheck %s --check-prefix=MAX-COST
6 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
7 target triple = "aarch64--linux-gnu"
9 @a = common global [80 x i8] zeroinitializer, align 16
11 define void @PR28330(i32 %n) {
12 ; DEFAULT-LABEL: @PR28330(
13 ; DEFAULT-NEXT: entry:
14 ; DEFAULT-NEXT: [[TMP0:%.*]] = load <8 x i8>, <8 x i8>* bitcast (i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 1) to <8 x i8>*), align 1
15 ; DEFAULT-NEXT: [[TMP1:%.*]] = icmp eq <8 x i8> [[TMP0]], zeroinitializer
16 ; DEFAULT-NEXT: br label [[FOR_BODY:%.*]]
18 ; DEFAULT-NEXT: [[P17:%.*]] = phi i32 [ [[OP_EXTRA:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]
19 ; DEFAULT-NEXT: [[TMP2:%.*]] = select <8 x i1> [[TMP1]], <8 x i32> <i32 -720, i32 -720, i32 -720, i32 -720, i32 -720, i32 -720, i32 -720, i32 -720>, <8 x i32> <i32 -80, i32 -80, i32 -80, i32 -80, i32 -80, i32 -80, i32 -80, i32 -80>
20 ; DEFAULT-NEXT: [[P20:%.*]] = add i32 [[P17]], undef
21 ; DEFAULT-NEXT: [[P22:%.*]] = add i32 [[P20]], undef
22 ; DEFAULT-NEXT: [[P24:%.*]] = add i32 [[P22]], undef
23 ; DEFAULT-NEXT: [[P26:%.*]] = add i32 [[P24]], undef
24 ; DEFAULT-NEXT: [[P28:%.*]] = add i32 [[P26]], undef
25 ; DEFAULT-NEXT: [[P30:%.*]] = add i32 [[P28]], undef
26 ; DEFAULT-NEXT: [[P32:%.*]] = add i32 [[P30]], undef
27 ; DEFAULT-NEXT: [[TMP3:%.*]] = call i32 @llvm.experimental.vector.reduce.add.v8i32(<8 x i32> [[TMP2]])
28 ; DEFAULT-NEXT: [[OP_EXTRA]] = add i32 [[TMP3]], [[P17]]
29 ; DEFAULT-NEXT: [[P34:%.*]] = add i32 [[P32]], undef
30 ; DEFAULT-NEXT: br label [[FOR_BODY]]
32 ; GATHER-LABEL: @PR28330(
34 ; GATHER-NEXT: [[TMP0:%.*]] = load <8 x i8>, <8 x i8>* bitcast (i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 1) to <8 x i8>*), align 1
35 ; GATHER-NEXT: [[TMP1:%.*]] = icmp eq <8 x i8> [[TMP0]], zeroinitializer
36 ; GATHER-NEXT: br label [[FOR_BODY:%.*]]
38 ; GATHER-NEXT: [[P17:%.*]] = phi i32 [ [[OP_EXTRA:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]
39 ; GATHER-NEXT: [[TMP2:%.*]] = extractelement <8 x i1> [[TMP1]], i32 0
40 ; GATHER-NEXT: [[TMP3:%.*]] = insertelement <8 x i1> undef, i1 [[TMP2]], i32 0
41 ; GATHER-NEXT: [[TMP4:%.*]] = extractelement <8 x i1> [[TMP1]], i32 1
42 ; GATHER-NEXT: [[TMP5:%.*]] = insertelement <8 x i1> [[TMP3]], i1 [[TMP4]], i32 1
43 ; GATHER-NEXT: [[TMP6:%.*]] = extractelement <8 x i1> [[TMP1]], i32 2
44 ; GATHER-NEXT: [[TMP7:%.*]] = insertelement <8 x i1> [[TMP5]], i1 [[TMP6]], i32 2
45 ; GATHER-NEXT: [[TMP8:%.*]] = extractelement <8 x i1> [[TMP1]], i32 3
46 ; GATHER-NEXT: [[TMP9:%.*]] = insertelement <8 x i1> [[TMP7]], i1 [[TMP8]], i32 3
47 ; GATHER-NEXT: [[TMP10:%.*]] = extractelement <8 x i1> [[TMP1]], i32 4
48 ; GATHER-NEXT: [[TMP11:%.*]] = insertelement <8 x i1> [[TMP9]], i1 [[TMP10]], i32 4
49 ; GATHER-NEXT: [[TMP12:%.*]] = extractelement <8 x i1> [[TMP1]], i32 5
50 ; GATHER-NEXT: [[TMP13:%.*]] = insertelement <8 x i1> [[TMP11]], i1 [[TMP12]], i32 5
51 ; GATHER-NEXT: [[TMP14:%.*]] = extractelement <8 x i1> [[TMP1]], i32 6
52 ; GATHER-NEXT: [[TMP15:%.*]] = insertelement <8 x i1> [[TMP13]], i1 [[TMP14]], i32 6
53 ; GATHER-NEXT: [[TMP16:%.*]] = extractelement <8 x i1> [[TMP1]], i32 7
54 ; GATHER-NEXT: [[TMP17:%.*]] = insertelement <8 x i1> [[TMP15]], i1 [[TMP16]], i32 7
55 ; GATHER-NEXT: [[TMP18:%.*]] = select <8 x i1> [[TMP17]], <8 x i32> <i32 -720, i32 -720, i32 -720, i32 -720, i32 -720, i32 -720, i32 -720, i32 -720>, <8 x i32> <i32 -80, i32 -80, i32 -80, i32 -80, i32 -80, i32 -80, i32 -80, i32 -80>
56 ; GATHER-NEXT: [[TMP19:%.*]] = extractelement <8 x i32> [[TMP18]], i32 0
57 ; GATHER-NEXT: [[P20:%.*]] = add i32 [[P17]], [[TMP19]]
58 ; GATHER-NEXT: [[TMP20:%.*]] = extractelement <8 x i32> [[TMP18]], i32 1
59 ; GATHER-NEXT: [[P22:%.*]] = add i32 [[P20]], [[TMP20]]
60 ; GATHER-NEXT: [[TMP21:%.*]] = extractelement <8 x i32> [[TMP18]], i32 2
61 ; GATHER-NEXT: [[P24:%.*]] = add i32 [[P22]], [[TMP21]]
62 ; GATHER-NEXT: [[TMP22:%.*]] = extractelement <8 x i32> [[TMP18]], i32 3
63 ; GATHER-NEXT: [[P26:%.*]] = add i32 [[P24]], [[TMP22]]
64 ; GATHER-NEXT: [[TMP23:%.*]] = extractelement <8 x i32> [[TMP18]], i32 4
65 ; GATHER-NEXT: [[P28:%.*]] = add i32 [[P26]], [[TMP23]]
66 ; GATHER-NEXT: [[TMP24:%.*]] = extractelement <8 x i32> [[TMP18]], i32 5
67 ; GATHER-NEXT: [[P30:%.*]] = add i32 [[P28]], [[TMP24]]
68 ; GATHER-NEXT: [[TMP25:%.*]] = extractelement <8 x i32> [[TMP18]], i32 6
69 ; GATHER-NEXT: [[P32:%.*]] = add i32 [[P30]], [[TMP25]]
70 ; GATHER-NEXT: [[TMP26:%.*]] = insertelement <8 x i32> undef, i32 [[TMP19]], i32 0
71 ; GATHER-NEXT: [[TMP27:%.*]] = insertelement <8 x i32> [[TMP26]], i32 [[TMP20]], i32 1
72 ; GATHER-NEXT: [[TMP28:%.*]] = insertelement <8 x i32> [[TMP27]], i32 [[TMP21]], i32 2
73 ; GATHER-NEXT: [[TMP29:%.*]] = insertelement <8 x i32> [[TMP28]], i32 [[TMP22]], i32 3
74 ; GATHER-NEXT: [[TMP30:%.*]] = insertelement <8 x i32> [[TMP29]], i32 [[TMP23]], i32 4
75 ; GATHER-NEXT: [[TMP31:%.*]] = insertelement <8 x i32> [[TMP30]], i32 [[TMP24]], i32 5
76 ; GATHER-NEXT: [[TMP32:%.*]] = insertelement <8 x i32> [[TMP31]], i32 [[TMP25]], i32 6
77 ; GATHER-NEXT: [[TMP33:%.*]] = extractelement <8 x i32> [[TMP18]], i32 7
78 ; GATHER-NEXT: [[TMP34:%.*]] = insertelement <8 x i32> [[TMP32]], i32 [[TMP33]], i32 7
79 ; GATHER-NEXT: [[TMP35:%.*]] = call i32 @llvm.experimental.vector.reduce.add.v8i32(<8 x i32> [[TMP34]])
80 ; GATHER-NEXT: [[OP_EXTRA]] = add i32 [[TMP35]], [[P17]]
81 ; GATHER-NEXT: [[P34:%.*]] = add i32 [[P32]], [[TMP33]]
82 ; GATHER-NEXT: br label [[FOR_BODY]]
84 ; MAX-COST-LABEL: @PR28330(
85 ; MAX-COST-NEXT: entry:
86 ; MAX-COST-NEXT: [[P0:%.*]] = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 1), align 1
87 ; MAX-COST-NEXT: [[P1:%.*]] = icmp eq i8 [[P0]], 0
88 ; MAX-COST-NEXT: [[P2:%.*]] = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 2), align 2
89 ; MAX-COST-NEXT: [[P3:%.*]] = icmp eq i8 [[P2]], 0
90 ; MAX-COST-NEXT: [[P4:%.*]] = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 3), align 1
91 ; MAX-COST-NEXT: [[P5:%.*]] = icmp eq i8 [[P4]], 0
92 ; MAX-COST-NEXT: [[P6:%.*]] = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 4), align 4
93 ; MAX-COST-NEXT: [[P7:%.*]] = icmp eq i8 [[P6]], 0
94 ; MAX-COST-NEXT: [[P8:%.*]] = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 5), align 1
95 ; MAX-COST-NEXT: [[P9:%.*]] = icmp eq i8 [[P8]], 0
96 ; MAX-COST-NEXT: [[P10:%.*]] = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 6), align 2
97 ; MAX-COST-NEXT: [[P11:%.*]] = icmp eq i8 [[P10]], 0
98 ; MAX-COST-NEXT: [[P12:%.*]] = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 7), align 1
99 ; MAX-COST-NEXT: [[P13:%.*]] = icmp eq i8 [[P12]], 0
100 ; MAX-COST-NEXT: [[P14:%.*]] = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 8), align 8
101 ; MAX-COST-NEXT: [[P15:%.*]] = icmp eq i8 [[P14]], 0
102 ; MAX-COST-NEXT: br label [[FOR_BODY:%.*]]
103 ; MAX-COST: for.body:
104 ; MAX-COST-NEXT: [[P17:%.*]] = phi i32 [ [[P34:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]
105 ; MAX-COST-NEXT: [[P19:%.*]] = select i1 [[P1]], i32 -720, i32 -80
106 ; MAX-COST-NEXT: [[P20:%.*]] = add i32 [[P17]], [[P19]]
107 ; MAX-COST-NEXT: [[P21:%.*]] = select i1 [[P3]], i32 -720, i32 -80
108 ; MAX-COST-NEXT: [[P22:%.*]] = add i32 [[P20]], [[P21]]
109 ; MAX-COST-NEXT: [[P23:%.*]] = select i1 [[P5]], i32 -720, i32 -80
110 ; MAX-COST-NEXT: [[P24:%.*]] = add i32 [[P22]], [[P23]]
111 ; MAX-COST-NEXT: [[P25:%.*]] = select i1 [[P7]], i32 -720, i32 -80
112 ; MAX-COST-NEXT: [[P26:%.*]] = add i32 [[P24]], [[P25]]
113 ; MAX-COST-NEXT: [[P27:%.*]] = select i1 [[P9]], i32 -720, i32 -80
114 ; MAX-COST-NEXT: [[P28:%.*]] = add i32 [[P26]], [[P27]]
115 ; MAX-COST-NEXT: [[P29:%.*]] = select i1 [[P11]], i32 -720, i32 -80
116 ; MAX-COST-NEXT: [[P30:%.*]] = add i32 [[P28]], [[P29]]
117 ; MAX-COST-NEXT: [[P31:%.*]] = select i1 [[P13]], i32 -720, i32 -80
118 ; MAX-COST-NEXT: [[P32:%.*]] = add i32 [[P30]], [[P31]]
119 ; MAX-COST-NEXT: [[P33:%.*]] = select i1 [[P15]], i32 -720, i32 -80
120 ; MAX-COST-NEXT: [[P34]] = add i32 [[P32]], [[P33]]
121 ; MAX-COST-NEXT: br label [[FOR_BODY]]
124 %p0 = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 1), align 1
125 %p1 = icmp eq i8 %p0, 0
126 %p2 = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 2), align 2
127 %p3 = icmp eq i8 %p2, 0
128 %p4 = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 3), align 1
129 %p5 = icmp eq i8 %p4, 0
130 %p6 = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 4), align 4
131 %p7 = icmp eq i8 %p6, 0
132 %p8 = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 5), align 1
133 %p9 = icmp eq i8 %p8, 0
134 %p10 = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 6), align 2
135 %p11 = icmp eq i8 %p10, 0
136 %p12 = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 7), align 1
137 %p13 = icmp eq i8 %p12, 0
138 %p14 = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 8), align 8
139 %p15 = icmp eq i8 %p14, 0
143 %p17 = phi i32 [ %p34, %for.body ], [ 0, %entry ]
144 %p19 = select i1 %p1, i32 -720, i32 -80
145 %p20 = add i32 %p17, %p19
146 %p21 = select i1 %p3, i32 -720, i32 -80
147 %p22 = add i32 %p20, %p21
148 %p23 = select i1 %p5, i32 -720, i32 -80
149 %p24 = add i32 %p22, %p23
150 %p25 = select i1 %p7, i32 -720, i32 -80
151 %p26 = add i32 %p24, %p25
152 %p27 = select i1 %p9, i32 -720, i32 -80
153 %p28 = add i32 %p26, %p27
154 %p29 = select i1 %p11, i32 -720, i32 -80
155 %p30 = add i32 %p28, %p29
156 %p31 = select i1 %p13, i32 -720, i32 -80
157 %p32 = add i32 %p30, %p31
158 %p33 = select i1 %p15, i32 -720, i32 -80
159 %p34 = add i32 %p32, %p33
163 define void @PR32038(i32 %n) {
164 ; DEFAULT-LABEL: @PR32038(
165 ; DEFAULT-NEXT: entry:
166 ; DEFAULT-NEXT: [[TMP0:%.*]] = load <8 x i8>, <8 x i8>* bitcast (i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 1) to <8 x i8>*), align 1
167 ; DEFAULT-NEXT: [[TMP1:%.*]] = icmp eq <8 x i8> [[TMP0]], zeroinitializer
168 ; DEFAULT-NEXT: br label [[FOR_BODY:%.*]]
170 ; DEFAULT-NEXT: [[P17:%.*]] = phi i32 [ [[OP_EXTRA:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]
171 ; DEFAULT-NEXT: [[TMP2:%.*]] = select <8 x i1> [[TMP1]], <8 x i32> <i32 -720, i32 -720, i32 -720, i32 -720, i32 -720, i32 -720, i32 -720, i32 -720>, <8 x i32> <i32 -80, i32 -80, i32 -80, i32 -80, i32 -80, i32 -80, i32 -80, i32 -80>
172 ; DEFAULT-NEXT: [[P20:%.*]] = add i32 -5, undef
173 ; DEFAULT-NEXT: [[P22:%.*]] = add i32 [[P20]], undef
174 ; DEFAULT-NEXT: [[P24:%.*]] = add i32 [[P22]], undef
175 ; DEFAULT-NEXT: [[P26:%.*]] = add i32 [[P24]], undef
176 ; DEFAULT-NEXT: [[P28:%.*]] = add i32 [[P26]], undef
177 ; DEFAULT-NEXT: [[P30:%.*]] = add i32 [[P28]], undef
178 ; DEFAULT-NEXT: [[P32:%.*]] = add i32 [[P30]], undef
179 ; DEFAULT-NEXT: [[TMP3:%.*]] = call i32 @llvm.experimental.vector.reduce.add.v8i32(<8 x i32> [[TMP2]])
180 ; DEFAULT-NEXT: [[OP_EXTRA]] = add i32 [[TMP3]], -5
181 ; DEFAULT-NEXT: [[P34:%.*]] = add i32 [[P32]], undef
182 ; DEFAULT-NEXT: br label [[FOR_BODY]]
184 ; GATHER-LABEL: @PR32038(
185 ; GATHER-NEXT: entry:
186 ; GATHER-NEXT: [[TMP0:%.*]] = load <8 x i8>, <8 x i8>* bitcast (i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 1) to <8 x i8>*), align 1
187 ; GATHER-NEXT: [[TMP1:%.*]] = icmp eq <8 x i8> [[TMP0]], zeroinitializer
188 ; GATHER-NEXT: br label [[FOR_BODY:%.*]]
190 ; GATHER-NEXT: [[P17:%.*]] = phi i32 [ [[OP_EXTRA:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]
191 ; GATHER-NEXT: [[TMP2:%.*]] = extractelement <8 x i1> [[TMP1]], i32 0
192 ; GATHER-NEXT: [[TMP3:%.*]] = insertelement <8 x i1> undef, i1 [[TMP2]], i32 0
193 ; GATHER-NEXT: [[TMP4:%.*]] = extractelement <8 x i1> [[TMP1]], i32 1
194 ; GATHER-NEXT: [[TMP5:%.*]] = insertelement <8 x i1> [[TMP3]], i1 [[TMP4]], i32 1
195 ; GATHER-NEXT: [[TMP6:%.*]] = extractelement <8 x i1> [[TMP1]], i32 2
196 ; GATHER-NEXT: [[TMP7:%.*]] = insertelement <8 x i1> [[TMP5]], i1 [[TMP6]], i32 2
197 ; GATHER-NEXT: [[TMP8:%.*]] = extractelement <8 x i1> [[TMP1]], i32 3
198 ; GATHER-NEXT: [[TMP9:%.*]] = insertelement <8 x i1> [[TMP7]], i1 [[TMP8]], i32 3
199 ; GATHER-NEXT: [[TMP10:%.*]] = extractelement <8 x i1> [[TMP1]], i32 4
200 ; GATHER-NEXT: [[TMP11:%.*]] = insertelement <8 x i1> [[TMP9]], i1 [[TMP10]], i32 4
201 ; GATHER-NEXT: [[TMP12:%.*]] = extractelement <8 x i1> [[TMP1]], i32 5
202 ; GATHER-NEXT: [[TMP13:%.*]] = insertelement <8 x i1> [[TMP11]], i1 [[TMP12]], i32 5
203 ; GATHER-NEXT: [[TMP14:%.*]] = extractelement <8 x i1> [[TMP1]], i32 6
204 ; GATHER-NEXT: [[TMP15:%.*]] = insertelement <8 x i1> [[TMP13]], i1 [[TMP14]], i32 6
205 ; GATHER-NEXT: [[TMP16:%.*]] = extractelement <8 x i1> [[TMP1]], i32 7
206 ; GATHER-NEXT: [[TMP17:%.*]] = insertelement <8 x i1> [[TMP15]], i1 [[TMP16]], i32 7
207 ; GATHER-NEXT: [[TMP18:%.*]] = select <8 x i1> [[TMP17]], <8 x i32> <i32 -720, i32 -720, i32 -720, i32 -720, i32 -720, i32 -720, i32 -720, i32 -720>, <8 x i32> <i32 -80, i32 -80, i32 -80, i32 -80, i32 -80, i32 -80, i32 -80, i32 -80>
208 ; GATHER-NEXT: [[TMP19:%.*]] = extractelement <8 x i32> [[TMP18]], i32 0
209 ; GATHER-NEXT: [[P20:%.*]] = add i32 -5, [[TMP19]]
210 ; GATHER-NEXT: [[TMP20:%.*]] = extractelement <8 x i32> [[TMP18]], i32 1
211 ; GATHER-NEXT: [[P22:%.*]] = add i32 [[P20]], [[TMP20]]
212 ; GATHER-NEXT: [[TMP21:%.*]] = extractelement <8 x i32> [[TMP18]], i32 2
213 ; GATHER-NEXT: [[P24:%.*]] = add i32 [[P22]], [[TMP21]]
214 ; GATHER-NEXT: [[TMP22:%.*]] = extractelement <8 x i32> [[TMP18]], i32 3
215 ; GATHER-NEXT: [[P26:%.*]] = add i32 [[P24]], [[TMP22]]
216 ; GATHER-NEXT: [[TMP23:%.*]] = extractelement <8 x i32> [[TMP18]], i32 4
217 ; GATHER-NEXT: [[P28:%.*]] = add i32 [[P26]], [[TMP23]]
218 ; GATHER-NEXT: [[TMP24:%.*]] = extractelement <8 x i32> [[TMP18]], i32 5
219 ; GATHER-NEXT: [[P30:%.*]] = add i32 [[P28]], [[TMP24]]
220 ; GATHER-NEXT: [[TMP25:%.*]] = extractelement <8 x i32> [[TMP18]], i32 6
221 ; GATHER-NEXT: [[P32:%.*]] = add i32 [[P30]], [[TMP25]]
222 ; GATHER-NEXT: [[TMP26:%.*]] = insertelement <8 x i32> undef, i32 [[TMP19]], i32 0
223 ; GATHER-NEXT: [[TMP27:%.*]] = insertelement <8 x i32> [[TMP26]], i32 [[TMP20]], i32 1
224 ; GATHER-NEXT: [[TMP28:%.*]] = insertelement <8 x i32> [[TMP27]], i32 [[TMP21]], i32 2
225 ; GATHER-NEXT: [[TMP29:%.*]] = insertelement <8 x i32> [[TMP28]], i32 [[TMP22]], i32 3
226 ; GATHER-NEXT: [[TMP30:%.*]] = insertelement <8 x i32> [[TMP29]], i32 [[TMP23]], i32 4
227 ; GATHER-NEXT: [[TMP31:%.*]] = insertelement <8 x i32> [[TMP30]], i32 [[TMP24]], i32 5
228 ; GATHER-NEXT: [[TMP32:%.*]] = insertelement <8 x i32> [[TMP31]], i32 [[TMP25]], i32 6
229 ; GATHER-NEXT: [[TMP33:%.*]] = extractelement <8 x i32> [[TMP18]], i32 7
230 ; GATHER-NEXT: [[TMP34:%.*]] = insertelement <8 x i32> [[TMP32]], i32 [[TMP33]], i32 7
231 ; GATHER-NEXT: [[TMP35:%.*]] = call i32 @llvm.experimental.vector.reduce.add.v8i32(<8 x i32> [[TMP34]])
232 ; GATHER-NEXT: [[OP_EXTRA]] = add i32 [[TMP35]], -5
233 ; GATHER-NEXT: [[P34:%.*]] = add i32 [[P32]], [[TMP33]]
234 ; GATHER-NEXT: br label [[FOR_BODY]]
236 ; MAX-COST-LABEL: @PR32038(
237 ; MAX-COST-NEXT: entry:
238 ; MAX-COST-NEXT: [[TMP0:%.*]] = load <2 x i8>, <2 x i8>* bitcast (i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 1) to <2 x i8>*), align 1
239 ; MAX-COST-NEXT: [[TMP1:%.*]] = icmp eq <2 x i8> [[TMP0]], zeroinitializer
240 ; MAX-COST-NEXT: [[P4:%.*]] = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 3), align 1
241 ; MAX-COST-NEXT: [[P5:%.*]] = icmp eq i8 [[P4]], 0
242 ; MAX-COST-NEXT: [[P6:%.*]] = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 4), align 4
243 ; MAX-COST-NEXT: [[P7:%.*]] = icmp eq i8 [[P6]], 0
244 ; MAX-COST-NEXT: [[P8:%.*]] = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 5), align 1
245 ; MAX-COST-NEXT: [[P9:%.*]] = icmp eq i8 [[P8]], 0
246 ; MAX-COST-NEXT: [[P10:%.*]] = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 6), align 2
247 ; MAX-COST-NEXT: [[P11:%.*]] = icmp eq i8 [[P10]], 0
248 ; MAX-COST-NEXT: [[P12:%.*]] = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 7), align 1
249 ; MAX-COST-NEXT: [[P13:%.*]] = icmp eq i8 [[P12]], 0
250 ; MAX-COST-NEXT: [[P14:%.*]] = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 8), align 8
251 ; MAX-COST-NEXT: [[P15:%.*]] = icmp eq i8 [[P14]], 0
252 ; MAX-COST-NEXT: br label [[FOR_BODY:%.*]]
253 ; MAX-COST: for.body:
254 ; MAX-COST-NEXT: [[P17:%.*]] = phi i32 [ [[P34:%.*]], [[FOR_BODY]] ], [ 0, [[ENTRY:%.*]] ]
255 ; MAX-COST-NEXT: [[TMP2:%.*]] = extractelement <2 x i1> [[TMP1]], i32 0
256 ; MAX-COST-NEXT: [[TMP3:%.*]] = insertelement <4 x i1> undef, i1 [[TMP2]], i32 0
257 ; MAX-COST-NEXT: [[TMP4:%.*]] = extractelement <2 x i1> [[TMP1]], i32 1
258 ; MAX-COST-NEXT: [[TMP5:%.*]] = insertelement <4 x i1> [[TMP3]], i1 [[TMP4]], i32 1
259 ; MAX-COST-NEXT: [[TMP6:%.*]] = insertelement <4 x i1> [[TMP5]], i1 [[P5]], i32 2
260 ; MAX-COST-NEXT: [[TMP7:%.*]] = insertelement <4 x i1> [[TMP6]], i1 [[P7]], i32 3
261 ; MAX-COST-NEXT: [[TMP8:%.*]] = select <4 x i1> [[TMP7]], <4 x i32> <i32 -720, i32 -720, i32 -720, i32 -720>, <4 x i32> <i32 -80, i32 -80, i32 -80, i32 -80>
262 ; MAX-COST-NEXT: [[P20:%.*]] = add i32 -5, undef
263 ; MAX-COST-NEXT: [[P22:%.*]] = add i32 [[P20]], undef
264 ; MAX-COST-NEXT: [[P24:%.*]] = add i32 [[P22]], undef
265 ; MAX-COST-NEXT: [[P26:%.*]] = add i32 [[P24]], undef
266 ; MAX-COST-NEXT: [[P27:%.*]] = select i1 [[P9]], i32 -720, i32 -80
267 ; MAX-COST-NEXT: [[P28:%.*]] = add i32 [[P26]], [[P27]]
268 ; MAX-COST-NEXT: [[P29:%.*]] = select i1 [[P11]], i32 -720, i32 -80
269 ; MAX-COST-NEXT: [[TMP9:%.*]] = call i32 @llvm.experimental.vector.reduce.add.v4i32(<4 x i32> [[TMP8]])
270 ; MAX-COST-NEXT: [[TMP10:%.*]] = add i32 [[TMP9]], [[P27]]
271 ; MAX-COST-NEXT: [[TMP11:%.*]] = add i32 [[TMP10]], [[P29]]
272 ; MAX-COST-NEXT: [[OP_EXTRA:%.*]] = add i32 [[TMP11]], -5
273 ; MAX-COST-NEXT: [[P30:%.*]] = add i32 [[P28]], [[P29]]
274 ; MAX-COST-NEXT: [[P31:%.*]] = select i1 [[P13]], i32 -720, i32 -80
275 ; MAX-COST-NEXT: [[P32:%.*]] = add i32 [[OP_EXTRA]], [[P31]]
276 ; MAX-COST-NEXT: [[P33:%.*]] = select i1 [[P15]], i32 -720, i32 -80
277 ; MAX-COST-NEXT: [[P34]] = add i32 [[P32]], [[P33]]
278 ; MAX-COST-NEXT: br label [[FOR_BODY]]
281 %p0 = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 1), align 1
282 %p1 = icmp eq i8 %p0, 0
283 %p2 = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 2), align 2
284 %p3 = icmp eq i8 %p2, 0
285 %p4 = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 3), align 1
286 %p5 = icmp eq i8 %p4, 0
287 %p6 = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 4), align 4
288 %p7 = icmp eq i8 %p6, 0
289 %p8 = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 5), align 1
290 %p9 = icmp eq i8 %p8, 0
291 %p10 = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 6), align 2
292 %p11 = icmp eq i8 %p10, 0
293 %p12 = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 7), align 1
294 %p13 = icmp eq i8 %p12, 0
295 %p14 = load i8, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @a, i64 0, i64 8), align 8
296 %p15 = icmp eq i8 %p14, 0
300 %p17 = phi i32 [ %p34, %for.body ], [ 0, %entry ]
301 %p19 = select i1 %p1, i32 -720, i32 -80
302 %p20 = add i32 -5, %p19
303 %p21 = select i1 %p3, i32 -720, i32 -80
304 %p22 = add i32 %p20, %p21
305 %p23 = select i1 %p5, i32 -720, i32 -80
306 %p24 = add i32 %p22, %p23
307 %p25 = select i1 %p7, i32 -720, i32 -80
308 %p26 = add i32 %p24, %p25
309 %p27 = select i1 %p9, i32 -720, i32 -80
310 %p28 = add i32 %p26, %p27
311 %p29 = select i1 %p11, i32 -720, i32 -80
312 %p30 = add i32 %p28, %p29
313 %p31 = select i1 %p13, i32 -720, i32 -80
314 %p32 = add i32 %p30, %p31
315 %p33 = select i1 %p15, i32 -720, i32 -80
316 %p34 = add i32 %p32, %p33