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-110.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-110.s > vect-110.ll
6 ; ModuleID = 'vect-110.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 @main1.b = internal unnamed_addr constant [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 @main1.c = internal unnamed_addr constant [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
13 define i32 @main() nounwind uwtable {
15 call void @check_vect()
16 %call = call i32 @main1()
20 define internal void @check_vect() nounwind uwtable noinline {
22 %a = alloca i32, align 4
23 %b = alloca i32, align 4
24 %c = alloca i32, align 4
25 %d = alloca i32, align 4
26 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
27 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
28 %tobool = icmp eq i32 %call1, 0
29 br i1 %tobool, label %if.then, label %lor.lhs.false
31 lor.lhs.false: ; preds = %entry
32 %tmp4 = load i32* %d, align 4
33 %and6 = and i32 %tmp4, 67108864
34 %cmp = icmp eq i32 %and6, 0
35 br i1 %cmp, label %if.then, label %if.end
37 if.then: ; preds = %entry, %lor.lhs.false
38 call void @exit(i32 0) noreturn nounwind
41 if.end: ; preds = %lor.lhs.false
42 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
46 define internal i32 @main1() nounwind uwtable noinline {
48 %a = alloca [16 x float], align 16
49 %b = alloca [16 x float], align 16
50 %c = alloca [16 x float], align 16
51 %tmp = bitcast [16 x float]* %b to i8*
52 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp, i8* bitcast ([16 x float]* @main1.b to i8*), i64 64, i32 16, i1 false)
53 %tmp2 = bitcast [16 x float]* %c to i8*
54 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp2, i8* bitcast ([16 x float]* @main1.c to i8*), i64 64, i32 16, i1 false)
57 for.cond: ; preds = %for.inc, %entry
58 %indvar2 = phi i64 [ %indvar.next3, %for.inc ], [ 0, %entry ]
59 %tmp4 = add i64 %indvar2, 1
60 %arrayidx25 = getelementptr [16 x float]* %a, i64 0, i64 %tmp4
61 %arrayidx8 = getelementptr [16 x float]* %c, i64 0, i64 %indvar2
62 %arrayidx = getelementptr [16 x float]* %b, i64 0, i64 %indvar2
63 %arrayidx12 = getelementptr [16 x float]* %a, i64 0, i64 %indvar2
64 %exitcond = icmp ne i64 %indvar2, 15
65 br i1 %exitcond, label %for.body, label %for.end
67 for.body: ; preds = %for.cond
68 %tmp5 = load float* %arrayidx, align 4
69 %tmp9 = load float* %arrayidx8, align 4
70 %add = fadd float %tmp5, %tmp9
71 store float %add, float* %arrayidx12, align 4
72 %tmp16 = load float* %arrayidx, align 4
73 %tmp20 = load float* %arrayidx8, align 4
74 %add21 = fadd float %tmp16, %tmp20
75 store float %add21, float* %arrayidx25, align 4
78 for.inc: ; preds = %for.body
79 %indvar.next3 = add i64 %indvar2, 1
82 for.end: ; preds = %for.cond
85 for.cond27: ; preds = %for.inc45, %for.end
86 %indvar = phi i64 [ %indvar.next, %for.inc45 ], [ 0, %for.end ]
87 %arrayidx41 = getelementptr [16 x float]* %c, i64 0, i64 %indvar
88 %arrayidx37 = getelementptr [16 x float]* %b, i64 0, i64 %indvar
89 %arrayidx33 = getelementptr [16 x float]* %a, i64 0, i64 %indvar
90 %i.1 = trunc i64 %indvar to i32
91 %cmp29 = icmp slt i32 %i.1, 15
92 br i1 %cmp29, label %for.body30, label %for.end48
94 for.body30: ; preds = %for.cond27
95 %tmp34 = load float* %arrayidx33, align 4
96 %tmp38 = load float* %arrayidx37, align 4
97 %tmp42 = load float* %arrayidx41, align 4
98 %add43 = fadd float %tmp38, %tmp42
99 %cmp44 = fcmp une float %tmp34, %add43
100 br i1 %cmp44, label %if.then, label %if.end
102 if.then: ; preds = %for.body30
103 call void @abort() noreturn nounwind
106 if.end: ; preds = %for.body30
109 for.inc45: ; preds = %if.end
110 %indvar.next = add i64 %indvar, 1
113 for.end48: ; preds = %for.cond27
117 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
119 declare void @abort() noreturn
121 declare void (i32)* @signal(i32, void (i32)*) nounwind
123 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
125 call void @exit(i32 0) noreturn nounwind
128 return: ; No predecessors!
132 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
134 %and = and i32 %__level, -2147483648
135 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
136 %cmp = icmp ult i32 %call, %__level
137 br i1 %cmp, label %if.then, label %if.end
139 if.then: ; preds = %entry
142 if.end: ; preds = %entry
143 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
144 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
145 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
146 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
147 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
148 store i32 %asmresult, i32* %__eax, align 4
149 store i32 %asmresult8, i32* %__ebx, align 4
150 store i32 %asmresult9, i32* %__ecx, align 4
151 store i32 %asmresult10, i32* %__edx, align 4
154 return: ; preds = %if.end, %if.then
155 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
159 declare void @exit(i32) noreturn
161 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
163 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
164 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
165 %tobool = icmp eq i32* %__sig, null
166 br i1 %tobool, label %if.end, label %if.then
168 if.then: ; preds = %entry
169 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
170 store i32 %asmresult1, i32* %__sig, align 4
173 if.end: ; preds = %entry, %if.then
177 !0 = metadata !{i32 -2147343589, i32 -2147343581}
178 !1 = metadata !{i32 -2147343712, i32 -2147343704}