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-20.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-20.s > vect-20.ll
6 ; ModuleID = 'vect-20.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 @ib = global [64 x i32] [i32 1, i32 1, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0], align 16
11 @cb = global [64 x i8] c"\01\01\00\00\01\00\01\00\01\01\00\00\01\00\01\00\01\01\00\00\01\00\01\00\01\01\00\00\01\00\01\00\01\01\00\00\01\00\01\00\01\01\00\00\01\00\01\00\01\01\00\00\01\00\01\00\01\01\00\00\01\00\01\00", align 16
12 @sb = global [64 x i16] [i16 1, i16 1, i16 0, i16 0, i16 1, i16 0, i16 1, i16 0, i16 1, i16 1, i16 0, i16 0, i16 1, i16 0, i16 1, i16 0, i16 1, i16 1, i16 0, i16 0, i16 1, i16 0, i16 1, i16 0, i16 1, i16 1, i16 0, i16 0, i16 1, i16 0, i16 1, i16 0, i16 1, i16 1, i16 0, i16 0, i16 1, i16 0, i16 1, i16 0, i16 1, i16 1, i16 0, i16 0, i16 1, i16 0, i16 1, i16 0, i16 1, i16 1, i16 0, i16 0, i16 1, i16 0, i16 1, i16 0, i16 1, i16 1, i16 0, i16 0, i16 1, i16 0, i16 1, i16 0], align 16
13 @ia = common global [64 x i32] zeroinitializer, align 16
14 @ca = common global [64 x i8] zeroinitializer, align 16
15 @sa = common global [64 x i16] zeroinitializer, align 16
17 define i32 @main1() nounwind uwtable noinline {
21 for.cond: ; preds = %for.inc, %entry
22 %indvar12 = phi i64 [ %indvar.next13, %for.inc ], [ 0, %entry ]
23 %arrayidx5 = getelementptr [64 x i32]* @ia, i64 0, i64 %indvar12
24 %arrayidx = getelementptr [64 x i32]* @ib, i64 0, i64 %indvar12
25 %exitcond14 = icmp ne i64 %indvar12, 64
26 br i1 %exitcond14, label %for.body, label %for.end
28 for.body: ; preds = %for.cond
29 %tmp2 = load i32* %arrayidx, align 4
30 %neg = xor i32 %tmp2, -1
31 store i32 %neg, i32* %arrayidx5, align 4
34 for.inc: ; preds = %for.body
35 %indvar.next13 = add i64 %indvar12, 1
38 for.end: ; preds = %for.cond
41 for.cond7: ; preds = %for.inc21, %for.end
42 %indvar10 = phi i64 [ %indvar.next11, %for.inc21 ], [ 0, %for.end ]
43 %arrayidx17 = getelementptr [64 x i32]* @ib, i64 0, i64 %indvar10
44 %arrayidx13 = getelementptr [64 x i32]* @ia, i64 0, i64 %indvar10
45 %i.1 = trunc i64 %indvar10 to i32
46 %cmp9 = icmp slt i32 %i.1, 64
47 br i1 %cmp9, label %for.body10, label %for.end24
49 for.body10: ; preds = %for.cond7
50 %tmp14 = load i32* %arrayidx13, align 4
51 %tmp18 = load i32* %arrayidx17, align 4
52 %neg19 = xor i32 %tmp18, -1
53 %cmp20 = icmp eq i32 %tmp14, %neg19
54 br i1 %cmp20, label %if.end, label %if.then
56 if.then: ; preds = %for.body10
57 call void @abort() noreturn nounwind
60 if.end: ; preds = %for.body10
63 for.inc21: ; preds = %if.end
64 %indvar.next11 = add i64 %indvar10, 1
67 for.end24: ; preds = %for.cond7
70 for.cond25: ; preds = %for.inc38, %for.end24
71 %indvar7 = phi i64 [ %indvar.next8, %for.inc38 ], [ 0, %for.end24 ]
72 %arrayidx37 = getelementptr [64 x i8]* @ca, i64 0, i64 %indvar7
73 %arrayidx31 = getelementptr [64 x i8]* @cb, i64 0, i64 %indvar7
74 %exitcond9 = icmp ne i64 %indvar7, 64
75 br i1 %exitcond9, label %for.body28, label %for.end41
77 for.body28: ; preds = %for.cond25
78 %tmp32 = load i8* %arrayidx31, align 1
79 %neg33 = xor i8 %tmp32, -1
80 store i8 %neg33, i8* %arrayidx37, align 1
83 for.inc38: ; preds = %for.body28
84 %indvar.next8 = add i64 %indvar7, 1
87 for.end41: ; preds = %for.cond25
90 for.cond42: ; preds = %for.inc62, %for.end41
91 %indvar5 = phi i64 [ %indvar.next6, %for.inc62 ], [ 0, %for.end41 ]
92 %arrayidx54 = getelementptr [64 x i8]* @cb, i64 0, i64 %indvar5
93 %arrayidx49 = getelementptr [64 x i8]* @ca, i64 0, i64 %indvar5
94 %i.3 = trunc i64 %indvar5 to i32
95 %cmp44 = icmp slt i32 %i.3, 64
96 br i1 %cmp44, label %for.body46, label %for.end65
98 for.body46: ; preds = %for.cond42
99 %tmp50 = load i8* %arrayidx49, align 1
100 %conv51 = sext i8 %tmp50 to i32
101 %tmp55 = load i8* %arrayidx54, align 1
102 %conv56 = sext i8 %tmp55 to i32
103 %neg57 = xor i32 %conv56, -1
104 %cmp58 = icmp eq i32 %conv51, %neg57
105 br i1 %cmp58, label %if.end61, label %if.then60
107 if.then60: ; preds = %for.body46
108 call void @abort() noreturn nounwind
111 if.end61: ; preds = %for.body46
114 for.inc62: ; preds = %if.end61
115 %indvar.next6 = add i64 %indvar5, 1
118 for.end65: ; preds = %for.cond42
121 for.cond66: ; preds = %for.inc81, %for.end65
122 %indvar3 = phi i64 [ %indvar.next4, %for.inc81 ], [ 0, %for.end65 ]
123 %arrayidx80 = getelementptr [64 x i16]* @sa, i64 0, i64 %indvar3
124 %arrayidx73 = getelementptr [64 x i16]* @sb, i64 0, i64 %indvar3
125 %exitcond = icmp ne i64 %indvar3, 64
126 br i1 %exitcond, label %for.body70, label %for.end84
128 for.body70: ; preds = %for.cond66
129 %tmp74 = load i16* %arrayidx73, align 2
130 %neg76 = xor i16 %tmp74, -1
131 store i16 %neg76, i16* %arrayidx80, align 2
134 for.inc81: ; preds = %for.body70
135 %indvar.next4 = add i64 %indvar3, 1
138 for.end84: ; preds = %for.cond66
141 for.cond85: ; preds = %for.inc105, %for.end84
142 %indvar = phi i64 [ %indvar.next, %for.inc105 ], [ 0, %for.end84 ]
143 %arrayidx97 = getelementptr [64 x i16]* @sb, i64 0, i64 %indvar
144 %arrayidx92 = getelementptr [64 x i16]* @sa, i64 0, i64 %indvar
145 %i.5 = trunc i64 %indvar to i32
146 %cmp87 = icmp slt i32 %i.5, 64
147 br i1 %cmp87, label %for.body89, label %for.end108
149 for.body89: ; preds = %for.cond85
150 %tmp93 = load i16* %arrayidx92, align 2
151 %conv94 = sext i16 %tmp93 to i32
152 %tmp98 = load i16* %arrayidx97, align 2
153 %conv99 = sext i16 %tmp98 to i32
154 %neg100 = xor i32 %conv99, -1
155 %cmp101 = icmp eq i32 %conv94, %neg100
156 br i1 %cmp101, label %if.end104, label %if.then103
158 if.then103: ; preds = %for.body89
159 call void @abort() noreturn nounwind
162 if.end104: ; preds = %for.body89
165 for.inc105: ; preds = %if.end104
166 %indvar.next = add i64 %indvar, 1
169 for.end108: ; preds = %for.cond85
173 declare void @abort() noreturn
175 define i32 @main() nounwind uwtable {
177 call void @check_vect()
178 %call = call i32 @main1()
182 define internal void @check_vect() nounwind uwtable noinline {
184 %a = alloca i32, align 4
185 %b = alloca i32, align 4
186 %c = alloca i32, align 4
187 %d = alloca i32, align 4
188 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
189 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
190 %tobool = icmp eq i32 %call1, 0
191 br i1 %tobool, label %if.then, label %lor.lhs.false
193 lor.lhs.false: ; preds = %entry
194 %tmp4 = load i32* %d, align 4
195 %and6 = and i32 %tmp4, 67108864
196 %cmp = icmp eq i32 %and6, 0
197 br i1 %cmp, label %if.then, label %if.end
199 if.then: ; preds = %entry, %lor.lhs.false
200 call void @exit(i32 0) noreturn nounwind
203 if.end: ; preds = %lor.lhs.false
204 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
208 declare void (i32)* @signal(i32, void (i32)*) nounwind
210 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
212 call void @exit(i32 0) noreturn nounwind
215 return: ; No predecessors!
219 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
221 %and = and i32 %__level, -2147483648
222 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
223 %cmp = icmp ult i32 %call, %__level
224 br i1 %cmp, label %if.then, label %if.end
226 if.then: ; preds = %entry
229 if.end: ; preds = %entry
230 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
231 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
232 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
233 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
234 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
235 store i32 %asmresult, i32* %__eax, align 4
236 store i32 %asmresult8, i32* %__ebx, align 4
237 store i32 %asmresult9, i32* %__ecx, align 4
238 store i32 %asmresult10, i32* %__edx, align 4
241 return: ; preds = %if.end, %if.then
242 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
246 declare void @exit(i32) noreturn
248 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
250 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
251 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
252 %tobool = icmp eq i32* %__sig, null
253 br i1 %tobool, label %if.end, label %if.then
255 if.then: ; preds = %entry
256 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
257 store i32 %asmresult1, i32* %__sig, align 4
260 if.end: ; preds = %entry, %if.then
264 !0 = metadata !{i32 -2147342646, i32 -2147342638}
265 !1 = metadata !{i32 -2147342769, i32 -2147342761}