1 /*
2  * Copyright 2015, Cyril Bur, IBM Corp.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version
7  * 2 of the License, or (at your option) any later version.
8  */
9 
10 #include "basic_asm.h"
11 
12 /* POS MUST BE 16 ALIGNED! */
13 #define PUSH_VMX(pos,reg) \
14 	li	reg,pos; \
15 	stvx	v20,reg,%r1; \
16 	addi	reg,reg,16; \
17 	stvx	v21,reg,%r1; \
18 	addi	reg,reg,16; \
19 	stvx	v22,reg,%r1; \
20 	addi	reg,reg,16; \
21 	stvx	v23,reg,%r1; \
22 	addi	reg,reg,16; \
23 	stvx	v24,reg,%r1; \
24 	addi	reg,reg,16; \
25 	stvx	v25,reg,%r1; \
26 	addi	reg,reg,16; \
27 	stvx	v26,reg,%r1; \
28 	addi	reg,reg,16; \
29 	stvx	v27,reg,%r1; \
30 	addi	reg,reg,16; \
31 	stvx	v28,reg,%r1; \
32 	addi	reg,reg,16; \
33 	stvx	v29,reg,%r1; \
34 	addi	reg,reg,16; \
35 	stvx	v30,reg,%r1; \
36 	addi	reg,reg,16; \
37 	stvx	v31,reg,%r1;
38 
39 /* POS MUST BE 16 ALIGNED! */
40 #define POP_VMX(pos,reg) \
41 	li	reg,pos; \
42 	lvx	v20,reg,%r1; \
43 	addi	reg,reg,16; \
44 	lvx	v21,reg,%r1; \
45 	addi	reg,reg,16; \
46 	lvx	v22,reg,%r1; \
47 	addi	reg,reg,16; \
48 	lvx	v23,reg,%r1; \
49 	addi	reg,reg,16; \
50 	lvx	v24,reg,%r1; \
51 	addi	reg,reg,16; \
52 	lvx	v25,reg,%r1; \
53 	addi	reg,reg,16; \
54 	lvx	v26,reg,%r1; \
55 	addi	reg,reg,16; \
56 	lvx	v27,reg,%r1; \
57 	addi	reg,reg,16; \
58 	lvx	v28,reg,%r1; \
59 	addi	reg,reg,16; \
60 	lvx	v29,reg,%r1; \
61 	addi	reg,reg,16; \
62 	lvx	v30,reg,%r1; \
63 	addi	reg,reg,16; \
64 	lvx	v31,reg,%r1;
65 
66 /*
67  * Careful this will 'clobber' vmx (by design)
68  * Don't call this from C
69  */
70 FUNC_START(load_vmx)
71 	li	r5,0
72 	lvx	v20,r5,r3
73 	addi	r5,r5,16
74 	lvx	v21,r5,r3
75 	addi	r5,r5,16
76 	lvx	v22,r5,r3
77 	addi	r5,r5,16
78 	lvx	v23,r5,r3
79 	addi	r5,r5,16
80 	lvx	v24,r5,r3
81 	addi	r5,r5,16
82 	lvx	v25,r5,r3
83 	addi	r5,r5,16
84 	lvx	v26,r5,r3
85 	addi	r5,r5,16
86 	lvx	v27,r5,r3
87 	addi	r5,r5,16
88 	lvx	v28,r5,r3
89 	addi	r5,r5,16
90 	lvx	v29,r5,r3
91 	addi	r5,r5,16
92 	lvx	v30,r5,r3
93 	addi	r5,r5,16
94 	lvx	v31,r5,r3
95 	blr
96 FUNC_END(load_vmx)
97