| 1 |
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py |
| 2 |
# RUN: llc -mtriple=riscv32 -run-pass=legalizer %s -o - | FileCheck %s --check-prefixes=CHECK,RV32I |
| 3 |
# RUN: llc -mtriple=riscv32 -mattr=+zbb -run-pass=legalizer %s -o - \ |
| 4 |
# RUN: | FileCheck %s --check-prefixes=CHECK,RV32ZBB |
| 5 |
|
| 6 |
--- |
| 7 |
name: smin_i8 |
| 8 |
body: | |
| 9 |
bb.0.entry: |
| 10 |
; RV32I-LABEL: name: smin_i8 |
| 11 |
; RV32I: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 |
| 12 |
; RV32I-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 |
| 13 |
; RV32I-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 24 |
| 14 |
; RV32I-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[C]](s32) |
| 15 |
; RV32I-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32) |
| 16 |
; RV32I-NEXT: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[COPY1]], [[C]](s32) |
| 17 |
; RV32I-NEXT: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[SHL1]], [[C]](s32) |
| 18 |
; RV32I-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(slt), [[ASHR]](s32), [[ASHR1]] |
| 19 |
; RV32I-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s32), [[COPY]], [[COPY1]] |
| 20 |
; RV32I-NEXT: [[SHL2:%[0-9]+]]:_(s32) = G_SHL [[SELECT]], [[C]](s32) |
| 21 |
; RV32I-NEXT: [[ASHR2:%[0-9]+]]:_(s32) = G_ASHR [[SHL2]], [[C]](s32) |
| 22 |
; RV32I-NEXT: $x10 = COPY [[ASHR2]](s32) |
| 23 |
; RV32I-NEXT: PseudoRET implicit $x10 |
| 24 |
; |
| 25 |
; RV32ZBB-LABEL: name: smin_i8 |
| 26 |
; RV32ZBB: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 |
| 27 |
; RV32ZBB-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 |
| 28 |
; RV32ZBB-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY]], 8 |
| 29 |
; RV32ZBB-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY1]], 8 |
| 30 |
; RV32ZBB-NEXT: [[SMIN:%[0-9]+]]:_(s32) = G_SMIN [[SEXT_INREG]], [[SEXT_INREG1]] |
| 31 |
; RV32ZBB-NEXT: $x10 = COPY [[SMIN]](s32) |
| 32 |
; RV32ZBB-NEXT: PseudoRET implicit $x10 |
| 33 |
%0:_(s32) = COPY $x10 |
| 34 |
%1:_(s32) = COPY $x11 |
| 35 |
%2:_(s8) = G_TRUNC %0(s32) |
| 36 |
%3:_(s8) = G_TRUNC %1(s32) |
| 37 |
%4:_(s8) = G_SMIN %2, %3 |
| 38 |
%5:_(s32) = G_SEXT %4(s8) |
| 39 |
$x10 = COPY %5(s32) |
| 40 |
PseudoRET implicit $x10 |
| 41 |
... |
| 42 |
|
| 43 |
--- |
| 44 |
name: smin_i16 |
| 45 |
body: | |
| 46 |
bb.0.entry: |
| 47 |
; RV32I-LABEL: name: smin_i16 |
| 48 |
; RV32I: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 |
| 49 |
; RV32I-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 |
| 50 |
; RV32I-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16 |
| 51 |
; RV32I-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[C]](s32) |
| 52 |
; RV32I-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32) |
| 53 |
; RV32I-NEXT: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[COPY1]], [[C]](s32) |
| 54 |
; RV32I-NEXT: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[SHL1]], [[C]](s32) |
| 55 |
; RV32I-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(slt), [[ASHR]](s32), [[ASHR1]] |
| 56 |
; RV32I-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s32), [[COPY]], [[COPY1]] |
| 57 |
; RV32I-NEXT: [[SHL2:%[0-9]+]]:_(s32) = G_SHL [[SELECT]], [[C]](s32) |
| 58 |
; RV32I-NEXT: [[ASHR2:%[0-9]+]]:_(s32) = G_ASHR [[SHL2]], [[C]](s32) |
| 59 |
; RV32I-NEXT: $x10 = COPY [[ASHR2]](s32) |
| 60 |
; RV32I-NEXT: PseudoRET implicit $x10 |
| 61 |
; |
| 62 |
; RV32ZBB-LABEL: name: smin_i16 |
| 63 |
; RV32ZBB: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 |
| 64 |
; RV32ZBB-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 |
| 65 |
; RV32ZBB-NEXT: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY]], 16 |
| 66 |
; RV32ZBB-NEXT: [[SEXT_INREG1:%[0-9]+]]:_(s32) = G_SEXT_INREG [[COPY1]], 16 |
| 67 |
; RV32ZBB-NEXT: [[SMIN:%[0-9]+]]:_(s32) = G_SMIN [[SEXT_INREG]], [[SEXT_INREG1]] |
| 68 |
; RV32ZBB-NEXT: $x10 = COPY [[SMIN]](s32) |
| 69 |
; RV32ZBB-NEXT: PseudoRET implicit $x10 |
| 70 |
%0:_(s32) = COPY $x10 |
| 71 |
%1:_(s32) = COPY $x11 |
| 72 |
%2:_(s16) = G_TRUNC %0(s32) |
| 73 |
%3:_(s16) = G_TRUNC %1(s32) |
| 74 |
%4:_(s16) = G_SMIN %2, %3 |
| 75 |
%5:_(s32) = G_SEXT %4(s16) |
| 76 |
$x10 = COPY %5(s32) |
| 77 |
PseudoRET implicit $x10 |
| 78 |
... |
| 79 |
|
| 80 |
--- |
| 81 |
name: smin_i32 |
| 82 |
body: | |
| 83 |
bb.0.entry: |
| 84 |
; RV32I-LABEL: name: smin_i32 |
| 85 |
; RV32I: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 |
| 86 |
; RV32I-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 |
| 87 |
; RV32I-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(slt), [[COPY]](s32), [[COPY1]] |
| 88 |
; RV32I-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s32), [[COPY]], [[COPY1]] |
| 89 |
; RV32I-NEXT: $x10 = COPY [[SELECT]](s32) |
| 90 |
; RV32I-NEXT: PseudoRET implicit $x10 |
| 91 |
; |
| 92 |
; RV32ZBB-LABEL: name: smin_i32 |
| 93 |
; RV32ZBB: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 |
| 94 |
; RV32ZBB-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 |
| 95 |
; RV32ZBB-NEXT: [[SMIN:%[0-9]+]]:_(s32) = G_SMIN [[COPY]], [[COPY1]] |
| 96 |
; RV32ZBB-NEXT: $x10 = COPY [[SMIN]](s32) |
| 97 |
; RV32ZBB-NEXT: PseudoRET implicit $x10 |
| 98 |
%0:_(s32) = COPY $x10 |
| 99 |
%1:_(s32) = COPY $x11 |
| 100 |
%2:_(s32) = G_SMIN %0, %1 |
| 101 |
$x10 = COPY %2(s32) |
| 102 |
PseudoRET implicit $x10 |
| 103 |
... |
| 104 |
|
| 105 |
--- |
| 106 |
name: smin_i64 |
| 107 |
body: | |
| 108 |
bb.0.entry: |
| 109 |
; CHECK-LABEL: name: smin_i64 |
| 110 |
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 |
| 111 |
; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 |
| 112 |
; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12 |
| 113 |
; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY $x13 |
| 114 |
; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[COPY]](s32), [[COPY2]] |
| 115 |
; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(slt), [[COPY1]](s32), [[COPY3]] |
| 116 |
; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[COPY1]](s32), [[COPY3]] |
| 117 |
; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP2]](s32), [[ICMP]], [[ICMP1]] |
| 118 |
; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[SELECT]](s32), [[COPY]], [[COPY2]] |
| 119 |
; CHECK-NEXT: $x10 = COPY [[SELECT1]](s32) |
| 120 |
; CHECK-NEXT: PseudoRET implicit $x10 |
| 121 |
%0:_(s32) = COPY $x10 |
| 122 |
%1:_(s32) = COPY $x11 |
| 123 |
%2:_(s32) = COPY $x12 |
| 124 |
%3:_(s32) = COPY $x13 |
| 125 |
%4:_(s64) = G_MERGE_VALUES %0(s32), %1(s32) |
| 126 |
%5:_(s64) = G_MERGE_VALUES %2(s32), %3(s32) |
| 127 |
%6:_(s64) = G_SMIN %4, %5 |
| 128 |
%7:_(s32) = G_TRUNC %6(s64) |
| 129 |
$x10 = COPY %7(s32) |
| 130 |
PseudoRET implicit $x10 |
| 131 |
... |