Add compile command to each testcase
[gcc-vect-testsuite.git] / slp-reduc-3.ll
blobf41223d9b05445d7ac9f62f7f4f14c0ae3208275
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 slp-reduc-3.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer slp-reduc-3.s > slp-reduc-3.ll
6 ; ModuleID = 'slp-reduc-3.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 @X = common global [64 x i16] zeroinitializer, align 16
11 @Y = common global [64 x i16] zeroinitializer, align 16
13 define i32 @foo1(i32 %len, i32* %result1, i32* %result2) nounwind uwtable noinline {
14 entry:
15   %tmp = icmp sgt i32 %len, 0
16   %smax = select i1 %tmp, i32 %len, i32 0
17   br label %for.cond
19 for.cond:                                         ; preds = %for.inc, %entry
20   %tmp6 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
21   %res1.0 = phi i32 [ 10, %entry ], [ %add, %for.inc ]
22   %res2.0 = phi i32 [ 20, %entry ], [ %add34, %for.inc ]
23   %mul = mul i32 %tmp6, 2
24   %add171 = add i32 %mul, 1
25   %exitcond = icmp ne i32 %tmp6, %smax
26   br i1 %exitcond, label %for.body, label %for.end
28 for.body:                                         ; preds = %for.cond
29   br label %for.inc
31 for.inc:                                          ; preds = %for.body
32   %idxprom25 = sext i32 %add171 to i64
33   %idxprom18 = sext i32 %add171 to i64
34   %idxprom6 = sext i32 %mul to i64
35   %idxprom = sext i32 %mul to i64
36   %arrayidx26 = getelementptr inbounds [64 x i16]* @Y, i64 0, i64 %idxprom25
37   %arrayidx19 = getelementptr inbounds [64 x i16]* @X, i64 0, i64 %idxprom18
38   %arrayidx7 = getelementptr inbounds [64 x i16]* @Y, i64 0, i64 %idxprom6
39   %arrayidx = getelementptr inbounds [64 x i16]* @X, i64 0, i64 %idxprom
40   %tmp27 = load i16* %arrayidx26, align 2
41   %tmp20 = load i16* %arrayidx19, align 2
42   %tmp8 = load i16* %arrayidx7, align 4
43   %tmp3 = load i16* %arrayidx, align 4
44   %mul29 = mul i16 %tmp20, %tmp27
45   %mul10 = mul i16 %tmp3, %tmp8
46   %conv32 = zext i16 %mul29 to i32
47   %conv13 = zext i16 %mul10 to i32
48   %add34 = add i32 %res2.0, %conv32
49   %add = add i32 %res1.0, %conv13
50   %inc = add nsw i32 %tmp6, 1
51   br label %for.cond
53 for.end:                                          ; preds = %for.cond
54   %res2.0.lcssa = phi i32 [ %res2.0, %for.cond ]
55   %res1.0.lcssa = phi i32 [ %res1.0, %for.cond ]
56   store i32 %res1.0.lcssa, i32* %result1, align 4
57   store i32 %res2.0.lcssa, i32* %result2, align 4
58   ret i32 0
61 define i32 @main() nounwind uwtable {
62 entry:
63   %dot1 = alloca i32, align 4
64   %dot2 = alloca i32, align 4
65   call void @check_vect()
66   br label %for.cond
68 for.cond:                                         ; preds = %for.inc, %entry
69   %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %entry ]
70   %tmp = mul i64 %indvar, -1
71   %tmp1 = add i64 %tmp, 64
72   %sub = trunc i64 %tmp1 to i16
73   %i.0 = trunc i64 %indvar to i16
74   %arrayidx9 = getelementptr [64 x i16]* @Y, i64 0, i64 %indvar
75   %arrayidx = getelementptr [64 x i16]* @X, i64 0, i64 %indvar
76   %exitcond = icmp ne i64 %indvar, 64
77   br i1 %exitcond, label %for.body, label %for.end
79 for.body:                                         ; preds = %for.cond
80   store i16 %i.0, i16* %arrayidx, align 2
81   store i16 %sub, i16* %arrayidx9, align 2
82   br label %for.inc
84 for.inc:                                          ; preds = %for.body
85   %indvar.next = add i64 %indvar, 1
86   br label %for.cond
88 for.end:                                          ; preds = %for.cond
89   %call = call i32 @foo1(i32 32, i32* %dot1, i32* %dot2)
90   %tmp11 = load i32* %dot1, align 4
91   %cmp12 = icmp eq i32 %tmp11, 21834
92   br i1 %cmp12, label %lor.lhs.false, label %if.then
94 lor.lhs.false:                                    ; preds = %for.end
95   %tmp14 = load i32* %dot2, align 4
96   %cmp15 = icmp eq i32 %tmp14, 21876
97   br i1 %cmp15, label %if.end, label %if.then
99 if.then:                                          ; preds = %lor.lhs.false, %for.end
100   call void @abort() noreturn nounwind
101   unreachable
103 if.end:                                           ; preds = %lor.lhs.false
104   ret i32 0
107 define internal void @check_vect() nounwind uwtable noinline {
108 entry:
109   %a = alloca i32, align 4
110   %b = alloca i32, align 4
111   %c = alloca i32, align 4
112   %d = alloca i32, align 4
113   %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
114   %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
115   %tobool = icmp eq i32 %call1, 0
116   br i1 %tobool, label %if.then, label %lor.lhs.false
118 lor.lhs.false:                                    ; preds = %entry
119   %tmp4 = load i32* %d, align 4
120   %and6 = and i32 %tmp4, 67108864
121   %cmp = icmp eq i32 %and6, 0
122   br i1 %cmp, label %if.then, label %if.end
124 if.then:                                          ; preds = %entry, %lor.lhs.false
125   call void @exit(i32 0) noreturn nounwind
126   unreachable
128 if.end:                                           ; preds = %lor.lhs.false
129   %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
130   ret void
133 declare void @abort() noreturn
135 declare void (i32)* @signal(i32, void (i32)*) nounwind
137 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
138 entry:
139   call void @exit(i32 0) noreturn nounwind
140   unreachable
142 return:                                           ; No predecessors!
143   ret void
146 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
147 entry:
148   %and = and i32 %__level, -2147483648
149   %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
150   %cmp = icmp ult i32 %call, %__level
151   br i1 %cmp, label %if.then, label %if.end
153 if.then:                                          ; preds = %entry
154   br label %return
156 if.end:                                           ; preds = %entry
157   %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
158   %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
159   %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
160   %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
161   %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
162   store i32 %asmresult, i32* %__eax, align 4
163   store i32 %asmresult8, i32* %__ebx, align 4
164   store i32 %asmresult9, i32* %__ecx, align 4
165   store i32 %asmresult10, i32* %__edx, align 4
166   br label %return
168 return:                                           ; preds = %if.end, %if.then
169   %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
170   ret i32 %retval.0
173 declare void @exit(i32) noreturn
175 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
176 entry:
177   %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
178   %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
179   %tobool = icmp eq i32* %__sig, null
180   br i1 %tobool, label %if.end, label %if.then
182 if.then:                                          ; preds = %entry
183   %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
184   store i32 %asmresult1, i32* %__sig, align 4
185   br label %if.end
187 if.end:                                           ; preds = %entry, %if.then
188   ret i32 %asmresult
191 !0 = metadata !{i32 -2147342737, i32 -2147342729} 
192 !1 = metadata !{i32 -2147342860, i32 -2147342852} 
193 ; CHECK: define