1 ; RUN: llvm-as -o - %s | llc -march=cellspu > %t1.s
2 ; RUN: grep ceqb %t1.s | count 24
3 ; RUN: grep ceqbi %t1.s | count 12
4 ; RUN: grep clgtb %t1.s | count 11
5 ; RUN: grep cgtb %t1.s | count 13
6 ; RUN: grep cgtbi %t1.s | count 5
7 ; RUN: grep {selb\t\\\$3, \\\$6, \\\$5, \\\$3} %t1.s | count 7
8 ; RUN: grep {selb\t\\\$3, \\\$5, \\\$6, \\\$3} %t1.s | count 3
9 ; RUN: grep {selb\t\\\$3, \\\$5, \\\$4, \\\$3} %t1.s | count 11
10 ; RUN: grep {selb\t\\\$3, \\\$4, \\\$5, \\\$3} %t1.s | count 4
12 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"
15 ; $3 = %arg1, $4 = %arg2, $5 = %val1, $6 = %val2
16 ; $3 = %arg1, $4 = %val1, $5 = %val2
18 ; For "positive" comparisons:
19 ; selb $3, $6, $5, <i1>
20 ; selb $3, $5, $4, <i1>
22 ; For "negative" comparisons, i.e., those where the result of the comparison
23 ; must be inverted (setne, for example):
24 ; selb $3, $5, $6, <i1>
25 ; selb $3, $4, $5, <i1>
27 ; i8 integer comparisons:
28 define i8 @icmp_eq_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind {
30 %A = icmp eq i8 %arg1, %arg2
31 %B = select i1 %A, i8 %val1, i8 %val2
35 define i1 @icmp_eq_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind {
37 %A = icmp eq i8 %arg1, %arg2
41 define i8 @icmp_eq_immed01_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind {
43 %A = icmp eq i8 %arg1, 127
44 %B = select i1 %A, i8 %val1, i8 %val2
48 define i8 @icmp_eq_immed02_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind {
50 %A = icmp eq i8 %arg1, -128
51 %B = select i1 %A, i8 %val1, i8 %val2
55 define i8 @icmp_eq_immed03_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind {
57 %A = icmp eq i8 %arg1, -1
58 %B = select i1 %A, i8 %val1, i8 %val2
62 define i8 @icmp_ne_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind {
64 %A = icmp ne i8 %arg1, %arg2
65 %B = select i1 %A, i8 %val1, i8 %val2
69 define i1 @icmp_ne_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind {
71 %A = icmp ne i8 %arg1, %arg2
75 define i8 @icmp_ne_immed01_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind {
77 %A = icmp ne i8 %arg1, 127
78 %B = select i1 %A, i8 %val1, i8 %val2
82 define i8 @icmp_ne_immed02_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind {
84 %A = icmp ne i8 %arg1, -128
85 %B = select i1 %A, i8 %val1, i8 %val2
89 define i8 @icmp_ne_immed03_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind {
91 %A = icmp ne i8 %arg1, -1
92 %B = select i1 %A, i8 %val1, i8 %val2
96 define i8 @icmp_ugt_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind {
98 %A = icmp ugt i8 %arg1, %arg2
99 %B = select i1 %A, i8 %val1, i8 %val2
103 define i1 @icmp_ugt_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind {
105 %A = icmp ugt i8 %arg1, %arg2
109 define i8 @icmp_ugt_immed01_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind {
111 %A = icmp ugt i8 %arg1, 126
112 %B = select i1 %A, i8 %val1, i8 %val2
116 define i8 @icmp_uge_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind {
118 %A = icmp uge i8 %arg1, %arg2
119 %B = select i1 %A, i8 %val1, i8 %val2
123 define i1 @icmp_uge_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind {
125 %A = icmp uge i8 %arg1, %arg2
129 ;; Note: icmp uge i8 %arg1, <immed> can always be transformed into
130 ;; icmp ugt i8 %arg1, <immed>-1
132 ;; Consequently, even though the patterns exist to match, it's unlikely
133 ;; they'll ever be generated.
135 define i8 @icmp_ult_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind {
137 %A = icmp ult i8 %arg1, %arg2
138 %B = select i1 %A, i8 %val1, i8 %val2
142 define i1 @icmp_ult_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind {
144 %A = icmp ult i8 %arg1, %arg2
148 define i8 @icmp_ult_immed01_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind {
150 %A = icmp ult i8 %arg1, 253
151 %B = select i1 %A, i8 %val1, i8 %val2
155 define i8 @icmp_ult_immed02_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind {
157 %A = icmp ult i8 %arg1, 129
158 %B = select i1 %A, i8 %val1, i8 %val2
162 define i8 @icmp_ule_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind {
164 %A = icmp ule i8 %arg1, %arg2
165 %B = select i1 %A, i8 %val1, i8 %val2
169 define i1 @icmp_ule_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind {
171 %A = icmp ule i8 %arg1, %arg2
175 ;; Note: icmp ule i8 %arg1, <immed> can always be transformed into
176 ;; icmp ult i8 %arg1, <immed>+1
178 ;; Consequently, even though the patterns exist to match, it's unlikely
179 ;; they'll ever be generated.
181 define i8 @icmp_sgt_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind {
183 %A = icmp sgt i8 %arg1, %arg2
184 %B = select i1 %A, i8 %val1, i8 %val2
188 define i1 @icmp_sgt_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind {
190 %A = icmp sgt i8 %arg1, %arg2
194 define i8 @icmp_sgt_immed01_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind {
196 %A = icmp sgt i8 %arg1, 96
197 %B = select i1 %A, i8 %val1, i8 %val2
201 define i8 @icmp_sgt_immed02_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind {
203 %A = icmp sgt i8 %arg1, -1
204 %B = select i1 %A, i8 %val1, i8 %val2
208 define i8 @icmp_sgt_immed03_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind {
210 %A = icmp sgt i8 %arg1, -128
211 %B = select i1 %A, i8 %val1, i8 %val2
215 define i8 @icmp_sge_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind {
217 %A = icmp sge i8 %arg1, %arg2
218 %B = select i1 %A, i8 %val1, i8 %val2
222 define i1 @icmp_sge_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind {
224 %A = icmp sge i8 %arg1, %arg2
228 ;; Note: icmp sge i8 %arg1, <immed> can always be transformed into
229 ;; icmp sgt i8 %arg1, <immed>-1
231 ;; Consequently, even though the patterns exist to match, it's unlikely
232 ;; they'll ever be generated.
234 define i8 @icmp_slt_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind {
236 %A = icmp slt i8 %arg1, %arg2
237 %B = select i1 %A, i8 %val1, i8 %val2
241 define i1 @icmp_slt_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind {
243 %A = icmp slt i8 %arg1, %arg2
247 define i8 @icmp_slt_immed01_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind {
249 %A = icmp slt i8 %arg1, 96
250 %B = select i1 %A, i8 %val1, i8 %val2
254 define i8 @icmp_slt_immed02_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind {
256 %A = icmp slt i8 %arg1, -120
257 %B = select i1 %A, i8 %val1, i8 %val2
261 define i8 @icmp_slt_immed03_i8(i8 %arg1, i8 %val1, i8 %val2) nounwind {
263 %A = icmp slt i8 %arg1, -1
264 %B = select i1 %A, i8 %val1, i8 %val2
268 define i8 @icmp_sle_select_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind {
270 %A = icmp sle i8 %arg1, %arg2
271 %B = select i1 %A, i8 %val1, i8 %val2
275 define i1 @icmp_sle_setcc_i8(i8 %arg1, i8 %arg2, i8 %val1, i8 %val2) nounwind {
277 %A = icmp sle i8 %arg1, %arg2
281 ;; Note: icmp sle i8 %arg1, <immed> can always be transformed into
282 ;; icmp slt i8 %arg1, <immed>+1
284 ;; Consequently, even though the patterns exist to match, it's unlikely
285 ;; they'll ever be generated.