1 /*
2 * include/asm-sparc64/xor.h
3 *
4 * High speed xor_block operation for RAID4/5 utilizing the
5 * UltraSparc Visual Instruction Set.
6 *
7 * Copyright (C) 1997, 1999 Jakub Jelinek (jj@ultra.linux.cz)
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2, or (at your option)
12 * any later version.
13 *
14 * You should have received a copy of the GNU General Public License
15 * (for example /usr/src/linux/COPYING); if not, write to the Free
16 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19 /*
20 * Requirements:
21 * !(((long)dest | (long)sourceN) & (64 - 1)) &&
22 * !(len & 127) && len >= 256
23 *
24 * It is done in pure assembly, as otherwise gcc makes it a non-leaf
25 * function, which is not what we want.
26 */
27
28 #include <asm/pstate.h>
29 #include <asm/asi.h>
30
31 extern void xor_vis_2(unsigned long, unsigned long *, unsigned long *);
32 extern void xor_vis_3(unsigned long, unsigned long *, unsigned long *,
33 unsigned long *);
34 extern void xor_vis_4(unsigned long, unsigned long *, unsigned long *,
35 unsigned long *, unsigned long *);
36 extern void xor_vis_5(unsigned long, unsigned long *, unsigned long *,
37 unsigned long *, unsigned long *, unsigned long *);
38
39 #define _S(x) __S(x)
40 #define __S(x) #x
41 #define DEF(x) __asm__(#x " = " _S(x))
42
43 DEF(FPRS_FEF);
44 DEF(FPRS_DU);
45 DEF(ASI_BLK_P);
46
47 /* ??? We set and use %asi instead of using ASI_BLK_P directly because gas
48 currently does not accept symbolic constants for the ASI specifier. */
49
50 __asm__ ("
51 .text
52 .globl xor_vis_2
53 .type xor_vis_2,@function
54 xor_vis_2:
55 rd %fprs, %g1
56 andcc %g1, FPRS_FEF|FPRS_DU, %g0
57 be,pt %icc, 0f
58 sethi %hi(VISenter), %g1
59 jmpl %g1 + %lo(VISenter), %g7
60 add %g7, 8, %g7
61 0: wr %g0, FPRS_FEF, %fprs
62 rd %asi, %g1
63 wr %g0, ASI_BLK_P, %asi
64 membar #LoadStore|#StoreLoad|#StoreStore
65 sub %o0, 128, %o0
66 ldda [%o1] %asi, %f0
67 ldda [%o2] %asi, %f16
68
69 2: ldda [%o1 + 64] %asi, %f32
70 fxor %f0, %f16, %f16
71 fxor %f2, %f18, %f18
72 fxor %f4, %f20, %f20
73 fxor %f6, %f22, %f22
74 fxor %f8, %f24, %f24
75 fxor %f10, %f26, %f26
76 fxor %f12, %f28, %f28
77 fxor %f14, %f30, %f30
78 stda %f16, [%o1] %asi
79 ldda [%o2 + 64] %asi, %f48
80 ldda [%o1 + 128] %asi, %f0
81 fxor %f32, %f48, %f48
82 fxor %f34, %f50, %f50
83 add %o1, 128, %o1
84 fxor %f36, %f52, %f52
85 add %o2, 128, %o2
86 fxor %f38, %f54, %f54
87 subcc %o0, 128, %o0
88 fxor %f40, %f56, %f56
89 fxor %f42, %f58, %f58
90 fxor %f44, %f60, %f60
91 fxor %f46, %f62, %f62
92 stda %f48, [%o1 - 64] %asi
93 bne,pt %xcc, 2b
94 ldda [%o2] %asi, %f16
95
96 ldda [%o1 + 64] %asi, %f32
97 fxor %f0, %f16, %f16
98 fxor %f2, %f18, %f18
99 fxor %f4, %f20, %f20
100 fxor %f6, %f22, %f22
101 fxor %f8, %f24, %f24
102 fxor %f10, %f26, %f26
103 fxor %f12, %f28, %f28
104 fxor %f14, %f30, %f30
105 stda %f16, [%o1] %asi
106 ldda [%o2 + 64] %asi, %f48
107 membar #Sync
108 fxor %f32, %f48, %f48
109 fxor %f34, %f50, %f50
110 fxor %f36, %f52, %f52
111 fxor %f38, %f54, %f54
112 fxor %f40, %f56, %f56
113 fxor %f42, %f58, %f58
114 fxor %f44, %f60, %f60
115 fxor %f46, %f62, %f62
116 stda %f48, [%o1 + 64] %asi
117 membar #Sync|#StoreStore|#StoreLoad
118 wr %g1, %g0, %asi
119 retl
120 wr %g0, 0, %fprs
121 .size xor_vis_2, .-xor_vis_2
122
123
124 .globl xor_vis_3
125 .type xor_vis_3,@function
126 xor_vis_3:
127 rd %fprs, %g1
128 andcc %g1, FPRS_FEF|FPRS_DU, %g0
129 be,pt %icc, 0f
130 sethi %hi(VISenter), %g1
131 jmpl %g1 + %lo(VISenter), %g7
132 add %g7, 8, %g7
133 0: wr %g0, FPRS_FEF, %fprs
134 rd %asi, %g1
135 wr %g0, ASI_BLK_P, %asi
136 membar #LoadStore|#StoreLoad|#StoreStore
137 sub %o0, 64, %o0
138 ldda [%o1] %asi, %f0
139 ldda [%o2] %asi, %f16
140
141 3: ldda [%o3] %asi, %f32
142 fxor %f0, %f16, %f48
143 fxor %f2, %f18, %f50
144 add %o1, 64, %o1
145 fxor %f4, %f20, %f52
146 fxor %f6, %f22, %f54
147 add %o2, 64, %o2
148 fxor %f8, %f24, %f56
149 fxor %f10, %f26, %f58
150 fxor %f12, %f28, %f60
151 fxor %f14, %f30, %f62
152 ldda [%o1] %asi, %f0
153 fxor %f48, %f32, %f48
154 fxor %f50, %f34, %f50
155 fxor %f52, %f36, %f52
156 fxor %f54, %f38, %f54
157 add %o3, 64, %o3
158 fxor %f56, %f40, %f56
159 fxor %f58, %f42, %f58
160 subcc %o0, 64, %o0
161 fxor %f60, %f44, %f60
162 fxor %f62, %f46, %f62
163 stda %f48, [%o1 - 64] %asi
164 bne,pt %xcc, 3b
165 ldda [%o2] %asi, %f16
166
167 ldda [%o3] %asi, %f32
168 fxor %f0, %f16, %f48
169 fxor %f2, %f18, %f50
170 fxor %f4, %f20, %f52
171 fxor %f6, %f22, %f54
172 fxor %f8, %f24, %f56
173 fxor %f10, %f26, %f58
174 fxor %f12, %f28, %f60
175 fxor %f14, %f30, %f62
176 membar #Sync
177 fxor %f48, %f32, %f48
178 fxor %f50, %f34, %f50
179 fxor %f52, %f36, %f52
180 fxor %f54, %f38, %f54
181 fxor %f56, %f40, %f56
182 fxor %f58, %f42, %f58
183 fxor %f60, %f44, %f60
184 fxor %f62, %f46, %f62
185 stda %f48, [%o1] %asi
186 membar #Sync|#StoreStore|#StoreLoad
187 wr %g1, %g0, %asi
188 retl
189 wr %g0, 0, %fprs
190 .size xor_vis_3, .-xor_vis_3
191
192
193 .globl xor_vis_4
194 .type xor_vis_4,@function
195 xor_vis_4:
196 rd %fprs, %g1
197 andcc %g1, FPRS_FEF|FPRS_DU, %g0
198 be,pt %icc, 0f
199 sethi %hi(VISenter), %g1
200 jmpl %g1 + %lo(VISenter), %g7
201 add %g7, 8, %g7
202 0: wr %g0, FPRS_FEF, %fprs
203 rd %asi, %g1
204 wr %g0, ASI_BLK_P, %asi
205 membar #LoadStore|#StoreLoad|#StoreStore
206 sub %o0, 64, %o0
207 ldda [%o1] %asi, %f0
208 ldda [%o2] %asi, %f16
209
210 4: ldda [%o3] %asi, %f32
211 fxor %f0, %f16, %f16
212 fxor %f2, %f18, %f18
213 add %o1, 64, %o1
214 fxor %f4, %f20, %f20
215 fxor %f6, %f22, %f22
216 add %o2, 64, %o2
217 fxor %f8, %f24, %f24
218 fxor %f10, %f26, %f26
219 fxor %f12, %f28, %f28
220 fxor %f14, %f30, %f30
221 ldda [%o4] %asi, %f48
222 fxor %f16, %f32, %f32
223 fxor %f18, %f34, %f34
224 fxor %f20, %f36, %f36
225 fxor %f22, %f38, %f38
226 add %o3, 64, %o3
227 fxor %f24, %f40, %f40
228 fxor %f26, %f42, %f42
229 fxor %f28, %f44, %f44
230 fxor %f30, %f46, %f46
231 ldda [%o1] %asi, %f0
232 fxor %f32, %f48, %f48
233 fxor %f34, %f50, %f50
234 fxor %f36, %f52, %f52
235 add %o4, 64, %o4
236 fxor %f38, %f54, %f54
237 fxor %f40, %f56, %f56
238 fxor %f42, %f58, %f58
239 subcc %o0, 64, %o0
240 fxor %f44, %f60, %f60
241 fxor %f46, %f62, %f62
242 stda %f48, [%o1 - 64] %asi
243 bne,pt %xcc, 4b
244 ldda [%o2] %asi, %f16
245
246 ldda [%o3] %asi, %f32
247 fxor %f0, %f16, %f16
248 fxor %f2, %f18, %f18
249 fxor %f4, %f20, %f20
250 fxor %f6, %f22, %f22
251 fxor %f8, %f24, %f24
252 fxor %f10, %f26, %f26
253 fxor %f12, %f28, %f28
254 fxor %f14, %f30, %f30
255 ldda [%o4] %asi, %f48
256 fxor %f16, %f32, %f32
257 fxor %f18, %f34, %f34
258 fxor %f20, %f36, %f36
259 fxor %f22, %f38, %f38
260 fxor %f24, %f40, %f40
261 fxor %f26, %f42, %f42
262 fxor %f28, %f44, %f44
263 fxor %f30, %f46, %f46
264 membar #Sync
265 fxor %f32, %f48, %f48
266 fxor %f34, %f50, %f50
267 fxor %f36, %f52, %f52
268 fxor %f38, %f54, %f54
269 fxor %f40, %f56, %f56
270 fxor %f42, %f58, %f58
271 fxor %f44, %f60, %f60
272 fxor %f46, %f62, %f62
273 stda %f48, [%o1] %asi
274 membar #Sync|#StoreStore|#StoreLoad
275 wr %g1, %g0, %asi
276 retl
277 wr %g0, 0, %fprs
278 .size xor_vis_4, .-xor_vis_4
279
280
281 .globl xor_vis_5
282 .type xor_vis_5,@function
283 xor_vis_5:
284 rd %fprs, %g1
285 andcc %g1, FPRS_FEF|FPRS_DU, %g0
286 be,pt %icc, 0f
287 sethi %hi(VISenter), %g1
288 jmpl %g1 + %lo(VISenter), %g7
289 add %g7, 8, %g7
290 0: wr %g0, FPRS_FEF, %fprs
291 rd %asi, %g1
292 wr %g0, ASI_BLK_P, %asi
293 membar #LoadStore|#StoreLoad|#StoreStore
294 sub %o0, 64, %o0
295 ldda [%o1] %asi, %f0
296 ldda [%o2] %asi, %f16
297
298 5: ldda [%o3] %asi, %f32
299 fxor %f0, %f16, %f48
300 fxor %f2, %f18, %f50
301 add %o1, 64, %o1
302 fxor %f4, %f20, %f52
303 fxor %f6, %f22, %f54
304 add %o2, 64, %o2
305 fxor %f8, %f24, %f56
306 fxor %f10, %f26, %f58
307 fxor %f12, %f28, %f60
308 fxor %f14, %f30, %f62
309 ldda [%o4] %asi, %f16
310 fxor %f48, %f32, %f48
311 fxor %f50, %f34, %f50
312 fxor %f52, %f36, %f52
313 fxor %f54, %f38, %f54
314 add %o3, 64, %o3
315 fxor %f56, %f40, %f56
316 fxor %f58, %f42, %f58
317 fxor %f60, %f44, %f60
318 fxor %f62, %f46, %f62
319 ldda [%o5] %asi, %f32
320 fxor %f48, %f16, %f48
321 fxor %f50, %f18, %f50
322 add %o4, 64, %o4
323 fxor %f52, %f20, %f52
324 fxor %f54, %f22, %f54
325 add %o5, 64, %o5
326 fxor %f56, %f24, %f56
327 fxor %f58, %f26, %f58
328 fxor %f60, %f28, %f60
329 fxor %f62, %f30, %f62
330 ldda [%o1] %asi, %f0
331 fxor %f48, %f32, %f48
332 fxor %f50, %f34, %f50
333 fxor %f52, %f36, %f52
334 fxor %f54, %f38, %f54
335 fxor %f56, %f40, %f56
336 fxor %f58, %f42, %f58
337 subcc %o0, 64, %o0
338 fxor %f60, %f44, %f60
339 fxor %f62, %f46, %f62
340 stda %f48, [%o1 - 64] %asi
341 bne,pt %xcc, 5b
342 ldda [%o2] %asi, %f16
343
344 ldda [%o3] %asi, %f32
345 fxor %f0, %f16, %f48
346 fxor %f2, %f18, %f50
347 fxor %f4, %f20, %f52
348 fxor %f6, %f22, %f54
349 fxor %f8, %f24, %f56
350 fxor %f10, %f26, %f58
351 fxor %f12, %f28, %f60
352 fxor %f14, %f30, %f62
353 ldda [%o4] %asi, %f16
354 fxor %f48, %f32, %f48
355 fxor %f50, %f34, %f50
356 fxor %f52, %f36, %f52
357 fxor %f54, %f38, %f54
358 fxor %f56, %f40, %f56
359 fxor %f58, %f42, %f58
360 fxor %f60, %f44, %f60
361 fxor %f62, %f46, %f62
362 ldda [%o5] %asi, %f32
363 fxor %f48, %f16, %f48
364 fxor %f50, %f18, %f50
365 fxor %f52, %f20, %f52
366 fxor %f54, %f22, %f54
367 fxor %f56, %f24, %f56
368 fxor %f58, %f26, %f58
369 fxor %f60, %f28, %f60
370 fxor %f62, %f30, %f62
371 membar #Sync
372 fxor %f48, %f32, %f48
373 fxor %f50, %f34, %f50
374 fxor %f52, %f36, %f52
375 fxor %f54, %f38, %f54
376 fxor %f56, %f40, %f56
377 fxor %f58, %f42, %f58
378 fxor %f60, %f44, %f60
379 fxor %f62, %f46, %f62
380 stda %f48, [%o1] %asi
381 membar #Sync|#StoreStore|#StoreLoad
382 wr %g1, %g0, %asi
383 retl
384 wr %g0, 0, %fprs
385 .size xor_vis_5, .-xor_vis_5
386 ");
387
388 static struct xor_block_template xor_block_VIS = {
389 name: "VIS",
390 do_2: xor_vis_2,
391 do_3: xor_vis_3,
392 do_4: xor_vis_4,
393 do_5: xor_vis_5,
394 };
395
396 #define XOR_TRY_TEMPLATES xor_speed(&xor_block_VIS)
397
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.