275 lines · plain
1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 22# RUN: llc -mtriple=amdgcn -mcpu=gfx1100 -verify-machineinstrs -run-pass=prologepilog -o - %s | FileCheck -check-prefix=GCN %s3 4--- |5 declare amdgpu_cs_chain void @callee()6 declare amdgpu_gfx void @gfx_callee()7 8 define amdgpu_cs_chain_preserve void @preserve_active_lanes_above_args() {ret void}9 define amdgpu_cs_chain_preserve void @preserve_all_lanes_wwm_above_args() {ret void}10 define amdgpu_cs_chain_preserve void @dont_preserve_args() {ret void}11 define amdgpu_cs_chain_preserve void @preserve_inactive_lanes_wwm_args() {ret void}12 define amdgpu_cs_chain_preserve void @dont_preserve_if_no_chain_calls() {ret void}13 define amdgpu_cs_chain_preserve void @dont_preserve_v0_v7() {ret void}14 define amdgpu_cs_chain_preserve void @dont_preserve_sgpr() {ret void}15...16---17 18# NOTE: Since we don't know what the args are, we rely on the fact that we can't19# call llvm.amdgcn.cs.chain with more parameters than we received - so anything20# that is used by the SI_CS_CHAIN_TC_W32 is assumed to have been an arg and therefore21# not preserved.22 23---24name: preserve_active_lanes_above_args25tracksRegLiveness: true26frameInfo:27 hasTailCall: true28machineFunctionInfo:29 stackPtrOffsetReg: '$sgpr32'30 isChainFunction: true31 returnsVoid: true32body: |33 bb.0:34 liveins: $sgpr0, $vgpr8, $vgpr935 36 ; GCN-LABEL: name: preserve_active_lanes_above_args37 ; GCN: liveins: $sgpr0, $vgpr8, $vgpr9, $vgpr1038 ; GCN-NEXT: {{ $}}39 ; GCN-NEXT: SCRATCH_STORE_DWORD_ST killed $vgpr10, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.0, addrspace 5)40 ; GCN-NEXT: renamable $vgpr10 = V_MOV_B32_e32 10, implicit $exec41 ; GCN-NEXT: $vgpr8 = COPY killed renamable $vgpr1042 ; GCN-NEXT: renamable $sgpr4_sgpr5 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @callee + 4, target-flags(amdgpu-gotprel32-hi) @callee + 12, implicit-def dead $scc43 ; GCN-NEXT: renamable $sgpr4_sgpr5 = S_LOAD_DWORDX2_IMM killed renamable $sgpr4_sgpr5, 0, 0 :: (dereferenceable invariant load (p0) from got, addrspace 4)44 ; GCN-NEXT: $vgpr10 = SCRATCH_LOAD_DWORD_ST 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.0, addrspace 5)45 ; GCN-NEXT: SI_CS_CHAIN_TC_W32 killed renamable $sgpr4_sgpr5, @callee, 0, -1, amdgpu_allvgprs, implicit $sgpr0, implicit $vgpr8, implicit $vgpr946 renamable $vgpr10 = V_MOV_B32_e32 10, implicit $exec47 $vgpr8 = COPY renamable killed $vgpr1048 renamable $sgpr4_sgpr5 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @callee + 4, target-flags(amdgpu-gotprel32-hi) @callee + 12, implicit-def dead $scc49 renamable $sgpr4_sgpr5 = S_LOAD_DWORDX2_IMM killed renamable $sgpr4_sgpr5, 0, 0 :: (dereferenceable invariant load (p0) from got, addrspace 4)50 SI_CS_CHAIN_TC_W32 killed renamable $sgpr4_sgpr5, @callee, 0, -1, amdgpu_allvgprs, implicit $sgpr0, implicit $vgpr8, implicit $vgpr951 52...53 54---55name: preserve_all_lanes_wwm_above_args56tracksRegLiveness: true57frameInfo:58 hasTailCall: true59machineFunctionInfo:60 stackPtrOffsetReg: '$sgpr32'61 isChainFunction: true62 returnsVoid: true63 wwmReservedRegs:64 - '$vgpr10'65body: |66 bb.0:67 liveins: $sgpr0, $sgpr35, $vgpr8, $vgpr9, $vgpr1068 69 ; GCN-LABEL: name: preserve_all_lanes_wwm_above_args70 ; GCN: liveins: $sgpr0, $sgpr35, $vgpr8, $vgpr9, $vgpr1071 ; GCN-NEXT: {{ $}}72 ; GCN-NEXT: $sgpr1 = S_OR_SAVEEXEC_B32 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec73 ; GCN-NEXT: SCRATCH_STORE_DWORD_ST $vgpr10, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.0, addrspace 5)74 ; GCN-NEXT: $exec_lo = S_MOV_B32 killed $sgpr175 ; GCN-NEXT: S_NOP 0, implicit-def $vgpr0, implicit-def $vgpr1, implicit-def $vgpr2, implicit-def $vgpr3, implicit-def $vgpr4, implicit-def $vgpr5, implicit-def $vgpr6, implicit-def $vgpr776 ; GCN-NEXT: $vgpr10 = SI_SPILL_S32_TO_VGPR $sgpr35, 0, killed $vgpr1077 ; GCN-NEXT: $sgpr35 = S_MOV_B32 578 ; GCN-NEXT: $sgpr35 = SI_RESTORE_S32_FROM_VGPR $vgpr10, 079 ; GCN-NEXT: $vgpr10 = V_MOV_B32_e32 10, implicit $exec80 ; GCN-NEXT: $vgpr8 = COPY killed $vgpr1081 ; GCN-NEXT: renamable $sgpr4_sgpr5 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @callee + 4, target-flags(amdgpu-gotprel32-hi) @callee + 12, implicit-def dead $scc82 ; GCN-NEXT: renamable $sgpr4_sgpr5 = S_LOAD_DWORDX2_IMM killed renamable $sgpr4_sgpr5, 0, 0 :: (dereferenceable invariant load (p0) from got, addrspace 4)83 ; GCN-NEXT: $sgpr1 = S_OR_SAVEEXEC_B32 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec84 ; GCN-NEXT: $vgpr10 = SCRATCH_LOAD_DWORD_ST 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.0, addrspace 5)85 ; GCN-NEXT: $exec_lo = S_MOV_B32 killed $sgpr186 ; GCN-NEXT: SI_CS_CHAIN_TC_W32 killed renamable $sgpr4_sgpr5, @callee, 0, -1, amdgpu_allvgprs, implicit $sgpr0, implicit $vgpr8, implicit $vgpr987 S_NOP 0, implicit-def $vgpr0, implicit-def $vgpr1, implicit-def $vgpr2, implicit-def $vgpr3, implicit-def $vgpr4, implicit-def $vgpr5, implicit-def $vgpr6, implicit-def $vgpr788 $vgpr10 = SI_SPILL_S32_TO_VGPR $sgpr35, 0, killed $vgpr1089 $sgpr35 = S_MOV_B32 590 $sgpr35 = SI_RESTORE_S32_FROM_VGPR $vgpr10, 091 $vgpr10 = V_MOV_B32_e32 10, implicit $exec92 $vgpr8 = COPY killed $vgpr1093 renamable $sgpr4_sgpr5 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @callee + 4, target-flags(amdgpu-gotprel32-hi) @callee + 12, implicit-def dead $scc94 renamable $sgpr4_sgpr5 = S_LOAD_DWORDX2_IMM killed renamable $sgpr4_sgpr5, 0, 0 :: (dereferenceable invariant load (p0) from got, addrspace 4)95 SI_CS_CHAIN_TC_W32 killed renamable $sgpr4_sgpr5, @callee, 0, -1, amdgpu_allvgprs, implicit $sgpr0, implicit $vgpr8, implicit $vgpr996 97...98 99---100name: dont_preserve_args101tracksRegLiveness: true102frameInfo:103 hasTailCall: true104machineFunctionInfo:105 stackPtrOffsetReg: '$sgpr32'106 isChainFunction: true107 returnsVoid: true108body: |109 bb.0:110 liveins: $sgpr0, $vgpr8, $vgpr9111 112 ; GCN-LABEL: name: dont_preserve_args113 ; GCN: liveins: $sgpr0, $vgpr8, $vgpr9114 ; GCN-NEXT: {{ $}}115 ; GCN-NEXT: S_NOP 0, implicit-def $vgpr0, implicit-def $vgpr1, implicit-def $vgpr2, implicit-def $vgpr3, implicit-def $vgpr4, implicit-def $vgpr5, implicit-def $vgpr6, implicit-def $vgpr7116 ; GCN-NEXT: renamable $vgpr8 = V_MOV_B32_e32 10, implicit $exec117 ; GCN-NEXT: renamable $sgpr4_sgpr5 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @callee + 4, target-flags(amdgpu-gotprel32-hi) @callee + 12, implicit-def dead $scc118 ; GCN-NEXT: renamable $sgpr4_sgpr5 = S_LOAD_DWORDX2_IMM killed renamable $sgpr4_sgpr5, 0, 0 :: (dereferenceable invariant load (p0) from got, addrspace 4)119 ; GCN-NEXT: SI_CS_CHAIN_TC_W32 killed renamable $sgpr4_sgpr5, @callee, 0, -1, amdgpu_allvgprs, implicit $sgpr0, implicit $vgpr8, implicit $vgpr9120 S_NOP 0, implicit-def $vgpr0, implicit-def $vgpr1, implicit-def $vgpr2, implicit-def $vgpr3, implicit-def $vgpr4, implicit-def $vgpr5, implicit-def $vgpr6, implicit-def $vgpr7121 renamable $vgpr8 = V_MOV_B32_e32 10, implicit $exec122 renamable $sgpr4_sgpr5 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @callee + 4, target-flags(amdgpu-gotprel32-hi) @callee + 12, implicit-def dead $scc123 renamable $sgpr4_sgpr5 = S_LOAD_DWORDX2_IMM killed renamable $sgpr4_sgpr5, 0, 0 :: (dereferenceable invariant load (p0) from got, addrspace 4)124 SI_CS_CHAIN_TC_W32 killed renamable $sgpr4_sgpr5, @callee, 0, -1, amdgpu_allvgprs, implicit $sgpr0, implicit $vgpr8, implicit $vgpr9125 126...127 128---129name: preserve_inactive_lanes_wwm_args130tracksRegLiveness: true131frameInfo:132 hasTailCall: true133machineFunctionInfo:134 stackPtrOffsetReg: '$sgpr32'135 isChainFunction: true136 returnsVoid: true137 wwmReservedRegs:138 - '$vgpr9'139body: |140 bb.0:141 liveins: $sgpr0, $sgpr35, $vgpr8, $vgpr9, $vgpr10142 143 ; GCN-LABEL: name: preserve_inactive_lanes_wwm_args144 ; GCN: liveins: $sgpr0, $sgpr35, $vgpr8, $vgpr9, $vgpr10145 ; GCN-NEXT: {{ $}}146 ; GCN-NEXT: $sgpr1 = S_OR_SAVEEXEC_B32 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec147 ; GCN-NEXT: SCRATCH_STORE_DWORD_ST $vgpr9, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.0, addrspace 5)148 ; GCN-NEXT: $exec_lo = S_MOV_B32 killed $sgpr1149 ; GCN-NEXT: S_NOP 0, implicit-def $vgpr0, implicit-def $vgpr1, implicit-def $vgpr2, implicit-def $vgpr3, implicit-def $vgpr4, implicit-def $vgpr5, implicit-def $vgpr6, implicit-def $vgpr7150 ; GCN-NEXT: $vgpr8 = SI_SPILL_S32_TO_VGPR $sgpr35, 0, killed $vgpr8151 ; GCN-NEXT: $sgpr35 = S_MOV_B32 5152 ; GCN-NEXT: $sgpr35 = SI_RESTORE_S32_FROM_VGPR $vgpr8, 0153 ; GCN-NEXT: renamable $vgpr8 = V_MOV_B32_e32 10, implicit $exec154 ; GCN-NEXT: renamable $sgpr4_sgpr5 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @callee + 4, target-flags(amdgpu-gotprel32-hi) @callee + 12, implicit-def dead $scc155 ; GCN-NEXT: renamable $sgpr4_sgpr5 = S_LOAD_DWORDX2_IMM killed renamable $sgpr4_sgpr5, 0, 0 :: (dereferenceable invariant load (p0) from got, addrspace 4)156 ; GCN-NEXT: $sgpr1 = S_OR_SAVEEXEC_B32 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec157 ; GCN-NEXT: $vgpr9 = SCRATCH_LOAD_DWORD_ST 0, 0, implicit $exec, implicit $flat_scr, implicit $vgpr9(tied-def 0) :: (load (s32) from %stack.0, addrspace 5)158 ; GCN-NEXT: $exec_lo = S_MOV_B32 killed $sgpr1159 ; GCN-NEXT: SI_CS_CHAIN_TC_W32 killed renamable $sgpr4_sgpr5, @callee, 0, -1, amdgpu_allvgprs, implicit $sgpr0, implicit $vgpr8, implicit $vgpr9160 S_NOP 0, implicit-def $vgpr0, implicit-def $vgpr1, implicit-def $vgpr2, implicit-def $vgpr3, implicit-def $vgpr4, implicit-def $vgpr5, implicit-def $vgpr6, implicit-def $vgpr7161 renamable $vgpr8 = SI_SPILL_S32_TO_VGPR $sgpr35, 0, killed $vgpr8162 $sgpr35 = S_MOV_B32 5163 $sgpr35 = SI_RESTORE_S32_FROM_VGPR $vgpr8, 0164 renamable $vgpr8 = V_MOV_B32_e32 10, implicit $exec165 renamable $sgpr4_sgpr5 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @callee + 4, target-flags(amdgpu-gotprel32-hi) @callee + 12, implicit-def dead $scc166 renamable $sgpr4_sgpr5 = S_LOAD_DWORDX2_IMM killed renamable $sgpr4_sgpr5, 0, 0 :: (dereferenceable invariant load (p0) from got, addrspace 4)167 SI_CS_CHAIN_TC_W32 killed renamable $sgpr4_sgpr5, @callee, 0, -1, amdgpu_allvgprs, implicit $sgpr0, implicit $vgpr8, implicit $vgpr9168 169...170 171---172name: dont_preserve_if_no_chain_calls173tracksRegLiveness: true174frameInfo:175 hasTailCall: false176machineFunctionInfo:177 stackPtrOffsetReg: '$sgpr32'178 isChainFunction: true179 returnsVoid: true180 wwmReservedRegs:181 - '$vgpr9'182body: |183 bb.0:184 liveins: $sgpr0, $sgpr35, $vgpr0, $vgpr8, $vgpr9185 186 ; GCN-LABEL: name: dont_preserve_if_no_chain_calls187 ; GCN: liveins: $sgpr0, $sgpr35, $vgpr0, $vgpr8, $vgpr9188 ; GCN-NEXT: {{ $}}189 ; GCN-NEXT: S_NOP 0, implicit-def $vgpr0, implicit-def $vgpr1, implicit-def $vgpr2, implicit-def $vgpr3, implicit-def $vgpr4, implicit-def $vgpr5, implicit-def $vgpr6, implicit-def $vgpr7190 ; GCN-NEXT: $vgpr8 = SI_SPILL_S32_TO_VGPR $sgpr35, 0, killed $vgpr8191 ; GCN-NEXT: $sgpr35 = S_MOV_B32 5192 ; GCN-NEXT: $sgpr35 = SI_RESTORE_S32_FROM_VGPR $vgpr8, 0193 ; GCN-NEXT: renamable $vgpr8 = V_MOV_B32_e32 10, implicit $exec194 ; GCN-NEXT: $vgpr9 = V_MOV_B32_e32 20, implicit $exec195 ; GCN-NEXT: $vgpr10 = V_MOV_B32_e32 30, implicit $exec196 ; GCN-NEXT: S_ENDPGM 0197 S_NOP 0, implicit-def $vgpr0, implicit-def $vgpr1, implicit-def $vgpr2, implicit-def $vgpr3, implicit-def $vgpr4, implicit-def $vgpr5, implicit-def $vgpr6, implicit-def $vgpr7198 renamable $vgpr8 = SI_SPILL_S32_TO_VGPR $sgpr35, 0, killed $vgpr8199 $sgpr35 = S_MOV_B32 5200 $sgpr35 = SI_RESTORE_S32_FROM_VGPR $vgpr8, 0201 renamable $vgpr8 = V_MOV_B32_e32 10, implicit $exec202 $vgpr9 = V_MOV_B32_e32 20, implicit $exec203 $vgpr10 = V_MOV_B32_e32 30, implicit $exec204 S_ENDPGM 0205...206 207---208name: dont_preserve_v0_v7209tracksRegLiveness: true210frameInfo:211 hasTailCall: true212machineFunctionInfo:213 stackPtrOffsetReg: '$sgpr32'214 isChainFunction: true215 returnsVoid: true216 wwmReservedRegs:217 - '$vgpr1'218body: |219 bb.0:220 liveins: $sgpr0, $sgpr35, $vgpr0, $vgpr8221 222 ; GCN-LABEL: name: dont_preserve_v0_v7223 ; GCN: liveins: $sgpr0, $sgpr35, $vgpr0, $vgpr8224 ; GCN-NEXT: {{ $}}225 ; GCN-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr35, 0, killed $vgpr0226 ; GCN-NEXT: $sgpr35 = S_MOV_B32 5227 ; GCN-NEXT: $sgpr35 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 0228 ; GCN-NEXT: renamable $vgpr0 = V_MOV_B32_e32 10, implicit $exec229 ; GCN-NEXT: renamable $vgpr7 = V_MOV_B32_e32 16, implicit $exec230 ; GCN-NEXT: renamable $vgpr8 = COPY killed renamable $vgpr0231 ; GCN-NEXT: renamable $vgpr9 = COPY killed renamable $vgpr7232 ; GCN-NEXT: renamable $sgpr4_sgpr5 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @callee + 4, target-flags(amdgpu-gotprel32-hi) @callee + 12, implicit-def dead $scc233 ; GCN-NEXT: renamable $sgpr4_sgpr5 = S_LOAD_DWORDX2_IMM killed renamable $sgpr4_sgpr5, 0, 0 :: (dereferenceable invariant load (p0) from got, addrspace 4)234 ; GCN-NEXT: SI_CS_CHAIN_TC_W32 killed renamable $sgpr4_sgpr5, @callee, 0, -1, amdgpu_allvgprs, implicit $sgpr0, implicit $vgpr8, implicit $vgpr9235 renamable $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr35, 0, killed $vgpr0236 $sgpr35 = S_MOV_B32 5237 $sgpr35 = SI_RESTORE_S32_FROM_VGPR $vgpr0, 0238 renamable $vgpr0 = V_MOV_B32_e32 10, implicit $exec239 renamable $vgpr7 = V_MOV_B32_e32 16, implicit $exec240 renamable $vgpr8 = COPY killed renamable $vgpr0241 renamable $vgpr9 = COPY killed renamable $vgpr7242 renamable $sgpr4_sgpr5 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @callee + 4, target-flags(amdgpu-gotprel32-hi) @callee + 12, implicit-def dead $scc243 renamable $sgpr4_sgpr5 = S_LOAD_DWORDX2_IMM killed renamable $sgpr4_sgpr5, 0, 0 :: (dereferenceable invariant load (p0) from got, addrspace 4)244 SI_CS_CHAIN_TC_W32 killed renamable $sgpr4_sgpr5, @callee, 0, -1, amdgpu_allvgprs, implicit $sgpr0, implicit $vgpr8, implicit $vgpr9245...246 247---248name: dont_preserve_sgpr249tracksRegLiveness: true250frameInfo:251 hasTailCall: true252machineFunctionInfo:253 stackPtrOffsetReg: '$sgpr32'254 isChainFunction: true255 returnsVoid: true256body: |257 bb.0:258 liveins: $sgpr0259 260 ; GCN-LABEL: name: dont_preserve_sgpr261 ; GCN: liveins: $sgpr0262 ; GCN-NEXT: {{ $}}263 ; GCN-NEXT: renamable $sgpr1 = S_ADD_I32 killed renamable $sgpr0, renamable $sgpr0, implicit-def dead $scc264 ; GCN-NEXT: $sgpr0 = COPY killed renamable $sgpr1265 ; GCN-NEXT: renamable $sgpr4_sgpr5 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @callee + 4, target-flags(amdgpu-gotprel32-hi) @callee + 12, implicit-def dead $scc266 ; GCN-NEXT: renamable $sgpr4_sgpr5 = S_LOAD_DWORDX2_IMM killed renamable $sgpr4_sgpr5, 0, 0 :: (dereferenceable invariant load (p0) from got, addrspace 4)267 ; GCN-NEXT: SI_CS_CHAIN_TC_W32 killed renamable $sgpr4_sgpr5, @callee, 0, -1, amdgpu_allvgprs, implicit $sgpr0268 renamable $sgpr1 = S_ADD_I32 killed renamable $sgpr0, renamable $sgpr0, implicit-def dead $scc269 $sgpr0 = COPY killed renamable $sgpr1270 renamable $sgpr4_sgpr5 = SI_PC_ADD_REL_OFFSET target-flags(amdgpu-gotprel32-lo) @callee + 4, target-flags(amdgpu-gotprel32-hi) @callee + 12, implicit-def dead $scc271 renamable $sgpr4_sgpr5 = S_LOAD_DWORDX2_IMM killed renamable $sgpr4_sgpr5, 0, 0 :: (dereferenceable invariant load (p0) from got, addrspace 4)272 SI_CS_CHAIN_TC_W32 killed renamable $sgpr4_sgpr5, @callee, 0, -1, amdgpu_allvgprs, implicit $sgpr0273 274...275