]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - arch/sparc64/lib/xor.S
Linux-2.6.12-rc2
[mirror_ubuntu-artful-kernel.git] / arch / sparc64 / lib / xor.S
1 /*
2 * arch/sparc64/lib/xor.S
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
10 #include <asm/visasm.h>
11 #include <asm/asi.h>
12 #include <asm/dcu.h>
13 #include <asm/spitfire.h>
14
15 /*
16 * Requirements:
17 * !(((long)dest | (long)sourceN) & (64 - 1)) &&
18 * !(len & 127) && len >= 256
19 */
20 .text
21 .align 32
22 .globl xor_vis_2
23 .type xor_vis_2,#function
24 xor_vis_2:
25 rd %fprs, %o5
26 andcc %o5, FPRS_FEF|FPRS_DU, %g0
27 be,pt %icc, 0f
28 sethi %hi(VISenter), %g1
29 jmpl %g1 + %lo(VISenter), %g7
30 add %g7, 8, %g7
31 0: wr %g0, FPRS_FEF, %fprs
32 rd %asi, %g1
33 wr %g0, ASI_BLK_P, %asi
34 membar #LoadStore|#StoreLoad|#StoreStore
35 sub %o0, 128, %o0
36 ldda [%o1] %asi, %f0
37 ldda [%o2] %asi, %f16
38
39 2: ldda [%o1 + 64] %asi, %f32
40 fxor %f0, %f16, %f16
41 fxor %f2, %f18, %f18
42 fxor %f4, %f20, %f20
43 fxor %f6, %f22, %f22
44 fxor %f8, %f24, %f24
45 fxor %f10, %f26, %f26
46 fxor %f12, %f28, %f28
47 fxor %f14, %f30, %f30
48 stda %f16, [%o1] %asi
49 ldda [%o2 + 64] %asi, %f48
50 ldda [%o1 + 128] %asi, %f0
51 fxor %f32, %f48, %f48
52 fxor %f34, %f50, %f50
53 add %o1, 128, %o1
54 fxor %f36, %f52, %f52
55 add %o2, 128, %o2
56 fxor %f38, %f54, %f54
57 subcc %o0, 128, %o0
58 fxor %f40, %f56, %f56
59 fxor %f42, %f58, %f58
60 fxor %f44, %f60, %f60
61 fxor %f46, %f62, %f62
62 stda %f48, [%o1 - 64] %asi
63 bne,pt %xcc, 2b
64 ldda [%o2] %asi, %f16
65
66 ldda [%o1 + 64] %asi, %f32
67 fxor %f0, %f16, %f16
68 fxor %f2, %f18, %f18
69 fxor %f4, %f20, %f20
70 fxor %f6, %f22, %f22
71 fxor %f8, %f24, %f24
72 fxor %f10, %f26, %f26
73 fxor %f12, %f28, %f28
74 fxor %f14, %f30, %f30
75 stda %f16, [%o1] %asi
76 ldda [%o2 + 64] %asi, %f48
77 membar #Sync
78 fxor %f32, %f48, %f48
79 fxor %f34, %f50, %f50
80 fxor %f36, %f52, %f52
81 fxor %f38, %f54, %f54
82 fxor %f40, %f56, %f56
83 fxor %f42, %f58, %f58
84 fxor %f44, %f60, %f60
85 fxor %f46, %f62, %f62
86 stda %f48, [%o1 + 64] %asi
87 membar #Sync|#StoreStore|#StoreLoad
88 wr %g1, %g0, %asi
89 retl
90 wr %g0, 0, %fprs
91 .size xor_vis_2, .-xor_vis_2
92
93 .globl xor_vis_3
94 .type xor_vis_3,#function
95 xor_vis_3:
96 rd %fprs, %o5
97 andcc %o5, FPRS_FEF|FPRS_DU, %g0
98 be,pt %icc, 0f
99 sethi %hi(VISenter), %g1
100 jmpl %g1 + %lo(VISenter), %g7
101 add %g7, 8, %g7
102 0: wr %g0, FPRS_FEF, %fprs
103 rd %asi, %g1
104 wr %g0, ASI_BLK_P, %asi
105 membar #LoadStore|#StoreLoad|#StoreStore
106 sub %o0, 64, %o0
107 ldda [%o1] %asi, %f0
108 ldda [%o2] %asi, %f16
109
110 3: ldda [%o3] %asi, %f32
111 fxor %f0, %f16, %f48
112 fxor %f2, %f18, %f50
113 add %o1, 64, %o1
114 fxor %f4, %f20, %f52
115 fxor %f6, %f22, %f54
116 add %o2, 64, %o2
117 fxor %f8, %f24, %f56
118 fxor %f10, %f26, %f58
119 fxor %f12, %f28, %f60
120 fxor %f14, %f30, %f62
121 ldda [%o1] %asi, %f0
122 fxor %f48, %f32, %f48
123 fxor %f50, %f34, %f50
124 fxor %f52, %f36, %f52
125 fxor %f54, %f38, %f54
126 add %o3, 64, %o3
127 fxor %f56, %f40, %f56
128 fxor %f58, %f42, %f58
129 subcc %o0, 64, %o0
130 fxor %f60, %f44, %f60
131 fxor %f62, %f46, %f62
132 stda %f48, [%o1 - 64] %asi
133 bne,pt %xcc, 3b
134 ldda [%o2] %asi, %f16
135
136 ldda [%o3] %asi, %f32
137 fxor %f0, %f16, %f48
138 fxor %f2, %f18, %f50
139 fxor %f4, %f20, %f52
140 fxor %f6, %f22, %f54
141 fxor %f8, %f24, %f56
142 fxor %f10, %f26, %f58
143 fxor %f12, %f28, %f60
144 fxor %f14, %f30, %f62
145 membar #Sync
146 fxor %f48, %f32, %f48
147 fxor %f50, %f34, %f50
148 fxor %f52, %f36, %f52
149 fxor %f54, %f38, %f54
150 fxor %f56, %f40, %f56
151 fxor %f58, %f42, %f58
152 fxor %f60, %f44, %f60
153 fxor %f62, %f46, %f62
154 stda %f48, [%o1] %asi
155 membar #Sync|#StoreStore|#StoreLoad
156 wr %g1, %g0, %asi
157 retl
158 wr %g0, 0, %fprs
159 .size xor_vis_3, .-xor_vis_3
160
161 .globl xor_vis_4
162 .type xor_vis_4,#function
163 xor_vis_4:
164 rd %fprs, %o5
165 andcc %o5, FPRS_FEF|FPRS_DU, %g0
166 be,pt %icc, 0f
167 sethi %hi(VISenter), %g1
168 jmpl %g1 + %lo(VISenter), %g7
169 add %g7, 8, %g7
170 0: wr %g0, FPRS_FEF, %fprs
171 rd %asi, %g1
172 wr %g0, ASI_BLK_P, %asi
173 membar #LoadStore|#StoreLoad|#StoreStore
174 sub %o0, 64, %o0
175 ldda [%o1] %asi, %f0
176 ldda [%o2] %asi, %f16
177
178 4: ldda [%o3] %asi, %f32
179 fxor %f0, %f16, %f16
180 fxor %f2, %f18, %f18
181 add %o1, 64, %o1
182 fxor %f4, %f20, %f20
183 fxor %f6, %f22, %f22
184 add %o2, 64, %o2
185 fxor %f8, %f24, %f24
186 fxor %f10, %f26, %f26
187 fxor %f12, %f28, %f28
188 fxor %f14, %f30, %f30
189 ldda [%o4] %asi, %f48
190 fxor %f16, %f32, %f32
191 fxor %f18, %f34, %f34
192 fxor %f20, %f36, %f36
193 fxor %f22, %f38, %f38
194 add %o3, 64, %o3
195 fxor %f24, %f40, %f40
196 fxor %f26, %f42, %f42
197 fxor %f28, %f44, %f44
198 fxor %f30, %f46, %f46
199 ldda [%o1] %asi, %f0
200 fxor %f32, %f48, %f48
201 fxor %f34, %f50, %f50
202 fxor %f36, %f52, %f52
203 add %o4, 64, %o4
204 fxor %f38, %f54, %f54
205 fxor %f40, %f56, %f56
206 fxor %f42, %f58, %f58
207 subcc %o0, 64, %o0
208 fxor %f44, %f60, %f60
209 fxor %f46, %f62, %f62
210 stda %f48, [%o1 - 64] %asi
211 bne,pt %xcc, 4b
212 ldda [%o2] %asi, %f16
213
214 ldda [%o3] %asi, %f32
215 fxor %f0, %f16, %f16
216 fxor %f2, %f18, %f18
217 fxor %f4, %f20, %f20
218 fxor %f6, %f22, %f22
219 fxor %f8, %f24, %f24
220 fxor %f10, %f26, %f26
221 fxor %f12, %f28, %f28
222 fxor %f14, %f30, %f30
223 ldda [%o4] %asi, %f48
224 fxor %f16, %f32, %f32
225 fxor %f18, %f34, %f34
226 fxor %f20, %f36, %f36
227 fxor %f22, %f38, %f38
228 fxor %f24, %f40, %f40
229 fxor %f26, %f42, %f42
230 fxor %f28, %f44, %f44
231 fxor %f30, %f46, %f46
232 membar #Sync
233 fxor %f32, %f48, %f48
234 fxor %f34, %f50, %f50
235 fxor %f36, %f52, %f52
236 fxor %f38, %f54, %f54
237 fxor %f40, %f56, %f56
238 fxor %f42, %f58, %f58
239 fxor %f44, %f60, %f60
240 fxor %f46, %f62, %f62
241 stda %f48, [%o1] %asi
242 membar #Sync|#StoreStore|#StoreLoad
243 wr %g1, %g0, %asi
244 retl
245 wr %g0, 0, %fprs
246 .size xor_vis_4, .-xor_vis_4
247
248 .globl xor_vis_5
249 .type xor_vis_5,#function
250 xor_vis_5:
251 save %sp, -192, %sp
252 rd %fprs, %o5
253 andcc %o5, FPRS_FEF|FPRS_DU, %g0
254 be,pt %icc, 0f
255 sethi %hi(VISenter), %g1
256 jmpl %g1 + %lo(VISenter), %g7
257 add %g7, 8, %g7
258 0: wr %g0, FPRS_FEF, %fprs
259 rd %asi, %g1
260 wr %g0, ASI_BLK_P, %asi
261 membar #LoadStore|#StoreLoad|#StoreStore
262 sub %i0, 64, %i0
263 ldda [%i1] %asi, %f0
264 ldda [%i2] %asi, %f16
265
266 5: ldda [%i3] %asi, %f32
267 fxor %f0, %f16, %f48
268 fxor %f2, %f18, %f50
269 add %i1, 64, %i1
270 fxor %f4, %f20, %f52
271 fxor %f6, %f22, %f54
272 add %i2, 64, %i2
273 fxor %f8, %f24, %f56
274 fxor %f10, %f26, %f58
275 fxor %f12, %f28, %f60
276 fxor %f14, %f30, %f62
277 ldda [%i4] %asi, %f16
278 fxor %f48, %f32, %f48
279 fxor %f50, %f34, %f50
280 fxor %f52, %f36, %f52
281 fxor %f54, %f38, %f54
282 add %i3, 64, %i3
283 fxor %f56, %f40, %f56
284 fxor %f58, %f42, %f58
285 fxor %f60, %f44, %f60
286 fxor %f62, %f46, %f62
287 ldda [%i5] %asi, %f32
288 fxor %f48, %f16, %f48
289 fxor %f50, %f18, %f50
290 add %i4, 64, %i4
291 fxor %f52, %f20, %f52
292 fxor %f54, %f22, %f54
293 add %i5, 64, %i5
294 fxor %f56, %f24, %f56
295 fxor %f58, %f26, %f58
296 fxor %f60, %f28, %f60
297 fxor %f62, %f30, %f62
298 ldda [%i1] %asi, %f0
299 fxor %f48, %f32, %f48
300 fxor %f50, %f34, %f50
301 fxor %f52, %f36, %f52
302 fxor %f54, %f38, %f54
303 fxor %f56, %f40, %f56
304 fxor %f58, %f42, %f58
305 subcc %i0, 64, %i0
306 fxor %f60, %f44, %f60
307 fxor %f62, %f46, %f62
308 stda %f48, [%i1 - 64] %asi
309 bne,pt %xcc, 5b
310 ldda [%i2] %asi, %f16
311
312 ldda [%i3] %asi, %f32
313 fxor %f0, %f16, %f48
314 fxor %f2, %f18, %f50
315 fxor %f4, %f20, %f52
316 fxor %f6, %f22, %f54
317 fxor %f8, %f24, %f56
318 fxor %f10, %f26, %f58
319 fxor %f12, %f28, %f60
320 fxor %f14, %f30, %f62
321 ldda [%i4] %asi, %f16
322 fxor %f48, %f32, %f48
323 fxor %f50, %f34, %f50
324 fxor %f52, %f36, %f52
325 fxor %f54, %f38, %f54
326 fxor %f56, %f40, %f56
327 fxor %f58, %f42, %f58
328 fxor %f60, %f44, %f60
329 fxor %f62, %f46, %f62
330 ldda [%i5] %asi, %f32
331 fxor %f48, %f16, %f48
332 fxor %f50, %f18, %f50
333 fxor %f52, %f20, %f52
334 fxor %f54, %f22, %f54
335 fxor %f56, %f24, %f56
336 fxor %f58, %f26, %f58
337 fxor %f60, %f28, %f60
338 fxor %f62, %f30, %f62
339 membar #Sync
340 fxor %f48, %f32, %f48
341 fxor %f50, %f34, %f50
342 fxor %f52, %f36, %f52
343 fxor %f54, %f38, %f54
344 fxor %f56, %f40, %f56
345 fxor %f58, %f42, %f58
346 fxor %f60, %f44, %f60
347 fxor %f62, %f46, %f62
348 stda %f48, [%i1] %asi
349 membar #Sync|#StoreStore|#StoreLoad
350 wr %g1, %g0, %asi
351 wr %g0, 0, %fprs
352 ret
353 restore
354 .size xor_vis_5, .-xor_vis_5