1 /*
2  * SPARC assembly matrix code.
3  */
4 
5 #ifndef _SPARC_MATRIX_H
6 #define _SPARC_MATRIX_H
7 
8 #ifdef __arch64__
9 #define LDPTR		ldx
10 #define MAT_M		0x00
11 #define MAT_INV		0x08
12 #define V4F_DATA	0x00
13 #define V4F_START	0x08
14 #define V4F_COUNT	0x10
15 #define V4F_STRIDE	0x14
16 #define V4F_SIZE	0x18
17 #define V4F_FLAGS	0x1c
18 #else
19 #define LDPTR		ld
20 #define MAT_M		0x00
21 #define MAT_INV		0x04
22 #define V4F_DATA	0x00
23 #define V4F_START	0x04
24 #define V4F_COUNT	0x08
25 #define V4F_STRIDE	0x0c
26 #define V4F_SIZE	0x10
27 #define V4F_FLAGS	0x14
28 #endif
29 
30 #define VEC_SIZE_1   	1
31 #define VEC_SIZE_2   	3
32 #define VEC_SIZE_3   	7
33 #define VEC_SIZE_4   	15
34 
35 #define M0		%f16
36 #define M1		%f17
37 #define M2		%f18
38 #define M3		%f19
39 #define M4		%f20
40 #define M5		%f21
41 #define M6		%f22
42 #define M7		%f23
43 #define M8		%f24
44 #define M9		%f25
45 #define M10		%f26
46 #define M11		%f27
47 #define M12		%f28
48 #define M13		%f29
49 #define M14		%f30
50 #define M15		%f31
51 
52 #define LDMATRIX_0_1_2_3_12_13_14_15(BASE)	\
53 	ldd	[BASE + ( 0 * 0x4)], M0;	\
54 	ldd	[BASE + ( 2 * 0x4)], M2;	\
55 	ldd	[BASE + (12 * 0x4)], M12;	\
56 	ldd	[BASE + (14 * 0x4)], M14
57 
58 #define LDMATRIX_0_1_12_13(BASE)		\
59 	ldd	[BASE + ( 0 * 0x4)], M0;	\
60 	ldd	[BASE + (12 * 0x4)], M12
61 
62 #define LDMATRIX_0_12_13(BASE)			\
63 	ld	[BASE + ( 0 * 0x4)], M0;	\
64 	ldd	[BASE + (12 * 0x4)], M12
65 
66 #define LDMATRIX_0_1_2_12_13_14(BASE)		\
67 	ldd	[BASE + ( 0 * 0x4)], M0;	\
68 	ld	[BASE + ( 2 * 0x4)], M2;	\
69 	ldd	[BASE + (12 * 0x4)], M12;	\
70 	ld	[BASE + (14 * 0x4)], M14
71 
72 #define LDMATRIX_0_12_13_14(BASE)		\
73 	ld	[BASE + ( 0 * 0x4)], M0;	\
74 	ldd	[BASE + (12 * 0x4)], M12;	\
75 	ld	[BASE + (14 * 0x4)], M14
76 
77 #define LDMATRIX_0_14(BASE)			\
78 	ld	[BASE + ( 0 * 0x4)], M0;	\
79 	ld	[BASE + (14 * 0x4)], M14
80 
81 #define LDMATRIX_0_1_2_3_4_5_6_7_12_13_14_15(BASE) \
82 	ldd	[BASE + ( 0 * 0x4)], M0;	\
83 	ldd	[BASE + ( 2 * 0x4)], M2;	\
84 	ldd	[BASE + ( 4 * 0x4)], M4;	\
85 	ldd	[BASE + ( 6 * 0x4)], M6;	\
86 	ldd	[BASE + (12 * 0x4)], M12;	\
87 	ldd	[BASE + (14 * 0x4)], M14
88 
89 #define LDMATRIX_0_5_12_13(BASE) 		\
90 	ld	[BASE + ( 0 * 0x4)], M0;	\
91 	ld	[BASE + ( 5 * 0x4)], M5;	\
92 	ldd	[BASE + (12 * 0x4)], M12
93 
94 #define LDMATRIX_0_1_2_3_4_5_6_12_13_14(BASE)	\
95 	ldd	[BASE + ( 0 * 0x4)], M0;	\
96 	ldd	[BASE + ( 2 * 0x4)], M2;	\
97 	ldd	[BASE + ( 4 * 0x4)], M4;	\
98 	ld	[BASE + ( 6 * 0x4)], M6;	\
99 	ldd	[BASE + (12 * 0x4)], M12;	\
100 	ld	[BASE + (14 * 0x4)], M14
101 
102 #define LDMATRIX_0_5_12_13_14(BASE)		\
103 	ld	[BASE + ( 0 * 0x4)], M0;	\
104 	ld	[BASE + ( 5 * 0x4)], M5;	\
105 	ldd	[BASE + (12 * 0x4)], M12;	\
106 	ld	[BASE + (14 * 0x4)], M14
107 
108 #define LDMATRIX_0_5_14(BASE)			\
109 	ld	[BASE + ( 0 * 0x4)], M0;	\
110 	ld	[BASE + ( 5 * 0x4)], M5;	\
111 	ld	[BASE + (14 * 0x4)], M14
112 
113 #define LDMATRIX_0_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15(BASE) \
114 	ldd	[BASE + ( 0 * 0x4)], M0;	\
115 	ldd	[BASE + ( 2 * 0x4)], M2;	\
116 	ldd	[BASE + ( 4 * 0x4)], M4;	\
117 	ldd	[BASE + ( 6 * 0x4)], M6;	\
118 	ldd	[BASE + ( 8 * 0x4)], M8;	\
119 	ldd	[BASE + (10 * 0x4)], M10;	\
120 	ldd	[BASE + (12 * 0x4)], M12;	\
121 	ldd	[BASE + (14 * 0x4)], M14
122 
123 #define LDMATRIX_0_1_4_5_12_13(BASE) 		\
124 	ldd	[BASE + ( 0 * 0x4)], M0;	\
125 	ldd	[BASE + ( 4 * 0x4)], M4;	\
126 	ldd	[BASE + (12 * 0x4)], M12
127 
128 #define LDMATRIX_0_5_12_13(BASE) 		\
129 	ld	[BASE + ( 0 * 0x4)], M0;	\
130 	ld	[BASE + ( 5 * 0x4)], M5;	\
131 	ldd	[BASE + (12 * 0x4)], M12
132 
133 #define LDMATRIX_0_1_2_4_5_6_8_9_10(BASE) \
134 	ldd	[BASE + ( 0 * 0x4)], M0;	\
135 	ld	[BASE + ( 2 * 0x4)], M2;	\
136 	ldd	[BASE + ( 4 * 0x4)], M4;	\
137 	ld	[BASE + ( 6 * 0x4)], M6;	\
138 	ldd	[BASE + ( 8 * 0x4)], M8;	\
139 	ld	[BASE + (10 * 0x4)], M10
140 
141 #define LDMATRIX_0_1_2_4_5_6_8_9_10_12_13_14(BASE) \
142 	ldd	[BASE + ( 0 * 0x4)], M0;	\
143 	ld	[BASE + ( 2 * 0x4)], M2;	\
144 	ldd	[BASE + ( 4 * 0x4)], M4;	\
145 	ld	[BASE + ( 6 * 0x4)], M6;	\
146 	ldd	[BASE + ( 8 * 0x4)], M8;	\
147 	ld	[BASE + (10 * 0x4)], M10;	\
148 	ldd	[BASE + (12 * 0x4)], M12;	\
149 	ld	[BASE + (14 * 0x4)], M14
150 
151 #define LDMATRIX_0_5_10(BASE) 			\
152 	ld	[BASE + ( 0 * 0x4)], M0;	\
153 	ld	[BASE + ( 5 * 0x4)], M5;	\
154 	ld	[BASE + (10 * 0x4)], M10;	\
155 
156 #define LDMATRIX_0_5_10_12_13_14(BASE) 		\
157 	ld	[BASE + ( 0 * 0x4)], M0;	\
158 	ld	[BASE + ( 5 * 0x4)], M5;	\
159 	ld	[BASE + (10 * 0x4)], M10;	\
160 	ldd	[BASE + (12 * 0x4)], M12;	\
161 	ld	[BASE + (14 * 0x4)], M14
162 
163 #define LDMATRIX_0_5_8_9_10_14(BASE) 		\
164 	ld	[BASE + ( 0 * 0x4)], M0;	\
165 	ld	[BASE + ( 5 * 0x4)], M5;	\
166 	ldd	[BASE + ( 8 * 0x4)], M8;	\
167 	ld	[BASE + (10 * 0x4)], M10;	\
168 	ld	[BASE + (14 * 0x4)], M14
169 
170 #endif /* !(_SPARC_MATRIX_H) */
171