| 1 |
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py |
| 2 |
# RUN: llc -mtriple=riscv32 -run-pass=legalizer %s -o - \ |
| 3 |
# RUN: | FileCheck %s |
| 4 |
--- |
| 5 |
name: select_i7 |
| 6 |
body: | |
| 7 |
bb.0.entry: |
| 8 |
; CHECK-LABEL: name: select_i7 |
| 9 |
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 |
| 10 |
; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 |
| 11 |
; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12 |
| 12 |
; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 |
| 13 |
; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]] |
| 14 |
; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[COPY]], [[COPY1]] |
| 15 |
; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) |
| 16 |
; CHECK-NEXT: PseudoRET implicit $x10 |
| 17 |
%0:_(s32) = COPY $x10 |
| 18 |
%1:_(s32) = COPY $x11 |
| 19 |
%2:_(s32) = COPY $x12 |
| 20 |
%3:_(s7) = G_TRUNC %0(s32) |
| 21 |
%4:_(s7) = G_TRUNC %1(s32) |
| 22 |
%5:_(s1) = G_TRUNC %2(s32) |
| 23 |
%6:_(s7) = G_SELECT %5(s1), %3(s7), %4 |
| 24 |
%7:_(s32) = G_ANYEXT %6(s7) |
| 25 |
$x10 = COPY %7(s32) |
| 26 |
PseudoRET implicit $x10 |
| 27 |
|
| 28 |
... |
| 29 |
--- |
| 30 |
name: select_i8 |
| 31 |
body: | |
| 32 |
bb.0.entry: |
| 33 |
; CHECK-LABEL: name: select_i8 |
| 34 |
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 |
| 35 |
; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 |
| 36 |
; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12 |
| 37 |
; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 |
| 38 |
; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]] |
| 39 |
; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[COPY]], [[COPY1]] |
| 40 |
; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) |
| 41 |
; CHECK-NEXT: PseudoRET implicit $x10 |
| 42 |
%0:_(s32) = COPY $x10 |
| 43 |
%1:_(s32) = COPY $x11 |
| 44 |
%2:_(s32) = COPY $x12 |
| 45 |
%3:_(s8) = G_TRUNC %0(s32) |
| 46 |
%4:_(s8) = G_TRUNC %1(s32) |
| 47 |
%5:_(s1) = G_TRUNC %2(s32) |
| 48 |
%6:_(s8) = G_SELECT %5(s1), %3(s8), %4 |
| 49 |
%7:_(s32) = G_ANYEXT %6(s8) |
| 50 |
$x10 = COPY %7(s32) |
| 51 |
PseudoRET implicit $x10 |
| 52 |
|
| 53 |
... |
| 54 |
--- |
| 55 |
name: select_i16 |
| 56 |
body: | |
| 57 |
bb.0.entry: |
| 58 |
; CHECK-LABEL: name: select_i16 |
| 59 |
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 |
| 60 |
; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 |
| 61 |
; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12 |
| 62 |
; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 |
| 63 |
; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]] |
| 64 |
; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[COPY]], [[COPY1]] |
| 65 |
; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) |
| 66 |
; CHECK-NEXT: PseudoRET implicit $x10 |
| 67 |
%0:_(s32) = COPY $x10 |
| 68 |
%1:_(s32) = COPY $x11 |
| 69 |
%2:_(s32) = COPY $x12 |
| 70 |
%3:_(s16) = G_TRUNC %0(s32) |
| 71 |
%4:_(s16) = G_TRUNC %1(s32) |
| 72 |
%5:_(s1) = G_TRUNC %2(s32) |
| 73 |
%6:_(s16) = G_SELECT %5(s1), %3(s16), %4 |
| 74 |
%7:_(s32) = G_ANYEXT %6(s16) |
| 75 |
$x10 = COPY %7(s32) |
| 76 |
PseudoRET implicit $x10 |
| 77 |
|
| 78 |
... |
| 79 |
--- |
| 80 |
name: select_i32 |
| 81 |
body: | |
| 82 |
bb.0.entry: |
| 83 |
; CHECK-LABEL: name: select_i32 |
| 84 |
; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10 |
| 85 |
; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11 |
| 86 |
; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12 |
| 87 |
; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 |
| 88 |
; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]] |
| 89 |
; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[COPY]], [[COPY1]] |
| 90 |
; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) |
| 91 |
; CHECK-NEXT: PseudoRET implicit $x10 |
| 92 |
%0:_(s32) = COPY $x10 |
| 93 |
%1:_(s32) = COPY $x11 |
| 94 |
%2:_(s32) = COPY $x12 |
| 95 |
%3:_(s1) = G_TRUNC %2(s32) |
| 96 |
%4:_(s32) = G_SELECT %3(s1), %0(s32), %1(s32) |
| 97 |
$x10 = COPY %4(s32) |
| 98 |
PseudoRET implicit $x10 |
| 99 |
|
| 100 |
... |
| 101 |
--- |
| 102 |
name: select_i48 |
| 103 |
body: | |
| 104 |
bb.0.entry: |
| 105 |
; CHECK-LABEL: name: select_i48 |
| 106 |
; CHECK: %xhi:_(s32) = COPY $x10 |
| 107 |
; CHECK-NEXT: %xlo:_(s32) = COPY $x11 |
| 108 |
; CHECK-NEXT: %yhi:_(s32) = COPY $x12 |
| 109 |
; CHECK-NEXT: %ylo:_(s32) = COPY $x13 |
| 110 |
; CHECK-NEXT: %c0:_(s32) = COPY $x14 |
| 111 |
; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 |
| 112 |
; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND %c0, [[C]] |
| 113 |
; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), %xhi, %yhi |
| 114 |
; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), %xlo, %ylo |
| 115 |
; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) |
| 116 |
; CHECK-NEXT: $x11 = COPY [[SELECT1]](s32) |
| 117 |
; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11 |
| 118 |
%xhi:_(s32) = COPY $x10 |
| 119 |
%xlo:_(s32) = COPY $x11 |
| 120 |
%yhi:_(s32) = COPY $x12 |
| 121 |
%ylo:_(s32) = COPY $x13 |
| 122 |
%c0:_(s32) = COPY $x14 |
| 123 |
%x0:_(s64) = G_MERGE_VALUES %xhi(s32), %xlo(s32) |
| 124 |
%y0:_(s64) = G_MERGE_VALUES %yhi(s32), %ylo(s32) |
| 125 |
%x:_(s48) = G_TRUNC %x0(s64) |
| 126 |
%y:_(s48) = G_TRUNC %y0(s64) |
| 127 |
%c:_(s1) = G_TRUNC %c0(s32) |
| 128 |
%z:_(s48) = G_SELECT %c(s1), %x(s48), %y |
| 129 |
%z0:_(s64) = G_ANYEXT %z(s48) |
| 130 |
%zhi:_(s32), %zlo:_(s32) = G_UNMERGE_VALUES %z0(s64) |
| 131 |
$x10 = COPY %zhi(s32) |
| 132 |
$x11 = COPY %zlo(s32) |
| 133 |
PseudoRET implicit $x10, implicit $x11 |
| 134 |
|
| 135 |
... |
| 136 |
--- |
| 137 |
name: select_i64 |
| 138 |
body: | |
| 139 |
bb.0.entry: |
| 140 |
; CHECK-LABEL: name: select_i64 |
| 141 |
; CHECK: %xhi:_(s32) = COPY $x10 |
| 142 |
; CHECK-NEXT: %xlo:_(s32) = COPY $x11 |
| 143 |
; CHECK-NEXT: %yhi:_(s32) = COPY $x12 |
| 144 |
; CHECK-NEXT: %ylo:_(s32) = COPY $x13 |
| 145 |
; CHECK-NEXT: %c0:_(s32) = COPY $x14 |
| 146 |
; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 |
| 147 |
; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND %c0, [[C]] |
| 148 |
; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), %xhi, %yhi |
| 149 |
; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), %xlo, %ylo |
| 150 |
; CHECK-NEXT: $x10 = COPY [[SELECT]](s32) |
| 151 |
; CHECK-NEXT: $x11 = COPY [[SELECT1]](s32) |
| 152 |
; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11 |
| 153 |
%xhi:_(s32) = COPY $x10 |
| 154 |
%xlo:_(s32) = COPY $x11 |
| 155 |
%yhi:_(s32) = COPY $x12 |
| 156 |
%ylo:_(s32) = COPY $x13 |
| 157 |
%c0:_(s32) = COPY $x14 |
| 158 |
%x:_(s64) = G_MERGE_VALUES %xhi(s32), %xlo(s32) |
| 159 |
%y:_(s64) = G_MERGE_VALUES %yhi(s32), %ylo(s32) |
| 160 |
%c:_(s1) = G_TRUNC %c0(s32) |
| 161 |
%z:_(s64) = G_SELECT %c(s1), %x(s64), %y |
| 162 |
%zhi:_(s32), %zlo:_(s32) = G_UNMERGE_VALUES %z(s64) |
| 163 |
$x10 = COPY %zhi(s32) |
| 164 |
$x11 = COPY %zlo(s32) |
| 165 |
PseudoRET implicit $x10, implicit $x11 |
| 166 |
|
| 167 |
... |
| 168 |
--- |
| 169 |
name: select_i96 |
| 170 |
body: | |
| 171 |
bb.0.entry: |
| 172 |
; CHECK-LABEL: name: select_i96 |
| 173 |
; CHECK: %yhi:_(s32) = COPY $x13 |
| 174 |
; CHECK-NEXT: %ymid:_(s32) = COPY $x14 |
| 175 |
; CHECK-NEXT: %ylo:_(s32) = COPY $x15 |
| 176 |
; CHECK-NEXT: $x10 = COPY %yhi(s32) |
| 177 |
; CHECK-NEXT: $x11 = COPY %ymid(s32) |
| 178 |
; CHECK-NEXT: $x12 = COPY %ylo(s32) |
| 179 |
; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11, implicit $x12 |
| 180 |
%xhi:_(s32) = COPY $x10 |
| 181 |
%xmid:_(s32) = COPY $x11 |
| 182 |
%xlo:_(s32) = COPY $x12 |
| 183 |
%yhi:_(s32) = COPY $x13 |
| 184 |
%ymid:_(s32) = COPY $x14 |
| 185 |
%ylo:_(s32) = COPY $x15 |
| 186 |
%c0:_(s32) = COPY $x16 |
| 187 |
%x:_(s96) = G_MERGE_VALUES %xhi(s32), %xmid(s32), %xlo(s32) |
| 188 |
%y:_(s96) = G_MERGE_VALUES %yhi(s32), %ymid(s32), %ylo(s32) |
| 189 |
%c:_(s1) = G_TRUNC %c0(s32) |
| 190 |
%z:_(s96) = G_SELECT %c(s1), %x(s96), %y |
| 191 |
%zhi:_(s32), %zmid:_(s32), %zlo:_(s32) = G_UNMERGE_VALUES %y(s96) |
| 192 |
$x10 = COPY %zhi(s32) |
| 193 |
$x11 = COPY %zmid(s32) |
| 194 |
$x12 = COPY %zlo(s32) |
| 195 |
PseudoRET implicit $x10, implicit $x11, implicit $x12 |
| 196 |
|
| 197 |
... |
| 198 |
--- |
| 199 |
name: select_ptr |
| 200 |
body: | |
| 201 |
bb.0.entry: |
| 202 |
; CHECK-LABEL: name: select_ptr |
| 203 |
; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x10 |
| 204 |
; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x11 |
| 205 |
; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12 |
| 206 |
; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 |
| 207 |
; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]] |
| 208 |
; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(p0) = G_SELECT [[AND]](s32), [[COPY]], [[COPY1]] |
| 209 |
; CHECK-NEXT: $x10 = COPY [[SELECT]](p0) |
| 210 |
; CHECK-NEXT: PseudoRET implicit $x10 |
| 211 |
%0:_(p0) = COPY $x10 |
| 212 |
%1:_(p0) = COPY $x11 |
| 213 |
%2:_(s32) = COPY $x12 |
| 214 |
%3:_(s1) = G_TRUNC %2(s32) |
| 215 |
%4:_(p0) = G_SELECT %3(s1), %0(p0), %1(p0) |
| 216 |
$x10 = COPY %4(p0) |
| 217 |
PseudoRET implicit $x10 |
| 218 |
|
| 219 |
... |