Add compile command to each testcase
[gcc-vect-testsuite.git] / vect-strided-u8-i8.ll
blobcc70845c02f46a63b6c45cc9b22fc1f9321c4493
1 ; RUN: opt %loadPolly %defaultOpts -polly-codegen -enable-polly-vector -dce -S %s | FileCheck %s
2 ; Obtained from C source as:
3 ; clang -S -emit-llvm -O0 vect-strided-u8-i8.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-strided-u8-i8.s > vect-strided-u8-i8.ll
6 ; ModuleID = 'vect-strided-u8-i8.s'
7 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
8 target triple = "x86_64-unknown-linux-gnu"
10 %struct.s = type { i8, i8, i8, i8, i8, i8, i8, i8 }
12 define i32 @main1(%struct.s* %arr) nounwind uwtable noinline {
13 entry:
14   %res = alloca [32 x %struct.s], align 16
15   br label %for.cond
17 for.cond:                                         ; preds = %for.inc, %entry
18   %indvar16 = phi i64 [ %indvar.next17, %for.inc ], [ 0, %entry ]
19   %g148 = getelementptr [32 x %struct.s]* %res, i64 0, i64 %indvar16, i32 6
20   %h138 = getelementptr [32 x %struct.s]* %res, i64 0, i64 %indvar16, i32 7
21   %e124 = getelementptr [32 x %struct.s]* %res, i64 0, i64 %indvar16, i32 4
22   %f111 = getelementptr [32 x %struct.s]* %res, i64 0, i64 %indvar16, i32 5
23   %b98 = getelementptr [32 x %struct.s]* %res, i64 0, i64 %indvar16, i32 1
24   %d69 = getelementptr [32 x %struct.s]* %res, i64 0, i64 %indvar16, i32 3
25   %scevgep24 = getelementptr [32 x %struct.s]* %res, i64 0, i64 %indvar16
26   %a59 = bitcast %struct.s* %scevgep24 to i8*
27   %c30 = getelementptr [32 x %struct.s]* %res, i64 0, i64 %indvar16, i32 2
28   %g = getelementptr %struct.s* %arr, i64 %indvar16, i32 6
29   %d = getelementptr %struct.s* %arr, i64 %indvar16, i32 3
30   %e = getelementptr %struct.s* %arr, i64 %indvar16, i32 4
31   %b = getelementptr %struct.s* %arr, i64 %indvar16, i32 1
32   %h = getelementptr %struct.s* %arr, i64 %indvar16, i32 7
33   %f = getelementptr %struct.s* %arr, i64 %indvar16, i32 5
34   %c = getelementptr %struct.s* %arr, i64 %indvar16, i32 2
35   %scevgep34 = getelementptr %struct.s* %arr, i64 %indvar16
36   %a = bitcast %struct.s* %scevgep34 to i8*
37   %exitcond = icmp ne i64 %indvar16, 32
38   br i1 %exitcond, label %for.body, label %for.end
40 for.body:                                         ; preds = %for.cond
41   %tmp11 = load i8* %b, align 1
42   %tmp13 = load i8* %a, align 1
43   %sub = sub i8 %tmp11, %tmp13
44   %tmp17 = load i8* %d, align 1
45   %tmp20 = load i8* %c, align 1
46   %sub22 = sub i8 %tmp17, %tmp20
47   %add = add i8 %sub, %sub22
48   store i8 %add, i8* %c30, align 2
49   %tmp33 = load i8* %a, align 1
50   %tmp36 = load i8* %g, align 1
51   %add38 = add i8 %tmp33, %tmp36
52   %tmp42 = load i8* %b, align 1
53   %tmp46 = load i8* %d, align 1
54   %add48 = add i8 %tmp42, %tmp46
55   %add54 = add i8 %add38, %add48
56   store i8 %add54, i8* %a59, align 8
57   %add64 = add i8 %sub, %sub22
58   store i8 %add64, i8* %d69, align 1
59   %tmp71 = load i8* %h, align 1
60   %tmp75 = load i8* %a, align 1
61   %sub77 = sub i8 %tmp71, %tmp75
62   %tmp81 = load i8* %d, align 1
63   %tmp85 = load i8* %c, align 1
64   %sub87 = sub i8 %tmp81, %tmp85
65   %add93 = add i8 %sub77, %sub87
66   store i8 %add93, i8* %b98, align 1
67   %tmp100 = load i8* %f, align 1
68   %tmp104 = load i8* %h, align 1
69   %add106 = add i8 %tmp100, %tmp104
70   store i8 %add106, i8* %f111, align 1
71   %tmp114 = load i8* %b, align 1
72   %tmp117 = load i8* %e, align 1
73   %add119 = add i8 %tmp114, %tmp117
74   store i8 %add119, i8* %e124, align 4
75   %tmp127 = load i8* %d, align 1
76   %tmp131 = load i8* %g, align 1
77   %sub133 = sub i8 %tmp127, %tmp131
78   store i8 %sub133, i8* %h138, align 1
79   %add143 = add i8 %sub, %sub22
80   store i8 %add143, i8* %g148, align 2
81   br label %for.inc
83 for.inc:                                          ; preds = %for.body
84   %indvar.next17 = add i64 %indvar16, 1
85   br label %for.cond
87 for.end:                                          ; preds = %for.cond
88   br label %for.cond151
90 for.cond151:                                      ; preds = %for.inc426, %for.end
91   %indvar = phi i64 [ %indvar.next, %for.inc426 ], [ 0, %for.end ]
92   %c189 = getelementptr %struct.s* %arr, i64 %indvar, i32 2
93   %d181 = getelementptr %struct.s* %arr, i64 %indvar, i32 3
94   %scevgep = getelementptr %struct.s* %arr, i64 %indvar
95   %a173 = bitcast %struct.s* %scevgep to i8*
96   %b166 = getelementptr %struct.s* %arr, i64 %indvar, i32 1
97   %g390 = getelementptr [32 x %struct.s]* %res, i64 0, i64 %indvar, i32 6
98   %g212 = getelementptr %struct.s* %arr, i64 %indvar, i32 6
99   %h366 = getelementptr [32 x %struct.s]* %res, i64 0, i64 %indvar, i32 7
100   %e356 = getelementptr %struct.s* %arr, i64 %indvar, i32 4
101   %e342 = getelementptr [32 x %struct.s]* %res, i64 0, i64 %indvar, i32 4
102   %h285 = getelementptr %struct.s* %arr, i64 %indvar, i32 7
103   %f325 = getelementptr %struct.s* %arr, i64 %indvar, i32 5
104   %f318 = getelementptr [32 x %struct.s]* %res, i64 0, i64 %indvar, i32 5
105   %b278 = getelementptr [32 x %struct.s]* %res, i64 0, i64 %indvar, i32 1
106   %d238 = getelementptr [32 x %struct.s]* %res, i64 0, i64 %indvar, i32 3
107   %scevgep13 = getelementptr [32 x %struct.s]* %res, i64 0, i64 %indvar
108   %a198 = bitcast %struct.s* %scevgep13 to i8*
109   %c159 = getelementptr [32 x %struct.s]* %res, i64 0, i64 %indvar, i32 2
110   %i.1 = trunc i64 %indvar to i32
111   %cmp153 = icmp slt i32 %i.1, 32
112   br i1 %cmp153, label %for.body155, label %for.end429
114 for.body155:                                      ; preds = %for.cond151
115   %tmp160 = load i8* %c159, align 2
116   %conv161 = zext i8 %tmp160 to i32
117   %tmp167 = load i8* %b166, align 1
118   %conv168 = zext i8 %tmp167 to i32
119   %tmp174 = load i8* %a173, align 1
120   %conv175 = zext i8 %tmp174 to i32
121   %sub176 = sub nsw i32 %conv168, %conv175
122   %tmp182 = load i8* %d181, align 1
123   %conv183 = zext i8 %tmp182 to i32
124   %add184 = add nsw i32 %sub176, %conv183
125   %tmp190 = load i8* %c189, align 1
126   %conv191 = zext i8 %tmp190 to i32
127   %sub192 = sub nsw i32 %add184, %conv191
128   %cmp193 = icmp eq i32 %conv161, %sub192
129   br i1 %cmp193, label %lor.lhs.false, label %if.then
131 lor.lhs.false:                                    ; preds = %for.body155
132   %tmp199 = load i8* %a198, align 8
133   %conv200 = zext i8 %tmp199 to i32
134   %tmp206 = load i8* %a173, align 1
135   %conv207 = zext i8 %tmp206 to i32
136   %tmp213 = load i8* %g212, align 1
137   %conv214 = zext i8 %tmp213 to i32
138   %add215 = add nsw i32 %conv207, %conv214
139   %tmp221 = load i8* %b166, align 1
140   %conv222 = zext i8 %tmp221 to i32
141   %add223 = add nsw i32 %add215, %conv222
142   %tmp229 = load i8* %d181, align 1
143   %conv230 = zext i8 %tmp229 to i32
144   %add231 = add nsw i32 %add223, %conv230
145   %cmp232 = icmp eq i32 %conv200, %add231
146   br i1 %cmp232, label %lor.lhs.false234, label %if.then
148 lor.lhs.false234:                                 ; preds = %lor.lhs.false
149   %tmp239 = load i8* %d238, align 1
150   %conv240 = zext i8 %tmp239 to i32
151   %tmp246 = load i8* %b166, align 1
152   %conv247 = zext i8 %tmp246 to i32
153   %tmp253 = load i8* %a173, align 1
154   %conv254 = zext i8 %tmp253 to i32
155   %sub255 = sub nsw i32 %conv247, %conv254
156   %tmp261 = load i8* %d181, align 1
157   %conv262 = zext i8 %tmp261 to i32
158   %add263 = add nsw i32 %sub255, %conv262
159   %tmp269 = load i8* %c189, align 1
160   %conv270 = zext i8 %tmp269 to i32
161   %sub271 = sub nsw i32 %add263, %conv270
162   %cmp272 = icmp eq i32 %conv240, %sub271
163   br i1 %cmp272, label %lor.lhs.false274, label %if.then
165 lor.lhs.false274:                                 ; preds = %lor.lhs.false234
166   %tmp279 = load i8* %b278, align 1
167   %conv280 = zext i8 %tmp279 to i32
168   %tmp286 = load i8* %h285, align 1
169   %conv287 = zext i8 %tmp286 to i32
170   %tmp293 = load i8* %a173, align 1
171   %conv294 = zext i8 %tmp293 to i32
172   %sub295 = sub nsw i32 %conv287, %conv294
173   %tmp301 = load i8* %d181, align 1
174   %conv302 = zext i8 %tmp301 to i32
175   %add303 = add nsw i32 %sub295, %conv302
176   %tmp309 = load i8* %c189, align 1
177   %conv310 = zext i8 %tmp309 to i32
178   %sub311 = sub nsw i32 %add303, %conv310
179   %cmp312 = icmp eq i32 %conv280, %sub311
180   br i1 %cmp312, label %lor.lhs.false314, label %if.then
182 lor.lhs.false314:                                 ; preds = %lor.lhs.false274
183   %tmp319 = load i8* %f318, align 1
184   %conv320 = zext i8 %tmp319 to i32
185   %tmp326 = load i8* %f325, align 1
186   %conv327 = zext i8 %tmp326 to i32
187   %tmp333 = load i8* %h285, align 1
188   %conv334 = zext i8 %tmp333 to i32
189   %add335 = add nsw i32 %conv327, %conv334
190   %cmp336 = icmp eq i32 %conv320, %add335
191   br i1 %cmp336, label %lor.lhs.false338, label %if.then
193 lor.lhs.false338:                                 ; preds = %lor.lhs.false314
194   %tmp343 = load i8* %e342, align 4
195   %conv344 = zext i8 %tmp343 to i32
196   %tmp350 = load i8* %b166, align 1
197   %conv351 = zext i8 %tmp350 to i32
198   %tmp357 = load i8* %e356, align 1
199   %conv358 = zext i8 %tmp357 to i32
200   %add359 = add nsw i32 %conv351, %conv358
201   %cmp360 = icmp eq i32 %conv344, %add359
202   br i1 %cmp360, label %lor.lhs.false362, label %if.then
204 lor.lhs.false362:                                 ; preds = %lor.lhs.false338
205   %tmp367 = load i8* %h366, align 1
206   %conv368 = zext i8 %tmp367 to i32
207   %tmp374 = load i8* %d181, align 1
208   %conv375 = zext i8 %tmp374 to i32
209   %tmp381 = load i8* %g212, align 1
210   %conv382 = zext i8 %tmp381 to i32
211   %sub383 = sub nsw i32 %conv375, %conv382
212   %cmp384 = icmp eq i32 %conv368, %sub383
213   br i1 %cmp384, label %lor.lhs.false386, label %if.then
215 lor.lhs.false386:                                 ; preds = %lor.lhs.false362
216   %tmp391 = load i8* %g390, align 2
217   %conv392 = zext i8 %tmp391 to i32
218   %tmp398 = load i8* %b166, align 1
219   %conv399 = zext i8 %tmp398 to i32
220   %tmp405 = load i8* %a173, align 1
221   %conv406 = zext i8 %tmp405 to i32
222   %sub407 = sub nsw i32 %conv399, %conv406
223   %tmp413 = load i8* %d181, align 1
224   %conv414 = zext i8 %tmp413 to i32
225   %add415 = add nsw i32 %sub407, %conv414
226   %tmp421 = load i8* %c189, align 1
227   %conv422 = zext i8 %tmp421 to i32
228   %sub423 = sub nsw i32 %add415, %conv422
229   %cmp424 = icmp eq i32 %conv392, %sub423
230   br i1 %cmp424, label %if.end, label %if.then
232 if.then:                                          ; preds = %lor.lhs.false386, %lor.lhs.false362, %lor.lhs.false338, %lor.lhs.false314, %lor.lhs.false274, %lor.lhs.false234, %lor.lhs.false, %for.body155
233   call void @abort() noreturn nounwind
234   unreachable
236 if.end:                                           ; preds = %lor.lhs.false386
237   br label %for.inc426
239 for.inc426:                                       ; preds = %if.end
240   %indvar.next = add i64 %indvar, 1
241   br label %for.cond151
243 for.end429:                                       ; preds = %for.cond151
244   ret i32 undef
247 declare void @abort() noreturn
249 define i32 @main() nounwind uwtable {
250 entry:
251   %arr = alloca [32 x %struct.s], align 16
252   call void @check_vect()
253   br label %for.cond
255 for.cond:                                         ; preds = %for.inc, %entry
256   %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %entry ]
257   %tmp = mul i64 %indvar, 2
258   %conv4 = trunc i64 %tmp to i8
259   %scevgep = getelementptr [32 x %struct.s]* %arr, i64 0, i64 %indvar
260   %a = bitcast %struct.s* %scevgep to i8*
261   %h = getelementptr [32 x %struct.s]* %arr, i64 0, i64 %indvar, i32 7
262   %g = getelementptr [32 x %struct.s]* %arr, i64 0, i64 %indvar, i32 6
263   %tmp5 = add i64 %indvar, 3
264   %conv29 = trunc i64 %tmp5 to i8
265   %f = getelementptr [32 x %struct.s]* %arr, i64 0, i64 %indvar, i32 5
266   %tmp8 = add i64 %indvar, 5
267   %conv23 = trunc i64 %tmp8 to i8
268   %e = getelementptr [32 x %struct.s]* %arr, i64 0, i64 %indvar, i32 4
269   %conv = trunc i64 %indvar to i8
270   %d = getelementptr [32 x %struct.s]* %arr, i64 0, i64 %indvar, i32 3
271   %tmp13 = add i64 %indvar, 34
272   %conv12 = trunc i64 %tmp13 to i8
273   %c = getelementptr [32 x %struct.s]* %arr, i64 0, i64 %indvar, i32 2
274   %b = getelementptr [32 x %struct.s]* %arr, i64 0, i64 %indvar, i32 1
275   %i.0 = trunc i64 %indvar to i32
276   %cmp = icmp slt i32 %i.0, 32
277   br i1 %cmp, label %for.body, label %for.end
279 for.body:                                         ; preds = %for.cond
280   store i8 %conv, i8* %a, align 8
281   store i8 %conv4, i8* %b, align 1
282   store i8 17, i8* %c, align 2
283   store i8 %conv12, i8* %d, align 1
284   store i8 %conv, i8* %e, align 4
285   store i8 %conv23, i8* %f, align 1
286   store i8 %conv29, i8* %g, align 2
287   store i8 67, i8* %h, align 1
288   %tmp40 = load i8* %a, align 8
289   %cmp42 = icmp eq i8 %tmp40, -78
290   br i1 %cmp42, label %if.then, label %if.end
292 if.then:                                          ; preds = %for.body
293   call void @abort() noreturn nounwind
294   unreachable
296 if.end:                                           ; preds = %for.body
297   br label %for.inc
299 for.inc:                                          ; preds = %if.end
300   %indvar.next = add i64 %indvar, 1
301   br label %for.cond
303 for.end:                                          ; preds = %for.cond
304   %arraydecay = getelementptr inbounds [32 x %struct.s]* %arr, i64 0, i64 0
305   %call = call i32 @main1(%struct.s* %arraydecay)
306   ret i32 0
309 define internal void @check_vect() nounwind uwtable noinline {
310 entry:
311   %a = alloca i32, align 4
312   %b = alloca i32, align 4
313   %c = alloca i32, align 4
314   %d = alloca i32, align 4
315   %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
316   %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
317   %tobool = icmp eq i32 %call1, 0
318   br i1 %tobool, label %if.then, label %lor.lhs.false
320 lor.lhs.false:                                    ; preds = %entry
321   %tmp4 = load i32* %d, align 4
322   %and6 = and i32 %tmp4, 67108864
323   %cmp = icmp eq i32 %and6, 0
324   br i1 %cmp, label %if.then, label %if.end
326 if.then:                                          ; preds = %entry, %lor.lhs.false
327   call void @exit(i32 0) noreturn nounwind
328   unreachable
330 if.end:                                           ; preds = %lor.lhs.false
331   %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
332   ret void
335 declare void (i32)* @signal(i32, void (i32)*) nounwind
337 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
338 entry:
339   call void @exit(i32 0) noreturn nounwind
340   unreachable
342 return:                                           ; No predecessors!
343   ret void
346 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
347 entry:
348   %and = and i32 %__level, -2147483648
349   %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
350   %cmp = icmp ult i32 %call, %__level
351   br i1 %cmp, label %if.then, label %if.end
353 if.then:                                          ; preds = %entry
354   br label %return
356 if.end:                                           ; preds = %entry
357   %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
358   %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
359   %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
360   %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
361   %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
362   store i32 %asmresult, i32* %__eax, align 4
363   store i32 %asmresult8, i32* %__ebx, align 4
364   store i32 %asmresult9, i32* %__ecx, align 4
365   store i32 %asmresult10, i32* %__edx, align 4
366   br label %return
368 return:                                           ; preds = %if.end, %if.then
369   %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
370   ret i32 %retval.0
373 declare void @exit(i32) noreturn
375 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
376 entry:
377   %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
378   %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
379   %tobool = icmp eq i32* %__sig, null
380   br i1 %tobool, label %if.end, label %if.then
382 if.then:                                          ; preds = %entry
383   %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
384   store i32 %asmresult1, i32* %__sig, align 4
385   br label %if.end
387 if.end:                                           ; preds = %entry, %if.then
388   ret i32 %asmresult
391 !0 = metadata !{i32 -2147342398, i32 -2147342390} 
392 !1 = metadata !{i32 -2147342521, i32 -2147342513} 
393 ; CHECK: define