1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc --mtriple=loongarch32 -mattr=+d < %s | FileCheck %s --check-prefix=LA32
3 ; RUN: llc --mtriple=loongarch64 -mattr=+d < %s | FileCheck %s --check-prefix=LA64
5 define i1 @andn_icmp_eq_i8(i8 signext %a, i8 signext %b) nounwind {
6 ; LA32-LABEL: andn_icmp_eq_i8:
8 ; LA32-NEXT: andn $a0, $a1, $a0
9 ; LA32-NEXT: sltui $a0, $a0, 1
12 ; LA64-LABEL: andn_icmp_eq_i8:
14 ; LA64-NEXT: andn $a0, $a1, $a0
15 ; LA64-NEXT: sltui $a0, $a0, 1
18 %cmpeq = icmp eq i8 %and, %b
22 define i1 @andn_icmp_eq_i16(i16 signext %a, i16 signext %b) nounwind {
23 ; LA32-LABEL: andn_icmp_eq_i16:
25 ; LA32-NEXT: andn $a0, $a1, $a0
26 ; LA32-NEXT: sltui $a0, $a0, 1
29 ; LA64-LABEL: andn_icmp_eq_i16:
31 ; LA64-NEXT: andn $a0, $a1, $a0
32 ; LA64-NEXT: sltui $a0, $a0, 1
35 %cmpeq = icmp eq i16 %and, %b
39 define i1 @andn_icmp_eq_i32(i32 signext %a, i32 signext %b) nounwind {
40 ; LA32-LABEL: andn_icmp_eq_i32:
42 ; LA32-NEXT: andn $a0, $a1, $a0
43 ; LA32-NEXT: sltui $a0, $a0, 1
46 ; LA64-LABEL: andn_icmp_eq_i32:
48 ; LA64-NEXT: andn $a0, $a1, $a0
49 ; LA64-NEXT: sltui $a0, $a0, 1
52 %cmpeq = icmp eq i32 %and, %b
56 define i1 @andn_icmp_eq_i64(i64 %a, i64 %b) nounwind {
57 ; LA32-LABEL: andn_icmp_eq_i64:
59 ; LA32-NEXT: andn $a1, $a3, $a1
60 ; LA32-NEXT: andn $a0, $a2, $a0
61 ; LA32-NEXT: or $a0, $a0, $a1
62 ; LA32-NEXT: sltui $a0, $a0, 1
65 ; LA64-LABEL: andn_icmp_eq_i64:
67 ; LA64-NEXT: andn $a0, $a1, $a0
68 ; LA64-NEXT: sltui $a0, $a0, 1
71 %cmpeq = icmp eq i64 %and, %b
75 define i1 @andn_icmp_ne_i8(i8 signext %a, i8 signext %b) nounwind {
76 ; LA32-LABEL: andn_icmp_ne_i8:
78 ; LA32-NEXT: andn $a0, $a1, $a0
79 ; LA32-NEXT: sltu $a0, $zero, $a0
82 ; LA64-LABEL: andn_icmp_ne_i8:
84 ; LA64-NEXT: andn $a0, $a1, $a0
85 ; LA64-NEXT: sltu $a0, $zero, $a0
88 %cmpne = icmp ne i8 %and, %b
92 define i1 @andn_icmp_ne_i16(i16 signext %a, i16 signext %b) nounwind {
93 ; LA32-LABEL: andn_icmp_ne_i16:
95 ; LA32-NEXT: andn $a0, $a1, $a0
96 ; LA32-NEXT: sltu $a0, $zero, $a0
99 ; LA64-LABEL: andn_icmp_ne_i16:
101 ; LA64-NEXT: andn $a0, $a1, $a0
102 ; LA64-NEXT: sltu $a0, $zero, $a0
104 %and = and i16 %a, %b
105 %cmpne = icmp ne i16 %and, %b
109 define i1 @andn_icmp_ne_i32(i32 signext %a, i32 signext %b) nounwind {
110 ; LA32-LABEL: andn_icmp_ne_i32:
112 ; LA32-NEXT: andn $a0, $a1, $a0
113 ; LA32-NEXT: sltu $a0, $zero, $a0
116 ; LA64-LABEL: andn_icmp_ne_i32:
118 ; LA64-NEXT: andn $a0, $a1, $a0
119 ; LA64-NEXT: sltu $a0, $zero, $a0
121 %and = and i32 %a, %b
122 %cmpne = icmp ne i32 %and, %b
126 define i1 @andn_icmp_ne_i64(i64 %a, i64 %b) nounwind {
127 ; LA32-LABEL: andn_icmp_ne_i64:
129 ; LA32-NEXT: andn $a1, $a3, $a1
130 ; LA32-NEXT: andn $a0, $a2, $a0
131 ; LA32-NEXT: or $a0, $a0, $a1
132 ; LA32-NEXT: sltu $a0, $zero, $a0
135 ; LA64-LABEL: andn_icmp_ne_i64:
137 ; LA64-NEXT: andn $a0, $a1, $a0
138 ; LA64-NEXT: sltu $a0, $zero, $a0
140 %and = and i64 %a, %b
141 %cmpne = icmp ne i64 %and, %b
145 define i1 @andn_icmp_ult_i8(i8 signext %a, i8 signext %b) nounwind {
146 ; LA32-LABEL: andn_icmp_ult_i8:
148 ; LA32-NEXT: and $a0, $a0, $a1
149 ; LA32-NEXT: sltu $a0, $a0, $a1
152 ; LA64-LABEL: andn_icmp_ult_i8:
154 ; LA64-NEXT: and $a0, $a0, $a1
155 ; LA64-NEXT: sltu $a0, $a0, $a1
158 %cmp = icmp ult i8 %and, %b
162 define i1 @andn_icmp_ult_i16(i16 signext %a, i16 signext %b) nounwind {
163 ; LA32-LABEL: andn_icmp_ult_i16:
165 ; LA32-NEXT: and $a0, $a0, $a1
166 ; LA32-NEXT: sltu $a0, $a0, $a1
169 ; LA64-LABEL: andn_icmp_ult_i16:
171 ; LA64-NEXT: and $a0, $a0, $a1
172 ; LA64-NEXT: sltu $a0, $a0, $a1
174 %and = and i16 %a, %b
175 %cmp = icmp ult i16 %and, %b
179 define i1 @andn_icmp_uge_i8(i8 signext %a, i8 signext %b) nounwind {
180 ; LA32-LABEL: andn_icmp_uge_i8:
182 ; LA32-NEXT: and $a0, $a0, $a1
183 ; LA32-NEXT: sltu $a0, $a0, $a1
184 ; LA32-NEXT: xori $a0, $a0, 1
187 ; LA64-LABEL: andn_icmp_uge_i8:
189 ; LA64-NEXT: and $a0, $a0, $a1
190 ; LA64-NEXT: sltu $a0, $a0, $a1
191 ; LA64-NEXT: xori $a0, $a0, 1
194 %cmp = icmp uge i8 %and, %b
198 define i1 @andn_icmp_uge_i16(i16 signext %a, i16 signext %b) nounwind {
199 ; LA32-LABEL: andn_icmp_uge_i16:
201 ; LA32-NEXT: and $a0, $a0, $a1
202 ; LA32-NEXT: sltu $a0, $a0, $a1
203 ; LA32-NEXT: xori $a0, $a0, 1
206 ; LA64-LABEL: andn_icmp_uge_i16:
208 ; LA64-NEXT: and $a0, $a0, $a1
209 ; LA64-NEXT: sltu $a0, $a0, $a1
210 ; LA64-NEXT: xori $a0, $a0, 1
212 %and = and i16 %a, %b
213 %cmp = icmp uge i16 %and, %b
217 define i1 @andn_icmp_ugt_i8(i8 signext %a, i8 signext %b) nounwind {
218 ; LA32-LABEL: andn_icmp_ugt_i8:
220 ; LA32-NEXT: and $a0, $a0, $a1
221 ; LA32-NEXT: sltu $a0, $a1, $a0
224 ; LA64-LABEL: andn_icmp_ugt_i8:
226 ; LA64-NEXT: and $a0, $a0, $a1
227 ; LA64-NEXT: sltu $a0, $a1, $a0
230 %cmp = icmp ugt i8 %and, %b
234 define i1 @andn_icmp_ugt_i16(i16 signext %a, i16 signext %b) nounwind {
235 ; LA32-LABEL: andn_icmp_ugt_i16:
237 ; LA32-NEXT: and $a0, $a0, $a1
238 ; LA32-NEXT: sltu $a0, $a1, $a0
241 ; LA64-LABEL: andn_icmp_ugt_i16:
243 ; LA64-NEXT: and $a0, $a0, $a1
244 ; LA64-NEXT: sltu $a0, $a1, $a0
246 %and = and i16 %a, %b
247 %cmp = icmp ugt i16 %and, %b
251 define i1 @andn_icmp_ule_i8(i8 signext %a, i8 signext %b) nounwind {
252 ; LA32-LABEL: andn_icmp_ule_i8:
254 ; LA32-NEXT: and $a0, $a0, $a1
255 ; LA32-NEXT: sltu $a0, $a1, $a0
256 ; LA32-NEXT: xori $a0, $a0, 1
259 ; LA64-LABEL: andn_icmp_ule_i8:
261 ; LA64-NEXT: and $a0, $a0, $a1
262 ; LA64-NEXT: sltu $a0, $a1, $a0
263 ; LA64-NEXT: xori $a0, $a0, 1
266 %cmp = icmp ule i8 %and, %b
270 define i1 @andn_icmp_ule_i16(i16 signext %a, i16 signext %b) nounwind {
271 ; LA32-LABEL: andn_icmp_ule_i16:
273 ; LA32-NEXT: and $a0, $a0, $a1
274 ; LA32-NEXT: sltu $a0, $a1, $a0
275 ; LA32-NEXT: xori $a0, $a0, 1
278 ; LA64-LABEL: andn_icmp_ule_i16:
280 ; LA64-NEXT: and $a0, $a0, $a1
281 ; LA64-NEXT: sltu $a0, $a1, $a0
282 ; LA64-NEXT: xori $a0, $a0, 1
284 %and = and i16 %a, %b
285 %cmp = icmp ule i16 %and, %b
289 define i1 @andn_icmp_eq_i8_sz(i8 signext %a, i8 zeroext %b) nounwind {
290 ; LA32-LABEL: andn_icmp_eq_i8_sz:
292 ; LA32-NEXT: andn $a0, $a1, $a0
293 ; LA32-NEXT: sltui $a0, $a0, 1
296 ; LA64-LABEL: andn_icmp_eq_i8_sz:
298 ; LA64-NEXT: andn $a0, $a1, $a0
299 ; LA64-NEXT: sltui $a0, $a0, 1
302 %cmp = icmp eq i8 %and, %b
306 define i1 @andn_icmp_eq_i8_zs(i8 zeroext %a, i8 signext %b) nounwind {
307 ; LA32-LABEL: andn_icmp_eq_i8_zs:
309 ; LA32-NEXT: andn $a0, $a1, $a0
310 ; LA32-NEXT: andi $a0, $a0, 255
311 ; LA32-NEXT: sltui $a0, $a0, 1
314 ; LA64-LABEL: andn_icmp_eq_i8_zs:
316 ; LA64-NEXT: andn $a0, $a1, $a0
317 ; LA64-NEXT: andi $a0, $a0, 255
318 ; LA64-NEXT: sltui $a0, $a0, 1
321 %cmp = icmp eq i8 %and, %b
325 define i1 @andn_icmp_eq_i8_zz(i8 zeroext %a, i8 zeroext %b) nounwind {
326 ; LA32-LABEL: andn_icmp_eq_i8_zz:
328 ; LA32-NEXT: andn $a0, $a1, $a0
329 ; LA32-NEXT: sltui $a0, $a0, 1
332 ; LA64-LABEL: andn_icmp_eq_i8_zz:
334 ; LA64-NEXT: andn $a0, $a1, $a0
335 ; LA64-NEXT: sltui $a0, $a0, 1
338 %cmp = icmp eq i8 %and, %b
342 define i1 @andn_icmp_eq_i8_sn(i8 signext %a, i8 %b) nounwind {
343 ; LA32-LABEL: andn_icmp_eq_i8_sn:
345 ; LA32-NEXT: andn $a0, $a1, $a0
346 ; LA32-NEXT: andi $a0, $a0, 255
347 ; LA32-NEXT: sltui $a0, $a0, 1
350 ; LA64-LABEL: andn_icmp_eq_i8_sn:
352 ; LA64-NEXT: andn $a0, $a1, $a0
353 ; LA64-NEXT: andi $a0, $a0, 255
354 ; LA64-NEXT: sltui $a0, $a0, 1
357 %cmp = icmp eq i8 %and, %b
361 define i1 @andn_icmp_eq_i8_zn(i8 zeroext %a, i8 %b) nounwind {
362 ; LA32-LABEL: andn_icmp_eq_i8_zn:
364 ; LA32-NEXT: andn $a0, $a1, $a0
365 ; LA32-NEXT: andi $a0, $a0, 255
366 ; LA32-NEXT: sltui $a0, $a0, 1
369 ; LA64-LABEL: andn_icmp_eq_i8_zn:
371 ; LA64-NEXT: andn $a0, $a1, $a0
372 ; LA64-NEXT: andi $a0, $a0, 255
373 ; LA64-NEXT: sltui $a0, $a0, 1
376 %cmp = icmp eq i8 %and, %b
380 define i1 @andn_icmp_eq_i8_ns(i8 %a, i8 signext %b) nounwind {
381 ; LA32-LABEL: andn_icmp_eq_i8_ns:
383 ; LA32-NEXT: andn $a0, $a1, $a0
384 ; LA32-NEXT: andi $a0, $a0, 255
385 ; LA32-NEXT: sltui $a0, $a0, 1
388 ; LA64-LABEL: andn_icmp_eq_i8_ns:
390 ; LA64-NEXT: andn $a0, $a1, $a0
391 ; LA64-NEXT: andi $a0, $a0, 255
392 ; LA64-NEXT: sltui $a0, $a0, 1
395 %cmp = icmp eq i8 %and, %b
399 define i1 @andn_icmp_eq_i8_nz(i8 %a, i8 zeroext %b) nounwind {
400 ; LA32-LABEL: andn_icmp_eq_i8_nz:
402 ; LA32-NEXT: andn $a0, $a1, $a0
403 ; LA32-NEXT: sltui $a0, $a0, 1
406 ; LA64-LABEL: andn_icmp_eq_i8_nz:
408 ; LA64-NEXT: andn $a0, $a1, $a0
409 ; LA64-NEXT: sltui $a0, $a0, 1
412 %cmp = icmp eq i8 %and, %b
416 define i1 @andn_icmp_eq_i8_nn(i8 %a, i8 %b) nounwind {
417 ; LA32-LABEL: andn_icmp_eq_i8_nn:
419 ; LA32-NEXT: andn $a0, $a1, $a0
420 ; LA32-NEXT: andi $a0, $a0, 255
421 ; LA32-NEXT: sltui $a0, $a0, 1
424 ; LA64-LABEL: andn_icmp_eq_i8_nn:
426 ; LA64-NEXT: andn $a0, $a1, $a0
427 ; LA64-NEXT: andi $a0, $a0, 255
428 ; LA64-NEXT: sltui $a0, $a0, 1
431 %cmp = icmp eq i8 %and, %b
435 define i1 @andn_icmp_ult_i8_sz(i8 signext %a, i8 zeroext %b) nounwind {
436 ; LA32-LABEL: andn_icmp_ult_i8_sz:
438 ; LA32-NEXT: and $a0, $a0, $a1
439 ; LA32-NEXT: sltu $a0, $a0, $a1
442 ; LA64-LABEL: andn_icmp_ult_i8_sz:
444 ; LA64-NEXT: and $a0, $a0, $a1
445 ; LA64-NEXT: sltu $a0, $a0, $a1
448 %cmp = icmp ult i8 %and, %b
452 define i1 @andn_icmp_ult_i8_zs(i8 zeroext %a, i8 signext %b) nounwind {
453 ; LA32-LABEL: andn_icmp_ult_i8_zs:
455 ; LA32-NEXT: andi $a1, $a1, 255
456 ; LA32-NEXT: and $a0, $a0, $a1
457 ; LA32-NEXT: sltu $a0, $a0, $a1
460 ; LA64-LABEL: andn_icmp_ult_i8_zs:
462 ; LA64-NEXT: andi $a1, $a1, 255
463 ; LA64-NEXT: and $a0, $a0, $a1
464 ; LA64-NEXT: sltu $a0, $a0, $a1
467 %cmp = icmp ult i8 %and, %b
471 define i1 @andn_icmp_ult_i8_zz(i8 zeroext %a, i8 zeroext %b) nounwind {
472 ; LA32-LABEL: andn_icmp_ult_i8_zz:
474 ; LA32-NEXT: and $a0, $a0, $a1
475 ; LA32-NEXT: sltu $a0, $a0, $a1
478 ; LA64-LABEL: andn_icmp_ult_i8_zz:
480 ; LA64-NEXT: and $a0, $a0, $a1
481 ; LA64-NEXT: sltu $a0, $a0, $a1
484 %cmp = icmp ult i8 %and, %b
488 define i1 @andn_icmp_ult_i8_sn(i8 signext %a, i8 %b) nounwind {
489 ; LA32-LABEL: andn_icmp_ult_i8_sn:
491 ; LA32-NEXT: andi $a1, $a1, 255
492 ; LA32-NEXT: and $a0, $a1, $a0
493 ; LA32-NEXT: sltu $a0, $a0, $a1
496 ; LA64-LABEL: andn_icmp_ult_i8_sn:
498 ; LA64-NEXT: andi $a1, $a1, 255
499 ; LA64-NEXT: and $a0, $a1, $a0
500 ; LA64-NEXT: sltu $a0, $a0, $a1
503 %cmp = icmp ult i8 %and, %b
507 define i1 @andn_icmp_ult_i8_zn(i8 zeroext %a, i8 %b) nounwind {
508 ; LA32-LABEL: andn_icmp_ult_i8_zn:
510 ; LA32-NEXT: andi $a1, $a1, 255
511 ; LA32-NEXT: and $a0, $a1, $a0
512 ; LA32-NEXT: sltu $a0, $a0, $a1
515 ; LA64-LABEL: andn_icmp_ult_i8_zn:
517 ; LA64-NEXT: andi $a1, $a1, 255
518 ; LA64-NEXT: and $a0, $a1, $a0
519 ; LA64-NEXT: sltu $a0, $a0, $a1
522 %cmp = icmp ult i8 %and, %b
526 define i1 @andn_icmp_ult_i8_ns(i8 %a, i8 signext %b) nounwind {
527 ; LA32-LABEL: andn_icmp_ult_i8_ns:
529 ; LA32-NEXT: andi $a1, $a1, 255
530 ; LA32-NEXT: and $a0, $a1, $a0
531 ; LA32-NEXT: sltu $a0, $a0, $a1
534 ; LA64-LABEL: andn_icmp_ult_i8_ns:
536 ; LA64-NEXT: andi $a1, $a1, 255
537 ; LA64-NEXT: and $a0, $a1, $a0
538 ; LA64-NEXT: sltu $a0, $a0, $a1
541 %cmp = icmp ult i8 %and, %b
545 define i1 @andn_icmp_ult_i8_nz(i8 %a, i8 zeroext %b) nounwind {
546 ; LA32-LABEL: andn_icmp_ult_i8_nz:
548 ; LA32-NEXT: and $a0, $a0, $a1
549 ; LA32-NEXT: sltu $a0, $a0, $a1
552 ; LA64-LABEL: andn_icmp_ult_i8_nz:
554 ; LA64-NEXT: and $a0, $a0, $a1
555 ; LA64-NEXT: sltu $a0, $a0, $a1
558 %cmp = icmp ult i8 %and, %b
562 define i1 @andn_icmp_ult_i8_nn(i8 %a, i8 %b) nounwind {
563 ; LA32-LABEL: andn_icmp_ult_i8_nn:
565 ; LA32-NEXT: andi $a1, $a1, 255
566 ; LA32-NEXT: and $a0, $a1, $a0
567 ; LA32-NEXT: sltu $a0, $a0, $a1
570 ; LA64-LABEL: andn_icmp_ult_i8_nn:
572 ; LA64-NEXT: andi $a1, $a1, 255
573 ; LA64-NEXT: and $a0, $a1, $a0
574 ; LA64-NEXT: sltu $a0, $a0, $a1
577 %cmp = icmp ult i8 %and, %b
581 define i1 @andn_icmp_eq_i8_i32(i8 signext %a, i8 signext %b) nounwind {
582 ; LA32-LABEL: andn_icmp_eq_i8_i32:
584 ; LA32-NEXT: andn $a0, $a1, $a0
585 ; LA32-NEXT: sltui $a0, $a0, 1
588 ; LA64-LABEL: andn_icmp_eq_i8_i32:
590 ; LA64-NEXT: andn $a0, $a1, $a0
591 ; LA64-NEXT: andi $a0, $a0, 255
592 ; LA64-NEXT: sltui $a0, $a0, 1
594 %x = zext i8 %a to i32
595 %y = zext i8 %b to i32
596 %not = xor i32 %x, -1
597 %and = and i32 %not, %y
598 %cmp = icmp eq i32 %and, 0