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-12.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-12.s > vect-12.ll
6 ; ModuleID = 'vect-12.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.ic = internal unnamed_addr constant [16 x i32] [i32 0, i32 3, i32 6, i32 9, i32 12, i32 15, i32 18, i32 21, i32 24, i32 27, i32 30, i32 33, i32 36, i32 39, i32 42, i32 45], align 16
11 @main1.ib = internal unnamed_addr constant [16 x i32] [i32 0, i32 3, i32 6, i32 9, i32 12, i32 15, i32 18, i32 21, i32 24, i32 27, i32 30, i32 33, i32 36, i32 39, i32 42, i32 45], align 16
12 @main1.sc = internal unnamed_addr constant [16 x i16] [i16 0, i16 3, i16 6, i16 9, i16 12, i16 15, i16 18, i16 21, i16 24, i16 27, i16 30, i16 33, i16 36, i16 39, i16 42, i16 45], align 16
13 @main1.sb = internal unnamed_addr constant [16 x i16] [i16 0, i16 3, i16 6, i16 9, i16 12, i16 15, i16 18, i16 21, i16 24, i16 27, i16 30, i16 33, i16 36, i16 39, i16 42, i16 45], align 16
15 define i32 @main1() nounwind uwtable noinline {
17 %ia = alloca [16 x i32], align 16
18 %ic = alloca [16 x i32], align 16
19 %ib = alloca [16 x i32], align 16
20 %sa = alloca [16 x i16], align 16
21 %sc = alloca [16 x i16], align 16
22 %sb = alloca [16 x i16], align 16
23 %tmp = bitcast [16 x i32]* %ic to i8*
24 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp, i8* bitcast ([16 x i32]* @main1.ic to i8*), i64 64, i32 16, i1 false)
25 %tmp2 = bitcast [16 x i32]* %ib to i8*
26 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp2, i8* bitcast ([16 x i32]* @main1.ib to i8*), i64 64, i32 16, i1 false)
27 %tmp5 = bitcast [16 x i16]* %sc to i8*
28 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp5, i8* bitcast ([16 x i16]* @main1.sc to i8*), i64 32, i32 16, i1 false)
29 %tmp7 = bitcast [16 x i16]* %sb to i8*
30 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp7, i8* bitcast ([16 x i16]* @main1.sb to i8*), i64 32, i32 16, i1 false)
33 for.cond: ; preds = %for.inc, %entry
34 %indvar4 = phi i64 [ %indvar.next5, %for.inc ], [ 0, %entry ]
35 %arrayidx31 = getelementptr [16 x i16]* %sa, i64 0, i64 %indvar4
36 %arrayidx24 = getelementptr [16 x i16]* %sc, i64 0, i64 %indvar4
37 %arrayidx20 = getelementptr [16 x i16]* %sb, i64 0, i64 %indvar4
38 %arrayidx17 = getelementptr [16 x i32]* %ia, i64 0, i64 %indvar4
39 %arrayidx13 = getelementptr [16 x i32]* %ic, i64 0, i64 %indvar4
40 %arrayidx = getelementptr [16 x i32]* %ib, i64 0, i64 %indvar4
41 %exitcond = icmp ne i64 %indvar4, 16
42 br i1 %exitcond, label %for.body, label %for.end
44 for.body: ; preds = %for.cond
45 %tmp10 = load i32* %arrayidx, align 4
46 %tmp14 = load i32* %arrayidx13, align 4
47 %add = add nsw i32 %tmp10, %tmp14
48 store i32 %add, i32* %arrayidx17, align 4
49 %tmp21 = load i16* %arrayidx20, align 2
50 %tmp25 = load i16* %arrayidx24, align 2
51 %add27 = add i16 %tmp21, %tmp25
52 store i16 %add27, i16* %arrayidx31, align 2
55 for.inc: ; preds = %for.body
56 %indvar.next5 = add i64 %indvar4, 1
59 for.end: ; preds = %for.cond
62 for.cond33: ; preds = %for.inc71, %for.end
63 %indvar = phi i64 [ %indvar.next, %for.inc71 ], [ 0, %for.end ]
64 %arrayidx65 = getelementptr [16 x i16]* %sc, i64 0, i64 %indvar
65 %arrayidx60 = getelementptr [16 x i16]* %sb, i64 0, i64 %indvar
66 %arrayidx55 = getelementptr [16 x i16]* %sa, i64 0, i64 %indvar
67 %arrayidx48 = getelementptr [16 x i32]* %ic, i64 0, i64 %indvar
68 %arrayidx44 = getelementptr [16 x i32]* %ib, i64 0, i64 %indvar
69 %arrayidx40 = getelementptr [16 x i32]* %ia, i64 0, i64 %indvar
70 %i.1 = trunc i64 %indvar to i32
71 %cmp35 = icmp slt i32 %i.1, 16
72 br i1 %cmp35, label %for.body37, label %for.end74
74 for.body37: ; preds = %for.cond33
75 %tmp41 = load i32* %arrayidx40, align 4
76 %tmp45 = load i32* %arrayidx44, align 4
77 %tmp49 = load i32* %arrayidx48, align 4
78 %add50 = add nsw i32 %tmp45, %tmp49
79 %cmp51 = icmp eq i32 %tmp41, %add50
80 br i1 %cmp51, label %lor.lhs.false, label %if.then
82 lor.lhs.false: ; preds = %for.body37
83 %tmp56 = load i16* %arrayidx55, align 2
84 %conv57 = sext i16 %tmp56 to i32
85 %tmp61 = load i16* %arrayidx60, align 2
86 %conv62 = sext i16 %tmp61 to i32
87 %tmp66 = load i16* %arrayidx65, align 2
88 %conv67 = sext i16 %tmp66 to i32
89 %add68 = add nsw i32 %conv62, %conv67
90 %cmp69 = icmp eq i32 %conv57, %add68
91 br i1 %cmp69, label %if.end, label %if.then
93 if.then: ; preds = %lor.lhs.false, %for.body37
94 call void @abort() noreturn nounwind
97 if.end: ; preds = %lor.lhs.false
100 for.inc71: ; preds = %if.end
101 %indvar.next = add i64 %indvar, 1
104 for.end74: ; preds = %for.cond33
108 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
110 declare void @abort() noreturn
112 define i32 @main() nounwind uwtable {
114 call void @check_vect()
115 %call = call i32 @main1()
119 define internal void @check_vect() nounwind uwtable noinline {
121 %a = alloca i32, align 4
122 %b = alloca i32, align 4
123 %c = alloca i32, align 4
124 %d = alloca i32, align 4
125 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
126 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
127 %tobool = icmp eq i32 %call1, 0
128 br i1 %tobool, label %if.then, label %lor.lhs.false
130 lor.lhs.false: ; preds = %entry
131 %tmp4 = load i32* %d, align 4
132 %and6 = and i32 %tmp4, 67108864
133 %cmp = icmp eq i32 %and6, 0
134 br i1 %cmp, label %if.then, label %if.end
136 if.then: ; preds = %entry, %lor.lhs.false
137 call void @exit(i32 0) noreturn nounwind
140 if.end: ; preds = %lor.lhs.false
141 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
145 declare void (i32)* @signal(i32, void (i32)*) nounwind
147 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
149 call void @exit(i32 0) noreturn nounwind
152 return: ; No predecessors!
156 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
158 %and = and i32 %__level, -2147483648
159 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
160 %cmp = icmp ult i32 %call, %__level
161 br i1 %cmp, label %if.then, label %if.end
163 if.then: ; preds = %entry
166 if.end: ; preds = %entry
167 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
168 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
169 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
170 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
171 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
172 store i32 %asmresult, i32* %__eax, align 4
173 store i32 %asmresult8, i32* %__ebx, align 4
174 store i32 %asmresult9, i32* %__ecx, align 4
175 store i32 %asmresult10, i32* %__edx, align 4
178 return: ; preds = %if.end, %if.then
179 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
183 declare void @exit(i32) noreturn
185 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
187 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
188 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
189 %tobool = icmp eq i32* %__sig, null
190 br i1 %tobool, label %if.end, label %if.then
192 if.then: ; preds = %entry
193 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
194 store i32 %asmresult1, i32* %__sig, align 4
197 if.end: ; preds = %entry, %if.then
201 !0 = metadata !{i32 -2147343395, i32 -2147343387}
202 !1 = metadata !{i32 -2147343518, i32 -2147343510}