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-3.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-3.s > vect-3.ll
6 ; ModuleID = 'vect-3.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 @b = global [20 x float] [float 0.000000e+00, float 3.000000e+00, float 6.000000e+00, float 9.000000e+00, float 1.200000e+01, float 1.500000e+01, float 1.800000e+01, float 2.100000e+01, float 2.400000e+01, float 2.700000e+01, float 3.000000e+01, float 3.300000e+01, float 3.600000e+01, float 3.900000e+01, float 4.200000e+01, float 4.500000e+01, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00], align 16
11 @c = global [20 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, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00], align 16
12 @d = global [20 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, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00], align 16
13 @ic = global [20 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 0, i32 0, i32 0], align 16
14 @ib = global [20 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 0, i32 0, i32 0], align 16
15 @a = common global [20 x float] zeroinitializer, align 16
16 @e = common global [20 x float] zeroinitializer, align 16
17 @ia = common global [20 x i32] zeroinitializer, align 16
19 define i32 @main1() nounwind uwtable noinline {
23 for.cond: ; preds = %for.inc, %entry
24 %indvar1 = phi i64 [ %indvar.next2, %for.inc ], [ 0, %entry ]
25 %arrayidx43 = getelementptr [20 x i32]* @ia, i64 0, i64 %indvar1
26 %arrayidx38 = getelementptr [20 x i32]* @ic, i64 0, i64 %indvar1
27 %arrayidx34 = getelementptr [20 x i32]* @ib, i64 0, i64 %indvar1
28 %arrayidx31 = getelementptr [20 x float]* @e, i64 0, i64 %indvar1
29 %arrayidx9 = getelementptr [20 x float]* @d, i64 0, i64 %indvar1
30 %arrayidx5 = getelementptr [20 x float]* @c, i64 0, i64 %indvar1
31 %arrayidx = getelementptr [20 x float]* @b, i64 0, i64 %indvar1
32 %arrayidx14 = getelementptr [20 x float]* @a, i64 0, i64 %indvar1
33 %exitcond = icmp ne i64 %indvar1, 20
34 br i1 %exitcond, label %for.body, label %for.end
36 for.body: ; preds = %for.cond
37 %tmp2 = load float* %arrayidx, align 4
38 %tmp6 = load float* %arrayidx5, align 4
39 %add = fadd float %tmp2, %tmp6
40 %tmp10 = load float* %arrayidx9, align 4
41 %add11 = fadd float %add, %tmp10
42 store float %add11, float* %arrayidx14, align 4
43 %tmp18 = load float* %arrayidx, align 4
44 %tmp22 = load float* %arrayidx5, align 4
45 %add23 = fadd float %tmp18, %tmp22
46 %tmp27 = load float* %arrayidx9, align 4
47 %add28 = fadd float %add23, %tmp27
48 store float %add28, float* %arrayidx31, align 4
49 %tmp35 = load i32* %arrayidx34, align 4
50 %tmp39 = load i32* %arrayidx38, align 4
51 %add40 = add nsw i32 %tmp35, %tmp39
52 store i32 %add40, i32* %arrayidx43, align 4
55 for.inc: ; preds = %for.body
56 %indvar.next2 = add i64 %indvar1, 1
59 for.end: ; preds = %for.cond
62 for.cond45: ; preds = %for.inc93, %for.end
63 %indvar = phi i64 [ %indvar.next, %for.inc93 ], [ 0, %for.end ]
64 %arrayidx89 = getelementptr [20 x i32]* @ia, i64 0, i64 %indvar
65 %arrayidx82 = getelementptr [20 x float]* @e, i64 0, i64 %indvar
66 %arrayidx76 = getelementptr [20 x float]* @a, i64 0, i64 %indvar
67 %arrayidx71 = getelementptr [20 x i32]* @ic, i64 0, i64 %indvar
68 %arrayidx67 = getelementptr [20 x i32]* @ib, i64 0, i64 %indvar
69 %arrayidx61 = getelementptr [20 x float]* @d, i64 0, i64 %indvar
70 %arrayidx56 = getelementptr [20 x float]* @c, i64 0, i64 %indvar
71 %arrayidx52 = getelementptr [20 x float]* @b, i64 0, i64 %indvar
72 %i.1 = trunc i64 %indvar to i32
73 %cmp47 = icmp slt i32 %i.1, 20
74 br i1 %cmp47, label %for.body48, label %for.end96
76 for.body48: ; preds = %for.cond45
77 %tmp53 = load float* %arrayidx52, align 4
78 %tmp57 = load float* %arrayidx56, align 4
79 %add58 = fadd float %tmp53, %tmp57
80 %tmp62 = load float* %arrayidx61, align 4
81 %add63 = fadd float %add58, %tmp62
82 %tmp68 = load i32* %arrayidx67, align 4
83 %tmp72 = load i32* %arrayidx71, align 4
84 %add73 = add nsw i32 %tmp68, %tmp72
85 %tmp77 = load float* %arrayidx76, align 4
86 %cmp79 = fcmp une float %tmp77, %add63
87 br i1 %cmp79, label %if.then, label %lor.lhs.false
89 lor.lhs.false: ; preds = %for.body48
90 %tmp83 = load float* %arrayidx82, align 4
91 %cmp85 = fcmp une float %tmp83, %add63
92 br i1 %cmp85, label %if.then, label %lor.lhs.false86
94 lor.lhs.false86: ; preds = %lor.lhs.false
95 %tmp90 = load i32* %arrayidx89, align 4
96 %cmp92 = icmp eq i32 %tmp90, %add73
97 br i1 %cmp92, label %if.end, label %if.then
99 if.then: ; preds = %lor.lhs.false86, %lor.lhs.false, %for.body48
100 call void @abort() noreturn nounwind
103 if.end: ; preds = %lor.lhs.false86
106 for.inc93: ; preds = %if.end
107 %indvar.next = add i64 %indvar, 1
110 for.end96: ; preds = %for.cond45
114 declare void @abort() noreturn
116 define i32 @main() nounwind uwtable {
118 call void @check_vect()
119 %call = call i32 @main1()
123 define internal void @check_vect() nounwind uwtable noinline {
125 %a = alloca i32, align 4
126 %b = alloca i32, align 4
127 %c = alloca i32, align 4
128 %d = alloca i32, align 4
129 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
130 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
131 %tobool = icmp eq i32 %call1, 0
132 br i1 %tobool, label %if.then, label %lor.lhs.false
134 lor.lhs.false: ; preds = %entry
135 %tmp4 = load i32* %d, align 4
136 %and6 = and i32 %tmp4, 67108864
137 %cmp = icmp eq i32 %and6, 0
138 br i1 %cmp, label %if.then, label %if.end
140 if.then: ; preds = %entry, %lor.lhs.false
141 call void @exit(i32 0) noreturn nounwind
144 if.end: ; preds = %lor.lhs.false
145 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
149 declare void (i32)* @signal(i32, void (i32)*) nounwind
151 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
153 call void @exit(i32 0) noreturn nounwind
156 return: ; No predecessors!
160 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
162 %and = and i32 %__level, -2147483648
163 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
164 %cmp = icmp ult i32 %call, %__level
165 br i1 %cmp, label %if.then, label %if.end
167 if.then: ; preds = %entry
170 if.end: ; preds = %entry
171 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
172 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
173 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
174 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
175 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
176 store i32 %asmresult, i32* %__eax, align 4
177 store i32 %asmresult8, i32* %__ebx, align 4
178 store i32 %asmresult9, i32* %__ecx, align 4
179 store i32 %asmresult10, i32* %__edx, align 4
182 return: ; preds = %if.end, %if.then
183 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
187 declare void @exit(i32) noreturn
189 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
191 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
192 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
193 %tobool = icmp eq i32* %__sig, null
194 br i1 %tobool, label %if.end, label %if.then
196 if.then: ; preds = %entry
197 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
198 store i32 %asmresult1, i32* %__sig, align 4
201 if.end: ; preds = %entry, %if.then
205 !0 = metadata !{i32 -2147343163, i32 -2147343155}
206 !1 = metadata !{i32 -2147343286, i32 -2147343278}