brintos

brintos / llvm-project-archived public Read only

0
0
Text · 17.2 KiB · e158142 Raw
427 lines · plain
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py2# RUN: llc -mtriple=amdgcn -mcpu=gfx908 -verify-machineinstrs -run-pass si-insert-waitcnts -o - %s | FileCheck -check-prefixes=GFX9 %s3# RUN: llc -mtriple=amdgcn -mcpu=gfx1200 -verify-machineinstrs -run-pass si-insert-waitcnts -o - %s | FileCheck -check-prefixes=GFX12 %s4 5# For gfx12+, this test simply ensures that we don't crash in the face of manually6# inserted waitcnt intrinsics. They are still allowed for compatibility, but7# their effect in the HW is very conservative and code generation does not attempt8# to do anything with them. Developers who write code at such a low level should9# revisit their code for gfx12+ anyway.10 11---12name:            test_waitcnt_preexisting_lgkmcnt_unmodified13body:             |14  bb.0:15    liveins: $vgpr016 17    ; GFX9-LABEL: name: test_waitcnt_preexisting_lgkmcnt_unmodified18    ; GFX9: liveins: $vgpr019    ; GFX9-NEXT: {{  $}}20    ; GFX9-NEXT: S_WAITCNT 021    ; GFX9-NEXT: $vgpr0_vgpr1 = DS_READ2_B32 $vgpr0, 0, 1, 0, implicit $m0, implicit $exec22    ; GFX9-NEXT: S_WAITCNT 4927923    ; GFX9-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr24    ; GFX9-NEXT: S_WAITCNT 11225    ; GFX9-NEXT: FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr26    ; GFX9-NEXT: S_ENDPGM 027    ;28    ; GFX12-LABEL: name: test_waitcnt_preexisting_lgkmcnt_unmodified29    ; GFX12: liveins: $vgpr030    ; GFX12-NEXT: {{  $}}31    ; GFX12-NEXT: S_WAIT_LOADCNT_DSCNT 032    ; GFX12-NEXT: S_WAIT_EXPCNT 033    ; GFX12-NEXT: S_WAIT_SAMPLECNT 034    ; GFX12-NEXT: S_WAIT_BVHCNT 035    ; GFX12-NEXT: S_WAIT_KMCNT 036    ; GFX12-NEXT: $vgpr0_vgpr1 = DS_READ2_B32 $vgpr0, 0, 1, 0, implicit $m0, implicit $exec37    ; GFX12-NEXT: S_WAITCNT 4927938    ; GFX12-NEXT: S_WAIT_DSCNT 039    ; GFX12-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr40    ; GFX12-NEXT: S_WAIT_LOADCNT_DSCNT 041    ; GFX12-NEXT: FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr42    ; GFX12-NEXT: S_ENDPGM 043    $vgpr0_vgpr1 = DS_READ2_B32 $vgpr0, 0, 1, 0, implicit $m0, implicit $exec44    S_WAITCNT 4927945    $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr46    FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr47    S_ENDPGM 048...49 50---51name:            test_waitcnt_preexisting_vmcnt_unmodified52body:             |53  bb.0:54    liveins: $vgpr0_vgpr155 56    ; GFX9-LABEL: name: test_waitcnt_preexisting_vmcnt_unmodified57    ; GFX9: liveins: $vgpr0_vgpr158    ; GFX9-NEXT: {{  $}}59    ; GFX9-NEXT: S_WAITCNT 060    ; GFX9-NEXT: $vgpr0_vgpr1 = GLOBAL_LOAD_DWORDX2 $vgpr0_vgpr1, 0, 0, implicit $exec61    ; GFX9-NEXT: S_WAITCNT 395262    ; GFX9-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr63    ; GFX9-NEXT: S_WAITCNT 11264    ; GFX9-NEXT: FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr65    ; GFX9-NEXT: S_ENDPGM 066    ;67    ; GFX12-LABEL: name: test_waitcnt_preexisting_vmcnt_unmodified68    ; GFX12: liveins: $vgpr0_vgpr169    ; GFX12-NEXT: {{  $}}70    ; GFX12-NEXT: S_WAIT_LOADCNT_DSCNT 071    ; GFX12-NEXT: S_WAIT_EXPCNT 072    ; GFX12-NEXT: S_WAIT_SAMPLECNT 073    ; GFX12-NEXT: S_WAIT_BVHCNT 074    ; GFX12-NEXT: S_WAIT_KMCNT 075    ; GFX12-NEXT: $vgpr0_vgpr1 = GLOBAL_LOAD_DWORDX2 $vgpr0_vgpr1, 0, 0, implicit $exec76    ; GFX12-NEXT: S_WAITCNT 395277    ; GFX12-NEXT: S_WAIT_LOADCNT 078    ; GFX12-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr79    ; GFX12-NEXT: S_WAIT_LOADCNT_DSCNT 080    ; GFX12-NEXT: FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr81    ; GFX12-NEXT: S_ENDPGM 082    $vgpr0_vgpr1 = GLOBAL_LOAD_DWORDX2 $vgpr0_vgpr1, 0, 0, implicit $exec83    S_WAITCNT 395284    $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr85    FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr86    S_ENDPGM 087...88 89# Respect preexisting waitcnt and add required wait.90 91---92name:            test_waitcnt_preexisting_vmcnt_needs_lgkmcnt93body:             |94  bb.0:95    liveins: $vgpr096 97    ; GFX9-LABEL: name: test_waitcnt_preexisting_vmcnt_needs_lgkmcnt98    ; GFX9: liveins: $vgpr099    ; GFX9-NEXT: {{  $}}100    ; GFX9-NEXT: S_WAITCNT 0101    ; GFX9-NEXT: $vgpr0_vgpr1 = DS_READ2_B32 $vgpr0, 0, 1, 0, implicit $m0, implicit $exec102    ; GFX9-NEXT: S_WAITCNT 112103    ; GFX9-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr104    ; GFX9-NEXT: S_WAITCNT 112105    ; GFX9-NEXT: FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr106    ; GFX9-NEXT: S_ENDPGM 0107    ;108    ; GFX12-LABEL: name: test_waitcnt_preexisting_vmcnt_needs_lgkmcnt109    ; GFX12: liveins: $vgpr0110    ; GFX12-NEXT: {{  $}}111    ; GFX12-NEXT: S_WAIT_LOADCNT_DSCNT 0112    ; GFX12-NEXT: S_WAIT_EXPCNT 0113    ; GFX12-NEXT: S_WAIT_SAMPLECNT 0114    ; GFX12-NEXT: S_WAIT_BVHCNT 0115    ; GFX12-NEXT: S_WAIT_KMCNT 0116    ; GFX12-NEXT: $vgpr0_vgpr1 = DS_READ2_B32 $vgpr0, 0, 1, 0, implicit $m0, implicit $exec117    ; GFX12-NEXT: S_WAITCNT 3952118    ; GFX12-NEXT: S_WAIT_DSCNT 0119    ; GFX12-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr120    ; GFX12-NEXT: S_WAIT_LOADCNT_DSCNT 0121    ; GFX12-NEXT: FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr122    ; GFX12-NEXT: S_ENDPGM 0123    $vgpr0_vgpr1 = DS_READ2_B32 $vgpr0, 0, 1, 0, implicit $m0, implicit $exec124    S_WAITCNT 3952125    $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr126    FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr127    S_ENDPGM 0128...129 130---131name:            test_waitcnt_preexisting_lgkmcnt_needs_vmcnt132body:             |133  bb.0:134    liveins: $vgpr0_vgpr1135 136    ; GFX9-LABEL: name: test_waitcnt_preexisting_lgkmcnt_needs_vmcnt137    ; GFX9: liveins: $vgpr0_vgpr1138    ; GFX9-NEXT: {{  $}}139    ; GFX9-NEXT: S_WAITCNT 0140    ; GFX9-NEXT: $vgpr0_vgpr1 = GLOBAL_LOAD_DWORDX2 $vgpr0_vgpr1, 0, 0, implicit $exec141    ; GFX9-NEXT: S_WAITCNT 112142    ; GFX9-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr143    ; GFX9-NEXT: S_WAITCNT 112144    ; GFX9-NEXT: FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr145    ; GFX9-NEXT: S_ENDPGM 0146    ;147    ; GFX12-LABEL: name: test_waitcnt_preexisting_lgkmcnt_needs_vmcnt148    ; GFX12: liveins: $vgpr0_vgpr1149    ; GFX12-NEXT: {{  $}}150    ; GFX12-NEXT: S_WAIT_LOADCNT_DSCNT 0151    ; GFX12-NEXT: S_WAIT_EXPCNT 0152    ; GFX12-NEXT: S_WAIT_SAMPLECNT 0153    ; GFX12-NEXT: S_WAIT_BVHCNT 0154    ; GFX12-NEXT: S_WAIT_KMCNT 0155    ; GFX12-NEXT: $vgpr0_vgpr1 = GLOBAL_LOAD_DWORDX2 $vgpr0_vgpr1, 0, 0, implicit $exec156    ; GFX12-NEXT: S_WAITCNT 49279157    ; GFX12-NEXT: S_WAIT_LOADCNT 0158    ; GFX12-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr159    ; GFX12-NEXT: S_WAIT_LOADCNT_DSCNT 0160    ; GFX12-NEXT: FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr161    ; GFX12-NEXT: S_ENDPGM 0162    $vgpr0_vgpr1 = GLOBAL_LOAD_DWORDX2 $vgpr0_vgpr1, 0, 0, implicit $exec163    S_WAITCNT 49279164    $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr165    FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr166    S_ENDPGM 0167...168 169# Apply wait for all counters from preexisting waitcnt regardless of the wait170# required by the next instruction.171 172---173name:            test_waitcnt_preexisting_apply_all_counters174body:             |175  bb.0:176    liveins: $vgpr0_vgpr1, $vgpr2177 178    ; GFX9-LABEL: name: test_waitcnt_preexisting_apply_all_counters179    ; GFX9: liveins: $vgpr0_vgpr1, $vgpr2180    ; GFX9-NEXT: {{  $}}181    ; GFX9-NEXT: S_WAITCNT 0182    ; GFX9-NEXT: $vgpr4_vgpr5 = GLOBAL_LOAD_DWORDX2 $vgpr0_vgpr1, 0, 0, implicit $exec183    ; GFX9-NEXT: $vgpr6_vgpr7 = DS_READ2_B32 $vgpr2, 0, 1, 0, implicit $m0, implicit $exec184    ; GFX9-NEXT: S_WAITCNT 0185    ; GFX9-NEXT: $vgpr6 = V_OR_B32_e32 1, killed $vgpr6, implicit $exec186    ; GFX9-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr4_vgpr5, 0, 0, implicit $exec, implicit $flat_scr187    ; GFX9-NEXT: S_WAITCNT 112188    ; GFX9-NEXT: FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr189    ;190    ; GFX12-LABEL: name: test_waitcnt_preexisting_apply_all_counters191    ; GFX12: liveins: $vgpr0_vgpr1, $vgpr2192    ; GFX12-NEXT: {{  $}}193    ; GFX12-NEXT: S_WAIT_LOADCNT_DSCNT 0194    ; GFX12-NEXT: S_WAIT_EXPCNT 0195    ; GFX12-NEXT: S_WAIT_SAMPLECNT 0196    ; GFX12-NEXT: S_WAIT_BVHCNT 0197    ; GFX12-NEXT: S_WAIT_KMCNT 0198    ; GFX12-NEXT: $vgpr4_vgpr5 = GLOBAL_LOAD_DWORDX2 $vgpr0_vgpr1, 0, 0, implicit $exec199    ; GFX12-NEXT: $vgpr6_vgpr7 = DS_READ2_B32 $vgpr2, 0, 1, 0, implicit $m0, implicit $exec200    ; GFX12-NEXT: S_WAITCNT 0201    ; GFX12-NEXT: S_WAIT_DSCNT 0202    ; GFX12-NEXT: $vgpr6 = V_OR_B32_e32 1, killed $vgpr6, implicit $exec203    ; GFX12-NEXT: S_WAIT_LOADCNT 0204    ; GFX12-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr4_vgpr5, 0, 0, implicit $exec, implicit $flat_scr205    ; GFX12-NEXT: S_WAIT_LOADCNT_DSCNT 0206    ; GFX12-NEXT: FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr207    $vgpr4_vgpr5 = GLOBAL_LOAD_DWORDX2 $vgpr0_vgpr1, 0, 0, implicit $exec208    $vgpr6_vgpr7 = DS_READ2_B32 $vgpr2, 0, 1, 0, implicit $m0, implicit $exec209    S_WAITCNT 0210    $vgpr6 = V_OR_B32_e32 1, killed $vgpr6, implicit $exec211    $vgpr0 = FLAT_LOAD_DWORD $vgpr4_vgpr5, 0, 0, implicit $exec, implicit $flat_scr212    FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr213...214 215---216name:            test_waitcnt_preexisting_combine_waitcnt217body:             |218  bb.0:219    liveins: $vgpr0_vgpr1220 221    ; GFX9-LABEL: name: test_waitcnt_preexisting_combine_waitcnt222    ; GFX9: liveins: $vgpr0_vgpr1223    ; GFX9-NEXT: {{  $}}224    ; GFX9-NEXT: S_WAITCNT 0225    ; GFX9-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr226    ; GFX9-NEXT: S_WAITCNT 0227    ; GFX9-NEXT: FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr228    ;229    ; GFX12-LABEL: name: test_waitcnt_preexisting_combine_waitcnt230    ; GFX12: liveins: $vgpr0_vgpr1231    ; GFX12-NEXT: {{  $}}232    ; GFX12-NEXT: S_WAIT_LOADCNT_DSCNT 0233    ; GFX12-NEXT: S_WAIT_EXPCNT 0234    ; GFX12-NEXT: S_WAIT_SAMPLECNT 0235    ; GFX12-NEXT: S_WAIT_BVHCNT 0236    ; GFX12-NEXT: S_WAIT_KMCNT 0237    ; GFX12-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr238    ; GFX12-NEXT: S_WAITCNT 0239    ; GFX12-NEXT: S_WAITCNT 0240    ; GFX12-NEXT: S_WAITCNT 0241    ; GFX12-NEXT: S_WAITCNT 0242    ; GFX12-NEXT: S_WAITCNT 0243    ; GFX12-NEXT: S_WAITCNT 0244    ; GFX12-NEXT: S_WAIT_LOADCNT_DSCNT 0245    ; GFX12-NEXT: FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr246    $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr247    S_WAITCNT 0248    S_WAITCNT 0249    S_WAITCNT 0250    S_WAITCNT 0251    S_WAITCNT 0252    S_WAITCNT 0253    FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr254...255 256---257name:            test_waitcnt_preexisting_combine_waitcnt_diff_counters258body:             |259  bb.0:260    liveins: $vgpr0_vgpr1261 262    ; GFX9-LABEL: name: test_waitcnt_preexisting_combine_waitcnt_diff_counters263    ; GFX9: liveins: $vgpr0_vgpr1264    ; GFX9-NEXT: {{  $}}265    ; GFX9-NEXT: S_WAITCNT 0266    ; GFX9-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr267    ; GFX9-NEXT: S_WAITCNT 112268    ; GFX9-NEXT: FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr269    ;270    ; GFX12-LABEL: name: test_waitcnt_preexisting_combine_waitcnt_diff_counters271    ; GFX12: liveins: $vgpr0_vgpr1272    ; GFX12-NEXT: {{  $}}273    ; GFX12-NEXT: S_WAIT_LOADCNT_DSCNT 0274    ; GFX12-NEXT: S_WAIT_EXPCNT 0275    ; GFX12-NEXT: S_WAIT_SAMPLECNT 0276    ; GFX12-NEXT: S_WAIT_BVHCNT 0277    ; GFX12-NEXT: S_WAIT_KMCNT 0278    ; GFX12-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr279    ; GFX12-NEXT: S_WAITCNT 49279280    ; GFX12-NEXT: S_WAITCNT 3952281    ; GFX12-NEXT: S_WAIT_LOADCNT_DSCNT 0282    ; GFX12-NEXT: FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr283    $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr284    S_WAITCNT 49279285    S_WAITCNT 3952286    FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr287...288 289# Apply preexisting waitcnt when no wait is immediately needed.290# FIXME: Move waitcnt as late as possible.291 292---293name:            test_waitcnt_preexisting_early_wait294body:             |295  bb.0:296    liveins: $vgpr0_vgpr1297 298    ; GFX9-LABEL: name: test_waitcnt_preexisting_early_wait299    ; GFX9: liveins: $vgpr0_vgpr1300    ; GFX9-NEXT: {{  $}}301    ; GFX9-NEXT: S_WAITCNT 0302    ; GFX9-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr303    ; GFX9-NEXT: S_WAITCNT 0304    ; GFX9-NEXT: S_NOP 0305    ; GFX9-NEXT: S_NOP 0306    ; GFX9-NEXT: S_NOP 0307    ; GFX9-NEXT: FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr308    ; GFX9-NEXT: S_ENDPGM 0309    ;310    ; GFX12-LABEL: name: test_waitcnt_preexisting_early_wait311    ; GFX12: liveins: $vgpr0_vgpr1312    ; GFX12-NEXT: {{  $}}313    ; GFX12-NEXT: S_WAIT_LOADCNT_DSCNT 0314    ; GFX12-NEXT: S_WAIT_EXPCNT 0315    ; GFX12-NEXT: S_WAIT_SAMPLECNT 0316    ; GFX12-NEXT: S_WAIT_BVHCNT 0317    ; GFX12-NEXT: S_WAIT_KMCNT 0318    ; GFX12-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr319    ; GFX12-NEXT: S_WAITCNT 0320    ; GFX12-NEXT: S_NOP 0321    ; GFX12-NEXT: S_NOP 0322    ; GFX12-NEXT: S_NOP 0323    ; GFX12-NEXT: S_WAIT_LOADCNT_DSCNT 0324    ; GFX12-NEXT: FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr325    ; GFX12-NEXT: S_ENDPGM 0326    $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr327    S_WAITCNT 0328    S_NOP 0329    S_NOP 0330    S_NOP 0331    FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr332    S_ENDPGM 0333...334 335---336name:            test_waitcnt_preexisting_ignore_kill337body:             |338  bb.0:339    liveins: $vgpr0_vgpr1340 341    ; GFX9-LABEL: name: test_waitcnt_preexisting_ignore_kill342    ; GFX9: liveins: $vgpr0_vgpr1343    ; GFX9-NEXT: {{  $}}344    ; GFX9-NEXT: S_WAITCNT 0345    ; GFX9-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr346    ; GFX9-NEXT: S_WAITCNT 3952347    ; GFX9-NEXT: KILL $vgpr0348    ;349    ; GFX12-LABEL: name: test_waitcnt_preexisting_ignore_kill350    ; GFX12: liveins: $vgpr0_vgpr1351    ; GFX12-NEXT: {{  $}}352    ; GFX12-NEXT: S_WAIT_LOADCNT_DSCNT 0353    ; GFX12-NEXT: S_WAIT_EXPCNT 0354    ; GFX12-NEXT: S_WAIT_SAMPLECNT 0355    ; GFX12-NEXT: S_WAIT_BVHCNT 0356    ; GFX12-NEXT: S_WAIT_KMCNT 0357    ; GFX12-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr358    ; GFX12-NEXT: S_WAITCNT 3952359    ; GFX12-NEXT: KILL $vgpr0360    $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr361    S_WAITCNT 3952362    KILL $vgpr0363...364 365# Combine preexisting waitcnt with wait added to the start of a non-entry function.366 367---368name:            test_waitcnt_preexisting_func_start369body:             |370  bb.0:371    ; GFX9-LABEL: name: test_waitcnt_preexisting_func_start372    ; GFX9: S_WAITCNT 0373    ; GFX9-NEXT: S_ENDPGM 0374    ;375    ; GFX12-LABEL: name: test_waitcnt_preexisting_func_start376    ; GFX12: S_WAIT_LOADCNT_DSCNT 0377    ; GFX12-NEXT: S_WAIT_EXPCNT 0378    ; GFX12-NEXT: S_WAIT_SAMPLECNT 0379    ; GFX12-NEXT: S_WAIT_BVHCNT 0380    ; GFX12-NEXT: S_WAIT_KMCNT 0381    ; GFX12-NEXT: S_WAITCNT 0382    ; GFX12-NEXT: S_ENDPGM 0383    S_WAITCNT 0384    S_ENDPGM 0385...386 387# Verify that extra waitcnt are not added after buffer invalidate instructions.388 389---390name:            test_waitcnt_preexisting_buffer_inv391body:             |392  bb.0:393    ; GFX9-LABEL: name: test_waitcnt_preexisting_buffer_inv394    ; GFX9: S_WAITCNT 0395    ; GFX9-NEXT: $vgpr0_vgpr1 = GLOBAL_LOAD_DWORDX2 $vgpr0_vgpr1, 0, 0, implicit $exec396    ; GFX9-NEXT: S_WAITCNT 3952397    ; GFX9-NEXT: BUFFER_INVL2 implicit $exec398    ; GFX9-NEXT: BUFFER_WBINVL1_VOL implicit $exec399    ; GFX9-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr400    ; GFX9-NEXT: S_WAITCNT 112401    ; GFX9-NEXT: FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr402    ; GFX9-NEXT: S_ENDPGM 0403    ;404    ; GFX12-LABEL: name: test_waitcnt_preexisting_buffer_inv405    ; GFX12: S_WAIT_LOADCNT_DSCNT 0406    ; GFX12-NEXT: S_WAIT_EXPCNT 0407    ; GFX12-NEXT: S_WAIT_SAMPLECNT 0408    ; GFX12-NEXT: S_WAIT_BVHCNT 0409    ; GFX12-NEXT: S_WAIT_KMCNT 0410    ; GFX12-NEXT: $vgpr0_vgpr1 = GLOBAL_LOAD_DWORDX2 $vgpr0_vgpr1, 0, 0, implicit $exec411    ; GFX12-NEXT: S_WAITCNT 3952412    ; GFX12-NEXT: BUFFER_INVL2 implicit $exec413    ; GFX12-NEXT: S_WAIT_LOADCNT 0414    ; GFX12-NEXT: BUFFER_WBINVL1_VOL implicit $exec415    ; GFX12-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr416    ; GFX12-NEXT: S_WAIT_LOADCNT_DSCNT 0417    ; GFX12-NEXT: FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr418    ; GFX12-NEXT: S_ENDPGM 0419    $vgpr0_vgpr1 = GLOBAL_LOAD_DWORDX2 $vgpr0_vgpr1, 0, 0, implicit $exec420    S_WAITCNT 3952421    BUFFER_INVL2 implicit $exec422    BUFFER_WBINVL1_VOL implicit $exec423    $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr424    FLAT_STORE_DWORD $vgpr0_vgpr1, $vgpr0, 0, 0, implicit $exec, implicit $flat_scr425    S_ENDPGM 0426...427