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 fast-math-vect-pr29925.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer fast-math-vect-pr29925.s > fast-math-vect-pr29925.ll
6 ; ModuleID = 'fast-math-vect-pr29925.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 define void @interp_pitch(float* %exc, float* %interp, i32 %pitch, i32 %len) nounwind uwtable noinline {
12 %tmp = sub i32 -3, %pitch
13 %tmp3 = icmp sgt i32 %len, 0
14 %smax = select i1 %tmp3, i32 %len, i32 0
15 %tmp4 = zext i32 %smax to i64
16 %tmp6 = zext i32 %tmp to i64
19 for.cond: ; preds = %for.inc24, %entry
20 %indvar = phi i64 [ %indvar.next, %for.inc24 ], [ 0, %entry ]
21 %tmp7 = add i64 %tmp6, %indvar
22 %tmp8 = trunc i64 %tmp7 to i32
23 %arrayidx23 = getelementptr float* %interp, i64 %indvar
24 %exitcond5 = icmp ne i64 %indvar, %tmp4
25 br i1 %exitcond5, label %for.body, label %for.end27
27 for.body: ; preds = %for.cond
30 for.cond4: ; preds = %for.inc, %for.body
31 %tmp11 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ]
32 %tmp3.0 = phi float [ 0.000000e+00, %for.body ], [ %add17, %for.inc ]
33 %sub13 = add i32 %tmp8, %tmp11
34 %exitcond = icmp ne i32 %tmp11, 7
35 br i1 %exitcond, label %for.body7, label %for.end
37 for.body7: ; preds = %for.cond4
40 for.inc: ; preds = %for.body7
41 %idxprom = sext i32 %sub13 to i64
42 %arrayidx = getelementptr inbounds float* %exc, i64 %idxprom
43 %tmp15 = load float* %arrayidx, align 4
44 %add17 = fadd float %tmp3.0, %tmp15
45 %inc = add nsw i32 %tmp11, 1
48 for.end: ; preds = %for.cond4
49 %tmp3.0.lcssa = phi float [ %tmp3.0, %for.cond4 ]
50 store float %tmp3.0.lcssa, float* %arrayidx23, align 4
53 for.inc24: ; preds = %for.end
54 %indvar.next = add i64 %indvar, 1
57 for.end27: ; preds = %for.cond
61 define i32 @main() nounwind uwtable {
63 %call = call noalias i8* @calloc(i64 126, i64 4) nounwind
64 %tmp = bitcast i8* %call to float*
65 %call1 = call noalias i8* @calloc(i64 80, i64 4) nounwind
66 %tmp1 = bitcast i8* %call1 to float*
67 call void @check_vect()
68 call void @interp_pitch(float* %tmp, float* %tmp1, i32 -35, i32 80)
69 call void @free(i8* %call) nounwind
70 call void @free(i8* %call1) nounwind
74 declare noalias i8* @calloc(i64, i64) nounwind
76 define internal void @check_vect() nounwind uwtable noinline {
78 %a = alloca i32, align 4
79 %b = alloca i32, align 4
80 %c = alloca i32, align 4
81 %d = alloca i32, align 4
82 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
83 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
84 %tobool = icmp eq i32 %call1, 0
85 br i1 %tobool, label %if.then, label %lor.lhs.false
87 lor.lhs.false: ; preds = %entry
88 %tmp4 = load i32* %d, align 4
89 %and6 = and i32 %tmp4, 67108864
90 %cmp = icmp eq i32 %and6, 0
91 br i1 %cmp, label %if.then, label %if.end
93 if.then: ; preds = %entry, %lor.lhs.false
94 call void @exit(i32 0) noreturn nounwind
97 if.end: ; preds = %lor.lhs.false
98 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
102 declare void @free(i8*) nounwind
104 declare void (i32)* @signal(i32, void (i32)*) nounwind
106 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
108 call void @exit(i32 0) noreturn nounwind
111 return: ; No predecessors!
115 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
117 %and = and i32 %__level, -2147483648
118 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
119 %cmp = icmp ult i32 %call, %__level
120 br i1 %cmp, label %if.then, label %if.end
122 if.then: ; preds = %entry
125 if.end: ; preds = %entry
126 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
127 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
128 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
129 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
130 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
131 store i32 %asmresult, i32* %__eax, align 4
132 store i32 %asmresult8, i32* %__ebx, align 4
133 store i32 %asmresult9, i32* %__ecx, align 4
134 store i32 %asmresult10, i32* %__edx, align 4
137 return: ; preds = %if.end, %if.then
138 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
142 declare void @exit(i32) noreturn nounwind
144 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
146 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
147 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
148 %tobool = icmp eq i32* %__sig, null
149 br i1 %tobool, label %if.end, label %if.then
151 if.then: ; preds = %entry
152 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
153 store i32 %asmresult1, i32* %__sig, align 4
156 if.end: ; preds = %entry, %if.then
160 !0 = metadata !{i32 -2147228483, i32 -2147228475}
161 !1 = metadata !{i32 -2147228606, i32 -2147228598}