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-107.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-107.s > vect-107.ll
6 ; ModuleID = 'vect-107.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 [16 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], align 16
11 @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
12 @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
14 define i32 @main1() nounwind uwtable noinline {
16 %a = alloca [16 x float], align 16
19 for.cond: ; preds = %for.inc, %entry
20 %indvar12 = phi i64 [ %indvar.next13, %for.inc ], [ 0, %entry ]
21 %tmp15 = mul i64 %indvar12, 2
22 %arrayidx18 = getelementptr [16 x float]* @c, i64 0, i64 %tmp15
23 %tmp16 = add i64 %tmp15, 1
24 %arrayidx = getelementptr [16 x float]* @b, i64 0, i64 %tmp16
25 %arrayidx7 = getelementptr [16 x float]* @c, i64 0, i64 %tmp16
26 %arrayidx13 = getelementptr [16 x float]* @b, i64 0, i64 %tmp15
27 %arrayidx51 = getelementptr [16 x float]* @d, i64 0, i64 %indvar12
28 %arrayidx23 = getelementptr [16 x float]* %a, i64 0, i64 %indvar12
29 %exitcond = icmp ne i64 %indvar12, 8
30 br i1 %exitcond, label %for.body, label %for.end
32 for.body: ; preds = %for.cond
33 %tmp2 = load float* %arrayidx, align 4
34 %tmp8 = load float* %arrayidx7, align 4
35 %mul9 = fmul float %tmp2, %tmp8
36 %tmp14 = load float* %arrayidx13, align 8
37 %tmp19 = load float* %arrayidx18, align 8
38 %mul20 = fmul float %tmp14, %tmp19
39 %sub = fsub float %mul9, %mul20
40 store float %sub, float* %arrayidx23, align 4
41 %tmp28 = load float* %arrayidx13, align 8
42 %tmp34 = load float* %arrayidx7, align 4
43 %mul35 = fmul float %tmp28, %tmp34
44 %tmp41 = load float* %arrayidx, align 4
45 %tmp46 = load float* %arrayidx18, align 8
46 %mul47 = fmul float %tmp41, %tmp46
47 %add48 = fadd float %mul35, %mul47
48 store float %add48, float* %arrayidx51, align 4
51 for.inc: ; preds = %for.body
52 %indvar.next13 = add i64 %indvar12, 1
55 for.end: ; preds = %for.cond
58 for.cond53: ; preds = %for.inc117, %for.end
59 %indvar = phi i64 [ %indvar.next, %for.inc117 ], [ 0, %for.end ]
60 %tmp = mul i64 %indvar, 2
61 %arrayidx82 = getelementptr [16 x float]* @c, i64 0, i64 %tmp
62 %tmp10 = add i64 %tmp, 1
63 %arrayidx65 = getelementptr [16 x float]* @b, i64 0, i64 %tmp10
64 %arrayidx71 = getelementptr [16 x float]* @c, i64 0, i64 %tmp10
65 %arrayidx77 = getelementptr [16 x float]* @b, i64 0, i64 %tmp
66 %arrayidx89 = getelementptr [16 x float]* @d, i64 0, i64 %indvar
67 %arrayidx59 = getelementptr [16 x float]* %a, i64 0, i64 %indvar
68 %i.1 = trunc i64 %indvar to i32
69 %cmp55 = icmp slt i32 %i.1, 8
70 br i1 %cmp55, label %for.body56, label %for.end120
72 for.body56: ; preds = %for.cond53
73 %tmp60 = load float* %arrayidx59, align 4
74 %tmp66 = load float* %arrayidx65, align 4
75 %tmp72 = load float* %arrayidx71, align 4
76 %mul73 = fmul float %tmp66, %tmp72
77 %tmp78 = load float* %arrayidx77, align 8
78 %tmp83 = load float* %arrayidx82, align 8
79 %mul84 = fmul float %tmp78, %tmp83
80 %sub85 = fsub float %mul73, %mul84
81 %cmp86 = fcmp une float %tmp60, %sub85
82 br i1 %cmp86, label %if.then, label %lor.lhs.false
84 lor.lhs.false: ; preds = %for.body56
85 %tmp90 = load float* %arrayidx89, align 4
86 %tmp95 = load float* %arrayidx77, align 8
87 %tmp101 = load float* %arrayidx71, align 4
88 %mul102 = fmul float %tmp95, %tmp101
89 %tmp108 = load float* %arrayidx65, align 4
90 %tmp113 = load float* %arrayidx82, align 8
91 %mul114 = fmul float %tmp108, %tmp113
92 %add115 = fadd float %mul102, %mul114
93 %cmp116 = fcmp une float %tmp90, %add115
94 br i1 %cmp116, label %if.then, label %if.end
96 if.then: ; preds = %lor.lhs.false, %for.body56
97 call void @abort() noreturn nounwind
100 if.end: ; preds = %lor.lhs.false
103 for.inc117: ; preds = %if.end
104 %indvar.next = add i64 %indvar, 1
107 for.end120: ; preds = %for.cond53
111 declare void @abort() noreturn
113 define i32 @main() nounwind uwtable {
115 call void @check_vect()
116 %call = call i32 @main1()
120 define internal void @check_vect() nounwind uwtable noinline {
122 %a = alloca i32, align 4
123 %b = alloca i32, align 4
124 %c = alloca i32, align 4
125 %d = alloca i32, align 4
126 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
127 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
128 %tobool = icmp eq i32 %call1, 0
129 br i1 %tobool, label %if.then, label %lor.lhs.false
131 lor.lhs.false: ; preds = %entry
132 %tmp4 = load i32* %d, align 4
133 %and6 = and i32 %tmp4, 67108864
134 %cmp = icmp eq i32 %and6, 0
135 br i1 %cmp, label %if.then, label %if.end
137 if.then: ; preds = %entry, %lor.lhs.false
138 call void @exit(i32 0) noreturn nounwind
141 if.end: ; preds = %lor.lhs.false
142 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
146 declare void (i32)* @signal(i32, void (i32)*) nounwind
148 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
150 call void @exit(i32 0) noreturn nounwind
153 return: ; No predecessors!
157 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
159 %and = and i32 %__level, -2147483648
160 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
161 %cmp = icmp ult i32 %call, %__level
162 br i1 %cmp, label %if.then, label %if.end
164 if.then: ; preds = %entry
167 if.end: ; preds = %entry
168 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
169 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
170 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
171 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
172 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
173 store i32 %asmresult, i32* %__eax, align 4
174 store i32 %asmresult8, i32* %__ebx, align 4
175 store i32 %asmresult9, i32* %__ecx, align 4
176 store i32 %asmresult10, i32* %__edx, align 4
179 return: ; preds = %if.end, %if.then
180 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
184 declare void @exit(i32) noreturn
186 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
188 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
189 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
190 %tobool = icmp eq i32* %__sig, null
191 br i1 %tobool, label %if.end, label %if.then
193 if.then: ; preds = %entry
194 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
195 store i32 %asmresult1, i32* %__sig, align 4
198 if.end: ; preds = %entry, %if.then
202 !0 = metadata !{i32 -2147343190, i32 -2147343182}
203 !1 = metadata !{i32 -2147343313, i32 -2147343305}