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-114.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-114.s > vect-114.ll
6 ; ModuleID = 'vect-114.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
12 define i32 @main1() nounwind uwtable noinline {
14 %a = alloca [16 x float], align 16
15 %b = alloca [16 x float], align 16
16 %tmp = bitcast [16 x float]* %b to i8*
17 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp, i8* bitcast ([16 x float]* @main1.b to i8*), i64 64, i32 16, i1 false)
20 for.cond: ; preds = %for.inc, %entry
21 %indvar5 = phi i64 [ %indvar.next6, %for.inc ], [ 0, %entry ]
22 %tmp7 = mul i64 %indvar5, -1
23 %tmp8 = add i64 %tmp7, 15
24 %arrayidx = getelementptr [16 x float]* %b, i64 0, i64 %tmp8
25 %arrayidx7 = getelementptr [16 x float]* %a, i64 0, i64 %indvar5
26 %exitcond = icmp ne i64 %indvar5, 16
27 br i1 %exitcond, label %for.body, label %for.end
29 for.body: ; preds = %for.cond
30 %tmp3 = load float* %arrayidx, align 4
31 store float %tmp3, float* %arrayidx7, align 4
34 for.inc: ; preds = %for.body
35 %indvar.next6 = add i64 %indvar5, 1
38 for.end: ; preds = %for.cond
41 for.cond9: ; preds = %for.inc23, %for.end
42 %indvar = phi i64 [ %indvar.next, %for.inc23 ], [ 0, %for.end ]
43 %tmp1 = mul i64 %indvar, -1
44 %tmp2 = add i64 %tmp1, 15
45 %arrayidx20 = getelementptr [16 x float]* %b, i64 0, i64 %tmp2
46 %arrayidx15 = getelementptr [16 x float]* %a, i64 0, i64 %indvar
47 %i.1 = trunc i64 %indvar to i32
48 %cmp11 = icmp slt i32 %i.1, 16
49 br i1 %cmp11, label %for.body12, label %for.end25
51 for.body12: ; preds = %for.cond9
52 %tmp16 = load float* %arrayidx15, align 4
53 %tmp21 = load float* %arrayidx20, align 4
54 %cmp22 = fcmp une float %tmp16, %tmp21
55 br i1 %cmp22, label %if.then, label %if.end
57 if.then: ; preds = %for.body12
58 call void @abort() noreturn nounwind
61 if.end: ; preds = %for.body12
64 for.inc23: ; preds = %if.end
65 %indvar.next = add i64 %indvar, 1
68 for.end25: ; preds = %for.cond9
72 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
74 declare void @abort() noreturn
76 define i32 @main() nounwind uwtable {
78 call void @check_vect()
79 %call = call i32 @main1()
83 define internal void @check_vect() nounwind uwtable noinline {
85 %a = alloca i32, align 4
86 %b = alloca i32, align 4
87 %c = alloca i32, align 4
88 %d = alloca i32, align 4
89 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
90 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
91 %tobool = icmp eq i32 %call1, 0
92 br i1 %tobool, label %if.then, label %lor.lhs.false
94 lor.lhs.false: ; preds = %entry
95 %tmp4 = load i32* %d, align 4
96 %and6 = and i32 %tmp4, 67108864
97 %cmp = icmp eq i32 %and6, 0
98 br i1 %cmp, label %if.then, label %if.end
100 if.then: ; preds = %entry, %lor.lhs.false
101 call void @exit(i32 0) noreturn nounwind
104 if.end: ; preds = %lor.lhs.false
105 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
109 declare void (i32)* @signal(i32, void (i32)*) nounwind
111 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
113 call void @exit(i32 0) noreturn nounwind
116 return: ; No predecessors!
120 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
122 %and = and i32 %__level, -2147483648
123 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
124 %cmp = icmp ult i32 %call, %__level
125 br i1 %cmp, label %if.then, label %if.end
127 if.then: ; preds = %entry
130 if.end: ; preds = %entry
131 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
132 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
133 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
134 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
135 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
136 store i32 %asmresult, i32* %__eax, align 4
137 store i32 %asmresult8, i32* %__ebx, align 4
138 store i32 %asmresult9, i32* %__ecx, align 4
139 store i32 %asmresult10, i32* %__edx, align 4
142 return: ; preds = %if.end, %if.then
143 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
147 declare void @exit(i32) noreturn
149 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
151 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
152 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
153 %tobool = icmp eq i32* %__sig, null
154 br i1 %tobool, label %if.end, label %if.then
156 if.then: ; preds = %entry
157 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
158 store i32 %asmresult1, i32* %__sig, align 4
161 if.end: ; preds = %entry, %if.then
165 !0 = metadata !{i32 -2147343510, i32 -2147343502}
166 !1 = metadata !{i32 -2147343633, i32 -2147343625}