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-strided-float.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-strided-float.s > vect-strided-float.ll
6 ; ModuleID = 'vect-strided-float.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 [32 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 4.800000e+01, float 5.100000e+01, float 5.400000e+01, float 5.700000e+01, float 6.000000e+01, float 6.300000e+01, float 6.600000e+01, float 6.900000e+01, float 7.200000e+01, float 7.500000e+01, float 7.800000e+01, float 8.100000e+01, float 8.400000e+01, float 8.700000e+01, float 9.000000e+01, float 9.300000e+01], align 16
11 @c = global [32 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 1.600000e+01, float 1.700000e+01, float 1.800000e+01, float 1.900000e+01, float 2.000000e+01, float 2.100000e+01, float 2.200000e+01, float 2.300000e+01, float 2.400000e+01, float 2.500000e+01, float 2.600000e+01, float 2.700000e+01, float 2.800000e+01, float 2.900000e+01, float 3.000000e+01, float 3.100000e+01], align 16
13 define i32 @main1() nounwind uwtable noinline {
15 %a = alloca [32 x float], align 16
18 for.cond: ; preds = %for.inc, %entry
19 %indvar12 = phi i64 [ %indvar.next13, %for.inc ], [ 0, %entry ]
20 %tmp15 = mul i64 %indvar12, 2
21 %tmp16 = add i64 %tmp15, 1
22 %arrayidx56 = getelementptr [32 x float]* %a, i64 0, i64 %tmp16
23 %tmp17 = add i64 %tmp15, 8
24 %arrayidx48 = getelementptr [32 x float]* @c, i64 0, i64 %tmp17
25 %tmp18 = add i64 %tmp15, 9
26 %arrayidx42 = getelementptr [32 x float]* @b, i64 0, i64 %tmp18
27 %arrayidx35 = getelementptr [32 x float]* @c, i64 0, i64 %tmp18
28 %arrayidx29 = getelementptr [32 x float]* @b, i64 0, i64 %tmp17
29 %arrayidx24 = getelementptr [32 x float]* %a, i64 0, i64 %tmp15
30 %arrayidx18 = getelementptr [32 x float]* @c, i64 0, i64 %tmp15
31 %arrayidx13 = getelementptr [32 x float]* @b, i64 0, i64 %tmp15
32 %arrayidx7 = getelementptr [32 x float]* @c, i64 0, i64 %tmp16
33 %arrayidx = getelementptr [32 x float]* @b, i64 0, i64 %tmp16
34 %exitcond = icmp ne i64 %indvar12, 8
35 br i1 %exitcond, label %for.body, label %for.end
37 for.body: ; preds = %for.cond
38 %tmp2 = load float* %arrayidx, align 4
39 %tmp8 = load float* %arrayidx7, align 4
40 %mul9 = fmul float %tmp2, %tmp8
41 %tmp14 = load float* %arrayidx13, align 8
42 %tmp19 = load float* %arrayidx18, align 8
43 %mul20 = fmul float %tmp14, %tmp19
44 %sub = fsub float %mul9, %mul20
45 store float %sub, float* %arrayidx24, align 8
46 %tmp30 = load float* %arrayidx29, align 8
47 %tmp36 = load float* %arrayidx35, align 4
48 %mul37 = fmul float %tmp30, %tmp36
49 %tmp43 = load float* %arrayidx42, align 4
50 %tmp49 = load float* %arrayidx48, align 8
51 %mul50 = fmul float %tmp43, %tmp49
52 %add51 = fadd float %mul37, %mul50
53 store float %add51, float* %arrayidx56, align 4
56 for.inc: ; preds = %for.body
57 %indvar.next13 = add i64 %indvar12, 1
60 for.end: ; preds = %for.cond
63 for.cond58: ; preds = %for.inc127, %for.end
64 %indvar = phi i64 [ %indvar.next, %for.inc127 ], [ 0, %for.end ]
65 %tmp = mul i64 %indvar, 2
66 %tmp7 = add i64 %tmp, 8
67 %arrayidx122 = getelementptr [32 x float]* @c, i64 0, i64 %tmp7
68 %tmp9 = add i64 %tmp, 9
69 %arrayidx116 = getelementptr [32 x float]* @b, i64 0, i64 %tmp9
70 %arrayidx109 = getelementptr [32 x float]* @c, i64 0, i64 %tmp9
71 %arrayidx103 = getelementptr [32 x float]* @b, i64 0, i64 %tmp7
72 %tmp10 = add i64 %tmp, 1
73 %arrayidx97 = getelementptr [32 x float]* %a, i64 0, i64 %tmp10
74 %arrayidx88 = getelementptr [32 x float]* @c, i64 0, i64 %tmp
75 %arrayidx83 = getelementptr [32 x float]* @b, i64 0, i64 %tmp
76 %arrayidx77 = getelementptr [32 x float]* @c, i64 0, i64 %tmp10
77 %arrayidx71 = getelementptr [32 x float]* @b, i64 0, i64 %tmp10
78 %arrayidx65 = getelementptr [32 x float]* %a, i64 0, i64 %tmp
79 %i.1 = trunc i64 %indvar to i32
80 %cmp60 = icmp slt i32 %i.1, 8
81 br i1 %cmp60, label %for.body61, label %for.end130
83 for.body61: ; preds = %for.cond58
84 %tmp66 = load float* %arrayidx65, align 8
85 %tmp72 = load float* %arrayidx71, align 4
86 %tmp78 = load float* %arrayidx77, align 4
87 %mul79 = fmul float %tmp72, %tmp78
88 %tmp84 = load float* %arrayidx83, align 8
89 %tmp89 = load float* %arrayidx88, align 8
90 %mul90 = fmul float %tmp84, %tmp89
91 %sub91 = fsub float %mul79, %mul90
92 %cmp92 = fcmp une float %tmp66, %sub91
93 br i1 %cmp92, label %if.then, label %lor.lhs.false
95 lor.lhs.false: ; preds = %for.body61
96 %tmp98 = load float* %arrayidx97, align 4
97 %tmp104 = load float* %arrayidx103, align 8
98 %tmp110 = load float* %arrayidx109, align 4
99 %mul111 = fmul float %tmp104, %tmp110
100 %tmp117 = load float* %arrayidx116, align 4
101 %tmp123 = load float* %arrayidx122, align 8
102 %mul124 = fmul float %tmp117, %tmp123
103 %add125 = fadd float %mul111, %mul124
104 %cmp126 = fcmp une float %tmp98, %add125
105 br i1 %cmp126, label %if.then, label %if.end
107 if.then: ; preds = %lor.lhs.false, %for.body61
108 call void @abort() noreturn nounwind
111 if.end: ; preds = %lor.lhs.false
114 for.inc127: ; preds = %if.end
115 %indvar.next = add i64 %indvar, 1
118 for.end130: ; preds = %for.cond58
122 declare void @abort() noreturn
124 define i32 @main() nounwind uwtable {
126 call void @check_vect()
127 %call = call i32 @main1()
131 define internal void @check_vect() nounwind uwtable noinline {
133 %a = alloca i32, align 4
134 %b = alloca i32, align 4
135 %c = alloca i32, align 4
136 %d = alloca i32, align 4
137 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
138 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
139 %tobool = icmp eq i32 %call1, 0
140 br i1 %tobool, label %if.then, label %lor.lhs.false
142 lor.lhs.false: ; preds = %entry
143 %tmp4 = load i32* %d, align 4
144 %and6 = and i32 %tmp4, 67108864
145 %cmp = icmp eq i32 %and6, 0
146 br i1 %cmp, label %if.then, label %if.end
148 if.then: ; preds = %entry, %lor.lhs.false
149 call void @exit(i32 0) noreturn nounwind
152 if.end: ; preds = %lor.lhs.false
153 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
157 declare void (i32)* @signal(i32, void (i32)*) nounwind
159 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
161 call void @exit(i32 0) noreturn nounwind
164 return: ; No predecessors!
168 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
170 %and = and i32 %__level, -2147483648
171 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
172 %cmp = icmp ult i32 %call, %__level
173 br i1 %cmp, label %if.then, label %if.end
175 if.then: ; preds = %entry
178 if.end: ; preds = %entry
179 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
180 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
181 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
182 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
183 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
184 store i32 %asmresult, i32* %__eax, align 4
185 store i32 %asmresult8, i32* %__ebx, align 4
186 store i32 %asmresult9, i32* %__ecx, align 4
187 store i32 %asmresult10, i32* %__edx, align 4
190 return: ; preds = %if.end, %if.then
191 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
195 declare void @exit(i32) noreturn
197 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
199 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
200 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
201 %tobool = icmp eq i32* %__sig, null
202 br i1 %tobool, label %if.end, label %if.then
204 if.then: ; preds = %entry
205 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
206 store i32 %asmresult1, i32* %__sig, align 4
209 if.end: ; preds = %entry, %if.then
213 !0 = metadata !{i32 -2147343190, i32 -2147343182}
214 !1 = metadata !{i32 -2147343313, i32 -2147343305}