1 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -enable-misched=0 -post-RA-scheduler=0 -stress-regalloc=8 < %s | FileCheck %s
3 ; CHECK-LABEL: spill_v2i32:
4 ; CHECK-DAG: buffer_store_dword v{{.*}} offset:16 ; 4-byte Folded Spill
5 ; CHECK-DAG: buffer_store_dword v{{.*}} offset:20 ; 4-byte Folded Spill
7 ; CHECK-NEXT: ;;#ASMEND
8 ; CHECK-DAG: buffer_load_dword v{{.*}} offset:16 ; 4-byte Folded Reload
9 ; CHECK-DAG: buffer_load_dword v{{.*}} offset:20 ; 4-byte Folded Reload
11 define void @spill_v2i32() {
13 %alloca = alloca <2 x i32>, i32 2, align 4, addrspace(5)
15 %aptr = getelementptr <2 x i32>, <2 x i32> addrspace(5)* %alloca, i32 1
16 %a = load volatile <2 x i32>, <2 x i32> addrspace(5)* %aptr
19 call void asm sideeffect "", "~{v0},~{v1},~{v2},~{v3},~{v4},~{v5},~{v6},~{v7}" ()
21 %outptr = getelementptr <2 x i32>, <2 x i32> addrspace(5)* %alloca, i32 1
22 store volatile <2 x i32> %a, <2 x i32> addrspace(5)* %outptr
27 ; CHECK-LABEL: spill_v2f32:
28 ; CHECK-DAG: buffer_store_dword v{{.*}} offset:16 ; 4-byte Folded Spill
29 ; CHECK-DAG: buffer_store_dword v{{.*}} offset:20 ; 4-byte Folded Spill
31 ; CHECK-NEXT: ;;#ASMEND
32 ; CHECK-DAG: buffer_load_dword v{{.*}} offset:16 ; 4-byte Folded Reload
33 ; CHECK-DAG: buffer_load_dword v{{.*}} offset:20 ; 4-byte Folded Reload
35 define void @spill_v2f32() {
37 %alloca = alloca <2 x i32>, i32 2, align 4, addrspace(5)
39 %aptr = getelementptr <2 x i32>, <2 x i32> addrspace(5)* %alloca, i32 1
40 %a = load volatile <2 x i32>, <2 x i32> addrspace(5)* %aptr
43 call void asm sideeffect "", "~{v0},~{v1},~{v2},~{v3},~{v4},~{v5},~{v6},~{v7}" ()
45 %outptr = getelementptr <2 x i32>, <2 x i32> addrspace(5)* %alloca, i32 1
46 store volatile <2 x i32> %a, <2 x i32> addrspace(5)* %outptr
51 ; CHECK-LABEL: spill_v3i32:
52 ; CHECK-DAG: buffer_store_dword v{{.*}} offset:32 ; 4-byte Folded Spill
53 ; CHECK-DAG: buffer_store_dword v{{.*}} offset:36 ; 4-byte Folded Spill
54 ; CHECK-DAG: buffer_store_dword v{{.*}} offset:40 ; 4-byte Folded Spill
56 ; CHECK-NEXT: ;;#ASMEND
57 ; CHECK-DAG: buffer_load_dword v{{.*}} offset:32 ; 4-byte Folded Reload
58 ; CHECK-DAG: buffer_load_dword v{{.*}} offset:36 ; 4-byte Folded Reload
59 ; CHECK-DAG: buffer_load_dword v{{.*}} offset:40 ; 4-byte Folded Reload
61 define void @spill_v3i32() {
63 %alloca = alloca <3 x i32>, i32 2, align 4, addrspace(5)
65 %aptr = getelementptr <3 x i32>, <3 x i32> addrspace(5)* %alloca, i32 1
66 %a = load volatile <3 x i32>, <3 x i32> addrspace(5)* %aptr
69 call void asm sideeffect "", "~{v0},~{v1},~{v2},~{v3},~{v4},~{v5},~{v6},~{v7}" ()
71 %outptr = getelementptr <3 x i32>, <3 x i32> addrspace(5)* %alloca, i32 1
72 store volatile <3 x i32> %a, <3 x i32> addrspace(5)* %outptr
77 ; CHECK-LABEL: spill_v3f32:
78 ; CHECK-DAG: buffer_store_dword v{{.*}} offset:32 ; 4-byte Folded Spill
79 ; CHECK-DAG: buffer_store_dword v{{.*}} offset:36 ; 4-byte Folded Spill
80 ; CHECK-DAG: buffer_store_dword v{{.*}} offset:40 ; 4-byte Folded Spill
82 ; CHECK-NEXT: ;;#ASMEND
83 ; CHECK-DAG: buffer_load_dword v{{.*}} offset:32 ; 4-byte Folded Reload
84 ; CHECK-DAG: buffer_load_dword v{{.*}} offset:36 ; 4-byte Folded Reload
85 ; CHECK-DAG: buffer_load_dword v{{.*}} offset:40 ; 4-byte Folded Reload
87 define void @spill_v3f32() {
89 %alloca = alloca <3 x i32>, i32 2, align 4, addrspace(5)
91 %aptr = getelementptr <3 x i32>, <3 x i32> addrspace(5)* %alloca, i32 1
92 %a = load volatile <3 x i32>, <3 x i32> addrspace(5)* %aptr
95 call void asm sideeffect "", "~{v0},~{v1},~{v2},~{v3},~{v4},~{v5},~{v6},~{v7}" ()
97 %outptr = getelementptr <3 x i32>, <3 x i32> addrspace(5)* %alloca, i32 1
98 store volatile <3 x i32> %a, <3 x i32> addrspace(5)* %outptr
103 ; CHECK-LABEL: spill_v4i32:
104 ; CHECK-DAG: buffer_store_dword v{{.*}} offset:32 ; 4-byte Folded Spill
105 ; CHECK-DAG: buffer_store_dword v{{.*}} offset:36 ; 4-byte Folded Spill
106 ; CHECK-DAG: buffer_store_dword v{{.*}} offset:40 ; 4-byte Folded Spill
107 ; CHECK-DAG: buffer_store_dword v{{.*}} offset:44 ; 4-byte Folded Spill
109 ; CHECK-NEXT: ;;#ASMEND
110 ; CHECK-DAG: buffer_load_dword v{{.*}} offset:32 ; 4-byte Folded Reload
111 ; CHECK-DAG: buffer_load_dword v{{.*}} offset:36 ; 4-byte Folded Reload
112 ; CHECK-DAG: buffer_load_dword v{{.*}} offset:40 ; 4-byte Folded Reload
113 ; CHECK-DAG: buffer_load_dword v{{.*}} offset:44 ; 4-byte Folded Reload
115 define void @spill_v4i32() {
117 %alloca = alloca <4 x i32>, i32 2, align 4, addrspace(5)
119 %aptr = getelementptr <4 x i32>, <4 x i32> addrspace(5)* %alloca, i32 1
120 %a = load volatile <4 x i32>, <4 x i32> addrspace(5)* %aptr
123 call void asm sideeffect "", "~{v0},~{v1},~{v2},~{v3},~{v4},~{v5},~{v6},~{v7}" ()
125 %outptr = getelementptr <4 x i32>, <4 x i32> addrspace(5)* %alloca, i32 1
126 store volatile <4 x i32> %a, <4 x i32> addrspace(5)* %outptr
131 ; CHECK-LABEL: spill_v4f32:
132 ; CHECK-DAG: buffer_store_dword v{{.*}} offset:32 ; 4-byte Folded Spill
133 ; CHECK-DAG: buffer_store_dword v{{.*}} offset:36 ; 4-byte Folded Spill
134 ; CHECK-DAG: buffer_store_dword v{{.*}} offset:40 ; 4-byte Folded Spill
135 ; CHECK-DAG: buffer_store_dword v{{.*}} offset:44 ; 4-byte Folded Spill
137 ; CHECK-NEXT: ;;#ASMEND
138 ; CHECK-DAG: buffer_load_dword v{{.*}} offset:32 ; 4-byte Folded Reload
139 ; CHECK-DAG: buffer_load_dword v{{.*}} offset:36 ; 4-byte Folded Reload
140 ; CHECK-DAG: buffer_load_dword v{{.*}} offset:40 ; 4-byte Folded Reload
141 ; CHECK-DAG: buffer_load_dword v{{.*}} offset:44 ; 4-byte Folded Reload
143 define void @spill_v4f32() {
145 %alloca = alloca <4 x i32>, i32 2, align 4, addrspace(5)
147 %aptr = getelementptr <4 x i32>, <4 x i32> addrspace(5)* %alloca, i32 1
148 %a = load volatile <4 x i32>, <4 x i32> addrspace(5)* %aptr
151 call void asm sideeffect "", "~{v0},~{v1},~{v2},~{v3},~{v4},~{v5},~{v6},~{v7}" ()
153 %outptr = getelementptr <4 x i32>, <4 x i32> addrspace(5)* %alloca, i32 1
154 store volatile <4 x i32> %a, <4 x i32> addrspace(5)* %outptr
159 ; CHECK-LABEL: spill_v5i32:
160 ; CHECK-DAG: buffer_store_dword v{{.*}} offset:64 ; 4-byte Folded Spill
161 ; CHECK-DAG: buffer_store_dword v{{.*}} offset:68 ; 4-byte Folded Spill
162 ; CHECK-DAG: buffer_store_dword v{{.*}} offset:72 ; 4-byte Folded Spill
163 ; CHECK-DAG: buffer_store_dword v{{.*}} offset:76 ; 4-byte Folded Spill
165 ; CHECK-NEXT: ;;#ASMEND
166 ; CHECK-DAG: buffer_load_dword v{{.*}} offset:64 ; 4-byte Folded Reload
167 ; CHECK-DAG: buffer_load_dword v{{.*}} offset:68 ; 4-byte Folded Reload
168 ; CHECK-DAG: buffer_load_dword v{{.*}} offset:72 ; 4-byte Folded Reload
169 ; CHECK-DAG: buffer_load_dword v{{.*}} offset:76 ; 4-byte Folded Reload
170 define void @spill_v5i32() {
172 %alloca = alloca <5 x i32>, i32 2, align 4, addrspace(5)
174 %aptr = getelementptr <5 x i32>, <5 x i32> addrspace(5)* %alloca, i32 1
175 %a = load volatile <5 x i32>, <5 x i32> addrspace(5)* %aptr
178 call void asm sideeffect "", "~{v0},~{v1},~{v2},~{v3},~{v4},~{v5},~{v6},~{v7}" ()
180 %outptr = getelementptr <5 x i32>, <5 x i32> addrspace(5)* %alloca, i32 1
181 store volatile <5 x i32> %a, <5 x i32> addrspace(5)* %outptr
186 ; CHECK-LABEL: spill_v5f32:
187 ; CHECK-DAG: buffer_store_dword v{{.*}} offset:64 ; 4-byte Folded Spill
188 ; CHECK-DAG: buffer_store_dword v{{.*}} offset:68 ; 4-byte Folded Spill
189 ; CHECK-DAG: buffer_store_dword v{{.*}} offset:72 ; 4-byte Folded Spill
190 ; CHECK-DAG: buffer_store_dword v{{.*}} offset:76 ; 4-byte Folded Spill
192 ; CHECK-NEXT: ;;#ASMEND
193 ; CHECK-DAG: buffer_load_dword v{{.*}} offset:64 ; 4-byte Folded Reload
194 ; CHECK-DAG: buffer_load_dword v{{.*}} offset:68 ; 4-byte Folded Reload
195 ; CHECK-DAG: buffer_load_dword v{{.*}} offset:72 ; 4-byte Folded Reload
196 ; CHECK-DAG: buffer_load_dword v{{.*}} offset:76 ; 4-byte Folded Reload
197 define void @spill_v5f32() {
199 %alloca = alloca <5 x i32>, i32 2, align 4, addrspace(5)
201 %aptr = getelementptr <5 x i32>, <5 x i32> addrspace(5)* %alloca, i32 1
202 %a = load volatile <5 x i32>, <5 x i32> addrspace(5)* %aptr
205 call void asm sideeffect "", "~{v0},~{v1},~{v2},~{v3},~{v4},~{v5},~{v6},~{v7}" ()
207 %outptr = getelementptr <5 x i32>, <5 x i32> addrspace(5)* %alloca, i32 1
208 store volatile <5 x i32> %a, <5 x i32> addrspace(5)* %outptr