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