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-8.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-8.s > vect-8.ll
6 ; ModuleID = 'vect-8.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 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
11 @a = common global [16 x float] zeroinitializer, align 16
13 define i32 @main1(i32 %n) nounwind uwtable noinline {
15 %tmp = icmp sgt i32 %n, 0
16 %smax = select i1 %tmp, i32 %n, i32 0
17 %tmp4 = zext i32 %smax to i64
20 for.cond: ; preds = %for.inc, %entry
21 %indvar1 = phi i64 [ %indvar.next2, %for.inc ], [ 0, %entry ]
22 %arrayidx6 = getelementptr [16 x float]* @a, i64 0, i64 %indvar1
23 %arrayidx = getelementptr [16 x float]* @b, i64 0, i64 %indvar1
24 %exitcond = icmp ne i64 %indvar1, %tmp4
25 br i1 %exitcond, label %for.body, label %for.end
27 for.body: ; preds = %for.cond
28 %tmp3 = load float* %arrayidx, align 4
29 store float %tmp3, float* %arrayidx6, align 4
32 for.inc: ; preds = %for.body
33 %indvar.next2 = add i64 %indvar1, 1
36 for.end: ; preds = %for.cond
39 for.cond8: ; preds = %for.inc22, %for.end
40 %indvar = phi i64 [ %indvar.next, %for.inc22 ], [ 0, %for.end ]
41 %arrayidx19 = getelementptr [16 x float]* @b, i64 0, i64 %indvar
42 %arrayidx15 = getelementptr [16 x float]* @a, i64 0, i64 %indvar
43 %i.1 = trunc i64 %indvar to i32
44 %cmp11 = icmp slt i32 %i.1, %n
45 br i1 %cmp11, label %for.body12, label %for.end25
47 for.body12: ; preds = %for.cond8
48 %tmp16 = load float* %arrayidx15, align 4
49 %tmp20 = load float* %arrayidx19, align 4
50 %cmp21 = fcmp une float %tmp16, %tmp20
51 br i1 %cmp21, label %if.then, label %if.end
53 if.then: ; preds = %for.body12
54 call void @abort() noreturn nounwind
57 if.end: ; preds = %for.body12
60 for.inc22: ; preds = %if.end
61 %indvar.next = add i64 %indvar, 1
64 for.end25: ; preds = %for.cond8
68 declare void @abort() noreturn
70 define i32 @main() nounwind uwtable {
72 call void @check_vect()
73 %call = call i32 @main1(i32 16)
77 define internal void @check_vect() nounwind uwtable noinline {
79 %a = alloca i32, align 4
80 %b = alloca i32, align 4
81 %c = alloca i32, align 4
82 %d = alloca i32, align 4
83 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
84 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
85 %tobool = icmp eq i32 %call1, 0
86 br i1 %tobool, label %if.then, label %lor.lhs.false
88 lor.lhs.false: ; preds = %entry
89 %tmp4 = load i32* %d, align 4
90 %and6 = and i32 %tmp4, 67108864
91 %cmp = icmp eq i32 %and6, 0
92 br i1 %cmp, label %if.then, label %if.end
94 if.then: ; preds = %entry, %lor.lhs.false
95 call void @exit(i32 0) noreturn nounwind
98 if.end: ; preds = %lor.lhs.false
99 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
103 declare void (i32)* @signal(i32, void (i32)*) nounwind
105 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
107 call void @exit(i32 0) noreturn nounwind
110 return: ; No predecessors!
114 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
116 %and = and i32 %__level, -2147483648
117 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
118 %cmp = icmp ult i32 %call, %__level
119 br i1 %cmp, label %if.then, label %if.end
121 if.then: ; preds = %entry
124 if.end: ; preds = %entry
125 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
126 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
127 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
128 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
129 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
130 store i32 %asmresult, i32* %__eax, align 4
131 store i32 %asmresult8, i32* %__ebx, align 4
132 store i32 %asmresult9, i32* %__ecx, align 4
133 store i32 %asmresult10, i32* %__edx, align 4
136 return: ; preds = %if.end, %if.then
137 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
141 declare void @exit(i32) noreturn
143 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
145 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
146 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
147 %tobool = icmp eq i32* %__sig, null
148 br i1 %tobool, label %if.end, label %if.then
150 if.then: ; preds = %entry
151 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
152 store i32 %asmresult1, i32* %__sig, align 4
155 if.end: ; preds = %entry, %if.then
159 !0 = metadata !{i32 -2147343690, i32 -2147343682}
160 !1 = metadata !{i32 -2147343813, i32 -2147343805}