1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -verify-machineinstrs -run-pass=prologepilog %s -o - | FileCheck --check-prefix=MUBUF %s
3 # RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -verify-machineinstrs -run-pass=prologepilog -mattr=+enable-flat-scratch %s -o - | FileCheck --check-prefix=FLATSCR %s
6 name: use_restore_frame_reg
7 tracksRegLiveness: true
10 - { id: 0, type: default, offset: 0, size: 4, alignment: 8192 }
11 - { id: 1, type: default, offset: 0, size: 4, alignment: 8192 }
12 - { id: 2, type: default, offset: 0, size: 4, alignment: 8192 }
13 - { id: 3, type: default, offset: 0, size: 4, alignment: 8192 }
14 - { id: 4, type: default, offset: 0, size: 4, alignment: 8192 }
15 - { id: 5, type: default, offset: 0, size: 4, alignment: 8192 }
16 - { id: 6, type: default, offset: 0, size: 4, alignment: 8192 }
17 - { id: 7, type: default, offset: 0, size: 4, alignment: 8192 }
18 - { id: 8, type: default, offset: 0, size: 4, alignment: 8192 }
19 - { id: 9, type: default, offset: 0, size: 4, alignment: 8192 }
20 - { id: 10, type: default, offset: 0, size: 4, alignment: 8192 }
21 - { id: 11, type: default, offset: 0, size: 4, alignment: 8192 }
22 - { id: 12, type: default, offset: 0, size: 4, alignment: 8192 }
23 - { id: 13, type: default, offset: 0, size: 4, alignment: 8192 }
24 - { id: 14, type: default, offset: 0, size: 4, alignment: 8192 }
25 - { id: 15, type: default, offset: 0, size: 4, alignment: 8192 }
26 - { id: 16, type: default, offset: 0, size: 4, alignment: 8192 }
27 - { id: 17, type: default, offset: 0, size: 4, alignment: 8192 }
28 - { id: 18, type: default, offset: 0, size: 4, alignment: 8192 }
31 isEntryFunction: false
32 scratchRSrcReg: $sgpr0_sgpr1_sgpr2_sgpr3
33 frameOffsetReg: $sgpr33
34 stackPtrOffsetReg: $sgpr32
37 ; MUBUF-LABEL: name: use_restore_frame_reg
39 ; MUBUF-NEXT: successors: %bb.2(0x40000000), %bb.1(0x40000000)
40 ; MUBUF-NEXT: liveins: $vgpr1, $vgpr2
42 ; MUBUF-NEXT: $sgpr4 = COPY $sgpr33
43 ; MUBUF-NEXT: $sgpr33 = frame-setup S_ADD_I32 $sgpr32, 524224, implicit-def $scc
44 ; MUBUF-NEXT: $sgpr33 = frame-setup S_AND_B32 killed $sgpr33, 4294443008, implicit-def dead $scc
45 ; MUBUF-NEXT: $sgpr6_sgpr7 = S_XOR_SAVEEXEC_B64 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec
46 ; MUBUF-NEXT: $sgpr5 = S_ADD_I32 $sgpr33, 9961728, implicit-def dead $scc
47 ; MUBUF-NEXT: BUFFER_STORE_DWORD_OFFSET $vgpr2, $sgpr0_sgpr1_sgpr2_sgpr3, killed $sgpr5, 0, 0, 0, implicit $exec :: (store (s32) into %stack.20, addrspace 5)
48 ; MUBUF-NEXT: $exec = S_MOV_B64 killed $sgpr6_sgpr7
49 ; MUBUF-NEXT: $vgpr2 = SI_SPILL_S32_TO_VGPR $sgpr4, 0, undef $vgpr2
50 ; MUBUF-NEXT: $sgpr32 = frame-setup S_ADD_I32 $sgpr32, 11010048, implicit-def dead $scc
51 ; MUBUF-NEXT: S_CMP_EQ_U32 0, 0, implicit-def $scc
52 ; MUBUF-NEXT: S_NOP 0, implicit-def $sgpr4, implicit-def $sgpr5, implicit-def $sgpr6, implicit-def $sgpr7, implicit-def $sgpr8, implicit-def $sgpr9, implicit-def $sgpr10, implicit-def $sgpr11, implicit-def $sgpr12, implicit-def $sgpr13, implicit-def $sgpr14, implicit-def $sgpr15, implicit-def $sgpr16, implicit-def $sgpr17, implicit-def $sgpr18, implicit-def $sgpr19, implicit-def $sgpr20, implicit-def $sgpr21, implicit-def $sgpr22, implicit-def $sgpr23, implicit-def $sgpr24, implicit-def $sgpr25, implicit-def $sgpr26, implicit-def $sgpr27, implicit-def $sgpr28, implicit-def $sgpr29, implicit-def $sgpr30, implicit-def $sgpr31, implicit-def $vcc
53 ; MUBUF-NEXT: $vgpr0 = V_LSHRREV_B32_e64 6, $sgpr33, implicit $exec
54 ; MUBUF-NEXT: $vgpr0 = V_ADD_U32_e32 8192, killed $vgpr0, implicit $exec
55 ; MUBUF-NEXT: $vgpr3 = V_LSHRREV_B32_e64 6, $sgpr33, implicit $exec
56 ; MUBUF-NEXT: $vgpr3 = V_ADD_U32_e32 155648, killed $vgpr3, implicit $exec
57 ; MUBUF-NEXT: $vgpr0 = V_OR_B32_e32 killed $vgpr3, $vgpr1, implicit $exec, implicit $sgpr4, implicit $sgpr5, implicit $sgpr6, implicit $sgpr7, implicit $sgpr8, implicit $sgpr9, implicit $sgpr10, implicit $sgpr11, implicit $sgpr12, implicit $sgpr13, implicit $sgpr14, implicit $sgpr15, implicit $sgpr16, implicit $sgpr17, implicit $sgpr18, implicit $sgpr19, implicit $sgpr20, implicit $sgpr21, implicit $sgpr22, implicit $sgpr23, implicit $sgpr24, implicit $sgpr25, implicit $sgpr26, implicit $sgpr27, implicit $sgpr28, implicit $sgpr29, implicit $sgpr30, implicit $sgpr31
58 ; MUBUF-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc
59 ; MUBUF-NEXT: S_CBRANCH_SCC1 %bb.2, implicit $scc
62 ; MUBUF-NEXT: successors: %bb.2(0x80000000)
63 ; MUBUF-NEXT: liveins: $vgpr2
68 ; MUBUF-NEXT: liveins: $vgpr2
70 ; MUBUF-NEXT: $sgpr4 = SI_RESTORE_S32_FROM_VGPR $vgpr2, 0
71 ; MUBUF-NEXT: $sgpr6_sgpr7 = S_XOR_SAVEEXEC_B64 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec
72 ; MUBUF-NEXT: $sgpr5 = S_ADD_I32 $sgpr33, 9961728, implicit-def dead $scc
73 ; MUBUF-NEXT: $vgpr2 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, killed $sgpr5, 0, 0, 0, implicit $exec :: (load (s32) from %stack.20, addrspace 5)
74 ; MUBUF-NEXT: $exec = S_MOV_B64 killed $sgpr6_sgpr7
75 ; MUBUF-NEXT: $sgpr32 = frame-destroy S_ADD_I32 $sgpr32, -11010048, implicit-def dead $scc
76 ; MUBUF-NEXT: $sgpr33 = COPY $sgpr4
77 ; MUBUF-NEXT: S_ENDPGM 0
79 ; FLATSCR-LABEL: name: use_restore_frame_reg
81 ; FLATSCR-NEXT: successors: %bb.2(0x40000000), %bb.1(0x40000000)
82 ; FLATSCR-NEXT: liveins: $vgpr1, $vgpr2
83 ; FLATSCR-NEXT: {{ $}}
84 ; FLATSCR-NEXT: $sgpr4 = COPY $sgpr33
85 ; FLATSCR-NEXT: $sgpr33 = frame-setup S_ADD_I32 $sgpr32, 8191, implicit-def $scc
86 ; FLATSCR-NEXT: $sgpr33 = frame-setup S_AND_B32 killed $sgpr33, 4294959104, implicit-def dead $scc
87 ; FLATSCR-NEXT: $sgpr6_sgpr7 = S_XOR_SAVEEXEC_B64 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec
88 ; FLATSCR-NEXT: $sgpr5 = S_ADD_I32 $sgpr33, 155652, implicit-def dead $scc
89 ; FLATSCR-NEXT: SCRATCH_STORE_DWORD_SADDR $vgpr2, killed $sgpr5, 0, 0, implicit $exec, implicit $flat_scr :: (store (s32) into %stack.20, addrspace 5)
90 ; FLATSCR-NEXT: $exec = S_MOV_B64 killed $sgpr6_sgpr7
91 ; FLATSCR-NEXT: $vgpr2 = SI_SPILL_S32_TO_VGPR $sgpr4, 0, undef $vgpr2
92 ; FLATSCR-NEXT: $sgpr32 = frame-setup S_ADD_I32 $sgpr32, 172032, implicit-def dead $scc
93 ; FLATSCR-NEXT: S_CMP_EQ_U32 0, 0, implicit-def $scc
94 ; FLATSCR-NEXT: S_NOP 0, implicit-def $sgpr4, implicit-def $sgpr5, implicit-def $sgpr6, implicit-def $sgpr7, implicit-def $sgpr8, implicit-def $sgpr9, implicit-def $sgpr10, implicit-def $sgpr11, implicit-def $sgpr12, implicit-def $sgpr13, implicit-def $sgpr14, implicit-def $sgpr15, implicit-def $sgpr16, implicit-def $sgpr17, implicit-def $sgpr18, implicit-def $sgpr19, implicit-def $sgpr20, implicit-def $sgpr21, implicit-def $sgpr22, implicit-def $sgpr23, implicit-def $sgpr24, implicit-def $sgpr25, implicit-def $sgpr26, implicit-def $sgpr27, implicit-def $sgpr28, implicit-def $sgpr29, implicit-def $sgpr30, implicit-def $sgpr31, implicit-def $vcc
95 ; FLATSCR-NEXT: $sgpr33 = S_ADDC_U32 $sgpr33, 8192, implicit-def $scc, implicit $scc
96 ; FLATSCR-NEXT: S_BITCMP1_B32 $sgpr33, 0, implicit-def $scc
97 ; FLATSCR-NEXT: $sgpr33 = S_BITSET0_B32 0, $sgpr33
98 ; FLATSCR-NEXT: $vgpr0 = V_MOV_B32_e32 $sgpr33, implicit $exec
99 ; FLATSCR-NEXT: $sgpr33 = S_ADDC_U32 $sgpr33, -8192, implicit-def $scc, implicit $scc
100 ; FLATSCR-NEXT: S_BITCMP1_B32 $sgpr33, 0, implicit-def $scc
101 ; FLATSCR-NEXT: $sgpr33 = S_BITSET0_B32 0, $sgpr33
102 ; FLATSCR-NEXT: $sgpr33 = S_ADDC_U32 $sgpr33, 155648, implicit-def $scc, implicit $scc
103 ; FLATSCR-NEXT: S_BITCMP1_B32 $sgpr33, 0, implicit-def $scc
104 ; FLATSCR-NEXT: $sgpr33 = S_BITSET0_B32 0, $sgpr33
105 ; FLATSCR-NEXT: $vgpr0 = V_OR_B32_e32 $sgpr33, $vgpr1, implicit $exec, implicit $sgpr4, implicit $sgpr5, implicit $sgpr6, implicit $sgpr7, implicit $sgpr8, implicit $sgpr9, implicit $sgpr10, implicit $sgpr11, implicit $sgpr12, implicit $sgpr13, implicit $sgpr14, implicit $sgpr15, implicit $sgpr16, implicit $sgpr17, implicit $sgpr18, implicit $sgpr19, implicit $sgpr20, implicit $sgpr21, implicit $sgpr22, implicit $sgpr23, implicit $sgpr24, implicit $sgpr25, implicit $sgpr26, implicit $sgpr27, implicit $sgpr28, implicit $sgpr29, implicit $sgpr30, implicit $sgpr31
106 ; FLATSCR-NEXT: $sgpr33 = S_ADDC_U32 $sgpr33, -155648, implicit-def $scc, implicit $scc
107 ; FLATSCR-NEXT: S_BITCMP1_B32 $sgpr33, 0, implicit-def $scc
108 ; FLATSCR-NEXT: $sgpr33 = S_BITSET0_B32 0, $sgpr33
109 ; FLATSCR-NEXT: S_CBRANCH_VCCNZ %bb.2, implicit $vcc
110 ; FLATSCR-NEXT: S_CBRANCH_SCC1 %bb.2, implicit $scc
111 ; FLATSCR-NEXT: {{ $}}
112 ; FLATSCR-NEXT: bb.1:
113 ; FLATSCR-NEXT: successors: %bb.2(0x80000000)
114 ; FLATSCR-NEXT: liveins: $vgpr2
115 ; FLATSCR-NEXT: {{ $}}
116 ; FLATSCR-NEXT: S_NOP 0
117 ; FLATSCR-NEXT: {{ $}}
118 ; FLATSCR-NEXT: bb.2:
119 ; FLATSCR-NEXT: liveins: $vgpr2
120 ; FLATSCR-NEXT: {{ $}}
121 ; FLATSCR-NEXT: $sgpr4 = SI_RESTORE_S32_FROM_VGPR $vgpr2, 0
122 ; FLATSCR-NEXT: $sgpr6_sgpr7 = S_XOR_SAVEEXEC_B64 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec
123 ; FLATSCR-NEXT: $sgpr5 = S_ADD_I32 $sgpr33, 155652, implicit-def dead $scc
124 ; FLATSCR-NEXT: $vgpr2 = SCRATCH_LOAD_DWORD_SADDR killed $sgpr5, 0, 0, implicit $exec, implicit $flat_scr :: (load (s32) from %stack.20, addrspace 5)
125 ; FLATSCR-NEXT: $exec = S_MOV_B64 killed $sgpr6_sgpr7
126 ; FLATSCR-NEXT: $sgpr32 = frame-destroy S_ADD_I32 $sgpr32, -172032, implicit-def dead $scc
127 ; FLATSCR-NEXT: $sgpr33 = COPY $sgpr4
128 ; FLATSCR-NEXT: S_ENDPGM 0
132 S_CMP_EQ_U32 0, 0, implicit-def $scc
133 S_NOP 0, implicit-def $sgpr4, implicit-def $sgpr5, implicit-def $sgpr6, implicit-def $sgpr7, implicit-def $sgpr8, implicit-def $sgpr9, implicit-def $sgpr10, implicit-def $sgpr11, implicit-def $sgpr12, implicit-def $sgpr13, implicit-def $sgpr14, implicit-def $sgpr15, implicit-def $sgpr16, implicit-def $sgpr17, implicit-def $sgpr18, implicit-def $sgpr19, implicit-def $sgpr20, implicit-def $sgpr21, implicit-def $sgpr22, implicit-def $sgpr23, implicit-def $sgpr24, implicit-def $sgpr25, implicit-def $sgpr26, implicit-def $sgpr27, implicit-def $sgpr28, implicit-def $sgpr29, implicit-def $sgpr30, implicit-def $sgpr31, implicit-def $vcc
134 $vgpr0 = V_MOV_B32_e32 %stack.0, implicit $exec
135 $vgpr0 = V_OR_B32_e32 %stack.18, $vgpr1, implicit $exec, implicit $sgpr4, implicit $sgpr5, implicit $sgpr6, implicit $sgpr7, implicit $sgpr8, implicit $sgpr9, implicit $sgpr10, implicit $sgpr11, implicit $sgpr12, implicit $sgpr13, implicit $sgpr14, implicit $sgpr15, implicit $sgpr16, implicit $sgpr17, implicit $sgpr18, implicit $sgpr19, implicit $sgpr20, implicit $sgpr21, implicit $sgpr22, implicit $sgpr23, implicit $sgpr24, implicit $sgpr25, implicit $sgpr26, implicit $sgpr27, implicit $sgpr28, implicit $sgpr29, implicit $sgpr30, implicit $sgpr31
136 S_CBRANCH_VCCNZ %bb.2, implicit $vcc
137 S_CBRANCH_SCC1 %bb.2, implicit $scc