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-multitypes-1.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-multitypes-1.s > vect-multitypes-1.ll
6 ; ModuleID = 'vect-multitypes-1.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 @sb = global [32 x i16] [i16 0, i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7, i16 8, i16 9, i16 10, i16 11, i16 12, i16 13, i16 14, i16 15, i16 16, i16 17, i16 18, i16 19, i16 20, i16 21, i16 22, i16 23, i16 24, i16 25, i16 26, i16 27, i16 28, i16 29, i16 30, i16 31], align 16
11 @ib = global [32 x i32] [i32 0, i32 3, i32 6, i32 9, i32 12, i32 15, i32 18, i32 21, i32 24, i32 27, i32 30, i32 33, i32 36, i32 39, i32 42, i32 45, i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15], align 16
12 @sa = common global [32 x i16] zeroinitializer, align 16
13 @ia = common global [32 x i32] zeroinitializer, align 16
15 define i32 @main1(i32 %n) nounwind uwtable noinline {
17 %tmp9 = icmp sgt i32 %n, 0
18 %smax = select i1 %tmp9, i32 %n, i32 0
19 %tmp10 = zext i32 %smax to i64
22 for.cond: ; preds = %for.inc, %entry
23 %indvar7 = phi i64 [ %indvar.next8, %for.inc ], [ 0, %entry ]
24 %tmp12 = add i64 %indvar7, 3
25 %add13 = trunc i64 %tmp12 to i32
26 %tmp14 = add i64 %indvar7, 1
27 %arrayidx10 = getelementptr [32 x i32]* @ib, i64 0, i64 %tmp14
28 %tmp15 = add i64 %indvar7, 7
29 %add = trunc i64 %tmp15 to i32
30 %arrayidx = getelementptr [32 x i16]* @sb, i64 0, i64 %indvar7
31 %exitcond = icmp ne i64 %indvar7, %tmp10
32 br i1 %exitcond, label %for.body, label %for.end
34 for.body: ; preds = %for.cond
35 %tmp3 = load i16* %arrayidx, align 2
36 %idxprom5 = sext i32 %add to i64
37 %arrayidx6 = getelementptr inbounds [32 x i16]* @sa, i64 0, i64 %idxprom5
38 store i16 %tmp3, i16* %arrayidx6, align 2
39 %tmp11 = load i32* %arrayidx10, align 4
40 %idxprom14 = sext i32 %add13 to i64
41 %arrayidx15 = getelementptr inbounds [32 x i32]* @ia, i64 0, i64 %idxprom14
42 store i32 %tmp11, i32* %arrayidx15, align 4
45 for.inc: ; preds = %for.body
46 %indvar.next8 = add i64 %indvar7, 1
49 for.end: ; preds = %for.cond
52 for.cond17: ; preds = %for.inc46, %for.end
53 %indvar = phi i64 [ %indvar.next, %for.inc46 ], [ 0, %for.end ]
54 %tmp = add i64 %indvar, 1
55 %arrayidx42 = getelementptr [32 x i32]* @ib, i64 0, i64 %tmp
56 %tmp1 = add i64 %indvar, 3
57 %add35 = trunc i64 %tmp1 to i32
58 %arrayidx29 = getelementptr [32 x i16]* @sb, i64 0, i64 %indvar
59 %tmp4 = add i64 %indvar, 7
60 %add23 = trunc i64 %tmp4 to i32
61 %i.1 = trunc i64 %indvar to i32
62 %cmp20 = icmp slt i32 %i.1, %n
63 br i1 %cmp20, label %for.body21, label %for.end49
65 for.body21: ; preds = %for.cond17
66 %idxprom24 = sext i32 %add23 to i64
67 %arrayidx25 = getelementptr inbounds [32 x i16]* @sa, i64 0, i64 %idxprom24
68 %tmp26 = load i16* %arrayidx25, align 2
69 %tmp30 = load i16* %arrayidx29, align 2
70 %cmp32 = icmp eq i16 %tmp26, %tmp30
71 br i1 %cmp32, label %lor.lhs.false, label %if.then
73 lor.lhs.false: ; preds = %for.body21
74 %idxprom36 = sext i32 %add35 to i64
75 %arrayidx37 = getelementptr inbounds [32 x i32]* @ia, i64 0, i64 %idxprom36
76 %tmp38 = load i32* %arrayidx37, align 4
77 %tmp43 = load i32* %arrayidx42, align 4
78 %cmp44 = icmp eq i32 %tmp38, %tmp43
79 br i1 %cmp44, label %if.end, label %if.then
81 if.then: ; preds = %lor.lhs.false, %for.body21
82 call void @abort() noreturn nounwind
85 if.end: ; preds = %lor.lhs.false
88 for.inc46: ; preds = %if.end
89 %indvar.next = add i64 %indvar, 1
92 for.end49: ; preds = %for.cond17
96 declare void @abort() noreturn
98 define i32 @main2(i32 %n) nounwind uwtable noinline {
100 %tmp7 = icmp sgt i32 %n, 0
101 %smax = select i1 %tmp7, i32 %n, i32 0
102 %tmp8 = zext i32 %smax to i64
105 for.cond: ; preds = %for.inc, %entry
106 %indvar5 = phi i64 [ %indvar.next6, %for.inc ], [ 0, %entry ]
107 %tmp9 = add i64 %indvar5, 3
108 %add = trunc i64 %tmp9 to i32
109 %tmp12 = add i64 %indvar5, 1
110 %arrayidx10 = getelementptr [32 x i16]* @sb, i64 0, i64 %tmp12
111 %arrayidx = getelementptr [32 x i32]* @ib, i64 0, i64 %indvar5
112 %exitcond = icmp ne i64 %indvar5, %tmp8
113 br i1 %exitcond, label %for.body, label %for.end
115 for.body: ; preds = %for.cond
116 %tmp3 = load i32* %arrayidx, align 4
117 %idxprom5 = sext i32 %add to i64
118 %arrayidx6 = getelementptr inbounds [32 x i32]* @ia, i64 0, i64 %idxprom5
119 store i32 %tmp3, i32* %arrayidx6, align 4
120 %tmp11 = load i16* %arrayidx10, align 2
121 %idxprom14 = sext i32 %add to i64
122 %arrayidx15 = getelementptr inbounds [32 x i16]* @sa, i64 0, i64 %idxprom14
123 store i16 %tmp11, i16* %arrayidx15, align 2
126 for.inc: ; preds = %for.body
127 %indvar.next6 = add i64 %indvar5, 1
130 for.end: ; preds = %for.cond
133 for.cond17: ; preds = %for.inc46, %for.end
134 %indvar = phi i64 [ %indvar.next, %for.inc46 ], [ 0, %for.end ]
135 %arrayidx42 = getelementptr [32 x i32]* @ib, i64 0, i64 %indvar
136 %tmp = add i64 %indvar, 3
137 %add23 = trunc i64 %tmp to i32
138 %tmp2 = add i64 %indvar, 1
139 %arrayidx30 = getelementptr [32 x i16]* @sb, i64 0, i64 %tmp2
140 %i.1 = trunc i64 %indvar to i32
141 %cmp20 = icmp slt i32 %i.1, %n
142 br i1 %cmp20, label %for.body21, label %for.end49
144 for.body21: ; preds = %for.cond17
145 %idxprom24 = sext i32 %add23 to i64
146 %arrayidx25 = getelementptr inbounds [32 x i16]* @sa, i64 0, i64 %idxprom24
147 %tmp26 = load i16* %arrayidx25, align 2
148 %tmp31 = load i16* %arrayidx30, align 2
149 %cmp33 = icmp eq i16 %tmp26, %tmp31
150 br i1 %cmp33, label %lor.lhs.false, label %if.then
152 lor.lhs.false: ; preds = %for.body21
153 %idxprom37 = sext i32 %add23 to i64
154 %arrayidx38 = getelementptr inbounds [32 x i32]* @ia, i64 0, i64 %idxprom37
155 %tmp39 = load i32* %arrayidx38, align 4
156 %tmp43 = load i32* %arrayidx42, align 4
157 %cmp44 = icmp eq i32 %tmp39, %tmp43
158 br i1 %cmp44, label %if.end, label %if.then
160 if.then: ; preds = %lor.lhs.false, %for.body21
161 call void @abort() noreturn nounwind
164 if.end: ; preds = %lor.lhs.false
167 for.inc46: ; preds = %if.end
168 %indvar.next = add i64 %indvar, 1
171 for.end49: ; preds = %for.cond17
175 define i32 @main() nounwind uwtable {
177 call void @check_vect()
178 %call = call i32 @main1(i32 25)
179 %call1 = call i32 @main2(i32 29)
183 define internal void @check_vect() nounwind uwtable noinline {
185 %a = alloca i32, align 4
186 %b = alloca i32, align 4
187 %c = alloca i32, align 4
188 %d = alloca i32, align 4
189 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
190 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
191 %tobool = icmp eq i32 %call1, 0
192 br i1 %tobool, label %if.then, label %lor.lhs.false
194 lor.lhs.false: ; preds = %entry
195 %tmp4 = load i32* %d, align 4
196 %and6 = and i32 %tmp4, 67108864
197 %cmp = icmp eq i32 %and6, 0
198 br i1 %cmp, label %if.then, label %if.end
200 if.then: ; preds = %entry, %lor.lhs.false
201 call void @exit(i32 0) noreturn nounwind
204 if.end: ; preds = %lor.lhs.false
205 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
209 declare void (i32)* @signal(i32, void (i32)*) nounwind
211 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
213 call void @exit(i32 0) noreturn nounwind
216 return: ; No predecessors!
220 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
222 %and = and i32 %__level, -2147483648
223 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
224 %cmp = icmp ult i32 %call, %__level
225 br i1 %cmp, label %if.then, label %if.end
227 if.then: ; preds = %entry
230 if.end: ; preds = %entry
231 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
232 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
233 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
234 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
235 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
236 store i32 %asmresult, i32* %__eax, align 4
237 store i32 %asmresult8, i32* %__ebx, align 4
238 store i32 %asmresult9, i32* %__ecx, align 4
239 store i32 %asmresult10, i32* %__edx, align 4
242 return: ; preds = %if.end, %if.then
243 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
247 declare void @exit(i32) noreturn
249 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
251 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
252 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
253 %tobool = icmp eq i32* %__sig, null
254 br i1 %tobool, label %if.end, label %if.then
256 if.then: ; preds = %entry
257 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
258 store i32 %asmresult1, i32* %__sig, align 4
261 if.end: ; preds = %entry, %if.then
265 !0 = metadata !{i32 -2147341957, i32 -2147341949}
266 !1 = metadata !{i32 -2147342080, i32 -2147342072}