1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py 2# RUN: llc -march=amdgcn -mcpu=gfx900 -run-pass=regbankselect -verify-machineinstrs -regbankselect-fast -o - %s | FileCheck %s 3# RUN: llc -march=amdgcn -mcpu=gfx900 -run-pass=regbankselect -verify-machineinstrs -regbankselect-greedy -o - %s | FileCheck %s 4 5--- 6name: umin_s32_ss 7legalized: true 8 9body: | 10 bb.0: 11 liveins: $sgpr0, $sgpr1 12 13 ; CHECK-LABEL: name: umin_s32_ss 14 ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0 15 ; CHECK: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1 16 ; CHECK: [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(ult), [[COPY]](s32), [[COPY1]] 17 ; CHECK: [[SELECT:%[0-9]+]]:sgpr(s32) = G_SELECT [[ICMP]](s32), [[COPY]], [[COPY1]] 18 ; CHECK: $sgpr0 = COPY [[SELECT]](s32) 19 %0:_(s32) = COPY $sgpr0 20 %1:_(s32) = COPY $sgpr1 21 %2:_(s32) = G_UMIN %0, %1 22 $sgpr0 = COPY %2 23 24... 25 26--- 27name: umin_s32_sv 28legalized: true 29 30body: | 31 bb.0: 32 liveins: $sgpr0, $vgpr0 33 34 ; CHECK-LABEL: name: umin_s32_sv 35 ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0 36 ; CHECK: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr0 37 ; CHECK: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[COPY]](s32) 38 ; CHECK: [[UMIN:%[0-9]+]]:vgpr(s32) = G_UMIN [[COPY2]], [[COPY1]] 39 ; CHECK: $vgpr0 = COPY [[UMIN]](s32) 40 %0:_(s32) = COPY $sgpr0 41 %1:_(s32) = COPY $vgpr0 42 %2:_(s32) = G_UMIN %0, %1 43 $vgpr0 = COPY %2 44 45... 46 47--- 48name: umin_s32_vs 49legalized: true 50 51body: | 52 bb.0: 53 liveins: $sgpr0, $vgpr0 54 55 ; CHECK-LABEL: name: umin_s32_vs 56 ; CHECK: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0 57 ; CHECK: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr0 58 ; CHECK: [[COPY2:%[0-9]+]]:vgpr(s32) = COPY [[COPY1]](s32) 59 ; CHECK: [[UMIN:%[0-9]+]]:vgpr(s32) = G_UMIN [[COPY]], [[COPY2]] 60 ; CHECK: $vgpr0 = COPY [[UMIN]](s32) 61 %0:_(s32) = COPY $vgpr0 62 %1:_(s32) = COPY $sgpr0 63 %2:_(s32) = G_UMIN %0, %1 64 $vgpr0 = COPY %2 65 66... 67 68--- 69name: umin_s32_vv 70legalized: true 71 72body: | 73 bb.0: 74 liveins: $vgpr0, $vgpr1 75 76 ; CHECK-LABEL: name: umin_s32_vv 77 ; CHECK: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0 78 ; CHECK: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1 79 ; CHECK: [[UMIN:%[0-9]+]]:vgpr(s32) = G_UMIN [[COPY]], [[COPY1]] 80 ; CHECK: $vgpr0 = COPY [[UMIN]](s32) 81 %0:_(s32) = COPY $vgpr0 82 %1:_(s32) = COPY $vgpr1 83 %2:_(s32) = G_UMIN %0, %1 84 $vgpr0 = COPY %2 85 86... 87 88# FIXME: This should use VGPR instruction 89--- 90name: umin_s32_ss_vgpr_use 91legalized: true 92 93body: | 94 bb.0: 95 liveins: $sgpr0, $sgpr1 96 97 ; CHECK-LABEL: name: umin_s32_ss_vgpr_use 98 ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0 99 ; CHECK: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1 100 ; CHECK: [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(ult), [[COPY]](s32), [[COPY1]] 101 ; CHECK: [[SELECT:%[0-9]+]]:sgpr(s32) = G_SELECT [[ICMP]](s32), [[COPY]], [[COPY1]] 102 ; CHECK: $vgpr0 = COPY [[SELECT]](s32) 103 %0:_(s32) = COPY $sgpr0 104 %1:_(s32) = COPY $sgpr1 105 %2:_(s32) = G_UMIN %0, %1 106 $vgpr0 = COPY %2 107... 108 109--- 110name: umin_s16_ss 111legalized: true 112 113body: | 114 bb.0: 115 liveins: $sgpr0, $sgpr1 116 117 ; CHECK-LABEL: name: umin_s16_ss 118 ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0 119 ; CHECK: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1 120 ; CHECK: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32) 121 ; CHECK: [[TRUNC1:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY1]](s32) 122 ; CHECK: [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC]](s16) 123 ; CHECK: [[ZEXT1:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s16) 124 ; CHECK: [[TRUNC2:%[0-9]+]]:sgpr(s16) = G_TRUNC %8(s32) 125 ; CHECK: [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(ult), [[ZEXT]](s32), [[ZEXT1]] 126 ; CHECK: [[SELECT:%[0-9]+]]:sgpr(s32) = G_SELECT [[ICMP]](s32), [[ZEXT]], [[ZEXT1]] 127 ; CHECK: [[ANYEXT:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC2]](s16) 128 ; CHECK: $sgpr0 = COPY [[ANYEXT]](s32) 129 %0:_(s32) = COPY $sgpr0 130 %1:_(s32) = COPY $sgpr1 131 %2:_(s16) = G_TRUNC %0 132 %3:_(s16) = G_TRUNC %1 133 %4:_(s16) = G_UMIN %2, %3 134 %5:_(s32) = G_ANYEXT %4 135 $sgpr0 = COPY %5 136 137... 138 139--- 140name: umin_s16_ss_vgpr_use 141legalized: true 142 143body: | 144 bb.0: 145 liveins: $sgpr0, $sgpr1 146 147 ; CHECK-LABEL: name: umin_s16_ss_vgpr_use 148 ; CHECK: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0 149 ; CHECK: [[COPY1:%[0-9]+]]:sgpr(s32) = COPY $sgpr1 150 ; CHECK: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32) 151 ; CHECK: [[TRUNC1:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY1]](s32) 152 ; CHECK: [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC]](s16) 153 ; CHECK: [[ZEXT1:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s16) 154 ; CHECK: [[TRUNC2:%[0-9]+]]:sgpr(s16) = G_TRUNC %8(s32) 155 ; CHECK: [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(ult), [[ZEXT]](s32), [[ZEXT1]] 156 ; CHECK: [[SELECT:%[0-9]+]]:sgpr(s32) = G_SELECT [[ICMP]](s32), [[ZEXT]], [[ZEXT1]] 157 ; CHECK: [[ANYEXT:%[0-9]+]]:sgpr(s32) = G_ANYEXT [[TRUNC2]](s16) 158 ; CHECK: $vgpr0 = COPY [[ANYEXT]](s32) 159 %0:_(s32) = COPY $sgpr0 160 %1:_(s32) = COPY $sgpr1 161 %2:_(s16) = G_TRUNC %0 162 %3:_(s16) = G_TRUNC %1 163 %4:_(s16) = G_UMIN %2, %3 164 %5:_(s32) = G_ANYEXT %4 165 $vgpr0 = COPY %5 166 167... 168 169--- 170name: umin_v2s16_ss 171legalized: true 172 173body: | 174 bb.0: 175 liveins: $sgpr0, $sgpr1 176 177 ; CHECK-LABEL: name: umin_v2s16_ss 178 ; CHECK: [[COPY:%[0-9]+]]:sgpr(<2 x s16>) = COPY $sgpr0 179 ; CHECK: [[COPY1:%[0-9]+]]:sgpr(<2 x s16>) = COPY $sgpr1 180 ; CHECK: [[BITCAST:%[0-9]+]]:sgpr(s32) = G_BITCAST [[COPY]](<2 x s16>) 181 ; CHECK: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 16 182 ; CHECK: [[LSHR:%[0-9]+]]:sgpr(s32) = G_LSHR [[BITCAST]], [[C]](s32) 183 ; CHECK: [[C1:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 65535 184 ; CHECK: [[AND:%[0-9]+]]:sgpr(s32) = G_AND [[BITCAST]], [[C1]] 185 ; CHECK: [[BITCAST1:%[0-9]+]]:sgpr(s32) = G_BITCAST [[COPY1]](<2 x s16>) 186 ; CHECK: [[C2:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 16 187 ; CHECK: [[LSHR1:%[0-9]+]]:sgpr(s32) = G_LSHR [[BITCAST1]], [[C2]](s32) 188 ; CHECK: [[C3:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 65535 189 ; CHECK: [[AND1:%[0-9]+]]:sgpr(s32) = G_AND [[BITCAST1]], [[C3]] 190 ; CHECK: [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(ult), [[AND]](s32), [[AND1]] 191 ; CHECK: [[SELECT:%[0-9]+]]:sgpr(s32) = G_SELECT [[ICMP]](s32), [[AND]], [[AND1]] 192 ; CHECK: [[ICMP1:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(ult), [[LSHR]](s32), [[LSHR1]] 193 ; CHECK: [[SELECT1:%[0-9]+]]:sgpr(s32) = G_SELECT [[ICMP1]](s32), [[LSHR]], [[LSHR1]] 194 ; CHECK: [[BUILD_VECTOR_TRUNC:%[0-9]+]]:sgpr(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[SELECT]](s32), [[SELECT1]](s32) 195 ; CHECK: $sgpr0 = COPY [[BUILD_VECTOR_TRUNC]](<2 x s16>) 196 %0:_(<2 x s16>) = COPY $sgpr0 197 %1:_(<2 x s16>) = COPY $sgpr1 198 %2:_(<2 x s16>) = G_UMIN %0, %1 199 $sgpr0 = COPY %2 200... 201 202--- 203name: umin_v2s16_sv 204legalized: true 205 206body: | 207 bb.0: 208 liveins: $sgpr0, $vgpr0 209 210 ; CHECK-LABEL: name: umin_v2s16_sv 211 ; CHECK: [[COPY:%[0-9]+]]:sgpr(<2 x s16>) = COPY $sgpr0 212 ; CHECK: [[COPY1:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0 213 ; CHECK: [[COPY2:%[0-9]+]]:vgpr(<2 x s16>) = COPY [[COPY]](<2 x s16>) 214 ; CHECK: [[UMIN:%[0-9]+]]:vgpr(<2 x s16>) = G_UMIN [[COPY2]], [[COPY1]] 215 ; CHECK: $vgpr0 = COPY [[UMIN]](<2 x s16>) 216 %0:_(<2 x s16>) = COPY $sgpr0 217 %1:_(<2 x s16>) = COPY $vgpr0 218 %2:_(<2 x s16>) = G_UMIN %0, %1 219 $vgpr0 = COPY %2 220... 221 222--- 223name: umin_v2s16_vs 224legalized: true 225 226body: | 227 bb.0: 228 liveins: $sgpr0, $vgpr0 229 230 ; CHECK-LABEL: name: umin_v2s16_vs 231 ; CHECK: [[COPY:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0 232 ; CHECK: [[COPY1:%[0-9]+]]:sgpr(<2 x s16>) = COPY $sgpr0 233 ; CHECK: [[COPY2:%[0-9]+]]:vgpr(<2 x s16>) = COPY [[COPY1]](<2 x s16>) 234 ; CHECK: [[UMIN:%[0-9]+]]:vgpr(<2 x s16>) = G_UMIN [[COPY]], [[COPY2]] 235 ; CHECK: $vgpr0 = COPY [[UMIN]](<2 x s16>) 236 %0:_(<2 x s16>) = COPY $vgpr0 237 %1:_(<2 x s16>) = COPY $sgpr0 238 %2:_(<2 x s16>) = G_UMIN %0, %1 239 $vgpr0 = COPY %2 240... 241 242--- 243name: umin_v2s16_vv 244legalized: true 245 246body: | 247 bb.0: 248 liveins: $vgpr0, $vgpr1 249 250 ; CHECK-LABEL: name: umin_v2s16_vv 251 ; CHECK: [[COPY:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0 252 ; CHECK: [[COPY1:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr1 253 ; CHECK: [[UMIN:%[0-9]+]]:vgpr(<2 x s16>) = G_UMIN [[COPY]], [[COPY1]] 254 ; CHECK: $vgpr0 = COPY [[UMIN]](<2 x s16>) 255 %0:_(<2 x s16>) = COPY $vgpr0 256 %1:_(<2 x s16>) = COPY $vgpr1 257 %2:_(<2 x s16>) = G_UMIN %0, %1 258 $vgpr0 = COPY %2 259... 260