1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * test helper assembly functions
4 *
5 * Copyright (C) 2016 Simon Guo, IBM Corporation.
6 */
7#include <ppc-asm.h>
8#include "reg.h"
9
10
11/* Non volatile GPR - unsigned long buf[18] */
12FUNC_START(load_gpr)
13	ld	14, 0*8(3)
14	ld	15, 1*8(3)
15	ld	16, 2*8(3)
16	ld	17, 3*8(3)
17	ld	18, 4*8(3)
18	ld	19, 5*8(3)
19	ld	20, 6*8(3)
20	ld	21, 7*8(3)
21	ld	22, 8*8(3)
22	ld	23, 9*8(3)
23	ld	24, 10*8(3)
24	ld	25, 11*8(3)
25	ld	26, 12*8(3)
26	ld	27, 13*8(3)
27	ld	28, 14*8(3)
28	ld	29, 15*8(3)
29	ld	30, 16*8(3)
30	ld	31, 17*8(3)
31	blr
32FUNC_END(load_gpr)
33
34FUNC_START(store_gpr)
35	std	14, 0*8(3)
36	std	15, 1*8(3)
37	std	16, 2*8(3)
38	std	17, 3*8(3)
39	std	18, 4*8(3)
40	std	19, 5*8(3)
41	std	20, 6*8(3)
42	std	21, 7*8(3)
43	std	22, 8*8(3)
44	std	23, 9*8(3)
45	std	24, 10*8(3)
46	std	25, 11*8(3)
47	std	26, 12*8(3)
48	std	27, 13*8(3)
49	std	28, 14*8(3)
50	std	29, 15*8(3)
51	std	30, 16*8(3)
52	std	31, 17*8(3)
53	blr
54FUNC_END(store_gpr)
55
56/* Double Precision Float - double buf[32] */
57FUNC_START(store_fpr)
58	stfd  0,  0*8(3)
59	stfd  1,  1*8(3)
60	stfd  2,  2*8(3)
61	stfd  3,  3*8(3)
62	stfd  4,  4*8(3)
63	stfd  5,  5*8(3)
64	stfd  6,  6*8(3)
65	stfd  7,  7*8(3)
66	stfd  8,  8*8(3)
67	stfd  9,  9*8(3)
68	stfd 10, 10*8(3)
69	stfd 11, 11*8(3)
70	stfd 12, 12*8(3)
71	stfd 13, 13*8(3)
72	stfd 14, 14*8(3)
73	stfd 15, 15*8(3)
74	stfd 16, 16*8(3)
75	stfd 17, 17*8(3)
76	stfd 18, 18*8(3)
77	stfd 19, 19*8(3)
78	stfd 20, 20*8(3)
79	stfd 21, 21*8(3)
80	stfd 22, 22*8(3)
81	stfd 23, 23*8(3)
82	stfd 24, 24*8(3)
83	stfd 25, 25*8(3)
84	stfd 26, 26*8(3)
85	stfd 27, 27*8(3)
86	stfd 28, 28*8(3)
87	stfd 29, 29*8(3)
88	stfd 30, 30*8(3)
89	stfd 31, 31*8(3)
90	blr
91FUNC_END(store_fpr)
92
93/* VMX/VSX registers - unsigned long buf[128] */
94FUNC_START(loadvsx)
95	lis	4, 0
96	LXVD2X	(0,(4),(3))
97	addi	4, 4, 16
98	LXVD2X	(1,(4),(3))
99	addi	4, 4, 16
100	LXVD2X	(2,(4),(3))
101	addi	4, 4, 16
102	LXVD2X	(3,(4),(3))
103	addi	4, 4, 16
104	LXVD2X	(4,(4),(3))
105	addi	4, 4, 16
106	LXVD2X	(5,(4),(3))
107	addi	4, 4, 16
108	LXVD2X	(6,(4),(3))
109	addi	4, 4, 16
110	LXVD2X	(7,(4),(3))
111	addi	4, 4, 16
112	LXVD2X	(8,(4),(3))
113	addi	4, 4, 16
114	LXVD2X	(9,(4),(3))
115	addi	4, 4, 16
116	LXVD2X	(10,(4),(3))
117	addi	4, 4, 16
118	LXVD2X	(11,(4),(3))
119	addi	4, 4, 16
120	LXVD2X	(12,(4),(3))
121	addi	4, 4, 16
122	LXVD2X	(13,(4),(3))
123	addi	4, 4, 16
124	LXVD2X	(14,(4),(3))
125	addi	4, 4, 16
126	LXVD2X	(15,(4),(3))
127	addi	4, 4, 16
128	LXVD2X	(16,(4),(3))
129	addi	4, 4, 16
130	LXVD2X	(17,(4),(3))
131	addi	4, 4, 16
132	LXVD2X	(18,(4),(3))
133	addi	4, 4, 16
134	LXVD2X	(19,(4),(3))
135	addi	4, 4, 16
136	LXVD2X	(20,(4),(3))
137	addi	4, 4, 16
138	LXVD2X	(21,(4),(3))
139	addi	4, 4, 16
140	LXVD2X	(22,(4),(3))
141	addi	4, 4, 16
142	LXVD2X	(23,(4),(3))
143	addi	4, 4, 16
144	LXVD2X	(24,(4),(3))
145	addi	4, 4, 16
146	LXVD2X	(25,(4),(3))
147	addi	4, 4, 16
148	LXVD2X	(26,(4),(3))
149	addi	4, 4, 16
150	LXVD2X	(27,(4),(3))
151	addi	4, 4, 16
152	LXVD2X	(28,(4),(3))
153	addi	4, 4, 16
154	LXVD2X	(29,(4),(3))
155	addi	4, 4, 16
156	LXVD2X	(30,(4),(3))
157	addi	4, 4, 16
158	LXVD2X	(31,(4),(3))
159	addi	4, 4, 16
160	LXVD2X	(32,(4),(3))
161	addi	4, 4, 16
162	LXVD2X	(33,(4),(3))
163	addi	4, 4, 16
164	LXVD2X	(34,(4),(3))
165	addi	4, 4, 16
166	LXVD2X	(35,(4),(3))
167	addi	4, 4, 16
168	LXVD2X	(36,(4),(3))
169	addi	4, 4, 16
170	LXVD2X	(37,(4),(3))
171	addi	4, 4, 16
172	LXVD2X	(38,(4),(3))
173	addi	4, 4, 16
174	LXVD2X	(39,(4),(3))
175	addi	4, 4, 16
176	LXVD2X	(40,(4),(3))
177	addi	4, 4, 16
178	LXVD2X	(41,(4),(3))
179	addi	4, 4, 16
180	LXVD2X	(42,(4),(3))
181	addi	4, 4, 16
182	LXVD2X	(43,(4),(3))
183	addi	4, 4, 16
184	LXVD2X	(44,(4),(3))
185	addi	4, 4, 16
186	LXVD2X	(45,(4),(3))
187	addi	4, 4, 16
188	LXVD2X	(46,(4),(3))
189	addi	4, 4, 16
190	LXVD2X	(47,(4),(3))
191	addi	4, 4, 16
192	LXVD2X	(48,(4),(3))
193	addi	4, 4, 16
194	LXVD2X	(49,(4),(3))
195	addi	4, 4, 16
196	LXVD2X	(50,(4),(3))
197	addi	4, 4, 16
198	LXVD2X	(51,(4),(3))
199	addi	4, 4, 16
200	LXVD2X	(52,(4),(3))
201	addi	4, 4, 16
202	LXVD2X	(53,(4),(3))
203	addi	4, 4, 16
204	LXVD2X	(54,(4),(3))
205	addi	4, 4, 16
206	LXVD2X	(55,(4),(3))
207	addi	4, 4, 16
208	LXVD2X	(56,(4),(3))
209	addi	4, 4, 16
210	LXVD2X	(57,(4),(3))
211	addi	4, 4, 16
212	LXVD2X	(58,(4),(3))
213	addi	4, 4, 16
214	LXVD2X	(59,(4),(3))
215	addi	4, 4, 16
216	LXVD2X	(60,(4),(3))
217	addi	4, 4, 16
218	LXVD2X	(61,(4),(3))
219	addi	4, 4, 16
220	LXVD2X	(62,(4),(3))
221	addi	4, 4, 16
222	LXVD2X	(63,(4),(3))
223	blr
224FUNC_END(loadvsx)
225
226FUNC_START(storevsx)
227	lis	4, 0
228	STXVD2X	(0,(4),(3))
229	addi	4, 4, 16
230	STXVD2X	(1,(4),(3))
231	addi	4, 4, 16
232	STXVD2X	(2,(4),(3))
233	addi	4, 4, 16
234	STXVD2X	(3,(4),(3))
235	addi	4, 4, 16
236	STXVD2X	(4,(4),(3))
237	addi	4, 4, 16
238	STXVD2X	(5,(4),(3))
239	addi	4, 4, 16
240	STXVD2X	(6,(4),(3))
241	addi	4, 4, 16
242	STXVD2X	(7,(4),(3))
243	addi	4, 4, 16
244	STXVD2X	(8,(4),(3))
245	addi	4, 4, 16
246	STXVD2X	(9,(4),(3))
247	addi	4, 4, 16
248	STXVD2X	(10,(4),(3))
249	addi	4, 4, 16
250	STXVD2X	(11,(4),(3))
251	addi	4, 4, 16
252	STXVD2X	(12,(4),(3))
253	addi	4, 4, 16
254	STXVD2X	(13,(4),(3))
255	addi	4, 4, 16
256	STXVD2X	(14,(4),(3))
257	addi	4, 4, 16
258	STXVD2X	(15,(4),(3))
259	addi	4, 4, 16
260	STXVD2X	(16,(4),(3))
261	addi	4, 4, 16
262	STXVD2X	(17,(4),(3))
263	addi	4, 4, 16
264	STXVD2X	(18,(4),(3))
265	addi	4, 4, 16
266	STXVD2X	(19,(4),(3))
267	addi	4, 4, 16
268	STXVD2X	(20,(4),(3))
269	addi	4, 4, 16
270	STXVD2X	(21,(4),(3))
271	addi	4, 4, 16
272	STXVD2X	(22,(4),(3))
273	addi	4, 4, 16
274	STXVD2X	(23,(4),(3))
275	addi	4, 4, 16
276	STXVD2X	(24,(4),(3))
277	addi	4, 4, 16
278	STXVD2X	(25,(4),(3))
279	addi	4, 4, 16
280	STXVD2X	(26,(4),(3))
281	addi	4, 4, 16
282	STXVD2X	(27,(4),(3))
283	addi	4, 4, 16
284	STXVD2X	(28,(4),(3))
285	addi	4, 4, 16
286	STXVD2X	(29,(4),(3))
287	addi	4, 4, 16
288	STXVD2X	(30,(4),(3))
289	addi	4, 4, 16
290	STXVD2X	(31,(4),(3))
291	addi	4, 4, 16
292	STXVD2X	(32,(4),(3))
293	addi	4, 4, 16
294	STXVD2X	(33,(4),(3))
295	addi	4, 4, 16
296	STXVD2X	(34,(4),(3))
297	addi	4, 4, 16
298	STXVD2X	(35,(4),(3))
299	addi	4, 4, 16
300	STXVD2X	(36,(4),(3))
301	addi	4, 4, 16
302	STXVD2X	(37,(4),(3))
303	addi	4, 4, 16
304	STXVD2X	(38,(4),(3))
305	addi	4, 4, 16
306	STXVD2X	(39,(4),(3))
307	addi	4, 4, 16
308	STXVD2X	(40,(4),(3))
309	addi	4, 4, 16
310	STXVD2X	(41,(4),(3))
311	addi	4, 4, 16
312	STXVD2X	(42,(4),(3))
313	addi	4, 4, 16
314	STXVD2X	(43,(4),(3))
315	addi	4, 4, 16
316	STXVD2X	(44,(4),(3))
317	addi	4, 4, 16
318	STXVD2X	(45,(4),(3))
319	addi	4, 4, 16
320	STXVD2X	(46,(4),(3))
321	addi	4, 4, 16
322	STXVD2X	(47,(4),(3))
323	addi	4, 4, 16
324	STXVD2X	(48,(4),(3))
325	addi	4, 4, 16
326	STXVD2X	(49,(4),(3))
327	addi	4, 4, 16
328	STXVD2X	(50,(4),(3))
329	addi	4, 4, 16
330	STXVD2X	(51,(4),(3))
331	addi	4, 4, 16
332	STXVD2X	(52,(4),(3))
333	addi	4, 4, 16
334	STXVD2X	(53,(4),(3))
335	addi	4, 4, 16
336	STXVD2X	(54,(4),(3))
337	addi	4, 4, 16
338	STXVD2X	(55,(4),(3))
339	addi	4, 4, 16
340	STXVD2X	(56,(4),(3))
341	addi	4, 4, 16
342	STXVD2X	(57,(4),(3))
343	addi	4, 4, 16
344	STXVD2X	(58,(4),(3))
345	addi	4, 4, 16
346	STXVD2X	(59,(4),(3))
347	addi	4, 4, 16
348	STXVD2X	(60,(4),(3))
349	addi	4, 4, 16
350	STXVD2X	(61,(4),(3))
351	addi	4, 4, 16
352	STXVD2X	(62,(4),(3))
353	addi	4, 4, 16
354	STXVD2X	(63,(4),(3))
355	blr
356FUNC_END(storevsx)
357