1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 4
2 # RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx908 -run-pass=prologepilog -verify-machineinstrs -o - %s | FileCheck -check-prefix=GCN %s
4 # There are free scratch SGPRs available and hence use the smallest available pair for exec copy
5 # instead of the pair in the CSR range already given.
8 name: shift_back_exec_copy_reserved_reg
9 tracksRegLiveness: true
13 isEntryFunction: false
14 scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
15 stackPtrOffsetReg: '$sgpr32'
16 frameOffsetReg: '$sgpr33'
17 sgprForEXECCopy: '$sgpr34_sgpr35'
20 liveins: $sgpr30_sgpr31, $vgpr0
21 ; GCN-LABEL: name: shift_back_exec_copy_reserved_reg
22 ; GCN: liveins: $sgpr30_sgpr31, $vgpr0
24 ; GCN-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr30, 0, killed $vgpr0
25 ; GCN-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr31, 1, killed $vgpr0
26 ; GCN-NEXT: $sgpr4_sgpr5 = S_OR_SAVEEXEC_B64 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec
27 ; GCN-NEXT: $vgpr1 = COPY $vgpr0
28 ; GCN-NEXT: $exec = S_MOV_B64 killed $sgpr4_sgpr5
29 ; GCN-NEXT: $sgpr30 = SI_RESTORE_S32_FROM_VGPR $vgpr1, 0
30 ; GCN-NEXT: $sgpr31 = SI_RESTORE_S32_FROM_VGPR $vgpr1, 1
31 ; GCN-NEXT: S_SETPC_B64 $sgpr30_sgpr31
32 $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr30, 0, killed $vgpr0
33 $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr31, 1, killed $vgpr0
34 $sgpr34_sgpr35 = S_OR_SAVEEXEC_B64 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec
36 $exec = S_MOV_B64 killed $sgpr34_sgpr35
37 $sgpr30 = SI_RESTORE_S32_FROM_VGPR $vgpr1, 0
38 $sgpr31 = SI_RESTORE_S32_FROM_VGPR $vgpr1, 1
39 S_SETPC_B64 $sgpr30_sgpr31
42 # All scratch registers are made unavailable so that the CSR SGPR pair used for EXEC copy needed spills at prolog and epilog.
45 name: spill_exec_copy_reserved_reg
46 tracksRegLiveness: true
50 isEntryFunction: false
51 scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
52 stackPtrOffsetReg: '$sgpr32'
53 frameOffsetReg: '$sgpr33'
54 sgprForEXECCopy: '$sgpr34_sgpr35'
57 liveins: $sgpr4, $sgpr5, $sgpr6, $sgpr7, $sgpr8, $sgpr9, $sgpr10, $sgpr11, $sgpr12, $sgpr13, $sgpr14, $sgpr15, $sgpr16, $sgpr17, $sgpr18, $sgpr19, $sgpr20, $sgpr21, $sgpr22, $sgpr23, $sgpr24, $sgpr25, $sgpr26, $sgpr27, $sgpr30_sgpr31, $vcc, $vgpr0
58 ; GCN-LABEL: name: spill_exec_copy_reserved_reg
59 ; GCN: liveins: $vcc, $sgpr4, $sgpr5, $sgpr6, $sgpr7, $sgpr8, $sgpr9, $sgpr10, $sgpr11, $sgpr12, $sgpr13, $sgpr14, $sgpr15, $sgpr16, $sgpr17, $sgpr18, $sgpr19, $sgpr20, $sgpr21, $sgpr22, $sgpr23, $sgpr24, $sgpr25, $sgpr26, $sgpr27, $vgpr0, $vgpr2, $sgpr30_sgpr31
61 ; GCN-NEXT: $sgpr28_sgpr29 = S_XOR_SAVEEXEC_B64 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec
62 ; GCN-NEXT: BUFFER_STORE_DWORD_OFFSET $vgpr2, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr32, 0, 0, 0, implicit $exec :: (store (s32) into %stack.1, addrspace 5)
63 ; GCN-NEXT: $exec = S_MOV_B64 killed $sgpr28_sgpr29
64 ; GCN-NEXT: $vgpr2 = SI_SPILL_S32_TO_VGPR $sgpr34, 0, undef $vgpr2
65 ; GCN-NEXT: $vgpr2 = SI_SPILL_S32_TO_VGPR $sgpr35, 1, undef $vgpr2
66 ; GCN-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr30, 0, killed $vgpr0
67 ; GCN-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr31, 1, killed $vgpr0
68 ; GCN-NEXT: $sgpr34_sgpr35 = S_OR_SAVEEXEC_B64 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec
69 ; GCN-NEXT: $sgpr28_sgpr29 = IMPLICIT_DEF
70 ; GCN-NEXT: $vgpr1 = COPY $vgpr0
71 ; GCN-NEXT: S_NOP 0, implicit $sgpr28_sgpr29
72 ; GCN-NEXT: $exec = S_MOV_B64 killed $sgpr34_sgpr35
73 ; GCN-NEXT: $sgpr30 = SI_RESTORE_S32_FROM_VGPR $vgpr1, 0
74 ; GCN-NEXT: $sgpr31 = SI_RESTORE_S32_FROM_VGPR $vgpr1, 1
75 ; GCN-NEXT: S_SETPC_B64 $sgpr30_sgpr31, implicit $sgpr4, implicit $sgpr5, implicit $sgpr6, implicit $sgpr7, implicit $sgpr8_sgpr9_sgpr10, implicit $sgpr11, implicit $sgpr12, implicit $sgpr13, implicit $sgpr14, implicit $sgpr15, implicit $sgpr15, implicit $sgpr17, implicit $sgpr18, implicit $sgpr19, implicit $sgpr20, implicit $sgpr21, implicit $sgpr22, implicit $sgpr23, implicit $sgpr24, implicit $sgpr25, implicit $sgpr26, implicit $sgpr27, implicit $vcc
76 $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr30, 0, killed $vgpr0
77 $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr31, 1, killed $vgpr0
78 $sgpr34_sgpr35 = S_OR_SAVEEXEC_B64 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec
79 $sgpr28_sgpr29 = IMPLICIT_DEF
81 S_NOP 0, implicit $sgpr28_sgpr29
82 $exec = S_MOV_B64 killed $sgpr34_sgpr35
83 $sgpr30 = SI_RESTORE_S32_FROM_VGPR $vgpr1, 0
84 $sgpr31 = SI_RESTORE_S32_FROM_VGPR $vgpr1, 1
85 S_SETPC_B64 $sgpr30_sgpr31, implicit $sgpr4, implicit $sgpr5, implicit $sgpr6, implicit $sgpr7, implicit $sgpr8_sgpr9_sgpr10, implicit $sgpr11, implicit $sgpr12, implicit $sgpr13, implicit $sgpr14, implicit $sgpr15, implicit $sgpr15, implicit $sgpr17, implicit $sgpr18, implicit $sgpr19, implicit $sgpr20, implicit $sgpr21, implicit $sgpr22, implicit $sgpr23, implicit $sgpr24, implicit $sgpr25, implicit $sgpr26, implicit $sgpr27, implicit $vcc