348 lines · plain
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py2# RUN: llc -mtriple=amdgcn -mcpu=gfx1200 -run-pass post-RA-hazard-rec,amdgpu-wait-sgpr-hazards -o - %s | FileCheck -check-prefix=GCN %s3 4--- |5 define amdgpu_gs void @hazard_disable() #0 { ret void }6 define amdgpu_gs void @hazard_enable() #1 { ret void }7 define amdgpu_cs void @hazard_calls() #2 { ret void }8 define void @hazard_callee1() #2 { ret void }9 define void @hazard_callee2() #2 { ret void }10 define amdgpu_cs void @hazard_cull_vmem() #3 { ret void }11 define amdgpu_cs void @hazard_cull_vmem2() #4 { ret void }12 define amdgpu_cs void @hazard_cull_sample() #3 { ret void }13 define amdgpu_cs void @hazard_cull_bvh() #3 { ret void }14 define amdgpu_cs void @hazard_nocull_scratch() #3 { ret void }15 define amdgpu_cs void @hazard_cull_global() #3 { ret void }16 define amdgpu_cs void @hazard_nocull_flat() #3 { ret void }17 18 attributes #0 = { "amdgpu-sgpr-hazard-wait"="0" }19 attributes #1 = { "amdgpu-sgpr-hazard-wait"="1" }20 attributes #2 = { "amdgpu-sgpr-hazard-boundary-cull" }21 attributes #3 = { "amdgpu-sgpr-hazard-mem-wait-cull" "amdgpu-sgpr-hazard-mem-wait-cull-threshold"="1" }22 attributes #4 = { "amdgpu-sgpr-hazard-mem-wait-cull" "amdgpu-sgpr-hazard-mem-wait-cull-threshold"="2" }23...24 25---26name: hazard_disable27body: |28 bb.0:29 ; GCN-LABEL: name: hazard_disable30 ; GCN: $vgpr1 = V_CNDMASK_B32_e64 0, $vgpr1, 0, $vgpr2, $sgpr0, implicit $exec31 ; GCN-NEXT: $sgpr0_sgpr1 = S_GETPC_B6432 ; GCN-NEXT: $sgpr3 = S_ADD_U32 $sgpr0, 0, implicit-def $scc33 ; GCN-NEXT: S_ENDPGM 034 $vgpr1 = V_CNDMASK_B32_e64 0, $vgpr1, 0, $vgpr2, $sgpr0, implicit $exec35 $sgpr0_sgpr1 = S_GETPC_B6436 $sgpr3 = S_ADD_U32 $sgpr0, 0, implicit-def $scc37 S_ENDPGM 038...39 40---41name: hazard_enable42body: |43 bb.0:44 ; GCN-LABEL: name: hazard_enable45 ; GCN: $vgpr1 = V_CNDMASK_B32_e64 0, $vgpr1, 0, $vgpr2, $sgpr0, implicit $exec46 ; GCN-NEXT: $sgpr0_sgpr1 = S_GETPC_B6447 ; GCN-NEXT: S_WAITCNT_DEPCTR 6543848 ; GCN-NEXT: $sgpr3 = S_ADD_U32 $sgpr0, 0, implicit-def $scc49 ; GCN-NEXT: S_ENDPGM 050 $vgpr1 = V_CNDMASK_B32_e64 0, $vgpr1, 0, $vgpr2, $sgpr0, implicit $exec51 $sgpr0_sgpr1 = S_GETPC_B6452 $sgpr3 = S_ADD_U32 $sgpr0, 0, implicit-def $scc53 S_ENDPGM 054...55 56---57name: hazard_calls58frameInfo:59 hasCalls: true60body: |61 ; GCN-LABEL: name: hazard_calls62 ; GCN: bb.0:63 ; GCN-NEXT: successors: %bb.2(0x40000000), %bb.1(0x40000000)64 ; GCN-NEXT: {{ $}}65 ; GCN-NEXT: $vgpr0 = V_WRITELANE_B32 0, $sgpr4, $vgpr066 ; GCN-NEXT: $vgpr0 = V_WRITELANE_B32 1, $sgpr8, $vgpr067 ; GCN-NEXT: $vgpr0 = V_WRITELANE_B32 2, $sgpr16, $vgpr068 ; GCN-NEXT: $vgpr0 = V_WRITELANE_B32 3, $sgpr18, $vgpr069 ; GCN-NEXT: $vgpr0 = V_WRITELANE_B32 4, $sgpr20, $vgpr070 ; GCN-NEXT: $vgpr0 = V_WRITELANE_B32 5, $sgpr22, $vgpr071 ; GCN-NEXT: S_CBRANCH_SCC0 %bb.2, implicit $scc72 ; GCN-NEXT: S_BRANCH %bb.173 ; GCN-NEXT: {{ $}}74 ; GCN-NEXT: bb.1:75 ; GCN-NEXT: successors: %bb.3(0x40000000), %bb.4(0x40000000)76 ; GCN-NEXT: {{ $}}77 ; GCN-NEXT: S_CBRANCH_SCC0 %bb.3, implicit $scc78 ; GCN-NEXT: S_BRANCH %bb.479 ; GCN-NEXT: {{ $}}80 ; GCN-NEXT: bb.2:81 ; GCN-NEXT: $sgpr16 = S_MOV_B32 082 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec83 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec84 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec85 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec86 ; GCN-NEXT: S_WAITCNT_DEPCTR 6543887 ; GCN-NEXT: S_SETPC_B64 $sgpr0_sgpr188 ; GCN-NEXT: {{ $}}89 ; GCN-NEXT: bb.3:90 ; GCN-NEXT: $sgpr18 = S_MOV_B32 091 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec92 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec93 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec94 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec95 ; GCN-NEXT: S_WAITCNT_DEPCTR 6543896 ; GCN-NEXT: S_SETPC_B64_return $sgpr0_sgpr197 ; GCN-NEXT: {{ $}}98 ; GCN-NEXT: bb.4:99 ; GCN-NEXT: successors: %bb.5(0x80000000)100 ; GCN-NEXT: {{ $}}101 ; GCN-NEXT: $vcc_lo = S_MOV_B32 0102 ; GCN-NEXT: $sgpr20 = S_MOV_B32 0103 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec104 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec105 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec106 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec107 ; GCN-NEXT: S_WAITCNT_DEPCTR 65438108 ; GCN-NEXT: $sgpr4_sgpr5 = S_SWAPPC_B64 $sgpr2_sgpr3109 ; GCN-NEXT: $sgpr4 = S_ADD_U32 $sgpr4, 0, implicit-def $scc110 ; GCN-NEXT: {{ $}}111 ; GCN-NEXT: bb.5:112 ; GCN-NEXT: successors: %bb.6(0x80000000)113 ; GCN-NEXT: {{ $}}114 ; GCN-NEXT: $sgpr8_sgpr9 = S_CALL_B64 0115 ; GCN-NEXT: {{ $}}116 ; GCN-NEXT: bb.6:117 ; GCN-NEXT: $sgpr22 = S_MOV_B32 $sgpr8118 ; GCN-NEXT: S_ENDPGM 0119 bb.0:120 $vgpr0 = V_WRITELANE_B32 0, $sgpr4, $vgpr0121 $vgpr0 = V_WRITELANE_B32 1, $sgpr8, $vgpr0122 $vgpr0 = V_WRITELANE_B32 2, $sgpr16, $vgpr0123 $vgpr0 = V_WRITELANE_B32 3, $sgpr18, $vgpr0124 $vgpr0 = V_WRITELANE_B32 4, $sgpr20, $vgpr0125 $vgpr0 = V_WRITELANE_B32 5, $sgpr22, $vgpr0126 S_CBRANCH_SCC0 %bb.2, implicit $scc127 S_BRANCH %bb.1128 129 bb.1:130 S_CBRANCH_SCC0 %bb.3, implicit $scc131 S_BRANCH %bb.4132 133 bb.2:134 $sgpr16 = S_MOV_B32 0135 S_SETPC_B64 $sgpr0_sgpr1136 137 bb.3:138 $sgpr18 = S_MOV_B32 0139 S_SETPC_B64_return $sgpr0_sgpr1140 141 bb.4:142 $vcc_lo = S_MOV_B32 0143 $sgpr20 = S_MOV_B32 0144 $sgpr4_sgpr5 = S_SWAPPC_B64 $sgpr2_sgpr3145 $sgpr4 = S_ADD_U32 $sgpr4, 0, implicit-def $scc146 147 bb.5:148 $sgpr8_sgpr9 = S_CALL_B64 0149 150 bb.6:151 $sgpr22 = S_MOV_B32 $sgpr8152 S_ENDPGM 0153...154 155---156name: hazard_callee1157body: |158 bb.0:159 ; GCN-LABEL: name: hazard_callee1160 ; GCN: $sgpr1 = S_CSELECT_B32 -1, 0, implicit $scc161 ; GCN-NEXT: $sgpr2 = S_ADD_U32 $sgpr1, 0, implicit-def $scc162 ; GCN-NEXT: S_SETPC_B64_return $sgpr30_sgpr31163 $sgpr1 = S_CSELECT_B32 -1, 0, implicit $scc164 $sgpr2 = S_ADD_U32 $sgpr1, 0, implicit-def $scc165 S_SETPC_B64_return $sgpr30_sgpr31166...167 168---169name: hazard_callee2170body: |171 bb.0:172 ; GCN-LABEL: name: hazard_callee2173 ; GCN: $vgpr1, $sgpr0 = V_ADDC_U32_e64 0, $vgpr1, $sgpr0, 0, implicit $exec174 ; GCN-NEXT: $sgpr1 = S_CSELECT_B32 -1, 0, implicit $scc175 ; GCN-NEXT: S_WAITCNT_DEPCTR 65438176 ; GCN-NEXT: $sgpr2 = S_ADD_U32 $sgpr1, 0, implicit-def $scc177 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec178 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec179 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec180 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec181 ; GCN-NEXT: S_SETPC_B64_return $sgpr30_sgpr31182 $vgpr1, $sgpr0 = V_ADDC_U32_e64 0, $vgpr1, $sgpr0, 0, implicit $exec183 $sgpr1 = S_CSELECT_B32 -1, 0, implicit $scc184 $sgpr2 = S_ADD_U32 $sgpr1, 0, implicit-def $scc185 S_SETPC_B64_return $sgpr30_sgpr31186...187 188---189name: hazard_cull_vmem190body: |191 bb.0:192 ; GCN-LABEL: name: hazard_cull_vmem193 ; GCN: $vgpr1, $sgpr0 = V_ADDC_U32_e64 0, $vgpr1, $sgpr0, 0, implicit $exec194 ; GCN-NEXT: $vgpr3 = BUFFER_LOAD_DWORD_OFFSET $sgpr4_sgpr5_sgpr6_sgpr7, $sgpr8, 0, 0, 0, implicit $exec195 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec196 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec197 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec198 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec199 ; GCN-NEXT: S_WAIT_LOADCNT 0200 ; GCN-NEXT: $sgpr0_sgpr1 = S_GETPC_B64201 ; GCN-NEXT: $sgpr3 = S_ADD_U32 $sgpr0, 0, implicit-def $scc202 ; GCN-NEXT: S_ENDPGM 0203 $vgpr1, $sgpr0 = V_ADDC_U32_e64 0, $vgpr1, $sgpr0, 0, implicit $exec204 $vgpr3 = BUFFER_LOAD_DWORD_OFFSET $sgpr4_sgpr5_sgpr6_sgpr7, $sgpr8, 0, 0, 0, implicit $exec205 S_WAIT_LOADCNT 0206 $sgpr0_sgpr1 = S_GETPC_B64207 $sgpr3 = S_ADD_U32 $sgpr0, 0, implicit-def $scc208 S_ENDPGM 0209...210 211---212name: hazard_cull_vmem2213body: |214 bb.0:215 ; GCN-LABEL: name: hazard_cull_vmem2216 ; GCN: $vgpr1, $sgpr0 = V_ADDC_U32_e64 0, $vgpr1, $sgpr0, 0, implicit $exec217 ; GCN-NEXT: $vgpr3 = BUFFER_LOAD_DWORD_OFFSET $sgpr4_sgpr5_sgpr6_sgpr7, $sgpr8, 0, 0, 0, implicit $exec218 ; GCN-NEXT: S_WAIT_LOADCNT 0219 ; GCN-NEXT: $vgpr1, $sgpr0 = V_ADDC_U32_e64 0, $vgpr1, $sgpr2, 0, implicit $exec220 ; GCN-NEXT: $vgpr4 = BUFFER_LOAD_DWORD_OFFSET $sgpr4_sgpr5_sgpr6_sgpr7, $sgpr8, 0, 0, 0, implicit $exec221 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec222 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec223 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec224 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec225 ; GCN-NEXT: S_WAIT_LOADCNT 0226 ; GCN-NEXT: $sgpr0_sgpr1 = S_GETPC_B64227 ; GCN-NEXT: $sgpr3 = S_ADD_U32 $sgpr0, 0, implicit-def $scc228 ; GCN-NEXT: S_ENDPGM 0229 $vgpr1, $sgpr0 = V_ADDC_U32_e64 0, $vgpr1, $sgpr0, 0, implicit $exec230 $vgpr3 = BUFFER_LOAD_DWORD_OFFSET $sgpr4_sgpr5_sgpr6_sgpr7, $sgpr8, 0, 0, 0, implicit $exec231 S_WAIT_LOADCNT 0232 $vgpr1, $sgpr0 = V_ADDC_U32_e64 0, $vgpr1, $sgpr2, 0, implicit $exec233 $vgpr4 = BUFFER_LOAD_DWORD_OFFSET $sgpr4_sgpr5_sgpr6_sgpr7, $sgpr8, 0, 0, 0, implicit $exec234 S_WAIT_LOADCNT 0235 $sgpr0_sgpr1 = S_GETPC_B64236 $sgpr3 = S_ADD_U32 $sgpr0, 0, implicit-def $scc237 S_ENDPGM 0238...239 240---241name: hazard_cull_sample242body: |243 bb.0:244 ; GCN-LABEL: name: hazard_cull_sample245 ; GCN: $vgpr1, $sgpr0 = V_ADDC_U32_e64 0, $vgpr1, $sgpr0, 0, implicit $exec246 ; GCN-NEXT: $vgpr10 = IMAGE_SAMPLE_LZ_V1_V2_gfx12 $vgpr3, $vgpr4, $sgpr0_sgpr1_sgpr2_sgpr3_sgpr4_sgpr5_sgpr6_sgpr7, $sgpr8_sgpr9_sgpr10_sgpr11, 1, 1, -1, 0, 0, 0, 0, 0, 0, implicit $exec :: (load (s128))247 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec248 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec249 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec250 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec251 ; GCN-NEXT: S_WAIT_SAMPLECNT 0252 ; GCN-NEXT: $sgpr0_sgpr1 = S_GETPC_B64253 ; GCN-NEXT: $sgpr3 = S_ADD_U32 $sgpr0, 0, implicit-def $scc254 ; GCN-NEXT: S_ENDPGM 0255 $vgpr1, $sgpr0 = V_ADDC_U32_e64 0, $vgpr1, $sgpr0, 0, implicit $exec256 $vgpr10 = IMAGE_SAMPLE_LZ_V1_V2_gfx12 $vgpr3, $vgpr4, $sgpr0_sgpr1_sgpr2_sgpr3_sgpr4_sgpr5_sgpr6_sgpr7, $sgpr8_sgpr9_sgpr10_sgpr11, 1, 1, -1, 0, 0, 0, 0, 0, 0, implicit $exec :: (load (s128))257 S_WAIT_SAMPLECNT 0258 $sgpr0_sgpr1 = S_GETPC_B64259 $sgpr3 = S_ADD_U32 $sgpr0, 0, implicit-def $scc260 S_ENDPGM 0261...262 263---264name: hazard_cull_bvh265body: |266 bb.0:267 ; GCN-LABEL: name: hazard_cull_bvh268 ; GCN: $vgpr1, $sgpr0 = V_ADDC_U32_e64 0, $vgpr1, $sgpr0, 0, implicit $exec269 ; GCN-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = IMAGE_BVH_INTERSECT_RAY_sa_gfx11 $vgpr4_vgpr5_vgpr6_vgpr7_vgpr8_vgpr9_vgpr10_vgpr11_vgpr12_vgpr13_vgpr14, renamable $sgpr0_sgpr1_sgpr2_sgpr3, 0, implicit $exec :: (dereferenceable load (s128), addrspace 7)270 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec271 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec272 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec273 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec274 ; GCN-NEXT: S_WAIT_BVHCNT 0275 ; GCN-NEXT: $sgpr0_sgpr1 = S_GETPC_B64276 ; GCN-NEXT: $sgpr3 = S_ADD_U32 $sgpr0, 0, implicit-def $scc277 ; GCN-NEXT: S_ENDPGM 0278 $vgpr1, $sgpr0 = V_ADDC_U32_e64 0, $vgpr1, $sgpr0, 0, implicit $exec279 $vgpr0_vgpr1_vgpr2_vgpr3 = IMAGE_BVH_INTERSECT_RAY_sa_gfx11 $vgpr4_vgpr5_vgpr6_vgpr7_vgpr8_vgpr9_vgpr10_vgpr11_vgpr12_vgpr13_vgpr14, renamable $sgpr0_sgpr1_sgpr2_sgpr3, 0, implicit $exec :: (dereferenceable load (s128), addrspace 7)280 S_WAIT_BVHCNT 0281 $sgpr0_sgpr1 = S_GETPC_B64282 $sgpr3 = S_ADD_U32 $sgpr0, 0, implicit-def $scc283 S_ENDPGM 0284...285 286---287name: hazard_nocull_scratch288body: |289 bb.0:290 ; GCN-LABEL: name: hazard_nocull_scratch291 ; GCN: $vgpr1, $sgpr0 = V_ADDC_U32_e64 0, $vgpr1, $sgpr0, 0, implicit $exec292 ; GCN-NEXT: $vgpr0 = SCRATCH_LOAD_DWORD $vgpr0, 0, 0, implicit $exec, implicit $flat_scr293 ; GCN-NEXT: S_WAIT_LOADCNT 0294 ; GCN-NEXT: $sgpr0_sgpr1 = S_GETPC_B64295 ; GCN-NEXT: S_WAITCNT_DEPCTR 65438296 ; GCN-NEXT: $sgpr3 = S_ADD_U32 $sgpr0, 0, implicit-def $scc297 ; GCN-NEXT: S_ENDPGM 0298 $vgpr1, $sgpr0 = V_ADDC_U32_e64 0, $vgpr1, $sgpr0, 0, implicit $exec299 $vgpr0 = SCRATCH_LOAD_DWORD $vgpr0, 0, 0, implicit $exec, implicit $flat_scr300 S_WAIT_LOADCNT 0301 $sgpr0_sgpr1 = S_GETPC_B64302 $sgpr3 = S_ADD_U32 $sgpr0, 0, implicit-def $scc303 S_ENDPGM 0304...305 306---307name: hazard_cull_global308body: |309 bb.0:310 ; GCN-LABEL: name: hazard_cull_global311 ; GCN: $vgpr1, $sgpr0 = V_ADDC_U32_e64 0, $vgpr1, $sgpr0, 0, implicit $exec312 ; GCN-NEXT: $vgpr0 = GLOBAL_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec313 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec314 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec315 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec316 ; GCN-NEXT: DS_NOP implicit $m0, implicit $exec317 ; GCN-NEXT: S_WAIT_LOADCNT 0318 ; GCN-NEXT: $sgpr0_sgpr1 = S_GETPC_B64319 ; GCN-NEXT: $sgpr3 = S_ADD_U32 $sgpr0, 0, implicit-def $scc320 ; GCN-NEXT: S_ENDPGM 0321 $vgpr1, $sgpr0 = V_ADDC_U32_e64 0, $vgpr1, $sgpr0, 0, implicit $exec322 $vgpr0 = GLOBAL_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec323 S_WAIT_LOADCNT 0324 $sgpr0_sgpr1 = S_GETPC_B64325 $sgpr3 = S_ADD_U32 $sgpr0, 0, implicit-def $scc326 S_ENDPGM 0327...328 329---330name: hazard_nocull_flat331body: |332 bb.0:333 ; GCN-LABEL: name: hazard_nocull_flat334 ; GCN: $vgpr1, $sgpr0 = V_ADDC_U32_e64 0, $vgpr1, $sgpr0, 0, implicit $exec335 ; GCN-NEXT: $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr336 ; GCN-NEXT: S_WAIT_LOADCNT 0337 ; GCN-NEXT: $sgpr0_sgpr1 = S_GETPC_B64338 ; GCN-NEXT: S_WAITCNT_DEPCTR 65438339 ; GCN-NEXT: $sgpr3 = S_ADD_U32 $sgpr0, 0, implicit-def $scc340 ; GCN-NEXT: S_ENDPGM 0341 $vgpr1, $sgpr0 = V_ADDC_U32_e64 0, $vgpr1, $sgpr0, 0, implicit $exec342 $vgpr0 = FLAT_LOAD_DWORD $vgpr0_vgpr1, 0, 0, implicit $exec, implicit $flat_scr343 S_WAIT_LOADCNT 0344 $sgpr0_sgpr1 = S_GETPC_B64345 $sgpr3 = S_ADD_U32 $sgpr0, 0, implicit-def $scc346 S_ENDPGM 0347...348