1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn -mcpu=gfx900 -start-before=si-lower-sgpr-spills -stop-after=prologepilog -verify-machineinstrs %s -o - | FileCheck -check-prefix=GCN %s
4 # Make sure the initial first $sgpr1 = COPY $sgpr2 copy is not deleted
5 # by the copy propagation after lowering the spill.
8 name: spill_sgpr128_use_subreg
9 tracksRegLiveness: true
12 scratchRSrcReg: $sgpr100_sgpr101_sgpr102_sgpr103
13 stackPtrOffsetReg: $sgpr32
16 - { id: 0, stack-id: sgpr-spill, type: spill-slot, size: 16, alignment: 4 }
20 liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr3, $sgpr4, $sgpr5, $sgpr6, $sgpr7, $vgpr0, $vgpr1, $vgpr2, $vgpr3
22 ; GCN-LABEL: name: spill_sgpr128_use_subreg
23 ; GCN: liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr3, $sgpr4, $sgpr5, $sgpr6, $sgpr7, $vgpr0, $vgpr1, $vgpr2, $vgpr3
25 ; GCN-NEXT: $sgpr8_sgpr9 = S_XOR_SAVEEXEC_B64 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec
26 ; GCN-NEXT: BUFFER_STORE_DWORD_OFFSET $vgpr0, $sgpr100_sgpr101_sgpr102_sgpr103, $sgpr32, 0, 0, 0, implicit $exec :: (store (s32) into %stack.1, addrspace 5)
27 ; GCN-NEXT: $exec = S_MOV_B64 killed $sgpr8_sgpr9
28 ; GCN-NEXT: renamable $vgpr0 = IMPLICIT_DEF
29 ; GCN-NEXT: renamable $sgpr1 = COPY $sgpr2
30 ; GCN-NEXT: renamable $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr0, 0, killed $vgpr0, implicit-def $sgpr0_sgpr1_sgpr2_sgpr3, implicit $sgpr0_sgpr1_sgpr2_sgpr3
31 ; GCN-NEXT: renamable $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr1, 1, killed $vgpr0
32 ; GCN-NEXT: renamable $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr2, 2, killed $vgpr0
33 ; GCN-NEXT: renamable $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr3, 3, killed $vgpr0, implicit $sgpr0_sgpr1_sgpr2_sgpr3
34 ; GCN-NEXT: renamable $sgpr8 = COPY renamable $sgpr1
35 ; GCN-NEXT: KILL killed renamable $vgpr0
36 ; GCN-NEXT: $sgpr0_sgpr1 = S_XOR_SAVEEXEC_B64 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec
37 ; GCN-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr100_sgpr101_sgpr102_sgpr103, $sgpr32, 0, 0, 0, implicit $exec :: (load (s32) from %stack.1, addrspace 5)
38 ; GCN-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1
39 ; GCN-NEXT: S_ENDPGM 0, implicit $sgpr8
40 renamable $sgpr1 = COPY $sgpr2
41 SI_SPILL_S128_SAVE renamable $sgpr0_sgpr1_sgpr2_sgpr3, %stack.0, implicit $exec, implicit $sgpr32 :: (store (s128) into %stack.0, align 4, addrspace 5)
42 renamable $sgpr8 = COPY killed renamable $sgpr1
43 S_ENDPGM 0, implicit $sgpr8
47 name: spill_sgpr128_use_kill
48 tracksRegLiveness: true
51 scratchRSrcReg: $sgpr100_sgpr101_sgpr102_sgpr103
52 stackPtrOffsetReg: $sgpr32
55 - { id: 0, stack-id: sgpr-spill, type: spill-slot, size: 16, alignment: 4 }
59 liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr3, $sgpr4, $sgpr5, $sgpr6, $sgpr7, $vgpr0, $vgpr1, $vgpr2, $vgpr3
61 ; GCN-LABEL: name: spill_sgpr128_use_kill
62 ; GCN: liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr3, $sgpr4, $sgpr5, $sgpr6, $sgpr7, $vgpr0, $vgpr1, $vgpr2, $vgpr3
64 ; GCN-NEXT: $sgpr8_sgpr9 = S_XOR_SAVEEXEC_B64 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec
65 ; GCN-NEXT: BUFFER_STORE_DWORD_OFFSET $vgpr0, $sgpr100_sgpr101_sgpr102_sgpr103, $sgpr32, 0, 0, 0, implicit $exec :: (store (s32) into %stack.1, addrspace 5)
66 ; GCN-NEXT: $exec = S_MOV_B64 killed $sgpr8_sgpr9
67 ; GCN-NEXT: renamable $vgpr0 = IMPLICIT_DEF
68 ; GCN-NEXT: renamable $sgpr1 = COPY $sgpr2
69 ; GCN-NEXT: renamable $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr0, 0, killed $vgpr0, implicit-def $sgpr0_sgpr1_sgpr2_sgpr3, implicit $sgpr0_sgpr1_sgpr2_sgpr3
70 ; GCN-NEXT: renamable $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr1, 1, killed $vgpr0
71 ; GCN-NEXT: renamable $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr2, 2, killed $vgpr0
72 ; GCN-NEXT: renamable $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr3, 3, killed $vgpr0, implicit $sgpr0_sgpr1_sgpr2_sgpr3
73 ; GCN-NEXT: KILL killed renamable $vgpr0
74 ; GCN-NEXT: $sgpr0_sgpr1 = S_XOR_SAVEEXEC_B64 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec
75 ; GCN-NEXT: $vgpr0 = BUFFER_LOAD_DWORD_OFFSET $sgpr100_sgpr101_sgpr102_sgpr103, $sgpr32, 0, 0, 0, implicit $exec :: (load (s32) from %stack.1, addrspace 5)
76 ; GCN-NEXT: $exec = S_MOV_B64 killed $sgpr0_sgpr1
77 ; GCN-NEXT: S_ENDPGM 0
78 renamable $sgpr1 = COPY $sgpr2
79 SI_SPILL_S128_SAVE renamable killed $sgpr0_sgpr1_sgpr2_sgpr3, %stack.0, implicit $exec, implicit $sgpr32 :: (store (s128) into %stack.0, align 4, addrspace 5)
84 name: spill_vgpr128_use_subreg
85 tracksRegLiveness: true
87 scratchRSrcReg: $sgpr100_sgpr101_sgpr102_sgpr103
88 stackPtrOffsetReg: $sgpr32
91 - { id: 0, type: spill-slot, size: 16, alignment: 4 }
95 liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3, $vgpr4, $vgpr5, $vgpr6, $vgpr7
97 ; GCN-LABEL: name: spill_vgpr128_use_subreg
98 ; GCN: liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3, $vgpr4, $vgpr5, $vgpr6, $vgpr7
100 ; GCN-NEXT: renamable $vgpr1 = COPY $vgpr2, implicit $exec
101 ; GCN-NEXT: BUFFER_STORE_DWORD_OFFSET $vgpr0, $sgpr100_sgpr101_sgpr102_sgpr103, $sgpr32, 0, 0, 0, implicit $exec, implicit-def $vgpr0_vgpr1_vgpr2_vgpr3, implicit $vgpr0_vgpr1_vgpr2_vgpr3 :: (store (s32) into %stack.0, addrspace 5)
102 ; GCN-NEXT: BUFFER_STORE_DWORD_OFFSET $vgpr1, $sgpr100_sgpr101_sgpr102_sgpr103, $sgpr32, 4, 0, 0, implicit $exec :: (store (s32) into %stack.0 + 4, addrspace 5)
103 ; GCN-NEXT: BUFFER_STORE_DWORD_OFFSET $vgpr2, $sgpr100_sgpr101_sgpr102_sgpr103, $sgpr32, 8, 0, 0, implicit $exec :: (store (s32) into %stack.0 + 8, addrspace 5)
104 ; GCN-NEXT: BUFFER_STORE_DWORD_OFFSET $vgpr3, $sgpr100_sgpr101_sgpr102_sgpr103, $sgpr32, 12, 0, 0, implicit $exec, implicit $vgpr0_vgpr1_vgpr2_vgpr3 :: (store (s32) into %stack.0 + 12, addrspace 5)
105 ; GCN-NEXT: renamable $vgpr8 = COPY $vgpr2, implicit $exec
106 ; GCN-NEXT: S_ENDPGM 0, implicit $vgpr8
107 renamable $vgpr1 = COPY $vgpr2
108 SI_SPILL_V128_SAVE renamable $vgpr0_vgpr1_vgpr2_vgpr3, %stack.0, $sgpr32, 0, implicit $exec :: (store (s128) into %stack.0, align 4, addrspace 5)
109 renamable $vgpr8 = COPY killed renamable $vgpr1
110 S_ENDPGM 0, implicit $vgpr8
114 name: spill_vgpr128_use_kill
115 tracksRegLiveness: true
117 scratchRSrcReg: $sgpr100_sgpr101_sgpr102_sgpr103
118 stackPtrOffsetReg: $sgpr32
121 - { id: 0, type: spill-slot, size: 16, alignment: 4 }
125 liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3, $vgpr4, $vgpr5, $vgpr6, $vgpr7
127 ; GCN-LABEL: name: spill_vgpr128_use_kill
128 ; GCN: liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3, $vgpr4, $vgpr5, $vgpr6, $vgpr7
130 ; GCN-NEXT: renamable $vgpr1 = COPY $vgpr2, implicit $exec
131 ; GCN-NEXT: BUFFER_STORE_DWORD_OFFSET $vgpr0, $sgpr100_sgpr101_sgpr102_sgpr103, $sgpr32, 0, 0, 0, implicit $exec, implicit-def $vgpr0_vgpr1_vgpr2_vgpr3, implicit $vgpr0_vgpr1_vgpr2_vgpr3 :: (store (s32) into %stack.0, addrspace 5)
132 ; GCN-NEXT: BUFFER_STORE_DWORD_OFFSET $vgpr1, $sgpr100_sgpr101_sgpr102_sgpr103, $sgpr32, 4, 0, 0, implicit $exec :: (store (s32) into %stack.0 + 4, addrspace 5)
133 ; GCN-NEXT: BUFFER_STORE_DWORD_OFFSET $vgpr2, $sgpr100_sgpr101_sgpr102_sgpr103, $sgpr32, 8, 0, 0, implicit $exec :: (store (s32) into %stack.0 + 8, addrspace 5)
134 ; GCN-NEXT: BUFFER_STORE_DWORD_OFFSET $vgpr3, $sgpr100_sgpr101_sgpr102_sgpr103, $sgpr32, 12, 0, 0, implicit $exec, implicit $vgpr0_vgpr1_vgpr2_vgpr3 :: (store (s32) into %stack.0 + 12, addrspace 5)
135 ; GCN-NEXT: S_ENDPGM 0
136 renamable $vgpr1 = COPY $vgpr2
137 SI_SPILL_V128_SAVE renamable killed $vgpr0_vgpr1_vgpr2_vgpr3, %stack.0, $sgpr32, 0, implicit $exec :: (store (s128) into %stack.0, align 4, addrspace 5)