1# RUN: llc -march=amdgcn -mcpu=gfx1010 -verify-machineinstrs -run-pass post-RA-hazard-rec -o - %s | FileCheck -check-prefix=GCN %s 2 3# GCN-LABEL: name: vmem_write_sgpr 4# GCN: BUFFER_LOAD_DWORD_OFFEN 5# GCN-NEXT: S_WAITCNT_DEPCTR 65507 6# GCN-NEXT: S_MOV_B32 7--- 8name: vmem_write_sgpr 9body: | 10 bb.0: 11 $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF 12 $sgpr4 = IMPLICIT_DEF 13 $vgpr0 = IMPLICIT_DEF 14 $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 0, 0, 0, 0, 0, 0, implicit $exec 15 $sgpr0 = S_MOV_B32 0 16... 17# GCN-LABEL: name: vmem_write_exec 18# GCN: BUFFER_STORE_DWORD_OFFEN_exact 19# GCN-NEXT: S_WAITCNT_DEPCTR 65507 20# GCN-NEXT: S_MOV_B32 21--- 22name: vmem_write_exec 23body: | 24 bb.0: 25 $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF 26 $sgpr4 = IMPLICIT_DEF 27 $vgpr0 = IMPLICIT_DEF 28 $vgpr1 = IMPLICIT_DEF 29 BUFFER_STORE_DWORD_OFFEN_exact killed renamable $vgpr0, renamable $vgpr1, renamable $sgpr0_sgpr1_sgpr2_sgpr3, 0, 0, 0, 0, 0, 0, 0, implicit $exec 30 $exec_lo = S_MOV_B32 -1 31... 32# GCN-LABEL: name: vmem_write_sgpr_chain 33# GCN: BUFFER_LOAD_DWORD_OFFEN 34# GCN-NEXT: S_MOV_B32 35# GCN-NEXT: S_MOV_B32 36# GCN-NEXT: S_MOV_B32 37# GCN-NEXT: S_MOV_B32 38# GCN-NEXT: S_WAITCNT_DEPCTR 65507 39# GCN-NEXT: S_MOV_B32 40--- 41name: vmem_write_sgpr_chain 42body: | 43 bb.0: 44 successors: 45 $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF 46 $sgpr4 = IMPLICIT_DEF 47 $vgpr0 = IMPLICIT_DEF 48 $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 0, 0, 0, 0, 0, 0, implicit $exec 49 $sgpr5 = S_MOV_B32 $sgpr0 50 $sgpr6 = S_MOV_B32 $sgpr1 51 $sgpr7 = S_MOV_B32 $sgpr2 52 $sgpr8 = S_MOV_B32 $sgpr3 53 $sgpr0 = S_MOV_B32 0 54... 55# GCN-LABEL: name: vmem_smem_write_sgpr 56# GCN: BUFFER_LOAD_DWORD_OFFEN 57# GCN-NEXT: S_WAITCNT_DEPCTR 65507 58# GCN-NEXT: S_LOAD_DWORD_IMM 59--- 60name: vmem_smem_write_sgpr 61body: | 62 bb.0: 63 $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF 64 $sgpr4 = IMPLICIT_DEF 65 $vgpr0 = IMPLICIT_DEF 66 $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 0, 0, 0, 0, 0, 0, implicit $exec 67 $sgpr0 = S_LOAD_DWORD_IMM $sgpr0_sgpr1, 0, 0, 0 68... 69# GCN-LABEL: name: vmem_snop_write_sgpr 70# GCN: BUFFER_LOAD_DWORD_OFFEN 71# GCN-NEXT: S_NOP 72# GCN-NEXT: S_WAITCNT_DEPCTR 65507 73# GCN-NEXT: S_MOV_B32 74--- 75name: vmem_snop_write_sgpr 76body: | 77 bb.0: 78 $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF 79 $sgpr4 = IMPLICIT_DEF 80 $vgpr0 = IMPLICIT_DEF 81 $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 0, 0, 0, 0, 0, 0, implicit $exec 82 S_NOP 0 83 $sgpr0 = S_MOV_B32 0 84... 85# GCN-LABEL: name: vmem_valu_write_sgpr 86# GCN: BUFFER_LOAD_DWORD_OFFEN 87# GCN-NEXT: V_ADD_F32 88# GCN-NEXT: S_MOV_B32 89--- 90name: vmem_valu_write_sgpr 91body: | 92 bb.0: 93 $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF 94 $sgpr4 = IMPLICIT_DEF 95 $vgpr0 = IMPLICIT_DEF 96 $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 0, 0, 0, 0, 0, 0, implicit $exec 97 $vgpr2 = V_ADD_F32_e32 $vgpr1, $vgpr1, implicit $mode, implicit $exec 98 $sgpr0 = S_MOV_B32 0 99... 100# GCN-LABEL: name: vmem_swait0_write_sgpr 101# GCN: BUFFER_LOAD_DWORD_OFFEN 102# GCN-NEXT: S_WAITCNT 103# GCN-NEXT: S_MOV_B32 104--- 105name: vmem_swait0_write_sgpr 106body: | 107 bb.0: 108 $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF 109 $sgpr4 = IMPLICIT_DEF 110 $vgpr0 = IMPLICIT_DEF 111 $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 0, 0, 0, 0, 0, 0, implicit $exec 112 S_WAITCNT 0 113 $sgpr0 = S_MOV_B32 0 114... 115# GCN-LABEL: name: vmem_swait_any_write_sgpr 116# GCN: BUFFER_LOAD_DWORD_OFFEN 117# GCN-NEXT: S_WAITCNT 118# GCN-NEXT: S_WAITCNT_DEPCTR 65507 119# GCN-NEXT: S_MOV_B32 120--- 121name: vmem_swait_any_write_sgpr 122body: | 123 bb.0: 124 $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF 125 $sgpr4 = IMPLICIT_DEF 126 $vgpr0 = IMPLICIT_DEF 127 $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 0, 0, 0, 0, 0, 0, implicit $exec 128 S_WAITCNT 1 129 $sgpr0 = S_MOV_B32 0 130... 131# GCN-LABEL: name: vmem_write_exec_impread 132# GCN: BUFFER_LOAD_DWORD_OFFEN 133# GCN: S_WAITCNT_DEPCTR 65507 134# GCN-NEXT: S_MOV_B64 135--- 136name: vmem_write_exec_impread 137body: | 138 bb.0: 139 $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF 140 $sgpr4 = IMPLICIT_DEF 141 $vgpr0 = IMPLICIT_DEF 142 $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 0, 0, 0, 0, 0, 0, implicit $exec 143 $exec = S_MOV_B64 7 144... 145# GCN-LABEL: name: vmem_write_exec_expread 146# GCN: BUFFER_LOAD_DWORD_OFFEN 147# GCN-NEXT: S_WAITCNT_DEPCTR 65507 148# GCN-NEXT: S_MOV_B64 149--- 150name: vmem_write_exec_expread 151body: | 152 bb.0: 153 $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF 154 $vgpr0 = IMPLICIT_DEF 155 $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $exec_lo, 0, 0, 0, 0, 0, 0, implicit $exec 156 $exec = S_MOV_B64 7 157... 158# GCN-LABEL: name: ds_write_m0 159# GCN: DS_READ_B32 160# GCN-NEXT: S_WAITCNT_DEPCTR 65507 161# GCN-NEXT: S_MOV_B32 162--- 163name: ds_write_m0 164body: | 165 bb.0: 166 $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF 167 $sgpr4 = IMPLICIT_DEF 168 $vgpr0 = IMPLICIT_DEF 169 $vgpr1 = DS_READ_B32 $vgpr0, 0, 0, implicit $m0, implicit $exec 170 $m0 = S_MOV_B32 7 171... 172# GCN-LABEL: name: vmem_write_sgpr_fall_through 173# GCN: BUFFER_LOAD_DWORD_OFFEN 174# GCN: S_WAITCNT_DEPCTR 65507 175# GCN-NEXT: S_MOV_B32 176--- 177name: vmem_write_sgpr_fall_through 178body: | 179 bb.0: 180 successors: %bb.1 181 $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF 182 $sgpr4 = IMPLICIT_DEF 183 $vgpr0 = IMPLICIT_DEF 184 $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 0, 0, 0, 0, 0, 0, implicit $exec 185 186 bb.1: 187 $sgpr0 = S_MOV_B32 0 188... 189# GCN-LABEL: name: vmem_write_sgpr_branch 190# GCN: BUFFER_LOAD_DWORD_OFFEN 191# GCN-NEXT: S_BRANCH 192# GCN: S_WAITCNT_DEPCTR 65507 193# GCN-NEXT: S_MOV_B32 194--- 195name: vmem_write_sgpr_branch 196body: | 197 bb.0: 198 successors: %bb.1 199 $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF 200 $sgpr4 = IMPLICIT_DEF 201 $vgpr0 = IMPLICIT_DEF 202 $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 0, 0, 0, 0, 0, 0, implicit $exec 203 S_BRANCH %bb.1 204 205 bb.1: 206 $sgpr0 = S_MOV_B32 0 207... 208# GCN-LABEL: name: vmem_write_sgpr_branch_around 209# GCN: BUFFER_LOAD_DWORD_OFFEN 210# GCN-NEXT: S_BRANCH 211# GCN: bb.2: 212# GCN-NEXT: S_WAITCNT_DEPCTR 65507 213# GCN-NEXT: S_MOV_B32 214--- 215name: vmem_write_sgpr_branch_around 216body: | 217 bb.0: 218 successors: %bb.2 219 $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF 220 $sgpr4 = IMPLICIT_DEF 221 $vgpr0 = IMPLICIT_DEF 222 $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 0, 0, 0, 0, 0, 0, implicit $exec 223 S_BRANCH %bb.2 224 225 bb.1: 226 successors: %bb.2 227 S_WAITCNT 0 228 229 bb.2: 230 $sgpr0 = S_MOV_B32 0 231... 232# GCN-LABEL: name: vmem_write_sgpr_cbranch_around 233# GCN: BUFFER_LOAD_DWORD_OFFEN 234# GCN-NEXT: S_CBRANCH 235# GCN-NEXT: S_BRANCH 236# GCN: bb.1: 237# GCN: S_WAITCNT 238# GCN: V_ADD_CO_U32 239# GCN: bb.2: 240# GCN-NEXT: S_WAITCNT_DEPCTR 65507 241# GCN-NEXT: S_MOV_B32 242--- 243name: vmem_write_sgpr_cbranch_around 244body: | 245 bb.0: 246 successors: %bb.1, %bb.2 247 $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF 248 $sgpr4 = IMPLICIT_DEF 249 $vgpr0 = IMPLICIT_DEF 250 $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 0, 0, 0, 0, 0, 0, implicit $exec 251 S_CBRANCH_SCC0 %bb.2, implicit $scc 252 S_BRANCH %bb.1 253 254 bb.1: 255 successors: %bb.2 256 S_WAITCNT 0 257 $vgpr2, $vcc_lo = V_ADD_CO_U32_e64 $vgpr1, $vgpr1, 0, implicit $exec 258 S_BRANCH %bb.2 259 260 bb.2: 261 $sgpr0 = S_MOV_B32 0 262... 263# GCN-LABEL: name: vmem_write_sgpr_branch_backedge 264# GCN: $vgpr0 = IMPLICIT_DEF 265# GCN-NEXT: S_WAITCNT_DEPCTR 65507 266# GCN-NEXT: S_MOV_B32 267--- 268name: vmem_write_sgpr_branch_backedge 269body: | 270 bb.0: 271 successors: %bb.1 272 $sgpr0_sgpr1_sgpr2_sgpr3 = IMPLICIT_DEF 273 $sgpr4 = IMPLICIT_DEF 274 $vgpr0 = IMPLICIT_DEF 275 $sgpr0 = S_MOV_B32 0 276 277 bb.1: 278 $vgpr1 = BUFFER_LOAD_DWORD_OFFEN $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr4, 0, 0, 0, 0, 0, 0, implicit $exec 279 S_BRANCH %bb.0 280... 281# GCN-LABEL: name: ds_write_exec 282# GCN: DS_WRITE_B32_gfx9 283# GCN-NEXT: S_WAITCNT_DEPCTR 65507 284# GCN-NEXT: S_MOV_B32 285--- 286name: ds_write_exec 287body: | 288 bb.0: 289 $vgpr0 = IMPLICIT_DEF 290 $vgpr1 = IMPLICIT_DEF 291 DS_WRITE_B32_gfx9 $vgpr0, $vgpr1, 0, 0, implicit $exec 292 $exec_lo = S_MOV_B32 -1 293... 294# GCN-LABEL: name: vmem_scratch_exec 295# GCN: SCRATCH_LOAD_DWORD 296# GCN-NEXT: S_WAITCNT_DEPCTR 65507 297# GCN-NEXT: S_MOV_B32 298--- 299name: vmem_scratch_exec 300body: | 301 bb.0: 302 $vgpr0 = IMPLICIT_DEF 303 $vgpr1 = SCRATCH_LOAD_DWORD undef $vgpr0, 0, 0, 0, 0, implicit $exec, implicit $flat_scr 304 $exec_lo = S_MOV_B32 -1 305... 306# GCN-LABEL: name: vmem_flat_exec 307# GCN: FLAT_LOAD_DWORD 308# GCN-NEXT: S_WAITCNT_DEPCTR 65507 309# GCN-NEXT: S_MOV_B32 310--- 311name: vmem_flat_exec 312body: | 313 bb.0: 314 $vgpr0 = IMPLICIT_DEF 315 $vgpr1 = IMPLICIT_DEF 316 $vgpr2 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, 0, 0, implicit $exec, implicit $flat_scr 317 $exec_lo = S_MOV_B32 -1 318... 319# GCN-LABEL: name: vmem_global_exec 320# GCN: GLOBAL_LOAD_DWORD 321# GCN-NEXT: S_WAITCNT_DEPCTR 65507 322# GCN-NEXT: S_MOV_B32 323--- 324name: vmem_global_exec 325body: | 326 bb.0: 327 $vgpr0 = IMPLICIT_DEF 328 $vgpr1 = IMPLICIT_DEF 329 $vgpr2 = GLOBAL_LOAD_DWORD $vgpr0_vgpr1, 0, 0, 0, 0, implicit $exec 330 $exec_lo = S_MOV_B32 -1 331... 332# GCN-LABEL: name: vmem_global_atomic_exec 333# GCN: GLOBAL_ATOMIC_ADD_RTN 334# GCN-NEXT: S_WAITCNT_DEPCTR 65507 335# GCN-NEXT: S_MOV_B32 336--- 337name: vmem_global_atomic_exec 338body: | 339 bb.0: 340 $vgpr0 = IMPLICIT_DEF 341 $vgpr1 = IMPLICIT_DEF 342 $vgpr2 = IMPLICIT_DEF 343 $vgpr3 = GLOBAL_ATOMIC_ADD_RTN $vgpr0_vgpr1, $vgpr2, 0, 1, 0, implicit $exec :: (load store syncscope("agent") seq_cst 4, addrspace 1) 344 $exec_lo = S_MOV_B32 -1 345... 346