1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py 2# RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=tahiti -run-pass=amdgpu-prelegalizer-combiner -verify-machineinstrs %s -o - | FileCheck -check-prefix=GCN %s 3 4--- 5name: sext_inreg_s32_7_sextload_from_1 6tracksRegLiveness: true 7body: | 8 bb.0: 9 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3 10 11 ; GCN-LABEL: name: sext_inreg_s32_7_sextload_from_1 12 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3 13 ; GCN: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1 14 ; GCN: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p1) :: (load 1, addrspace 1) 15 ; GCN: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[SEXTLOAD]], 7 16 ; GCN: $vgpr0 = COPY [[SEXT_INREG]](s32) 17 %0:_(p1) = COPY $vgpr0_vgpr1 18 %1:_(s32) = G_SEXTLOAD %0 :: (load 1, addrspace 1) 19 %2:_(s32) = G_SEXT_INREG %1, 7 20 $vgpr0 = COPY %2 21 22... 23 24--- 25name: sext_inreg_s32_8_sextload_from_1 26tracksRegLiveness: true 27body: | 28 bb.0: 29 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3 30 31 ; GCN-LABEL: name: sext_inreg_s32_8_sextload_from_1 32 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3 33 ; GCN: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1 34 ; GCN: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p1) :: (load 1, addrspace 1) 35 ; GCN: $vgpr0 = COPY [[SEXTLOAD]](s32) 36 %0:_(p1) = COPY $vgpr0_vgpr1 37 %1:_(s32) = G_SEXTLOAD %0 :: (load 1, addrspace 1) 38 %2:_(s32) = G_SEXT_INREG %1, 8 39 $vgpr0 = COPY %2 40 41... 42 43--- 44name: sext_inreg_s32_9_sextload_from_1 45tracksRegLiveness: true 46body: | 47 bb.0: 48 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3 49 50 ; GCN-LABEL: name: sext_inreg_s32_9_sextload_from_1 51 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3 52 ; GCN: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1 53 ; GCN: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p1) :: (load 1, addrspace 1) 54 ; GCN: $vgpr0 = COPY [[SEXTLOAD]](s32) 55 %0:_(p1) = COPY $vgpr0_vgpr1 56 %1:_(s32) = G_SEXTLOAD %0 :: (load 1, addrspace 1) 57 %2:_(s32) = G_SEXT_INREG %1, 9 58 $vgpr0 = COPY %2 59 60... 61 62--- 63name: sext_inreg_s32_7_sext_from_s8 64tracksRegLiveness: true 65body: | 66 bb.0: 67 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3 68 69 ; GCN-LABEL: name: sext_inreg_s32_7_sext_from_s8 70 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3 71 ; GCN: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1 72 ; GCN: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p1) :: (load 1, addrspace 1) 73 ; GCN: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[SEXTLOAD]], 7 74 ; GCN: $vgpr0 = COPY [[SEXT_INREG]](s32) 75 %0:_(p1) = COPY $vgpr0_vgpr1 76 %1:_(s8) = G_LOAD %0 :: (load 1, addrspace 1) 77 %2:_(s32) = G_SEXT %1 78 %3:_(s32) = G_SEXT_INREG %2, 7 79 $vgpr0 = COPY %3 80 81... 82 83--- 84name: sext_inreg_s32_8_sext_from_s8 85tracksRegLiveness: true 86body: | 87 bb.0: 88 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3 89 90 ; GCN-LABEL: name: sext_inreg_s32_8_sext_from_s8 91 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3 92 ; GCN: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1 93 ; GCN: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p1) :: (load 1, addrspace 1) 94 ; GCN: $vgpr0 = COPY [[SEXTLOAD]](s32) 95 %0:_(p1) = COPY $vgpr0_vgpr1 96 %1:_(s8) = G_LOAD %0 :: (load 1, addrspace 1) 97 %2:_(s32) = G_SEXT %1 98 %3:_(s32) = G_SEXT_INREG %2, 8 99 $vgpr0 = COPY %3 100 101... 102 103--- 104name: sext_inreg_s32_8_sext_from_s9 105tracksRegLiveness: true 106body: | 107 bb.0: 108 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3 109 110 ; GCN-LABEL: name: sext_inreg_s32_8_sext_from_s9 111 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3 112 ; GCN: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1 113 ; GCN: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p1) :: (load 1, addrspace 1) 114 ; GCN: $vgpr0 = COPY [[SEXTLOAD]](s32) 115 %0:_(p1) = COPY $vgpr0_vgpr1 116 %1:_(s8) = G_LOAD %0 :: (load 1, addrspace 1) 117 %2:_(s32) = G_SEXT %1 118 %3:_(s32) = G_SEXT_INREG %2, 9 119 $vgpr0 = COPY %3 120 121... 122 123--- 124name: sext_inreg_v2s32_7_sext_from_v2s8 125tracksRegLiveness: true 126body: | 127 bb.0: 128 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3 129 130 ; GCN-LABEL: name: sext_inreg_v2s32_7_sext_from_v2s8 131 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3 132 ; GCN: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1 133 ; GCN: [[LOAD:%[0-9]+]]:_(<2 x s8>) = G_LOAD [[COPY]](p1) :: (load 2, addrspace 1) 134 ; GCN: [[SEXT:%[0-9]+]]:_(<2 x s32>) = G_SEXT [[LOAD]](<2 x s8>) 135 ; GCN: [[SEXT_INREG:%[0-9]+]]:_(<2 x s32>) = G_SEXT_INREG [[SEXT]], 7 136 ; GCN: $vgpr0_vgpr1 = COPY [[SEXT_INREG]](<2 x s32>) 137 %0:_(p1) = COPY $vgpr0_vgpr1 138 %1:_(<2 x s8>) = G_LOAD %0 :: (load 2, addrspace 1) 139 %2:_(<2 x s32>) = G_SEXT %1 140 %3:_(<2 x s32>) = G_SEXT_INREG %2, 7 141 $vgpr0_vgpr1 = COPY %3 142 143... 144 145--- 146name: sext_inreg_v2s32_8_sext_from_v2s8 147tracksRegLiveness: true 148body: | 149 bb.0: 150 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3 151 152 ; GCN-LABEL: name: sext_inreg_v2s32_8_sext_from_v2s8 153 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3 154 ; GCN: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1 155 ; GCN: [[LOAD:%[0-9]+]]:_(<2 x s8>) = G_LOAD [[COPY]](p1) :: (load 2, addrspace 1) 156 ; GCN: [[SEXT:%[0-9]+]]:_(<2 x s32>) = G_SEXT [[LOAD]](<2 x s8>) 157 ; GCN: $vgpr0_vgpr1 = COPY [[SEXT]](<2 x s32>) 158 %0:_(p1) = COPY $vgpr0_vgpr1 159 %1:_(<2 x s8>) = G_LOAD %0 :: (load 2, addrspace 1) 160 %2:_(<2 x s32>) = G_SEXT %1 161 %3:_(<2 x s32>) = G_SEXT_INREG %2, 8 162 $vgpr0_vgpr1 = COPY %3 163 164... 165 166--- 167name: sext_inreg_v2s32_9_sext_from_v2s8 168tracksRegLiveness: true 169body: | 170 bb.0: 171 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3 172 173 ; GCN-LABEL: name: sext_inreg_v2s32_9_sext_from_v2s8 174 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3 175 ; GCN: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1 176 ; GCN: [[LOAD:%[0-9]+]]:_(<2 x s8>) = G_LOAD [[COPY]](p1) :: (load 2, addrspace 1) 177 ; GCN: [[SEXT:%[0-9]+]]:_(<2 x s32>) = G_SEXT [[LOAD]](<2 x s8>) 178 ; GCN: $vgpr0_vgpr1 = COPY [[SEXT]](<2 x s32>) 179 %0:_(p1) = COPY $vgpr0_vgpr1 180 %1:_(<2 x s8>) = G_LOAD %0 :: (load 2, addrspace 1) 181 %2:_(<2 x s32>) = G_SEXT %1 182 %3:_(<2 x s32>) = G_SEXT_INREG %2, 9 183 $vgpr0_vgpr1 = COPY %3 184 185... 186 187--- 188name: sext_inreg_s32_7_zextload_from_1 189tracksRegLiveness: true 190body: | 191 bb.0: 192 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3 193 194 ; GCN-LABEL: name: sext_inreg_s32_7_zextload_from_1 195 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3 196 ; GCN: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1 197 ; GCN: [[ZEXTLOAD:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[COPY]](p1) :: (load 1, addrspace 1) 198 ; GCN: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[ZEXTLOAD]], 7 199 ; GCN: $vgpr0 = COPY [[SEXT_INREG]](s32) 200 %0:_(p1) = COPY $vgpr0_vgpr1 201 %1:_(s32) = G_ZEXTLOAD %0 :: (load 1, addrspace 1) 202 %2:_(s32) = G_SEXT_INREG %1, 7 203 $vgpr0 = COPY %2 204 205... 206 207--- 208name: sext_inreg_s32_8_zextload_from_1 209tracksRegLiveness: true 210body: | 211 bb.0: 212 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3 213 214 ; GCN-LABEL: name: sext_inreg_s32_8_zextload_from_1 215 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3 216 ; GCN: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1 217 ; GCN: [[ZEXTLOAD:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[COPY]](p1) :: (load 1, addrspace 1) 218 ; GCN: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[ZEXTLOAD]], 8 219 ; GCN: $vgpr0 = COPY [[SEXT_INREG]](s32) 220 %0:_(p1) = COPY $vgpr0_vgpr1 221 %1:_(s32) = G_ZEXTLOAD %0 :: (load 1, addrspace 1) 222 %2:_(s32) = G_SEXT_INREG %1, 8 223 $vgpr0 = COPY %2 224 225... 226 227--- 228name: sext_inreg_s32_9_zextload_from_1 229tracksRegLiveness: true 230body: | 231 bb.0: 232 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3 233 234 ; GCN-LABEL: name: sext_inreg_s32_9_zextload_from_1 235 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3 236 ; GCN: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1 237 ; GCN: [[ZEXTLOAD:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[COPY]](p1) :: (load 1, addrspace 1) 238 ; GCN: $vgpr0 = COPY [[ZEXTLOAD]](s32) 239 %0:_(p1) = COPY $vgpr0_vgpr1 240 %1:_(s32) = G_ZEXTLOAD %0 :: (load 1, addrspace 1) 241 %2:_(s32) = G_SEXT_INREG %1, 9 242 $vgpr0 = COPY %2 243 244... 245 246--- 247name: sext_inreg_s32_select_sextload_from_1 248tracksRegLiveness: true 249body: | 250 bb.0: 251 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4, $vgpr5 252 253 ; GCN-LABEL: name: sext_inreg_s32_select_sextload_from_1 254 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4, $vgpr5 255 ; GCN: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1 256 ; GCN: [[COPY1:%[0-9]+]]:_(p1) = COPY $vgpr2_vgpr3 257 ; GCN: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr4 258 ; GCN: [[COPY3:%[0-9]+]]:_(s32) = COPY $vgpr5 259 ; GCN: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[COPY2]](s32), [[COPY3]] 260 ; GCN: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p1) :: (load 1, addrspace 1) 261 ; GCN: [[SEXTLOAD1:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY1]](p1) :: (load 1, addrspace 1) 262 ; GCN: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s1), [[SEXTLOAD]], [[SEXTLOAD1]] 263 ; GCN: $vgpr0 = COPY [[SELECT]](s32) 264 %0:_(p1) = COPY $vgpr0_vgpr1 265 %1:_(p1) = COPY $vgpr2_vgpr3 266 %2:_(s32) = COPY $vgpr4 267 %3:_(s32) = COPY $vgpr5 268 %4:_(s1) = G_ICMP intpred(eq), %2, %3 269 %5:_(s32) = G_SEXTLOAD %0 :: (load 1, addrspace 1) 270 %6:_(s32) = G_SEXTLOAD %1 :: (load 1, addrspace 1) 271 %7:_(s32) = G_SELECT %4, %5, %6 272 %8:_(s32) = G_SEXT_INREG %7, 8 273 $vgpr0 = COPY %8 274 275... 276 277--- 278name: sext_inreg_s32_select_sextload_from_1_fail_lhs 279tracksRegLiveness: true 280body: | 281 bb.0: 282 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4, $vgpr5 283 284 ; GCN-LABEL: name: sext_inreg_s32_select_sextload_from_1_fail_lhs 285 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4, $vgpr5 286 ; GCN: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1 287 ; GCN: [[COPY1:%[0-9]+]]:_(p1) = COPY $vgpr2_vgpr3 288 ; GCN: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr4 289 ; GCN: [[COPY3:%[0-9]+]]:_(s32) = COPY $vgpr5 290 ; GCN: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[COPY2]](s32), [[COPY3]] 291 ; GCN: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[COPY]](p1) :: (load 4, addrspace 1) 292 ; GCN: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY1]](p1) :: (load 1, addrspace 1) 293 ; GCN: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s1), [[LOAD]], [[SEXTLOAD]] 294 ; GCN: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[SELECT]], 8 295 ; GCN: $vgpr0 = COPY [[SEXT_INREG]](s32) 296 %0:_(p1) = COPY $vgpr0_vgpr1 297 %1:_(p1) = COPY $vgpr2_vgpr3 298 %2:_(s32) = COPY $vgpr4 299 %3:_(s32) = COPY $vgpr5 300 %4:_(s1) = G_ICMP intpred(eq), %2, %3 301 %5:_(s32) = G_LOAD %0 :: (load 4, addrspace 1) 302 %6:_(s32) = G_SEXTLOAD %1 :: (load 1, addrspace 1) 303 %7:_(s32) = G_SELECT %4, %5, %6 304 %8:_(s32) = G_SEXT_INREG %7, 8 305 $vgpr0 = COPY %8 306 307... 308 309--- 310name: sext_inreg_s32_select_sextload_from_1_fail_rhs 311tracksRegLiveness: true 312body: | 313 bb.0: 314 liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4, $vgpr5 315 316 ; GCN-LABEL: name: sext_inreg_s32_select_sextload_from_1_fail_rhs 317 ; GCN: liveins: $vgpr0_vgpr1, $vgpr2_vgpr3, $vgpr4, $vgpr5 318 ; GCN: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1 319 ; GCN: [[COPY1:%[0-9]+]]:_(p1) = COPY $vgpr2_vgpr3 320 ; GCN: [[COPY2:%[0-9]+]]:_(s32) = COPY $vgpr4 321 ; GCN: [[COPY3:%[0-9]+]]:_(s32) = COPY $vgpr5 322 ; GCN: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[COPY2]](s32), [[COPY3]] 323 ; GCN: [[SEXTLOAD:%[0-9]+]]:_(s32) = G_SEXTLOAD [[COPY]](p1) :: (load 1, addrspace 1) 324 ; GCN: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[COPY1]](p1) :: (load 4, addrspace 1) 325 ; GCN: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s1), [[SEXTLOAD]], [[LOAD]] 326 ; GCN: [[SEXT_INREG:%[0-9]+]]:_(s32) = G_SEXT_INREG [[SELECT]], 8 327 ; GCN: $vgpr0 = COPY [[SEXT_INREG]](s32) 328 %0:_(p1) = COPY $vgpr0_vgpr1 329 %1:_(p1) = COPY $vgpr2_vgpr3 330 %2:_(s32) = COPY $vgpr4 331 %3:_(s32) = COPY $vgpr5 332 %4:_(s1) = G_ICMP intpred(eq), %2, %3 333 %5:_(s32) = G_SEXTLOAD %0 :: (load 1, addrspace 1) 334 %6:_(s32) = G_LOAD %1 :: (load 4, addrspace 1) 335 %7:_(s32) = G_SELECT %4, %5, %6 336 %8:_(s32) = G_SEXT_INREG %7, 8 337 $vgpr0 = COPY %8 338 339... 340