Optimize andes_clear_page() and andes_copy_page() with prefetch
[linux-2.6/linux-mips.git] / include / asm-sparc64 / md.h
blob373c7674420c4c29056c0284d907832e59b69cd8
1 /* $Id: md.h,v 1.3 1999/05/25 16:53:28 jj Exp $
2 * md.h: High speed xor_block operation for RAID4/5
3 * utilizing the UltraSparc Visual Instruction Set.
5 * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
6 */
8 #ifndef __ASM_MD_H
9 #define __ASM_MD_H
11 #include <asm/head.h>
12 #include <asm/asi.h>
14 #undef HAVE_ARCH_XORBLOCK
16 #define MD_XORBLOCK_ALIGNMENT 64
18 /* void __xor_block (char *dest, char *src, long len)
19 * {
20 * while (len--) *dest++ ^= *src++;
21 * }
23 * Requirements:
24 * !(((long)dest | (long)src) & (MD_XORBLOCK_ALIGNMENT - 1)) &&
25 * !(len & 127) && len >= 256
28 static inline void __xor_block (char *dest, char *src, long len)
30 __asm__ __volatile__ ("
31 wr %%g0, %3, %%fprs
32 wr %%g0, %4, %%asi
33 membar #LoadStore|#StoreLoad|#StoreStore
34 sub %2, 128, %2
35 ldda [%0] %4, %%f0
36 ldda [%1] %4, %%f16
37 1: ldda [%0 + 64] %%asi, %%f32
38 fxor %%f0, %%f16, %%f16
39 fxor %%f2, %%f18, %%f18
40 fxor %%f4, %%f20, %%f20
41 fxor %%f6, %%f22, %%f22
42 fxor %%f8, %%f24, %%f24
43 fxor %%f10, %%f26, %%f26
44 fxor %%f12, %%f28, %%f28
45 fxor %%f14, %%f30, %%f30
46 stda %%f16, [%0] %4
47 ldda [%1 + 64] %%asi, %%f48
48 ldda [%0 + 128] %%asi, %%f0
49 fxor %%f32, %%f48, %%f48
50 fxor %%f34, %%f50, %%f50
51 add %0, 128, %0
52 fxor %%f36, %%f52, %%f52
53 add %1, 128, %1
54 fxor %%f38, %%f54, %%f54
55 subcc %2, 128, %2
56 fxor %%f40, %%f56, %%f56
57 fxor %%f42, %%f58, %%f58
58 fxor %%f44, %%f60, %%f60
59 fxor %%f46, %%f62, %%f62
60 stda %%f48, [%0 - 64] %%asi
61 bne,pt %%xcc, 1b
62 ldda [%1] %4, %%f16
63 ldda [%0 + 64] %%asi, %%f32
64 fxor %%f0, %%f16, %%f16
65 fxor %%f2, %%f18, %%f18
66 fxor %%f4, %%f20, %%f20
67 fxor %%f6, %%f22, %%f22
68 fxor %%f8, %%f24, %%f24
69 fxor %%f10, %%f26, %%f26
70 fxor %%f12, %%f28, %%f28
71 fxor %%f14, %%f30, %%f30
72 stda %%f16, [%0] %4
73 ldda [%1 + 64] %%asi, %%f48
74 membar #Sync
75 fxor %%f32, %%f48, %%f48
76 fxor %%f34, %%f50, %%f50
77 fxor %%f36, %%f52, %%f52
78 fxor %%f38, %%f54, %%f54
79 fxor %%f40, %%f56, %%f56
80 fxor %%f42, %%f58, %%f58
81 fxor %%f44, %%f60, %%f60
82 fxor %%f46, %%f62, %%f62
83 stda %%f48, [%0 + 64] %%asi
84 membar #Sync|#StoreStore|#StoreLoad
85 wr %%g0, 0, %%fprs
86 " : :
87 "r" (dest), "r" (src), "r" (len), "i" (FPRS_FEF), "i" (ASI_BLK_P) :
88 "cc", "memory");
91 #endif /* __ASM_MD_H */