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-10.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-multitypes-10.s > vect-multitypes-10.ll
6 ; ModuleID = 'vect-multitypes-10.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 @uX = common global [64 x i8] zeroinitializer, align 16
11 @uY = common global [64 x i16] zeroinitializer, align 16
12 @uresult = common global [64 x i32] zeroinitializer, align 16
13 @Y = common global [64 x i16] zeroinitializer, align 16
14 @result = common global [64 x i32] zeroinitializer, align 16
15 @X = common global [64 x i8] zeroinitializer, align 16
17 define i32 @foo1(i32 %len) nounwind uwtable noinline {
19 %tmp = icmp sgt i32 %len, 0
20 %smax = select i1 %tmp, i32 %len, i32 0
21 %tmp1 = zext i32 %smax to i64
24 for.cond: ; preds = %for.inc, %entry
25 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %entry ]
26 %arrayidx9 = getelementptr [64 x i32]* @uresult, i64 0, i64 %indvar
27 %arrayidx5 = getelementptr [64 x i16]* @uY, i64 0, i64 %indvar
28 %arrayidx = getelementptr [64 x i8]* @uX, i64 0, i64 %indvar
29 %exitcond = icmp ne i64 %indvar, %tmp1
30 br i1 %exitcond, label %for.body, label %for.end
32 for.body: ; preds = %for.cond
33 store i8 5, i8* %arrayidx, align 1
34 %tmp6 = load i16* %arrayidx5, align 2
35 %conv = zext i16 %tmp6 to i32
36 store i32 %conv, i32* %arrayidx9, align 4
39 for.inc: ; preds = %for.body
40 %indvar.next = add i64 %indvar, 1
43 for.end: ; preds = %for.cond
47 define i32 @foo2(i32 %len) nounwind uwtable noinline {
49 %tmp = icmp sgt i32 %len, 0
50 %smax = select i1 %tmp, i32 %len, i32 0
51 %tmp1 = zext i32 %smax to i64
54 for.cond: ; preds = %for.inc, %entry
55 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %entry ]
56 %arrayidx9 = getelementptr [64 x i32]* @result, i64 0, i64 %indvar
57 %arrayidx5 = getelementptr [64 x i16]* @Y, i64 0, i64 %indvar
58 %arrayidx = getelementptr [64 x i8]* @uX, i64 0, i64 %indvar
59 %exitcond = icmp ne i64 %indvar, %tmp1
60 br i1 %exitcond, label %for.body, label %for.end
62 for.body: ; preds = %for.cond
63 store i8 5, i8* %arrayidx, align 1
64 %tmp6 = load i16* %arrayidx5, align 2
65 %conv = sext i16 %tmp6 to i32
66 store i32 %conv, i32* %arrayidx9, align 4
69 for.inc: ; preds = %for.body
70 %indvar.next = add i64 %indvar, 1
73 for.end: ; preds = %for.cond
77 define i32 @main() nounwind uwtable {
79 call void @check_vect()
82 for.cond: ; preds = %for.inc, %entry
83 %indvar3 = phi i64 [ %indvar.next4, %for.inc ], [ 0, %entry ]
84 %arrayidx8 = getelementptr [64 x i8]* @uX, i64 0, i64 %indvar3
85 %tmp = mul i64 %indvar3, -1
86 %tmp5 = add i64 %tmp, 16
87 %conv = trunc i64 %tmp5 to i8
88 %arrayidx = getelementptr [64 x i8]* @X, i64 0, i64 %indvar3
89 %exitcond = icmp ne i64 %indvar3, 64
90 br i1 %exitcond, label %for.body, label %for.end
92 for.body: ; preds = %for.cond
93 store i8 %conv, i8* %arrayidx, align 1
94 store i8 %conv, i8* %arrayidx8, align 1
95 call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags}"() nounwind, !srcloc !0
98 for.inc: ; preds = %for.body
99 %indvar.next4 = add i64 %indvar3, 1
102 for.end: ; preds = %for.cond
103 %call = call i32 @foo1(i32 64)
106 for.cond10: ; preds = %for.inc26, %for.end
107 %indvar1 = phi i64 [ %indvar.next2, %for.inc26 ], [ 0, %for.end ]
108 %arrayidx21 = getelementptr [64 x i16]* @uY, i64 0, i64 %indvar1
109 %arrayidx17 = getelementptr [64 x i32]* @uresult, i64 0, i64 %indvar1
110 %i.1 = trunc i64 %indvar1 to i32
111 %cmp12 = icmp slt i32 %i.1, 64
112 br i1 %cmp12, label %for.body14, label %for.end29
114 for.body14: ; preds = %for.cond10
115 %tmp18 = load i32* %arrayidx17, align 4
116 %tmp22 = load i16* %arrayidx21, align 2
117 %conv23 = zext i16 %tmp22 to i32
118 %cmp24 = icmp eq i32 %tmp18, %conv23
119 br i1 %cmp24, label %if.end, label %if.then
121 if.then: ; preds = %for.body14
122 call void @abort() noreturn nounwind
125 if.end: ; preds = %for.body14
128 for.inc26: ; preds = %if.end
129 %indvar.next2 = add i64 %indvar1, 1
132 for.end29: ; preds = %for.cond10
133 %call30 = call i32 @foo2(i32 64)
136 for.cond31: ; preds = %for.inc49, %for.end29
137 %indvar = phi i64 [ %indvar.next, %for.inc49 ], [ 0, %for.end29 ]
138 %arrayidx42 = getelementptr [64 x i16]* @Y, i64 0, i64 %indvar
139 %arrayidx38 = getelementptr [64 x i32]* @result, i64 0, i64 %indvar
140 %i.2 = trunc i64 %indvar to i32
141 %cmp33 = icmp slt i32 %i.2, 64
142 br i1 %cmp33, label %for.body35, label %for.end52
144 for.body35: ; preds = %for.cond31
145 %tmp39 = load i32* %arrayidx38, align 4
146 %tmp43 = load i16* %arrayidx42, align 2
147 %conv44 = sext i16 %tmp43 to i32
148 %cmp45 = icmp eq i32 %tmp39, %conv44
149 br i1 %cmp45, label %if.end48, label %if.then47
151 if.then47: ; preds = %for.body35
152 call void @abort() noreturn nounwind
155 if.end48: ; preds = %for.body35
158 for.inc49: ; preds = %if.end48
159 %indvar.next = add i64 %indvar, 1
162 for.end52: ; preds = %for.cond31
166 define internal void @check_vect() nounwind uwtable noinline {
168 %a = alloca i32, align 4
169 %b = alloca i32, align 4
170 %c = alloca i32, align 4
171 %d = alloca i32, align 4
172 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
173 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
174 %tobool = icmp eq i32 %call1, 0
175 br i1 %tobool, label %if.then, label %lor.lhs.false
177 lor.lhs.false: ; preds = %entry
178 %tmp4 = load i32* %d, align 4
179 %and6 = and i32 %tmp4, 67108864
180 %cmp = icmp eq i32 %and6, 0
181 br i1 %cmp, label %if.then, label %if.end
183 if.then: ; preds = %entry, %lor.lhs.false
184 call void @exit(i32 0) noreturn nounwind
187 if.end: ; preds = %lor.lhs.false
188 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
192 declare void @abort() noreturn
194 declare void (i32)* @signal(i32, void (i32)*) nounwind
196 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
198 call void @exit(i32 0) noreturn nounwind
201 return: ; No predecessors!
205 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
207 %and = and i32 %__level, -2147483648
208 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
209 %cmp = icmp ult i32 %call, %__level
210 br i1 %cmp, label %if.then, label %if.end
212 if.then: ; preds = %entry
215 if.end: ; preds = %entry
216 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !1
217 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
218 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
219 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
220 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
221 store i32 %asmresult, i32* %__eax, align 4
222 store i32 %asmresult8, i32* %__ebx, align 4
223 store i32 %asmresult9, i32* %__ecx, align 4
224 store i32 %asmresult10, i32* %__edx, align 4
227 return: ; preds = %if.end, %if.then
228 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
232 declare void @exit(i32) noreturn
234 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
236 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !2
237 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
238 %tobool = icmp eq i32* %__sig, null
239 br i1 %tobool, label %if.end, label %if.then
241 if.then: ; preds = %entry
242 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
243 store i32 %asmresult1, i32* %__sig, align 4
246 if.end: ; preds = %entry, %if.then
250 !0 = metadata !{i32 919}
251 !1 = metadata !{i32 -2147343033, i32 -2147343025}
252 !2 = metadata !{i32 -2147343156, i32 -2147343148}