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: umax_s32_ss 7legalized: true 8 9body: | 10 bb.0: 11 liveins: $sgpr0, $sgpr1 12 13 ; CHECK-LABEL: name: umax_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(ugt), [[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_UMAX %0, %1 22 $sgpr0 = COPY %2 23... 24 25--- 26name: umax_s32_sv 27legalized: true 28 29body: | 30 bb.0: 31 liveins: $sgpr0, $vgpr0 32 33 ; CHECK-LABEL: name: umax_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: [[UMAX:%[0-9]+]]:vgpr(s32) = G_UMAX [[COPY2]], [[COPY1]] 38 ; CHECK: $vgpr0 = COPY [[UMAX]](s32) 39 %0:_(s32) = COPY $sgpr0 40 %1:_(s32) = COPY $vgpr0 41 %2:_(s32) = G_UMAX %0, %1 42 $vgpr0 = COPY %2 43... 44 45--- 46name: umax_s32_vs 47legalized: true 48 49body: | 50 bb.0: 51 liveins: $sgpr0, $vgpr0 52 53 ; CHECK-LABEL: name: umax_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: [[UMAX:%[0-9]+]]:vgpr(s32) = G_UMAX [[COPY]], [[COPY2]] 58 ; CHECK: $vgpr0 = COPY [[UMAX]](s32) 59 %0:_(s32) = COPY $vgpr0 60 %1:_(s32) = COPY $sgpr0 61 %2:_(s32) = G_UMAX %0, %1 62 $vgpr0 = COPY %2 63... 64 65--- 66name: umax_s32_vv 67legalized: true 68 69body: | 70 bb.0: 71 liveins: $vgpr0, $vgpr1 72 73 ; CHECK-LABEL: name: umax_s32_vv 74 ; CHECK: [[COPY:%[0-9]+]]:vgpr(s32) = COPY $vgpr0 75 ; CHECK: [[COPY1:%[0-9]+]]:vgpr(s32) = COPY $vgpr1 76 ; CHECK: [[UMAX:%[0-9]+]]:vgpr(s32) = G_UMAX [[COPY]], [[COPY1]] 77 ; CHECK: $vgpr0 = COPY [[UMAX]](s32) 78 %0:_(s32) = COPY $vgpr0 79 %1:_(s32) = COPY $vgpr1 80 %2:_(s32) = G_UMAX %0, %1 81 $vgpr0 = COPY %2 82... 83 84# FIXME: This should use VGPR instruction 85--- 86name: umax_s32_ss_vgpr_use 87legalized: true 88 89body: | 90 bb.0: 91 liveins: $sgpr0, $sgpr1 92 93 ; CHECK-LABEL: name: umax_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(ugt), [[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_UMAX %0, %1 102 $vgpr0 = COPY %2 103... 104 105--- 106name: umax_s16_ss 107legalized: true 108 109body: | 110 bb.0: 111 liveins: $sgpr0, $sgpr1 112 113 ; CHECK-LABEL: name: umax_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: [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC]](s16) 119 ; CHECK: [[ZEXT1:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s16) 120 ; CHECK: [[TRUNC2:%[0-9]+]]:sgpr(s16) = G_TRUNC %8(s32) 121 ; CHECK: [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(ugt), [[ZEXT]](s32), [[ZEXT1]] 122 ; CHECK: [[SELECT:%[0-9]+]]:sgpr(s32) = G_SELECT [[ICMP]](s32), [[ZEXT]], [[ZEXT1]] 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_UMAX %2, %3 130 %5:_(s32) = G_ANYEXT %4 131 $sgpr0 = COPY %5 132 133... 134 135--- 136name: umax_s16_ss_vgpr_use 137legalized: true 138 139body: | 140 bb.0: 141 liveins: $sgpr0, $sgpr1 142 143 ; CHECK-LABEL: name: umax_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: [[ZEXT:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC]](s16) 149 ; CHECK: [[ZEXT1:%[0-9]+]]:sgpr(s32) = G_ZEXT [[TRUNC1]](s16) 150 ; CHECK: [[TRUNC2:%[0-9]+]]:sgpr(s16) = G_TRUNC %8(s32) 151 ; CHECK: [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(ugt), [[ZEXT]](s32), [[ZEXT1]] 152 ; CHECK: [[SELECT:%[0-9]+]]:sgpr(s32) = G_SELECT [[ICMP]](s32), [[ZEXT]], [[ZEXT1]] 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_UMAX %2, %3 160 %5:_(s32) = G_ANYEXT %4 161 $vgpr0 = COPY %5 162 163... 164 165--- 166name: umax_v2s16_ss 167legalized: true 168 169body: | 170 bb.0: 171 liveins: $sgpr0, $sgpr1 172 173 ; CHECK-LABEL: name: umax_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: [[C:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 16 178 ; CHECK: [[LSHR:%[0-9]+]]:sgpr(s32) = G_LSHR [[BITCAST]], [[C]](s32) 179 ; CHECK: [[C1:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 65535 180 ; CHECK: [[AND:%[0-9]+]]:sgpr(s32) = G_AND [[BITCAST]], [[C1]] 181 ; CHECK: [[BITCAST1:%[0-9]+]]:sgpr(s32) = G_BITCAST [[COPY1]](<2 x s16>) 182 ; CHECK: [[C2:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 16 183 ; CHECK: [[LSHR1:%[0-9]+]]:sgpr(s32) = G_LSHR [[BITCAST1]], [[C2]](s32) 184 ; CHECK: [[C3:%[0-9]+]]:sgpr(s32) = G_CONSTANT i32 65535 185 ; CHECK: [[AND1:%[0-9]+]]:sgpr(s32) = G_AND [[BITCAST1]], [[C3]] 186 ; CHECK: [[ICMP:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(ugt), [[AND]](s32), [[AND1]] 187 ; CHECK: [[SELECT:%[0-9]+]]:sgpr(s32) = G_SELECT [[ICMP]](s32), [[AND]], [[AND1]] 188 ; CHECK: [[ICMP1:%[0-9]+]]:sgpr(s32) = G_ICMP intpred(ugt), [[LSHR]](s32), [[LSHR1]] 189 ; CHECK: [[SELECT1:%[0-9]+]]:sgpr(s32) = G_SELECT [[ICMP1]](s32), [[LSHR]], [[LSHR1]] 190 ; CHECK: [[BUILD_VECTOR_TRUNC:%[0-9]+]]:sgpr(<2 x s16>) = G_BUILD_VECTOR_TRUNC [[SELECT]](s32), [[SELECT1]](s32) 191 ; CHECK: $sgpr0 = COPY [[BUILD_VECTOR_TRUNC]](<2 x s16>) 192 %0:_(<2 x s16>) = COPY $sgpr0 193 %1:_(<2 x s16>) = COPY $sgpr1 194 %2:_(<2 x s16>) = G_UMAX %0, %1 195 $sgpr0 = COPY %2 196... 197 198--- 199name: umax_v2s16_sv 200legalized: true 201 202body: | 203 bb.0: 204 liveins: $sgpr0, $vgpr0 205 206 ; CHECK-LABEL: name: umax_v2s16_sv 207 ; CHECK: [[COPY:%[0-9]+]]:sgpr(<2 x s16>) = COPY $sgpr0 208 ; CHECK: [[COPY1:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0 209 ; CHECK: [[COPY2:%[0-9]+]]:vgpr(<2 x s16>) = COPY [[COPY]](<2 x s16>) 210 ; CHECK: [[UMAX:%[0-9]+]]:vgpr(<2 x s16>) = G_UMAX [[COPY2]], [[COPY1]] 211 ; CHECK: $vgpr0 = COPY [[UMAX]](<2 x s16>) 212 %0:_(<2 x s16>) = COPY $sgpr0 213 %1:_(<2 x s16>) = COPY $vgpr0 214 %2:_(<2 x s16>) = G_UMAX %0, %1 215 $vgpr0 = COPY %2 216... 217 218--- 219name: umax_v2s16_vs 220legalized: true 221 222body: | 223 bb.0: 224 liveins: $sgpr0, $vgpr0 225 226 ; CHECK-LABEL: name: umax_v2s16_vs 227 ; CHECK: [[COPY:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0 228 ; CHECK: [[COPY1:%[0-9]+]]:sgpr(<2 x s16>) = COPY $sgpr0 229 ; CHECK: [[COPY2:%[0-9]+]]:vgpr(<2 x s16>) = COPY [[COPY1]](<2 x s16>) 230 ; CHECK: [[UMAX:%[0-9]+]]:vgpr(<2 x s16>) = G_UMAX [[COPY]], [[COPY2]] 231 ; CHECK: $vgpr0 = COPY [[UMAX]](<2 x s16>) 232 %0:_(<2 x s16>) = COPY $vgpr0 233 %1:_(<2 x s16>) = COPY $sgpr0 234 %2:_(<2 x s16>) = G_UMAX %0, %1 235 $vgpr0 = COPY %2 236... 237 238--- 239name: umax_v2s16_vv 240legalized: true 241 242body: | 243 bb.0: 244 liveins: $vgpr0, $vgpr1 245 246 ; CHECK-LABEL: name: umax_v2s16_vv 247 ; CHECK: [[COPY:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr0 248 ; CHECK: [[COPY1:%[0-9]+]]:vgpr(<2 x s16>) = COPY $vgpr1 249 ; CHECK: [[UMAX:%[0-9]+]]:vgpr(<2 x s16>) = G_UMAX [[COPY]], [[COPY1]] 250 ; CHECK: $vgpr0 = COPY [[UMAX]](<2 x s16>) 251 %0:_(<2 x s16>) = COPY $vgpr0 252 %1:_(<2 x s16>) = COPY $vgpr1 253 %2:_(<2 x s16>) = G_UMAX %0, %1 254 $vgpr0 = COPY %2 255... 256