1 ; RUN: llvm-as -o - %s | llc -march=cellspu > %t1.s
2 ; RUN: grep ila %t1.s | count 6
3 ; RUN: grep ceq %t1.s | count 28
4 ; RUN: grep ceqi %t1.s | count 12
5 ; RUN: grep clgt %t1.s | count 16
6 ; RUN: grep clgti %t1.s | count 6
7 ; RUN: grep cgt %t1.s | count 16
8 ; RUN: grep cgti %t1.s | count 6
9 ; RUN: grep {selb\t\\\$3, \\\$6, \\\$5, \\\$3} %t1.s | count 7
10 ; RUN: grep {selb\t\\\$3, \\\$5, \\\$6, \\\$3} %t1.s | count 3
11 ; RUN: grep {selb\t\\\$3, \\\$5, \\\$4, \\\$3} %t1.s | count 20
13 target datalayout = "E-p:32:32:128-f64:64:128-f32:32:128-i64:32:128-i32:32:128-i16:16:128-i8:8:128-i1:8:128-a0:0:128-v128:128:128-s0:128:128"
16 ; $3 = %arg1, $4 = %arg2, $5 = %val1, $6 = %val2
17 ; $3 = %arg1, $4 = %val1, $5 = %val2
19 ; For "positive" comparisons:
20 ; selb $3, $6, $5, <i1>
21 ; selb $3, $5, $4, <i1>
23 ; For "negative" comparisons, i.e., those where the result of the comparison
24 ; must be inverted (setne, for example):
25 ; selb $3, $5, $6, <i1>
26 ; selb $3, $4, $5, <i1>
28 ; i32 integer comparisons:
29 define i32 @icmp_eq_select_i32(i32 %arg1, i32 %arg2, i32 %val1, i32 %val2) nounwind {
31 %A = icmp eq i32 %arg1, %arg2
32 %B = select i1 %A, i32 %val1, i32 %val2
36 define i1 @icmp_eq_setcc_i32(i32 %arg1, i32 %arg2, i32 %val1, i32 %val2) nounwind {
38 %A = icmp eq i32 %arg1, %arg2
42 define i32 @icmp_eq_immed01_i32(i32 %arg1, i32 %val1, i32 %val2) nounwind {
44 %A = icmp eq i32 %arg1, 511
45 %B = select i1 %A, i32 %val1, i32 %val2
49 define i32 @icmp_eq_immed02_i32(i32 %arg1, i32 %val1, i32 %val2) nounwind {
51 %A = icmp eq i32 %arg1, -512
52 %B = select i1 %A, i32 %val1, i32 %val2
56 define i32 @icmp_eq_immed03_i32(i32 %arg1, i32 %val1, i32 %val2) nounwind {
58 %A = icmp eq i32 %arg1, -1
59 %B = select i1 %A, i32 %val1, i32 %val2
63 define i32 @icmp_eq_immed04_i32(i32 %arg1, i32 %val1, i32 %val2) nounwind {
65 %A = icmp eq i32 %arg1, 32768
66 %B = select i1 %A, i32 %val1, i32 %val2
70 define i32 @icmp_ne_select_i32(i32 %arg1, i32 %arg2, i32 %val1, i32 %val2) nounwind {
72 %A = icmp ne i32 %arg1, %arg2
73 %B = select i1 %A, i32 %val1, i32 %val2
77 define i1 @icmp_ne_setcc_i32(i32 %arg1, i32 %arg2, i32 %val1, i32 %val2) nounwind {
79 %A = icmp ne i32 %arg1, %arg2
83 define i32 @icmp_ne_immed01_i32(i32 %arg1, i32 %val1, i32 %val2) nounwind {
85 %A = icmp ne i32 %arg1, 511
86 %B = select i1 %A, i32 %val1, i32 %val2
90 define i32 @icmp_ne_immed02_i32(i32 %arg1, i32 %val1, i32 %val2) nounwind {
92 %A = icmp ne i32 %arg1, -512
93 %B = select i1 %A, i32 %val1, i32 %val2
97 define i32 @icmp_ne_immed03_i32(i32 %arg1, i32 %val1, i32 %val2) nounwind {
99 %A = icmp ne i32 %arg1, -1
100 %B = select i1 %A, i32 %val1, i32 %val2
104 define i32 @icmp_ne_immed04_i32(i32 %arg1, i32 %val1, i32 %val2) nounwind {
106 %A = icmp ne i32 %arg1, 32768
107 %B = select i1 %A, i32 %val1, i32 %val2
111 define i32 @icmp_ugt_select_i32(i32 %arg1, i32 %arg2, i32 %val1, i32 %val2) nounwind {
113 %A = icmp ugt i32 %arg1, %arg2
114 %B = select i1 %A, i32 %val1, i32 %val2
118 define i1 @icmp_ugt_setcc_i32(i32 %arg1, i32 %arg2, i32 %val1, i32 %val2) nounwind {
120 %A = icmp ugt i32 %arg1, %arg2
124 define i32 @icmp_ugt_immed01_i32(i32 %arg1, i32 %val1, i32 %val2) nounwind {
126 %A = icmp ugt i32 %arg1, 511
127 %B = select i1 %A, i32 %val1, i32 %val2
131 define i32 @icmp_ugt_immed02_i32(i32 %arg1, i32 %val1, i32 %val2) nounwind {
133 %A = icmp ugt i32 %arg1, 4294966784
134 %B = select i1 %A, i32 %val1, i32 %val2
138 define i32 @icmp_ugt_immed03_i32(i32 %arg1, i32 %val1, i32 %val2) nounwind {
140 %A = icmp ugt i32 %arg1, 4294967293
141 %B = select i1 %A, i32 %val1, i32 %val2
145 define i32 @icmp_ugt_immed04_i32(i32 %arg1, i32 %val1, i32 %val2) nounwind {
147 %A = icmp ugt i32 %arg1, 32768
148 %B = select i1 %A, i32 %val1, i32 %val2
152 define i32 @icmp_uge_select_i32(i32 %arg1, i32 %arg2, i32 %val1, i32 %val2) nounwind {
154 %A = icmp uge i32 %arg1, %arg2
155 %B = select i1 %A, i32 %val1, i32 %val2
159 define i1 @icmp_uge_setcc_i32(i32 %arg1, i32 %arg2, i32 %val1, i32 %val2) nounwind {
161 %A = icmp uge i32 %arg1, %arg2
165 ;; Note: icmp uge i32 %arg1, <immed> can always be transformed into
166 ;; icmp ugt i32 %arg1, <immed>-1
168 ;; Consequently, even though the patterns exist to match, it's unlikely
169 ;; they'll ever be generated.
171 define i32 @icmp_ult_select_i32(i32 %arg1, i32 %arg2, i32 %val1, i32 %val2) nounwind {
173 %A = icmp ult i32 %arg1, %arg2
174 %B = select i1 %A, i32 %val1, i32 %val2
178 define i1 @icmp_ult_setcc_i32(i32 %arg1, i32 %arg2, i32 %val1, i32 %val2) nounwind {
180 %A = icmp ult i32 %arg1, %arg2
184 define i32 @icmp_ult_immed01_i32(i32 %arg1, i32 %val1, i32 %val2) nounwind {
186 %A = icmp ult i32 %arg1, 511
187 %B = select i1 %A, i32 %val1, i32 %val2
191 define i32 @icmp_ult_immed02_i32(i32 %arg1, i32 %val1, i32 %val2) nounwind {
193 %A = icmp ult i32 %arg1, 4294966784
194 %B = select i1 %A, i32 %val1, i32 %val2
198 define i32 @icmp_ult_immed03_i32(i32 %arg1, i32 %val1, i32 %val2) nounwind {
200 %A = icmp ult i32 %arg1, 4294967293
201 %B = select i1 %A, i32 %val1, i32 %val2
205 define i32 @icmp_ult_immed04_i32(i32 %arg1, i32 %val1, i32 %val2) nounwind {
207 %A = icmp ult i32 %arg1, 32768
208 %B = select i1 %A, i32 %val1, i32 %val2
212 define i32 @icmp_ule_select_i32(i32 %arg1, i32 %arg2, i32 %val1, i32 %val2) nounwind {
214 %A = icmp ule i32 %arg1, %arg2
215 %B = select i1 %A, i32 %val1, i32 %val2
219 define i1 @icmp_ule_setcc_i32(i32 %arg1, i32 %arg2, i32 %val1, i32 %val2) nounwind {
221 %A = icmp ule i32 %arg1, %arg2
225 ;; Note: icmp ule i32 %arg1, <immed> can always be transformed into
226 ;; icmp ult i32 %arg1, <immed>+1
228 ;; Consequently, even though the patterns exist to match, it's unlikely
229 ;; they'll ever be generated.
231 define i32 @icmp_sgt_select_i32(i32 %arg1, i32 %arg2, i32 %val1, i32 %val2) nounwind {
233 %A = icmp sgt i32 %arg1, %arg2
234 %B = select i1 %A, i32 %val1, i32 %val2
238 define i1 @icmp_sgt_setcc_i32(i32 %arg1, i32 %arg2, i32 %val1, i32 %val2) nounwind {
240 %A = icmp sgt i32 %arg1, %arg2
244 define i32 @icmp_sgt_immed01_i32(i32 %arg1, i32 %val1, i32 %val2) nounwind {
246 %A = icmp sgt i32 %arg1, 511
247 %B = select i1 %A, i32 %val1, i32 %val2
251 define i32 @icmp_sgt_immed02_i32(i32 %arg1, i32 %val1, i32 %val2) nounwind {
253 %A = icmp sgt i32 %arg1, 4294966784
254 %B = select i1 %A, i32 %val1, i32 %val2
258 define i32 @icmp_sgt_immed03_i32(i32 %arg1, i32 %val1, i32 %val2) nounwind {
260 %A = icmp sgt i32 %arg1, 4294967293
261 %B = select i1 %A, i32 %val1, i32 %val2
265 define i32 @icmp_sgt_immed04_i32(i32 %arg1, i32 %val1, i32 %val2) nounwind {
267 %A = icmp sgt i32 %arg1, 32768
268 %B = select i1 %A, i32 %val1, i32 %val2
272 define i32 @icmp_sge_select_i32(i32 %arg1, i32 %arg2, i32 %val1, i32 %val2) nounwind {
274 %A = icmp sge i32 %arg1, %arg2
275 %B = select i1 %A, i32 %val1, i32 %val2
279 define i1 @icmp_sge_setcc_i32(i32 %arg1, i32 %arg2, i32 %val1, i32 %val2) nounwind {
281 %A = icmp sge i32 %arg1, %arg2
285 ;; Note: icmp sge i32 %arg1, <immed> can always be transformed into
286 ;; icmp sgt i32 %arg1, <immed>-1
288 ;; Consequently, even though the patterns exist to match, it's unlikely
289 ;; they'll ever be generated.
291 define i32 @icmp_slt_select_i32(i32 %arg1, i32 %arg2, i32 %val1, i32 %val2) nounwind {
293 %A = icmp slt i32 %arg1, %arg2
294 %B = select i1 %A, i32 %val1, i32 %val2
298 define i1 @icmp_slt_setcc_i32(i32 %arg1, i32 %arg2, i32 %val1, i32 %val2) nounwind {
300 %A = icmp slt i32 %arg1, %arg2
304 define i32 @icmp_slt_immed01_i32(i32 %arg1, i32 %val1, i32 %val2) nounwind {
306 %A = icmp slt i32 %arg1, 511
307 %B = select i1 %A, i32 %val1, i32 %val2
311 define i32 @icmp_slt_immed02_i32(i32 %arg1, i32 %val1, i32 %val2) nounwind {
313 %A = icmp slt i32 %arg1, -512
314 %B = select i1 %A, i32 %val1, i32 %val2
318 define i32 @icmp_slt_immed03_i32(i32 %arg1, i32 %val1, i32 %val2) nounwind {
320 %A = icmp slt i32 %arg1, -1
321 %B = select i1 %A, i32 %val1, i32 %val2
325 define i32 @icmp_slt_immed04_i32(i32 %arg1, i32 %val1, i32 %val2) nounwind {
327 %A = icmp slt i32 %arg1, 32768
328 %B = select i1 %A, i32 %val1, i32 %val2
332 define i32 @icmp_sle_select_i32(i32 %arg1, i32 %arg2, i32 %val1, i32 %val2) nounwind {
334 %A = icmp sle i32 %arg1, %arg2
335 %B = select i1 %A, i32 %val1, i32 %val2
339 define i1 @icmp_sle_setcc_i32(i32 %arg1, i32 %arg2, i32 %val1, i32 %val2) nounwind {
341 %A = icmp sle i32 %arg1, %arg2
345 ;; Note: icmp sle i32 %arg1, <immed> can always be transformed into
346 ;; icmp slt i32 %arg1, <immed>+1
348 ;; Consequently, even though the patterns exist to match, it's unlikely
349 ;; they'll ever be generated.