Add compile command to each testcase
[gcc-vect-testsuite.git] / vect-strided-a-u16-mult.ll
blob9f403662432a247d31e9c69b0c2bcb37409b7c72
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-strided-a-u16-mult.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-strided-a-u16-mult.s > vect-strided-a-u16-mult.ll
6 ; ModuleID = 'vect-strided-a-u16-mult.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 %struct.s = type { i16, i16 }
12 define i32 @main1() nounwind uwtable noinline {
13 entry:
14   %arr = alloca [128 x %struct.s], align 16
15   %iarr = alloca [128 x i32], align 16
16   %res = alloca [128 x %struct.s], align 16
17   %ires = alloca [128 x i32], align 16
18   br label %for.cond
20 for.cond:                                         ; preds = %for.inc, %entry
21   %indvar18 = phi i64 [ %indvar.next19, %for.inc ], [ 0, %entry ]
22   %tmp = mul i64 %indvar18, 2
23   %conv5 = trunc i64 %tmp to i16
24   %scevgep21 = getelementptr [128 x %struct.s]* %arr, i64 0, i64 %indvar18
25   %a = bitcast %struct.s* %scevgep21 to i16*
26   %arrayidx13 = getelementptr [128 x i32]* %iarr, i64 0, i64 %indvar18
27   %tmp24 = mul i64 %indvar18, 3
28   %mul10 = trunc i64 %tmp24 to i32
29   %b = getelementptr [128 x %struct.s]* %arr, i64 0, i64 %indvar18, i32 1
30   %conv = trunc i64 %indvar18 to i16
31   %i.0 = trunc i64 %indvar18 to i32
32   %cmp = icmp slt i32 %i.0, 128
33   br i1 %cmp, label %for.body, label %for.end
35 for.body:                                         ; preds = %for.cond
36   store i16 %conv, i16* %a, align 4
37   store i16 %conv5, i16* %b, align 2
38   store i32 %mul10, i32* %arrayidx13, align 4
39   %tmp18 = load i16* %a, align 4
40   %cmp20 = icmp eq i16 %tmp18, 178
41   br i1 %cmp20, label %if.then, label %if.end
43 if.then:                                          ; preds = %for.body
44   call void @abort() noreturn nounwind
45   unreachable
47 if.end:                                           ; preds = %for.body
48   br label %for.inc
50 for.inc:                                          ; preds = %if.end
51   %indvar.next19 = add i64 %indvar18, 1
52   br label %for.cond
54 for.end:                                          ; preds = %for.cond
55   br label %for.cond23
57 for.cond23:                                       ; preds = %for.inc62, %for.end
58   %indvar8 = phi i64 [ %indvar.next9, %for.inc62 ], [ 0, %for.end ]
59   %scevgep10 = getelementptr [128 x %struct.s]* %res, i64 0, i64 %indvar8
60   %a58 = bitcast %struct.s* %scevgep10 to i16*
61   %b45 = getelementptr [128 x %struct.s]* %res, i64 0, i64 %indvar8, i32 1
62   %arrayidx32 = getelementptr [128 x i32]* %ires, i64 0, i64 %indvar8
63   %iptr.0 = getelementptr [128 x i32]* %iarr, i64 0, i64 %indvar8
64   %scevgep15 = getelementptr [128 x %struct.s]* %arr, i64 0, i64 %indvar8
65   %a38 = bitcast %struct.s* %scevgep15 to i16*
66   %b34 = getelementptr [128 x %struct.s]* %arr, i64 0, i64 %indvar8, i32 1
67   %exitcond = icmp ne i64 %indvar8, 128
68   br i1 %exitcond, label %for.body27, label %for.end65
70 for.body27:                                       ; preds = %for.cond23
71   %tmp29 = load i32* %iptr.0, align 4
72   store i32 %tmp29, i32* %arrayidx32, align 4
73   %tmp35 = load i16* %b34, align 2
74   %tmp39 = load i16* %a38, align 2
75   %sub = sub i16 %tmp35, %tmp39
76   store i16 %sub, i16* %b45, align 2
77   %tmp48 = load i16* %b34, align 2
78   %tmp52 = load i16* %a38, align 2
79   %add = add i16 %tmp48, %tmp52
80   store i16 %add, i16* %a58, align 4
81   br label %for.inc62
83 for.inc62:                                        ; preds = %for.body27
84   %indvar.next9 = add i64 %indvar8, 1
85   br label %for.cond23
87 for.end65:                                        ; preds = %for.cond23
88   br label %for.cond66
90 for.cond66:                                       ; preds = %for.inc126, %for.end65
91   %indvar = phi i64 [ %indvar.next, %for.inc126 ], [ 0, %for.end65 ]
92   %scevgep = getelementptr [128 x %struct.s]* %arr, i64 0, i64 %indvar
93   %a86 = bitcast %struct.s* %scevgep to i16*
94   %b80 = getelementptr [128 x %struct.s]* %arr, i64 0, i64 %indvar, i32 1
95   %scevgep3 = getelementptr [128 x %struct.s]* %res, i64 0, i64 %indvar
96   %a106 = bitcast %struct.s* %scevgep3 to i16*
97   %arrayidx98 = getelementptr [128 x i32]* %iarr, i64 0, i64 %indvar
98   %arrayidx94 = getelementptr [128 x i32]* %ires, i64 0, i64 %indvar
99   %b74 = getelementptr [128 x %struct.s]* %res, i64 0, i64 %indvar, i32 1
100   %i.2 = trunc i64 %indvar to i32
101   %cmp68 = icmp slt i32 %i.2, 128
102   br i1 %cmp68, label %for.body70, label %for.end129
104 for.body70:                                       ; preds = %for.cond66
105   %tmp75 = load i16* %b74, align 2
106   %conv76 = zext i16 %tmp75 to i32
107   %tmp81 = load i16* %b80, align 2
108   %conv82 = zext i16 %tmp81 to i32
109   %tmp87 = load i16* %a86, align 4
110   %conv88 = zext i16 %tmp87 to i32
111   %sub89 = sub nsw i32 %conv82, %conv88
112   %cmp90 = icmp eq i32 %conv76, %sub89
113   br i1 %cmp90, label %lor.lhs.false, label %if.then124
115 lor.lhs.false:                                    ; preds = %for.body70
116   %tmp95 = load i32* %arrayidx94, align 4
117   %tmp99 = load i32* %arrayidx98, align 4
118   %cmp100 = icmp eq i32 %tmp95, %tmp99
119   br i1 %cmp100, label %lor.lhs.false102, label %if.then124
121 lor.lhs.false102:                                 ; preds = %lor.lhs.false
122   %tmp107 = load i16* %a106, align 4
123   %conv108 = zext i16 %tmp107 to i32
124   %tmp113 = load i16* %b80, align 2
125   %conv114 = zext i16 %tmp113 to i32
126   %tmp119 = load i16* %a86, align 4
127   %conv120 = zext i16 %tmp119 to i32
128   %add121 = add nsw i32 %conv114, %conv120
129   %cmp122 = icmp eq i32 %conv108, %add121
130   br i1 %cmp122, label %if.end125, label %if.then124
132 if.then124:                                       ; preds = %lor.lhs.false102, %lor.lhs.false, %for.body70
133   call void @abort() noreturn nounwind
134   unreachable
136 if.end125:                                        ; preds = %lor.lhs.false102
137   br label %for.inc126
139 for.inc126:                                       ; preds = %if.end125
140   %indvar.next = add i64 %indvar, 1
141   br label %for.cond66
143 for.end129:                                       ; preds = %for.cond66
144   ret i32 0
147 declare void @abort() noreturn
149 define i32 @main() nounwind uwtable {
150 entry:
151   call void @check_vect()
152   %call = call i32 @main1()
153   ret i32 0
156 define internal void @check_vect() nounwind uwtable noinline {
157 entry:
158   %a = alloca i32, align 4
159   %b = alloca i32, align 4
160   %c = alloca i32, align 4
161   %d = alloca i32, align 4
162   %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
163   %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
164   %tobool = icmp eq i32 %call1, 0
165   br i1 %tobool, label %if.then, label %lor.lhs.false
167 lor.lhs.false:                                    ; preds = %entry
168   %tmp4 = load i32* %d, align 4
169   %and6 = and i32 %tmp4, 67108864
170   %cmp = icmp eq i32 %and6, 0
171   br i1 %cmp, label %if.then, label %if.end
173 if.then:                                          ; preds = %entry, %lor.lhs.false
174   call void @exit(i32 0) noreturn nounwind
175   unreachable
177 if.end:                                           ; preds = %lor.lhs.false
178   %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
179   ret void
182 declare void (i32)* @signal(i32, void (i32)*) nounwind
184 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
185 entry:
186   call void @exit(i32 0) noreturn nounwind
187   unreachable
189 return:                                           ; No predecessors!
190   ret void
193 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
194 entry:
195   %and = and i32 %__level, -2147483648
196   %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
197   %cmp = icmp ult i32 %call, %__level
198   br i1 %cmp, label %if.then, label %if.end
200 if.then:                                          ; preds = %entry
201   br label %return
203 if.end:                                           ; preds = %entry
204   %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
205   %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
206   %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
207   %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
208   %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
209   store i32 %asmresult, i32* %__eax, align 4
210   store i32 %asmresult8, i32* %__ebx, align 4
211   store i32 %asmresult9, i32* %__ecx, align 4
212   store i32 %asmresult10, i32* %__edx, align 4
213   br label %return
215 return:                                           ; preds = %if.end, %if.then
216   %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
217   ret i32 %retval.0
220 declare void @exit(i32) noreturn
222 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
223 entry:
224   %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
225   %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
226   %tobool = icmp eq i32* %__sig, null
227   br i1 %tobool, label %if.end, label %if.then
229 if.then:                                          ; preds = %entry
230   %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
231   store i32 %asmresult1, i32* %__sig, align 4
232   br label %if.end
234 if.end:                                           ; preds = %entry, %if.then
235   ret i32 %asmresult
238 !0 = metadata !{i32 -2147343234, i32 -2147343226} 
239 !1 = metadata !{i32 -2147343357, i32 -2147343349} 
240 ; CHECK: define