1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv64 -verify-machineinstrs < %s \
3 ; RUN: | FileCheck %s -check-prefixes=RV64,RV64I
4 ; RUN: llc -mtriple=riscv64 -verify-machineinstrs -mattr=+zba < %s \
5 ; RUN: | FileCheck %s -check-prefixes=RV64,RV64ZBA
7 ; The patterns for the 'W' suffixed RV64I instructions have the potential of
8 ; missing cases. This file checks all the variants of
9 ; sign-extended/zero-extended/any-extended inputs and outputs.
11 ; The 64-bit add instruction can safely be used when the result is anyext.
13 define i32 @aext_addw_aext_aext(i32 %a, i32 %b) nounwind {
14 ; RV64-LABEL: aext_addw_aext_aext:
16 ; RV64-NEXT: addw a0, a0, a1
22 define i32 @aext_addw_aext_sext(i32 %a, i32 signext %b) nounwind {
23 ; RV64-LABEL: aext_addw_aext_sext:
25 ; RV64-NEXT: addw a0, a0, a1
31 define i32 @aext_addw_aext_zext(i32 %a, i32 zeroext %b) nounwind {
32 ; RV64-LABEL: aext_addw_aext_zext:
34 ; RV64-NEXT: addw a0, a0, a1
40 define i32 @aext_addw_sext_aext(i32 signext %a, i32 %b) nounwind {
41 ; RV64-LABEL: aext_addw_sext_aext:
43 ; RV64-NEXT: addw a0, a0, a1
49 define i32 @aext_addw_sext_sext(i32 signext %a, i32 signext %b) nounwind {
50 ; RV64-LABEL: aext_addw_sext_sext:
52 ; RV64-NEXT: addw a0, a0, a1
58 define i32 @aext_addw_sext_zext(i32 signext %a, i32 zeroext %b) nounwind {
59 ; RV64-LABEL: aext_addw_sext_zext:
61 ; RV64-NEXT: addw a0, a0, a1
67 define i32 @aext_addw_zext_aext(i32 zeroext %a, i32 %b) nounwind {
68 ; RV64-LABEL: aext_addw_zext_aext:
70 ; RV64-NEXT: addw a0, a0, a1
76 define i32 @aext_addw_zext_sext(i32 zeroext %a, i32 signext %b) nounwind {
77 ; RV64-LABEL: aext_addw_zext_sext:
79 ; RV64-NEXT: addw a0, a0, a1
85 define i32 @aext_addw_zext_zext(i32 zeroext %a, i32 zeroext %b) nounwind {
86 ; RV64-LABEL: aext_addw_zext_zext:
88 ; RV64-NEXT: addw a0, a0, a1
94 ; Always select addw when a signext result is required.
96 define signext i32 @sext_addw_aext_aext(i32 %a, i32 %b) nounwind {
97 ; RV64-LABEL: sext_addw_aext_aext:
99 ; RV64-NEXT: addw a0, a0, a1
105 define signext i32 @sext_addw_aext_sext(i32 %a, i32 signext %b) nounwind {
106 ; RV64-LABEL: sext_addw_aext_sext:
108 ; RV64-NEXT: addw a0, a0, a1
114 define signext i32 @sext_addw_aext_zext(i32 %a, i32 zeroext %b) nounwind {
115 ; RV64-LABEL: sext_addw_aext_zext:
117 ; RV64-NEXT: addw a0, a0, a1
123 define signext i32 @sext_addw_sext_aext(i32 signext %a, i32 %b) nounwind {
124 ; RV64-LABEL: sext_addw_sext_aext:
126 ; RV64-NEXT: addw a0, a0, a1
132 define signext i32 @sext_addw_sext_sext(i32 signext %a, i32 signext %b) nounwind {
133 ; RV64-LABEL: sext_addw_sext_sext:
135 ; RV64-NEXT: addw a0, a0, a1
141 define signext i32 @sext_addw_sext_zext(i32 signext %a, i32 zeroext %b) nounwind {
142 ; RV64-LABEL: sext_addw_sext_zext:
144 ; RV64-NEXT: addw a0, a0, a1
150 define signext i32 @sext_addw_zext_aext(i32 zeroext %a, i32 %b) nounwind {
151 ; RV64-LABEL: sext_addw_zext_aext:
153 ; RV64-NEXT: addw a0, a0, a1
159 define signext i32 @sext_addw_zext_sext(i32 zeroext %a, i32 signext %b) nounwind {
160 ; RV64-LABEL: sext_addw_zext_sext:
162 ; RV64-NEXT: addw a0, a0, a1
168 define signext i32 @sext_addw_zext_zext(i32 zeroext %a, i32 zeroext %b) nounwind {
169 ; RV64-LABEL: sext_addw_zext_zext:
171 ; RV64-NEXT: addw a0, a0, a1
177 ; 64-bit add followed by zero-extension is a safe option when a zeroext result
180 define zeroext i32 @zext_addw_aext_aext(i32 %a, i32 %b) nounwind {
181 ; RV64I-LABEL: zext_addw_aext_aext:
183 ; RV64I-NEXT: add a0, a0, a1
184 ; RV64I-NEXT: slli a0, a0, 32
185 ; RV64I-NEXT: srli a0, a0, 32
188 ; RV64ZBA-LABEL: zext_addw_aext_aext:
190 ; RV64ZBA-NEXT: add a0, a0, a1
191 ; RV64ZBA-NEXT: zext.w a0, a0
197 define zeroext i32 @zext_addw_aext_sext(i32 %a, i32 signext %b) nounwind {
198 ; RV64I-LABEL: zext_addw_aext_sext:
200 ; RV64I-NEXT: add a0, a0, a1
201 ; RV64I-NEXT: slli a0, a0, 32
202 ; RV64I-NEXT: srli a0, a0, 32
205 ; RV64ZBA-LABEL: zext_addw_aext_sext:
207 ; RV64ZBA-NEXT: add a0, a0, a1
208 ; RV64ZBA-NEXT: zext.w a0, a0
214 define zeroext i32 @zext_addw_aext_zext(i32 %a, i32 zeroext %b) nounwind {
215 ; RV64I-LABEL: zext_addw_aext_zext:
217 ; RV64I-NEXT: add a0, a0, a1
218 ; RV64I-NEXT: slli a0, a0, 32
219 ; RV64I-NEXT: srli a0, a0, 32
222 ; RV64ZBA-LABEL: zext_addw_aext_zext:
224 ; RV64ZBA-NEXT: add a0, a0, a1
225 ; RV64ZBA-NEXT: zext.w a0, a0
231 define zeroext i32 @zext_addw_sext_aext(i32 signext %a, i32 %b) nounwind {
232 ; RV64I-LABEL: zext_addw_sext_aext:
234 ; RV64I-NEXT: add a0, a0, a1
235 ; RV64I-NEXT: slli a0, a0, 32
236 ; RV64I-NEXT: srli a0, a0, 32
239 ; RV64ZBA-LABEL: zext_addw_sext_aext:
241 ; RV64ZBA-NEXT: add a0, a0, a1
242 ; RV64ZBA-NEXT: zext.w a0, a0
248 define zeroext i32 @zext_addw_sext_sext(i32 signext %a, i32 signext %b) nounwind {
249 ; RV64I-LABEL: zext_addw_sext_sext:
251 ; RV64I-NEXT: add a0, a0, a1
252 ; RV64I-NEXT: slli a0, a0, 32
253 ; RV64I-NEXT: srli a0, a0, 32
256 ; RV64ZBA-LABEL: zext_addw_sext_sext:
258 ; RV64ZBA-NEXT: add a0, a0, a1
259 ; RV64ZBA-NEXT: zext.w a0, a0
265 define zeroext i32 @zext_addw_sext_zext(i32 signext %a, i32 zeroext %b) nounwind {
266 ; RV64I-LABEL: zext_addw_sext_zext:
268 ; RV64I-NEXT: add a0, a0, a1
269 ; RV64I-NEXT: slli a0, a0, 32
270 ; RV64I-NEXT: srli a0, a0, 32
273 ; RV64ZBA-LABEL: zext_addw_sext_zext:
275 ; RV64ZBA-NEXT: add a0, a0, a1
276 ; RV64ZBA-NEXT: zext.w a0, a0
282 define zeroext i32 @zext_addw_zext_aext(i32 zeroext %a, i32 %b) nounwind {
283 ; RV64I-LABEL: zext_addw_zext_aext:
285 ; RV64I-NEXT: add a0, a0, a1
286 ; RV64I-NEXT: slli a0, a0, 32
287 ; RV64I-NEXT: srli a0, a0, 32
290 ; RV64ZBA-LABEL: zext_addw_zext_aext:
292 ; RV64ZBA-NEXT: add a0, a0, a1
293 ; RV64ZBA-NEXT: zext.w a0, a0
299 define zeroext i32 @zext_addw_zext_sext(i32 zeroext %a, i32 signext %b) nounwind {
300 ; RV64I-LABEL: zext_addw_zext_sext:
302 ; RV64I-NEXT: add a0, a0, a1
303 ; RV64I-NEXT: slli a0, a0, 32
304 ; RV64I-NEXT: srli a0, a0, 32
307 ; RV64ZBA-LABEL: zext_addw_zext_sext:
309 ; RV64ZBA-NEXT: add a0, a0, a1
310 ; RV64ZBA-NEXT: zext.w a0, a0
316 define zeroext i32 @zext_addw_zext_zext(i32 zeroext %a, i32 zeroext %b) nounwind {
317 ; RV64I-LABEL: zext_addw_zext_zext:
319 ; RV64I-NEXT: add a0, a0, a1
320 ; RV64I-NEXT: slli a0, a0, 32
321 ; RV64I-NEXT: srli a0, a0, 32
324 ; RV64ZBA-LABEL: zext_addw_zext_zext:
326 ; RV64ZBA-NEXT: add a0, a0, a1
327 ; RV64ZBA-NEXT: zext.w a0, a0
333 ; 64-bit sub is safe for an anyext result.
335 define i32 @aext_subw_aext_aext(i32 %a, i32 %b) nounwind {
336 ; RV64-LABEL: aext_subw_aext_aext:
338 ; RV64-NEXT: subw a0, a0, a1
344 define i32 @aext_subw_aext_sext(i32 %a, i32 signext %b) nounwind {
345 ; RV64-LABEL: aext_subw_aext_sext:
347 ; RV64-NEXT: subw a0, a0, a1
353 define i32 @aext_subw_aext_zext(i32 %a, i32 zeroext %b) nounwind {
354 ; RV64-LABEL: aext_subw_aext_zext:
356 ; RV64-NEXT: subw a0, a0, a1
362 define i32 @aext_subw_sext_aext(i32 signext %a, i32 %b) nounwind {
363 ; RV64-LABEL: aext_subw_sext_aext:
365 ; RV64-NEXT: subw a0, a0, a1
371 define i32 @aext_subw_sext_sext(i32 signext %a, i32 signext %b) nounwind {
372 ; RV64-LABEL: aext_subw_sext_sext:
374 ; RV64-NEXT: subw a0, a0, a1
380 define i32 @aext_subw_sext_zext(i32 signext %a, i32 zeroext %b) nounwind {
381 ; RV64-LABEL: aext_subw_sext_zext:
383 ; RV64-NEXT: subw a0, a0, a1
389 define i32 @aext_subw_zext_aext(i32 zeroext %a, i32 %b) nounwind {
390 ; RV64-LABEL: aext_subw_zext_aext:
392 ; RV64-NEXT: subw a0, a0, a1
398 define i32 @aext_subw_zext_sext(i32 zeroext %a, i32 signext %b) nounwind {
399 ; RV64-LABEL: aext_subw_zext_sext:
401 ; RV64-NEXT: subw a0, a0, a1
407 define i32 @aext_subw_zext_zext(i32 zeroext %a, i32 zeroext %b) nounwind {
408 ; RV64-LABEL: aext_subw_zext_zext:
410 ; RV64-NEXT: subw a0, a0, a1
416 ; Always select subw for a signext result.
418 define signext i32 @sext_subw_aext_aext(i32 %a, i32 %b) nounwind {
419 ; RV64-LABEL: sext_subw_aext_aext:
421 ; RV64-NEXT: subw a0, a0, a1
427 define signext i32 @sext_subw_aext_sext(i32 %a, i32 signext %b) nounwind {
428 ; RV64-LABEL: sext_subw_aext_sext:
430 ; RV64-NEXT: subw a0, a0, a1
436 define signext i32 @sext_subw_aext_zext(i32 %a, i32 zeroext %b) nounwind {
437 ; RV64-LABEL: sext_subw_aext_zext:
439 ; RV64-NEXT: subw a0, a0, a1
445 define signext i32 @sext_subw_sext_aext(i32 signext %a, i32 %b) nounwind {
446 ; RV64-LABEL: sext_subw_sext_aext:
448 ; RV64-NEXT: subw a0, a0, a1
454 define signext i32 @sext_subw_sext_sext(i32 signext %a, i32 signext %b) nounwind {
455 ; RV64-LABEL: sext_subw_sext_sext:
457 ; RV64-NEXT: subw a0, a0, a1
463 define signext i32 @sext_subw_sext_zext(i32 signext %a, i32 zeroext %b) nounwind {
464 ; RV64-LABEL: sext_subw_sext_zext:
466 ; RV64-NEXT: subw a0, a0, a1
472 define signext i32 @sext_subw_zext_aext(i32 zeroext %a, i32 %b) nounwind {
473 ; RV64-LABEL: sext_subw_zext_aext:
475 ; RV64-NEXT: subw a0, a0, a1
481 define signext i32 @sext_subw_zext_sext(i32 zeroext %a, i32 signext %b) nounwind {
482 ; RV64-LABEL: sext_subw_zext_sext:
484 ; RV64-NEXT: subw a0, a0, a1
490 define signext i32 @sext_subw_zext_zext(i32 zeroext %a, i32 zeroext %b) nounwind {
491 ; RV64-LABEL: sext_subw_zext_zext:
493 ; RV64-NEXT: subw a0, a0, a1
499 ; 64-bit sub followed by zero-extension is safe for a zeroext result.
501 define zeroext i32 @zext_subw_aext_aext(i32 %a, i32 %b) nounwind {
502 ; RV64I-LABEL: zext_subw_aext_aext:
504 ; RV64I-NEXT: subw a0, a0, a1
505 ; RV64I-NEXT: slli a0, a0, 32
506 ; RV64I-NEXT: srli a0, a0, 32
509 ; RV64ZBA-LABEL: zext_subw_aext_aext:
511 ; RV64ZBA-NEXT: subw a0, a0, a1
512 ; RV64ZBA-NEXT: zext.w a0, a0
518 define zeroext i32 @zext_subw_aext_sext(i32 %a, i32 signext %b) nounwind {
519 ; RV64I-LABEL: zext_subw_aext_sext:
521 ; RV64I-NEXT: subw a0, a0, a1
522 ; RV64I-NEXT: slli a0, a0, 32
523 ; RV64I-NEXT: srli a0, a0, 32
526 ; RV64ZBA-LABEL: zext_subw_aext_sext:
528 ; RV64ZBA-NEXT: subw a0, a0, a1
529 ; RV64ZBA-NEXT: zext.w a0, a0
535 define zeroext i32 @zext_subw_aext_zext(i32 %a, i32 zeroext %b) nounwind {
536 ; RV64I-LABEL: zext_subw_aext_zext:
538 ; RV64I-NEXT: subw a0, a0, a1
539 ; RV64I-NEXT: slli a0, a0, 32
540 ; RV64I-NEXT: srli a0, a0, 32
543 ; RV64ZBA-LABEL: zext_subw_aext_zext:
545 ; RV64ZBA-NEXT: subw a0, a0, a1
546 ; RV64ZBA-NEXT: zext.w a0, a0
552 define zeroext i32 @zext_subw_sext_aext(i32 signext %a, i32 %b) nounwind {
553 ; RV64I-LABEL: zext_subw_sext_aext:
555 ; RV64I-NEXT: subw a0, a0, a1
556 ; RV64I-NEXT: slli a0, a0, 32
557 ; RV64I-NEXT: srli a0, a0, 32
560 ; RV64ZBA-LABEL: zext_subw_sext_aext:
562 ; RV64ZBA-NEXT: subw a0, a0, a1
563 ; RV64ZBA-NEXT: zext.w a0, a0
569 define zeroext i32 @zext_subw_sext_sext(i32 signext %a, i32 signext %b) nounwind {
570 ; RV64I-LABEL: zext_subw_sext_sext:
572 ; RV64I-NEXT: subw a0, a0, a1
573 ; RV64I-NEXT: slli a0, a0, 32
574 ; RV64I-NEXT: srli a0, a0, 32
577 ; RV64ZBA-LABEL: zext_subw_sext_sext:
579 ; RV64ZBA-NEXT: subw a0, a0, a1
580 ; RV64ZBA-NEXT: zext.w a0, a0
586 define zeroext i32 @zext_subw_sext_zext(i32 signext %a, i32 zeroext %b) nounwind {
587 ; RV64I-LABEL: zext_subw_sext_zext:
589 ; RV64I-NEXT: subw a0, a0, a1
590 ; RV64I-NEXT: slli a0, a0, 32
591 ; RV64I-NEXT: srli a0, a0, 32
594 ; RV64ZBA-LABEL: zext_subw_sext_zext:
596 ; RV64ZBA-NEXT: subw a0, a0, a1
597 ; RV64ZBA-NEXT: zext.w a0, a0
603 define zeroext i32 @zext_subw_zext_aext(i32 zeroext %a, i32 %b) nounwind {
604 ; RV64I-LABEL: zext_subw_zext_aext:
606 ; RV64I-NEXT: subw a0, a0, a1
607 ; RV64I-NEXT: slli a0, a0, 32
608 ; RV64I-NEXT: srli a0, a0, 32
611 ; RV64ZBA-LABEL: zext_subw_zext_aext:
613 ; RV64ZBA-NEXT: subw a0, a0, a1
614 ; RV64ZBA-NEXT: zext.w a0, a0
620 define zeroext i32 @zext_subw_zext_sext(i32 zeroext %a, i32 signext %b) nounwind {
621 ; RV64I-LABEL: zext_subw_zext_sext:
623 ; RV64I-NEXT: subw a0, a0, a1
624 ; RV64I-NEXT: slli a0, a0, 32
625 ; RV64I-NEXT: srli a0, a0, 32
628 ; RV64ZBA-LABEL: zext_subw_zext_sext:
630 ; RV64ZBA-NEXT: subw a0, a0, a1
631 ; RV64ZBA-NEXT: zext.w a0, a0
637 define zeroext i32 @zext_subw_zext_zext(i32 zeroext %a, i32 zeroext %b) nounwind {
638 ; RV64I-LABEL: zext_subw_zext_zext:
640 ; RV64I-NEXT: subw a0, a0, a1
641 ; RV64I-NEXT: slli a0, a0, 32
642 ; RV64I-NEXT: srli a0, a0, 32
645 ; RV64ZBA-LABEL: zext_subw_zext_zext:
647 ; RV64ZBA-NEXT: subw a0, a0, a1
648 ; RV64ZBA-NEXT: zext.w a0, a0
654 ; 64-bit sll is a safe choice for an anyext result.
656 define i32 @aext_sllw_aext_aext(i32 %a, i32 %b) nounwind {
657 ; RV64-LABEL: aext_sllw_aext_aext:
659 ; RV64-NEXT: sllw a0, a0, a1
665 define i32 @aext_sllw_aext_sext(i32 %a, i32 signext %b) nounwind {
666 ; RV64-LABEL: aext_sllw_aext_sext:
668 ; RV64-NEXT: sllw a0, a0, a1
674 define i32 @aext_sllw_aext_zext(i32 %a, i32 zeroext %b) nounwind {
675 ; RV64-LABEL: aext_sllw_aext_zext:
677 ; RV64-NEXT: sllw a0, a0, a1
683 define i32 @aext_sllw_sext_aext(i32 signext %a, i32 %b) nounwind {
684 ; RV64-LABEL: aext_sllw_sext_aext:
686 ; RV64-NEXT: sllw a0, a0, a1
692 define i32 @aext_sllw_sext_sext(i32 signext %a, i32 signext %b) nounwind {
693 ; RV64-LABEL: aext_sllw_sext_sext:
695 ; RV64-NEXT: sllw a0, a0, a1
701 define i32 @aext_sllw_sext_zext(i32 signext %a, i32 zeroext %b) nounwind {
702 ; RV64-LABEL: aext_sllw_sext_zext:
704 ; RV64-NEXT: sllw a0, a0, a1
710 define i32 @aext_sllw_zext_aext(i32 zeroext %a, i32 %b) nounwind {
711 ; RV64-LABEL: aext_sllw_zext_aext:
713 ; RV64-NEXT: sllw a0, a0, a1
719 define i32 @aext_sllw_zext_sext(i32 zeroext %a, i32 signext %b) nounwind {
720 ; RV64-LABEL: aext_sllw_zext_sext:
722 ; RV64-NEXT: sllw a0, a0, a1
728 define i32 @aext_sllw_zext_zext(i32 zeroext %a, i32 zeroext %b) nounwind {
729 ; RV64-LABEL: aext_sllw_zext_zext:
731 ; RV64-NEXT: sllw a0, a0, a1
737 define signext i32 @sext_sllw_aext_aext(i32 %a, i32 %b) nounwind {
738 ; RV64-LABEL: sext_sllw_aext_aext:
740 ; RV64-NEXT: sllw a0, a0, a1
746 define signext i32 @sext_sllw_aext_sext(i32 %a, i32 signext %b) nounwind {
747 ; RV64-LABEL: sext_sllw_aext_sext:
749 ; RV64-NEXT: sllw a0, a0, a1
755 define signext i32 @sext_sllw_aext_zext(i32 %a, i32 zeroext %b) nounwind {
756 ; RV64-LABEL: sext_sllw_aext_zext:
758 ; RV64-NEXT: sllw a0, a0, a1
764 define signext i32 @sext_sllw_sext_aext(i32 signext %a, i32 %b) nounwind {
765 ; RV64-LABEL: sext_sllw_sext_aext:
767 ; RV64-NEXT: sllw a0, a0, a1
773 define signext i32 @sext_sllw_sext_sext(i32 signext %a, i32 signext %b) nounwind {
774 ; RV64-LABEL: sext_sllw_sext_sext:
776 ; RV64-NEXT: sllw a0, a0, a1
782 define signext i32 @sext_sllw_sext_zext(i32 signext %a, i32 zeroext %b) nounwind {
783 ; RV64-LABEL: sext_sllw_sext_zext:
785 ; RV64-NEXT: sllw a0, a0, a1
791 define signext i32 @sext_sllw_zext_aext(i32 zeroext %a, i32 %b) nounwind {
792 ; RV64-LABEL: sext_sllw_zext_aext:
794 ; RV64-NEXT: sllw a0, a0, a1
800 define signext i32 @sext_sllw_zext_sext(i32 zeroext %a, i32 signext %b) nounwind {
801 ; RV64-LABEL: sext_sllw_zext_sext:
803 ; RV64-NEXT: sllw a0, a0, a1
809 define signext i32 @sext_sllw_zext_zext(i32 zeroext %a, i32 zeroext %b) nounwind {
810 ; RV64-LABEL: sext_sllw_zext_zext:
812 ; RV64-NEXT: sllw a0, a0, a1
818 ; 64-bit sll followed by zero-extension for a zeroext result.
820 define zeroext i32 @zext_sllw_aext_aext(i32 %a, i32 %b) nounwind {
821 ; RV64I-LABEL: zext_sllw_aext_aext:
823 ; RV64I-NEXT: sllw a0, a0, a1
824 ; RV64I-NEXT: slli a0, a0, 32
825 ; RV64I-NEXT: srli a0, a0, 32
828 ; RV64ZBA-LABEL: zext_sllw_aext_aext:
830 ; RV64ZBA-NEXT: sllw a0, a0, a1
831 ; RV64ZBA-NEXT: zext.w a0, a0
837 define zeroext i32 @zext_sllw_aext_sext(i32 %a, i32 signext %b) nounwind {
838 ; RV64I-LABEL: zext_sllw_aext_sext:
840 ; RV64I-NEXT: sllw a0, a0, a1
841 ; RV64I-NEXT: slli a0, a0, 32
842 ; RV64I-NEXT: srli a0, a0, 32
845 ; RV64ZBA-LABEL: zext_sllw_aext_sext:
847 ; RV64ZBA-NEXT: sllw a0, a0, a1
848 ; RV64ZBA-NEXT: zext.w a0, a0
854 define zeroext i32 @zext_sllw_aext_zext(i32 %a, i32 zeroext %b) nounwind {
855 ; RV64I-LABEL: zext_sllw_aext_zext:
857 ; RV64I-NEXT: sllw a0, a0, a1
858 ; RV64I-NEXT: slli a0, a0, 32
859 ; RV64I-NEXT: srli a0, a0, 32
862 ; RV64ZBA-LABEL: zext_sllw_aext_zext:
864 ; RV64ZBA-NEXT: sllw a0, a0, a1
865 ; RV64ZBA-NEXT: zext.w a0, a0
871 define zeroext i32 @zext_sllw_sext_aext(i32 signext %a, i32 %b) nounwind {
872 ; RV64I-LABEL: zext_sllw_sext_aext:
874 ; RV64I-NEXT: sllw a0, a0, a1
875 ; RV64I-NEXT: slli a0, a0, 32
876 ; RV64I-NEXT: srli a0, a0, 32
879 ; RV64ZBA-LABEL: zext_sllw_sext_aext:
881 ; RV64ZBA-NEXT: sllw a0, a0, a1
882 ; RV64ZBA-NEXT: zext.w a0, a0
888 define zeroext i32 @zext_sllw_sext_sext(i32 signext %a, i32 signext %b) nounwind {
889 ; RV64I-LABEL: zext_sllw_sext_sext:
891 ; RV64I-NEXT: sllw a0, a0, a1
892 ; RV64I-NEXT: slli a0, a0, 32
893 ; RV64I-NEXT: srli a0, a0, 32
896 ; RV64ZBA-LABEL: zext_sllw_sext_sext:
898 ; RV64ZBA-NEXT: sllw a0, a0, a1
899 ; RV64ZBA-NEXT: zext.w a0, a0
905 define zeroext i32 @zext_sllw_sext_zext(i32 signext %a, i32 zeroext %b) nounwind {
906 ; RV64I-LABEL: zext_sllw_sext_zext:
908 ; RV64I-NEXT: sllw a0, a0, a1
909 ; RV64I-NEXT: slli a0, a0, 32
910 ; RV64I-NEXT: srli a0, a0, 32
913 ; RV64ZBA-LABEL: zext_sllw_sext_zext:
915 ; RV64ZBA-NEXT: sllw a0, a0, a1
916 ; RV64ZBA-NEXT: zext.w a0, a0
922 define zeroext i32 @zext_sllw_zext_aext(i32 zeroext %a, i32 %b) nounwind {
923 ; RV64I-LABEL: zext_sllw_zext_aext:
925 ; RV64I-NEXT: sllw a0, a0, a1
926 ; RV64I-NEXT: slli a0, a0, 32
927 ; RV64I-NEXT: srli a0, a0, 32
930 ; RV64ZBA-LABEL: zext_sllw_zext_aext:
932 ; RV64ZBA-NEXT: sllw a0, a0, a1
933 ; RV64ZBA-NEXT: zext.w a0, a0
939 define zeroext i32 @zext_sllw_zext_sext(i32 zeroext %a, i32 signext %b) nounwind {
940 ; RV64I-LABEL: zext_sllw_zext_sext:
942 ; RV64I-NEXT: sllw a0, a0, a1
943 ; RV64I-NEXT: slli a0, a0, 32
944 ; RV64I-NEXT: srli a0, a0, 32
947 ; RV64ZBA-LABEL: zext_sllw_zext_sext:
949 ; RV64ZBA-NEXT: sllw a0, a0, a1
950 ; RV64ZBA-NEXT: zext.w a0, a0
956 define zeroext i32 @zext_sllw_zext_zext(i32 zeroext %a, i32 zeroext %b) nounwind {
957 ; RV64I-LABEL: zext_sllw_zext_zext:
959 ; RV64I-NEXT: sllw a0, a0, a1
960 ; RV64I-NEXT: slli a0, a0, 32
961 ; RV64I-NEXT: srli a0, a0, 32
964 ; RV64ZBA-LABEL: zext_sllw_zext_zext:
966 ; RV64ZBA-NEXT: sllw a0, a0, a1
967 ; RV64ZBA-NEXT: zext.w a0, a0
973 define i32 @aext_srlw_aext_aext(i32 %a, i32 %b) nounwind {
974 ; RV64-LABEL: aext_srlw_aext_aext:
976 ; RV64-NEXT: srlw a0, a0, a1
982 define i32 @aext_srlw_aext_sext(i32 %a, i32 signext %b) nounwind {
983 ; RV64-LABEL: aext_srlw_aext_sext:
985 ; RV64-NEXT: srlw a0, a0, a1
991 define i32 @aext_srlw_aext_zext(i32 %a, i32 zeroext %b) nounwind {
992 ; RV64-LABEL: aext_srlw_aext_zext:
994 ; RV64-NEXT: srlw a0, a0, a1
1000 define i32 @aext_srlw_sext_aext(i32 signext %a, i32 %b) nounwind {
1001 ; RV64-LABEL: aext_srlw_sext_aext:
1003 ; RV64-NEXT: srlw a0, a0, a1
1005 %1 = lshr i32 %a, %b
1009 define i32 @aext_srlw_sext_sext(i32 signext %a, i32 signext %b) nounwind {
1010 ; RV64-LABEL: aext_srlw_sext_sext:
1012 ; RV64-NEXT: srlw a0, a0, a1
1014 %1 = lshr i32 %a, %b
1018 define i32 @aext_srlw_sext_zext(i32 signext %a, i32 zeroext %b) nounwind {
1019 ; RV64-LABEL: aext_srlw_sext_zext:
1021 ; RV64-NEXT: srlw a0, a0, a1
1023 %1 = lshr i32 %a, %b
1027 define i32 @aext_srlw_zext_aext(i32 zeroext %a, i32 %b) nounwind {
1028 ; RV64-LABEL: aext_srlw_zext_aext:
1030 ; RV64-NEXT: srlw a0, a0, a1
1032 %1 = lshr i32 %a, %b
1036 define i32 @aext_srlw_zext_sext(i32 zeroext %a, i32 signext %b) nounwind {
1037 ; RV64-LABEL: aext_srlw_zext_sext:
1039 ; RV64-NEXT: srlw a0, a0, a1
1041 %1 = lshr i32 %a, %b
1045 define i32 @aext_srlw_zext_zext(i32 zeroext %a, i32 zeroext %b) nounwind {
1046 ; RV64-LABEL: aext_srlw_zext_zext:
1048 ; RV64-NEXT: srlw a0, a0, a1
1050 %1 = lshr i32 %a, %b
1054 define signext i32 @sext_srlw_aext_aext(i32 %a, i32 %b) nounwind {
1055 ; RV64-LABEL: sext_srlw_aext_aext:
1057 ; RV64-NEXT: srlw a0, a0, a1
1059 %1 = lshr i32 %a, %b
1063 define signext i32 @sext_srlw_aext_sext(i32 %a, i32 signext %b) nounwind {
1064 ; RV64-LABEL: sext_srlw_aext_sext:
1066 ; RV64-NEXT: srlw a0, a0, a1
1068 %1 = lshr i32 %a, %b
1072 define signext i32 @sext_srlw_aext_zext(i32 %a, i32 zeroext %b) nounwind {
1073 ; RV64-LABEL: sext_srlw_aext_zext:
1075 ; RV64-NEXT: srlw a0, a0, a1
1077 %1 = lshr i32 %a, %b
1081 define signext i32 @sext_srlw_sext_aext(i32 signext %a, i32 %b) nounwind {
1082 ; RV64-LABEL: sext_srlw_sext_aext:
1084 ; RV64-NEXT: srlw a0, a0, a1
1086 %1 = lshr i32 %a, %b
1090 define signext i32 @sext_srlw_sext_sext(i32 signext %a, i32 signext %b) nounwind {
1091 ; RV64-LABEL: sext_srlw_sext_sext:
1093 ; RV64-NEXT: srlw a0, a0, a1
1095 %1 = lshr i32 %a, %b
1099 define signext i32 @sext_srlw_sext_zext(i32 signext %a, i32 zeroext %b) nounwind {
1100 ; RV64-LABEL: sext_srlw_sext_zext:
1102 ; RV64-NEXT: srlw a0, a0, a1
1104 %1 = lshr i32 %a, %b
1108 define signext i32 @sext_srlw_zext_aext(i32 zeroext %a, i32 %b) nounwind {
1109 ; RV64-LABEL: sext_srlw_zext_aext:
1111 ; RV64-NEXT: srlw a0, a0, a1
1113 %1 = lshr i32 %a, %b
1117 define signext i32 @sext_srlw_zext_sext(i32 zeroext %a, i32 signext %b) nounwind {
1118 ; RV64-LABEL: sext_srlw_zext_sext:
1120 ; RV64-NEXT: srlw a0, a0, a1
1122 %1 = lshr i32 %a, %b
1126 define signext i32 @sext_srlw_zext_zext(i32 zeroext %a, i32 zeroext %b) nounwind {
1127 ; RV64-LABEL: sext_srlw_zext_zext:
1129 ; RV64-NEXT: srlw a0, a0, a1
1131 %1 = lshr i32 %a, %b
1135 define zeroext i32 @zext_srlw_aext_aext(i32 %a, i32 %b) nounwind {
1136 ; RV64I-LABEL: zext_srlw_aext_aext:
1138 ; RV64I-NEXT: srlw a0, a0, a1
1139 ; RV64I-NEXT: slli a0, a0, 32
1140 ; RV64I-NEXT: srli a0, a0, 32
1143 ; RV64ZBA-LABEL: zext_srlw_aext_aext:
1145 ; RV64ZBA-NEXT: srlw a0, a0, a1
1146 ; RV64ZBA-NEXT: zext.w a0, a0
1148 %1 = lshr i32 %a, %b
1152 define zeroext i32 @zext_srlw_aext_sext(i32 %a, i32 signext %b) nounwind {
1153 ; RV64I-LABEL: zext_srlw_aext_sext:
1155 ; RV64I-NEXT: srlw a0, a0, a1
1156 ; RV64I-NEXT: slli a0, a0, 32
1157 ; RV64I-NEXT: srli a0, a0, 32
1160 ; RV64ZBA-LABEL: zext_srlw_aext_sext:
1162 ; RV64ZBA-NEXT: srlw a0, a0, a1
1163 ; RV64ZBA-NEXT: zext.w a0, a0
1165 %1 = lshr i32 %a, %b
1169 define zeroext i32 @zext_srlw_aext_zext(i32 %a, i32 zeroext %b) nounwind {
1170 ; RV64I-LABEL: zext_srlw_aext_zext:
1172 ; RV64I-NEXT: srlw a0, a0, a1
1173 ; RV64I-NEXT: slli a0, a0, 32
1174 ; RV64I-NEXT: srli a0, a0, 32
1177 ; RV64ZBA-LABEL: zext_srlw_aext_zext:
1179 ; RV64ZBA-NEXT: srlw a0, a0, a1
1180 ; RV64ZBA-NEXT: zext.w a0, a0
1182 %1 = lshr i32 %a, %b
1186 define zeroext i32 @zext_srlw_sext_aext(i32 signext %a, i32 %b) nounwind {
1187 ; RV64I-LABEL: zext_srlw_sext_aext:
1189 ; RV64I-NEXT: srlw a0, a0, a1
1190 ; RV64I-NEXT: slli a0, a0, 32
1191 ; RV64I-NEXT: srli a0, a0, 32
1194 ; RV64ZBA-LABEL: zext_srlw_sext_aext:
1196 ; RV64ZBA-NEXT: srlw a0, a0, a1
1197 ; RV64ZBA-NEXT: zext.w a0, a0
1199 %1 = lshr i32 %a, %b
1203 define zeroext i32 @zext_srlw_sext_sext(i32 signext %a, i32 signext %b) nounwind {
1204 ; RV64I-LABEL: zext_srlw_sext_sext:
1206 ; RV64I-NEXT: srlw a0, a0, a1
1207 ; RV64I-NEXT: slli a0, a0, 32
1208 ; RV64I-NEXT: srli a0, a0, 32
1211 ; RV64ZBA-LABEL: zext_srlw_sext_sext:
1213 ; RV64ZBA-NEXT: srlw a0, a0, a1
1214 ; RV64ZBA-NEXT: zext.w a0, a0
1216 %1 = lshr i32 %a, %b
1220 define zeroext i32 @zext_srlw_sext_zext(i32 signext %a, i32 zeroext %b) nounwind {
1221 ; RV64I-LABEL: zext_srlw_sext_zext:
1223 ; RV64I-NEXT: srlw a0, a0, a1
1224 ; RV64I-NEXT: slli a0, a0, 32
1225 ; RV64I-NEXT: srli a0, a0, 32
1228 ; RV64ZBA-LABEL: zext_srlw_sext_zext:
1230 ; RV64ZBA-NEXT: srlw a0, a0, a1
1231 ; RV64ZBA-NEXT: zext.w a0, a0
1233 %1 = lshr i32 %a, %b
1237 define zeroext i32 @zext_srlw_zext_aext(i32 zeroext %a, i32 %b) nounwind {
1238 ; RV64I-LABEL: zext_srlw_zext_aext:
1240 ; RV64I-NEXT: srlw a0, a0, a1
1241 ; RV64I-NEXT: slli a0, a0, 32
1242 ; RV64I-NEXT: srli a0, a0, 32
1245 ; RV64ZBA-LABEL: zext_srlw_zext_aext:
1247 ; RV64ZBA-NEXT: srlw a0, a0, a1
1248 ; RV64ZBA-NEXT: zext.w a0, a0
1250 %1 = lshr i32 %a, %b
1254 define zeroext i32 @zext_srlw_zext_sext(i32 zeroext %a, i32 signext %b) nounwind {
1255 ; RV64I-LABEL: zext_srlw_zext_sext:
1257 ; RV64I-NEXT: srlw a0, a0, a1
1258 ; RV64I-NEXT: slli a0, a0, 32
1259 ; RV64I-NEXT: srli a0, a0, 32
1262 ; RV64ZBA-LABEL: zext_srlw_zext_sext:
1264 ; RV64ZBA-NEXT: srlw a0, a0, a1
1265 ; RV64ZBA-NEXT: zext.w a0, a0
1267 %1 = lshr i32 %a, %b
1271 define zeroext i32 @zext_srlw_zext_zext(i32 zeroext %a, i32 zeroext %b) nounwind {
1272 ; RV64I-LABEL: zext_srlw_zext_zext:
1274 ; RV64I-NEXT: srlw a0, a0, a1
1275 ; RV64I-NEXT: slli a0, a0, 32
1276 ; RV64I-NEXT: srli a0, a0, 32
1279 ; RV64ZBA-LABEL: zext_srlw_zext_zext:
1281 ; RV64ZBA-NEXT: srlw a0, a0, a1
1282 ; RV64ZBA-NEXT: zext.w a0, a0
1284 %1 = lshr i32 %a, %b
1288 define i32 @aext_sraw_aext_aext(i32 %a, i32 %b) nounwind {
1289 ; RV64-LABEL: aext_sraw_aext_aext:
1291 ; RV64-NEXT: sraw a0, a0, a1
1293 %1 = ashr i32 %a, %b
1297 define i32 @aext_sraw_aext_sext(i32 %a, i32 signext %b) nounwind {
1298 ; RV64-LABEL: aext_sraw_aext_sext:
1300 ; RV64-NEXT: sraw a0, a0, a1
1302 %1 = ashr i32 %a, %b
1306 define i32 @aext_sraw_aext_zext(i32 %a, i32 zeroext %b) nounwind {
1307 ; RV64-LABEL: aext_sraw_aext_zext:
1309 ; RV64-NEXT: sraw a0, a0, a1
1311 %1 = ashr i32 %a, %b
1315 define i32 @aext_sraw_sext_aext(i32 signext %a, i32 %b) nounwind {
1316 ; RV64-LABEL: aext_sraw_sext_aext:
1318 ; RV64-NEXT: sraw a0, a0, a1
1320 %1 = ashr i32 %a, %b
1324 define i32 @aext_sraw_sext_sext(i32 signext %a, i32 signext %b) nounwind {
1325 ; RV64-LABEL: aext_sraw_sext_sext:
1327 ; RV64-NEXT: sraw a0, a0, a1
1329 %1 = ashr i32 %a, %b
1333 define i32 @aext_sraw_sext_zext(i32 signext %a, i32 zeroext %b) nounwind {
1334 ; RV64-LABEL: aext_sraw_sext_zext:
1336 ; RV64-NEXT: sraw a0, a0, a1
1338 %1 = ashr i32 %a, %b
1342 define i32 @aext_sraw_zext_aext(i32 zeroext %a, i32 %b) nounwind {
1343 ; RV64-LABEL: aext_sraw_zext_aext:
1345 ; RV64-NEXT: sraw a0, a0, a1
1347 %1 = ashr i32 %a, %b
1351 define i32 @aext_sraw_zext_sext(i32 zeroext %a, i32 signext %b) nounwind {
1352 ; RV64-LABEL: aext_sraw_zext_sext:
1354 ; RV64-NEXT: sraw a0, a0, a1
1356 %1 = ashr i32 %a, %b
1360 define i32 @aext_sraw_zext_zext(i32 zeroext %a, i32 zeroext %b) nounwind {
1361 ; RV64-LABEL: aext_sraw_zext_zext:
1363 ; RV64-NEXT: sraw a0, a0, a1
1365 %1 = ashr i32 %a, %b
1369 define signext i32 @sext_sraw_aext_aext(i32 %a, i32 %b) nounwind {
1370 ; RV64-LABEL: sext_sraw_aext_aext:
1372 ; RV64-NEXT: sraw a0, a0, a1
1374 %1 = ashr i32 %a, %b
1378 define signext i32 @sext_sraw_aext_sext(i32 %a, i32 signext %b) nounwind {
1379 ; RV64-LABEL: sext_sraw_aext_sext:
1381 ; RV64-NEXT: sraw a0, a0, a1
1383 %1 = ashr i32 %a, %b
1387 define signext i32 @sext_sraw_aext_zext(i32 %a, i32 zeroext %b) nounwind {
1388 ; RV64-LABEL: sext_sraw_aext_zext:
1390 ; RV64-NEXT: sraw a0, a0, a1
1392 %1 = ashr i32 %a, %b
1396 define signext i32 @sext_sraw_sext_aext(i32 signext %a, i32 %b) nounwind {
1397 ; RV64-LABEL: sext_sraw_sext_aext:
1399 ; RV64-NEXT: sraw a0, a0, a1
1401 %1 = ashr i32 %a, %b
1405 define signext i32 @sext_sraw_sext_sext(i32 signext %a, i32 signext %b) nounwind {
1406 ; RV64-LABEL: sext_sraw_sext_sext:
1408 ; RV64-NEXT: sraw a0, a0, a1
1410 %1 = ashr i32 %a, %b
1414 define signext i32 @sext_sraw_sext_zext(i32 signext %a, i32 zeroext %b) nounwind {
1415 ; RV64-LABEL: sext_sraw_sext_zext:
1417 ; RV64-NEXT: sraw a0, a0, a1
1419 %1 = ashr i32 %a, %b
1423 define signext i32 @sext_sraw_zext_aext(i32 zeroext %a, i32 %b) nounwind {
1424 ; RV64-LABEL: sext_sraw_zext_aext:
1426 ; RV64-NEXT: sraw a0, a0, a1
1428 %1 = ashr i32 %a, %b
1432 define signext i32 @sext_sraw_zext_sext(i32 zeroext %a, i32 signext %b) nounwind {
1433 ; RV64-LABEL: sext_sraw_zext_sext:
1435 ; RV64-NEXT: sraw a0, a0, a1
1437 %1 = ashr i32 %a, %b
1441 define signext i32 @sext_sraw_zext_zext(i32 zeroext %a, i32 zeroext %b) nounwind {
1442 ; RV64-LABEL: sext_sraw_zext_zext:
1444 ; RV64-NEXT: sraw a0, a0, a1
1446 %1 = ashr i32 %a, %b
1450 define zeroext i32 @zext_sraw_aext_aext(i32 %a, i32 %b) nounwind {
1451 ; RV64I-LABEL: zext_sraw_aext_aext:
1453 ; RV64I-NEXT: sraw a0, a0, a1
1454 ; RV64I-NEXT: slli a0, a0, 32
1455 ; RV64I-NEXT: srli a0, a0, 32
1458 ; RV64ZBA-LABEL: zext_sraw_aext_aext:
1460 ; RV64ZBA-NEXT: sraw a0, a0, a1
1461 ; RV64ZBA-NEXT: zext.w a0, a0
1463 %1 = ashr i32 %a, %b
1467 define zeroext i32 @zext_sraw_aext_sext(i32 %a, i32 signext %b) nounwind {
1468 ; RV64I-LABEL: zext_sraw_aext_sext:
1470 ; RV64I-NEXT: sraw a0, a0, a1
1471 ; RV64I-NEXT: slli a0, a0, 32
1472 ; RV64I-NEXT: srli a0, a0, 32
1475 ; RV64ZBA-LABEL: zext_sraw_aext_sext:
1477 ; RV64ZBA-NEXT: sraw a0, a0, a1
1478 ; RV64ZBA-NEXT: zext.w a0, a0
1480 %1 = ashr i32 %a, %b
1484 define zeroext i32 @zext_sraw_aext_zext(i32 %a, i32 zeroext %b) nounwind {
1485 ; RV64I-LABEL: zext_sraw_aext_zext:
1487 ; RV64I-NEXT: sraw a0, a0, a1
1488 ; RV64I-NEXT: slli a0, a0, 32
1489 ; RV64I-NEXT: srli a0, a0, 32
1492 ; RV64ZBA-LABEL: zext_sraw_aext_zext:
1494 ; RV64ZBA-NEXT: sraw a0, a0, a1
1495 ; RV64ZBA-NEXT: zext.w a0, a0
1497 %1 = ashr i32 %a, %b
1501 define zeroext i32 @zext_sraw_sext_aext(i32 signext %a, i32 %b) nounwind {
1502 ; RV64I-LABEL: zext_sraw_sext_aext:
1504 ; RV64I-NEXT: sraw a0, a0, a1
1505 ; RV64I-NEXT: slli a0, a0, 32
1506 ; RV64I-NEXT: srli a0, a0, 32
1509 ; RV64ZBA-LABEL: zext_sraw_sext_aext:
1511 ; RV64ZBA-NEXT: sraw a0, a0, a1
1512 ; RV64ZBA-NEXT: zext.w a0, a0
1514 %1 = ashr i32 %a, %b
1518 define zeroext i32 @zext_sraw_sext_sext(i32 signext %a, i32 signext %b) nounwind {
1519 ; RV64I-LABEL: zext_sraw_sext_sext:
1521 ; RV64I-NEXT: sraw a0, a0, a1
1522 ; RV64I-NEXT: slli a0, a0, 32
1523 ; RV64I-NEXT: srli a0, a0, 32
1526 ; RV64ZBA-LABEL: zext_sraw_sext_sext:
1528 ; RV64ZBA-NEXT: sraw a0, a0, a1
1529 ; RV64ZBA-NEXT: zext.w a0, a0
1531 %1 = ashr i32 %a, %b
1535 define zeroext i32 @zext_sraw_sext_zext(i32 signext %a, i32 zeroext %b) nounwind {
1536 ; RV64I-LABEL: zext_sraw_sext_zext:
1538 ; RV64I-NEXT: sraw a0, a0, a1
1539 ; RV64I-NEXT: slli a0, a0, 32
1540 ; RV64I-NEXT: srli a0, a0, 32
1543 ; RV64ZBA-LABEL: zext_sraw_sext_zext:
1545 ; RV64ZBA-NEXT: sraw a0, a0, a1
1546 ; RV64ZBA-NEXT: zext.w a0, a0
1548 %1 = ashr i32 %a, %b
1552 define zeroext i32 @zext_sraw_zext_aext(i32 zeroext %a, i32 %b) nounwind {
1553 ; RV64I-LABEL: zext_sraw_zext_aext:
1555 ; RV64I-NEXT: sraw a0, a0, a1
1556 ; RV64I-NEXT: slli a0, a0, 32
1557 ; RV64I-NEXT: srli a0, a0, 32
1560 ; RV64ZBA-LABEL: zext_sraw_zext_aext:
1562 ; RV64ZBA-NEXT: sraw a0, a0, a1
1563 ; RV64ZBA-NEXT: zext.w a0, a0
1565 %1 = ashr i32 %a, %b
1569 define zeroext i32 @zext_sraw_zext_sext(i32 zeroext %a, i32 signext %b) nounwind {
1570 ; RV64I-LABEL: zext_sraw_zext_sext:
1572 ; RV64I-NEXT: sraw a0, a0, a1
1573 ; RV64I-NEXT: slli a0, a0, 32
1574 ; RV64I-NEXT: srli a0, a0, 32
1577 ; RV64ZBA-LABEL: zext_sraw_zext_sext:
1579 ; RV64ZBA-NEXT: sraw a0, a0, a1
1580 ; RV64ZBA-NEXT: zext.w a0, a0
1582 %1 = ashr i32 %a, %b
1586 define zeroext i32 @zext_sraw_zext_zext(i32 zeroext %a, i32 zeroext %b) nounwind {
1587 ; RV64I-LABEL: zext_sraw_zext_zext:
1589 ; RV64I-NEXT: sraw a0, a0, a1
1590 ; RV64I-NEXT: slli a0, a0, 32
1591 ; RV64I-NEXT: srli a0, a0, 32
1594 ; RV64ZBA-LABEL: zext_sraw_zext_zext:
1596 ; RV64ZBA-NEXT: sraw a0, a0, a1
1597 ; RV64ZBA-NEXT: zext.w a0, a0
1599 %1 = ashr i32 %a, %b
1603 ; addiw should be selected when there is a signext result.
1605 define i32 @aext_addiw_aext(i32 %a) nounwind {
1606 ; RV64-LABEL: aext_addiw_aext:
1608 ; RV64-NEXT: addiw a0, a0, 1
1614 define i32 @aext_addiw_sext(i32 signext %a) nounwind {
1615 ; RV64-LABEL: aext_addiw_sext:
1617 ; RV64-NEXT: addiw a0, a0, 2
1623 define i32 @aext_addiw_zext(i32 zeroext %a) nounwind {
1624 ; RV64-LABEL: aext_addiw_zext:
1626 ; RV64-NEXT: addiw a0, a0, 3
1632 define signext i32 @sext_addiw_aext(i32 %a) nounwind {
1633 ; RV64-LABEL: sext_addiw_aext:
1635 ; RV64-NEXT: addiw a0, a0, 4
1641 define signext i32 @sext_addiw_sext(i32 signext %a) nounwind {
1642 ; RV64-LABEL: sext_addiw_sext:
1644 ; RV64-NEXT: addiw a0, a0, 5
1650 define signext i32 @sext_addiw_zext(i32 zeroext %a) nounwind {
1651 ; RV64-LABEL: sext_addiw_zext:
1653 ; RV64-NEXT: addiw a0, a0, 6
1659 define zeroext i32 @zext_addiw_aext(i32 %a) nounwind {
1660 ; RV64I-LABEL: zext_addiw_aext:
1662 ; RV64I-NEXT: addi a0, a0, 7
1663 ; RV64I-NEXT: slli a0, a0, 32
1664 ; RV64I-NEXT: srli a0, a0, 32
1667 ; RV64ZBA-LABEL: zext_addiw_aext:
1669 ; RV64ZBA-NEXT: addi a0, a0, 7
1670 ; RV64ZBA-NEXT: zext.w a0, a0
1676 define zeroext i32 @zext_addiw_sext(i32 signext %a) nounwind {
1677 ; RV64I-LABEL: zext_addiw_sext:
1679 ; RV64I-NEXT: addi a0, a0, 8
1680 ; RV64I-NEXT: slli a0, a0, 32
1681 ; RV64I-NEXT: srli a0, a0, 32
1684 ; RV64ZBA-LABEL: zext_addiw_sext:
1686 ; RV64ZBA-NEXT: addi a0, a0, 8
1687 ; RV64ZBA-NEXT: zext.w a0, a0
1693 define zeroext i32 @zext_addiw_zext(i32 zeroext %a) nounwind {
1694 ; RV64I-LABEL: zext_addiw_zext:
1696 ; RV64I-NEXT: addi a0, a0, 9
1697 ; RV64I-NEXT: slli a0, a0, 32
1698 ; RV64I-NEXT: srli a0, a0, 32
1701 ; RV64ZBA-LABEL: zext_addiw_zext:
1703 ; RV64ZBA-NEXT: addi a0, a0, 9
1704 ; RV64ZBA-NEXT: zext.w a0, a0
1710 ; slliw should be selected whenever the return is signext.
1712 define i32 @aext_slliw_aext(i32 %a) nounwind {
1713 ; RV64-LABEL: aext_slliw_aext:
1715 ; RV64-NEXT: slliw a0, a0, 1
1721 define i32 @aext_slliw_sext(i32 signext %a) nounwind {
1722 ; RV64-LABEL: aext_slliw_sext:
1724 ; RV64-NEXT: slliw a0, a0, 2
1730 define i32 @aext_slliw_zext(i32 zeroext %a) nounwind {
1731 ; RV64-LABEL: aext_slliw_zext:
1733 ; RV64-NEXT: slliw a0, a0, 3
1739 define signext i32 @sext_slliw_aext(i32 %a) nounwind {
1740 ; RV64-LABEL: sext_slliw_aext:
1742 ; RV64-NEXT: slliw a0, a0, 4
1748 define signext i32 @sext_slliw_sext(i32 signext %a) nounwind {
1749 ; RV64-LABEL: sext_slliw_sext:
1751 ; RV64-NEXT: slliw a0, a0, 5
1757 define signext i32 @sext_slliw_zext(i32 zeroext %a) nounwind {
1758 ; RV64-LABEL: sext_slliw_zext:
1760 ; RV64-NEXT: slliw a0, a0, 6
1766 define zeroext i32 @zext_slliw_aext(i32 %a) nounwind {
1767 ; RV64-LABEL: zext_slliw_aext:
1769 ; RV64-NEXT: slli a0, a0, 39
1770 ; RV64-NEXT: srli a0, a0, 32
1776 define zeroext i32 @zext_slliw_sext(i32 signext %a) nounwind {
1777 ; RV64-LABEL: zext_slliw_sext:
1779 ; RV64-NEXT: slli a0, a0, 40
1780 ; RV64-NEXT: srli a0, a0, 32
1786 define zeroext i32 @zext_slliw_zext(i32 zeroext %a) nounwind {
1787 ; RV64-LABEL: zext_slliw_zext:
1789 ; RV64-NEXT: slli a0, a0, 41
1790 ; RV64-NEXT: srli a0, a0, 32
1796 ; srliw should be selected unless the first operand is zeroext, when srli is
1799 define i32 @aext_srliw_aext(i32 %a) nounwind {
1800 ; RV64-LABEL: aext_srliw_aext:
1802 ; RV64-NEXT: srliw a0, a0, 1
1808 define i32 @aext_srliw_sext(i32 signext %a) nounwind {
1809 ; RV64-LABEL: aext_srliw_sext:
1811 ; RV64-NEXT: srliw a0, a0, 2
1817 define i32 @aext_srliw_zext(i32 zeroext %a) nounwind {
1818 ; RV64-LABEL: aext_srliw_zext:
1820 ; RV64-NEXT: srli a0, a0, 3
1826 define signext i32 @sext_srliw_aext(i32 %a) nounwind {
1827 ; RV64-LABEL: sext_srliw_aext:
1829 ; RV64-NEXT: srliw a0, a0, 4
1835 define signext i32 @sext_srliw_sext(i32 signext %a) nounwind {
1836 ; RV64-LABEL: sext_srliw_sext:
1838 ; RV64-NEXT: srliw a0, a0, 5
1844 define signext i32 @sext_srliw_zext(i32 zeroext %a) nounwind {
1845 ; RV64-LABEL: sext_srliw_zext:
1847 ; RV64-NEXT: srli a0, a0, 6
1853 define zeroext i32 @zext_srliw_aext(i32 %a) nounwind {
1854 ; RV64-LABEL: zext_srliw_aext:
1856 ; RV64-NEXT: srliw a0, a0, 7
1862 define zeroext i32 @zext_srliw_sext(i32 signext %a) nounwind {
1863 ; RV64-LABEL: zext_srliw_sext:
1865 ; RV64-NEXT: srliw a0, a0, 8
1871 define zeroext i32 @zext_srliw_zext(i32 zeroext %a) nounwind {
1872 ; RV64-LABEL: zext_srliw_zext:
1874 ; RV64-NEXT: srli a0, a0, 9
1880 ; srai is equivalent to sraiw if the first operand is sign-extended.
1882 define i32 @aext_sraiw_aext(i32 %a) nounwind {
1883 ; RV64-LABEL: aext_sraiw_aext:
1885 ; RV64-NEXT: sraiw a0, a0, 1
1891 define i32 @aext_sraiw_sext(i32 signext %a) nounwind {
1892 ; RV64-LABEL: aext_sraiw_sext:
1894 ; RV64-NEXT: srai a0, a0, 2
1900 define i32 @aext_sraiw_zext(i32 zeroext %a) nounwind {
1901 ; RV64-LABEL: aext_sraiw_zext:
1903 ; RV64-NEXT: sraiw a0, a0, 3
1909 define signext i32 @sext_sraiw_aext(i32 %a) nounwind {
1910 ; RV64-LABEL: sext_sraiw_aext:
1912 ; RV64-NEXT: sraiw a0, a0, 4
1918 define signext i32 @sext_sraiw_sext(i32 signext %a) nounwind {
1919 ; RV64-LABEL: sext_sraiw_sext:
1921 ; RV64-NEXT: srai a0, a0, 5
1927 define signext i32 @sext_sraiw_zext(i32 zeroext %a) nounwind {
1928 ; RV64-LABEL: sext_sraiw_zext:
1930 ; RV64-NEXT: sraiw a0, a0, 6
1936 define zeroext i32 @zext_sraiw_aext(i32 %a) nounwind {
1937 ; RV64I-LABEL: zext_sraiw_aext:
1939 ; RV64I-NEXT: sext.w a0, a0
1940 ; RV64I-NEXT: slli a0, a0, 25
1941 ; RV64I-NEXT: srli a0, a0, 32
1944 ; RV64ZBA-LABEL: zext_sraiw_aext:
1946 ; RV64ZBA-NEXT: sraiw a0, a0, 7
1947 ; RV64ZBA-NEXT: zext.w a0, a0
1953 define zeroext i32 @zext_sraiw_sext(i32 signext %a) nounwind {
1954 ; RV64-LABEL: zext_sraiw_sext:
1956 ; RV64-NEXT: slli a0, a0, 24
1957 ; RV64-NEXT: srli a0, a0, 32
1963 define zeroext i32 @zext_sraiw_zext(i32 zeroext %a) nounwind {
1964 ; RV64I-LABEL: zext_sraiw_zext:
1966 ; RV64I-NEXT: sext.w a0, a0
1967 ; RV64I-NEXT: slli a0, a0, 23
1968 ; RV64I-NEXT: srli a0, a0, 32
1971 ; RV64ZBA-LABEL: zext_sraiw_zext:
1973 ; RV64ZBA-NEXT: sraiw a0, a0, 9
1974 ; RV64ZBA-NEXT: zext.w a0, a0