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