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