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-5.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-5.s > vect-5.ll
6 ; ModuleID = 'vect-5.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 @c = global [16 x float] [float 0.000000e+00, float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 6.000000e+00, float 7.000000e+00, float 8.000000e+00, float 9.000000e+00, float 1.000000e+01, float 1.100000e+01, float 1.200000e+01, float 1.300000e+01, float 1.400000e+01, float 1.500000e+01], align 16
11 @d = global [16 x float] [float 0.000000e+00, float 2.000000e+00, float 4.000000e+00, float 6.000000e+00, float 8.000000e+00, float 1.000000e+01, float 1.200000e+01, float 1.400000e+01, float 1.600000e+01, float 1.800000e+01, float 2.000000e+01, float 2.200000e+01, float 2.400000e+01, float 2.600000e+01, float 2.800000e+01, float 3.000000e+01], align 16
12 @a = common global [16 x float] zeroinitializer, align 16
14 define i32 @main1() nounwind uwtable noinline {
18 while.cond: ; preds = %while.body, %entry
19 %indvar7 = phi i64 [ %indvar.next8, %while.body ], [ 0, %entry ]
20 %arrayidx5 = getelementptr [16 x float]* @a, i64 0, i64 %indvar7
21 %arrayidx = getelementptr [16 x float]* @c, i64 0, i64 %indvar7
22 %exitcond9 = icmp ne i64 %indvar7, 16
23 br i1 %exitcond9, label %while.body, label %while.end
25 while.body: ; preds = %while.cond
26 %tmp2 = load float* %arrayidx, align 4
27 store float %tmp2, float* %arrayidx5, align 4
28 %indvar.next8 = add i64 %indvar7, 1
31 while.end: ; preds = %while.cond
34 for.cond: ; preds = %for.inc, %while.end
35 %indvar5 = phi i64 [ %indvar.next6, %for.inc ], [ 0, %while.end ]
36 %arrayidx16 = getelementptr [16 x float]* @c, i64 0, i64 %indvar5
37 %arrayidx12 = getelementptr [16 x float]* @a, i64 0, i64 %indvar5
38 %i.1 = trunc i64 %indvar5 to i32
39 %cmp9 = icmp slt i32 %i.1, 16
40 br i1 %cmp9, label %for.body, label %for.end
42 for.body: ; preds = %for.cond
43 %tmp13 = load float* %arrayidx12, align 4
44 %tmp17 = load float* %arrayidx16, align 4
45 %cmp18 = fcmp une float %tmp13, %tmp17
46 br i1 %cmp18, label %if.then, label %if.end
48 if.then: ; preds = %for.body
49 call void @abort() noreturn nounwind
52 if.end: ; preds = %for.body
55 for.inc: ; preds = %if.end
56 %indvar.next6 = add i64 %indvar5, 1
59 for.end: ; preds = %for.cond
62 for.cond21: ; preds = %for.inc33, %for.end
63 %indvar1 = phi i64 [ %indvar.next2, %for.inc33 ], [ 0, %for.end ]
64 %arrayidx32 = getelementptr [16 x float]* @a, i64 0, i64 %indvar1
65 %arrayidx27 = getelementptr [16 x float]* @d, i64 0, i64 %indvar1
66 %exitcond = icmp ne i64 %indvar1, 16
67 br i1 %exitcond, label %for.body24, label %for.end35
69 for.body24: ; preds = %for.cond21
70 %tmp28 = load float* %arrayidx27, align 4
71 store float %tmp28, float* %arrayidx32, align 4
74 for.inc33: ; preds = %for.body24
75 %indvar.next2 = add i64 %indvar1, 1
78 for.end35: ; preds = %for.cond21
81 for.cond36: ; preds = %for.inc51, %for.end35
82 %indvar = phi i64 [ %indvar.next, %for.inc51 ], [ 0, %for.end35 ]
83 %arrayidx46 = getelementptr [16 x float]* @d, i64 0, i64 %indvar
84 %arrayidx42 = getelementptr [16 x float]* @a, i64 0, i64 %indvar
85 %i.3 = trunc i64 %indvar to i32
86 %cmp38 = icmp slt i32 %i.3, 16
87 br i1 %cmp38, label %for.body39, label %for.end54
89 for.body39: ; preds = %for.cond36
90 %tmp43 = load float* %arrayidx42, align 4
91 %tmp47 = load float* %arrayidx46, align 4
92 %cmp48 = fcmp une float %tmp43, %tmp47
93 br i1 %cmp48, label %if.then49, label %if.end50
95 if.then49: ; preds = %for.body39
96 call void @abort() noreturn nounwind
99 if.end50: ; preds = %for.body39
102 for.inc51: ; preds = %if.end50
103 %indvar.next = add i64 %indvar, 1
106 for.end54: ; preds = %for.cond36
110 declare void @abort() noreturn
112 define i32 @main() nounwind uwtable {
114 call void @check_vect()
115 %call = call i32 @main1()
119 define internal void @check_vect() nounwind uwtable noinline {
121 %a = alloca i32, align 4
122 %b = alloca i32, align 4
123 %c = alloca i32, align 4
124 %d = alloca i32, align 4
125 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
126 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
127 %tobool = icmp eq i32 %call1, 0
128 br i1 %tobool, label %if.then, label %lor.lhs.false
130 lor.lhs.false: ; preds = %entry
131 %tmp4 = load i32* %d, align 4
132 %and6 = and i32 %tmp4, 67108864
133 %cmp = icmp eq i32 %and6, 0
134 br i1 %cmp, label %if.then, label %if.end
136 if.then: ; preds = %entry, %lor.lhs.false
137 call void @exit(i32 0) noreturn nounwind
140 if.end: ; preds = %lor.lhs.false
141 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
145 declare void (i32)* @signal(i32, void (i32)*) nounwind
147 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
149 call void @exit(i32 0) noreturn nounwind
152 return: ; No predecessors!
156 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
158 %and = and i32 %__level, -2147483648
159 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
160 %cmp = icmp ult i32 %call, %__level
161 br i1 %cmp, label %if.then, label %if.end
163 if.then: ; preds = %entry
166 if.end: ; preds = %entry
167 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
168 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
169 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
170 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
171 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
172 store i32 %asmresult, i32* %__eax, align 4
173 store i32 %asmresult8, i32* %__ebx, align 4
174 store i32 %asmresult9, i32* %__ecx, align 4
175 store i32 %asmresult10, i32* %__edx, align 4
178 return: ; preds = %if.end, %if.then
179 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
183 declare void @exit(i32) noreturn
185 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
187 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
188 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
189 %tobool = icmp eq i32* %__sig, null
190 br i1 %tobool, label %if.end, label %if.then
192 if.then: ; preds = %entry
193 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
194 store i32 %asmresult1, i32* %__sig, align 4
197 if.end: ; preds = %entry, %if.then
201 !0 = metadata !{i32 -2147343386, i32 -2147343378}
202 !1 = metadata !{i32 -2147343509, i32 -2147343501}