Lines Matching +full:0 +full:- +full:4

1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
6 * -__clear_user( ) called multiple times during elf load was byte loop
10 * -Hand crafted constant propagation for "constant" copy sizes
11 * -stock kernel shrunk by 33K at -O3
14 * -Added option to (UN)inline copy_(to|from)_user to reduce code sz
15 * -kernel shrunk by 200K even at -O3 (gcc 4.2.1)
16 * -Enabled when doing -Os
30 long __ret = 0; /* success by default */ \
34 case 4: __arc_get_user_one(*(k), u, "ld", __ret); break; \
41 * Returns 0 on success, -EFAULT if not.
42 * @ret already contains 0 - given that errors will be less likely
44 * In case of error, fixup code will make it -EFAULT
51 " .align 4\n" \
52 "3: # return -EFAULT\n" \
53 " mov %0, %3\n" \
55 " mov %1, 0\n" \
59 " .align 4\n" \
64 : "r" (src), "ir" (-EFAULT))
69 "4: ld %R1,[%2, 4]\n" \
72 " .align 4\n" \
73 "3: # return -EFAULT\n" \
74 " mov %0, %3\n" \
76 " mov %1, 0\n" \
77 " mov %R1, 0\n" \
81 " .align 4\n" \
83 " .word 4b,3b\n" \
87 : "r" (src), "ir" (-EFAULT))
91 long __ret = 0; /* success by default */ \
95 case 4: __arc_put_user_one(*(k), u, "st", __ret); break; \
106 " .align 4\n" \
107 "3: mov %0, %3\n" \
111 " .align 4\n" \
116 : "r" (src), "r" (dst), "ir" (-EFAULT))
121 "4: st %R1,[%2, 4]\n" \
124 " .align 4\n" \
125 "3: mov %0, %3\n" \
129 " .align 4\n" \
131 " .word 4b,3b\n" \
135 : "r" (src), "r" (dst), "ir" (-EFAULT))
141 long res = 0; in raw_copy_from_user()
146 if (n == 0) in raw_copy_from_user()
147 return 0; in raw_copy_from_user()
151 (((unsigned long)to & 0x3) || ((unsigned long)from & 0x3))) { in raw_copy_from_user()
156 " mov.f lp_count, %0 \n" in raw_copy_from_user()
160 " sub %0,%0,1 \n" in raw_copy_from_user()
163 " .align 4 \n" in raw_copy_from_user()
167 " .align 4 \n" in raw_copy_from_user()
185 * Hand-crafted constant propagation to reduce code sz of the in raw_copy_from_user()
186 * laddered copy 16x,8,4,2,1 in raw_copy_from_user()
195 " lsr lp_count, %7,4 \n" in raw_copy_from_user()
197 "1: ld.ab %3, [%2, 4] \n" in raw_copy_from_user()
198 "11: ld.ab %4, [%2, 4] \n" in raw_copy_from_user()
199 "12: ld.ab %5, [%2, 4] \n" in raw_copy_from_user()
200 "13: ld.ab %6, [%2, 4] \n" in raw_copy_from_user()
201 " st.ab %3, [%1, 4] \n" in raw_copy_from_user()
202 " st.ab %4, [%1, 4] \n" in raw_copy_from_user()
203 " st.ab %5, [%1, 4] \n" in raw_copy_from_user()
204 " st.ab %6, [%1, 4] \n" in raw_copy_from_user()
205 " sub %0,%0,16 \n" in raw_copy_from_user()
208 " .align 4 \n" in raw_copy_from_user()
209 "4: j 3b \n" in raw_copy_from_user()
212 " .align 4 \n" in raw_copy_from_user()
213 " .word 1b, 4b \n" in raw_copy_from_user()
214 " .word 11b,4b \n" in raw_copy_from_user()
215 " .word 12b,4b \n" in raw_copy_from_user()
216 " .word 13b,4b \n" in raw_copy_from_user()
227 "14: ld.ab %3, [%2,4] \n" in raw_copy_from_user()
228 "15: ld.ab %4, [%2,4] \n" in raw_copy_from_user()
229 " st.ab %3, [%1,4] \n" in raw_copy_from_user()
230 " st.ab %4, [%1,4] \n" in raw_copy_from_user()
231 " sub %0,%0,8 \n" in raw_copy_from_user()
234 " .align 4 \n" in raw_copy_from_user()
235 "4: j 31b \n" in raw_copy_from_user()
238 " .align 4 \n" in raw_copy_from_user()
239 " .word 14b,4b \n" in raw_copy_from_user()
240 " .word 15b,4b \n" in raw_copy_from_user()
247 if (orig_n / 4) { in raw_copy_from_user()
248 orig_n = orig_n % 4; in raw_copy_from_user()
251 "16: ld.ab %3, [%2,4] \n" in raw_copy_from_user()
252 " st.ab %3, [%1,4] \n" in raw_copy_from_user()
253 " sub %0,%0,4 \n" in raw_copy_from_user()
256 " .align 4 \n" in raw_copy_from_user()
257 "4: j 32b \n" in raw_copy_from_user()
260 " .align 4 \n" in raw_copy_from_user()
261 " .word 16b,4b \n" in raw_copy_from_user()
273 " sub %0,%0,2 \n" in raw_copy_from_user()
276 " .align 4 \n" in raw_copy_from_user()
277 "4: j 33b \n" in raw_copy_from_user()
280 " .align 4 \n" in raw_copy_from_user()
281 " .word 17b,4b \n" in raw_copy_from_user()
291 " sub %0,%0,1 \n" in raw_copy_from_user()
294 " .align 4 \n" in raw_copy_from_user()
295 "4: j 34b \n" in raw_copy_from_user()
298 " .align 4 \n" in raw_copy_from_user()
299 " .word 18b,4b \n" in raw_copy_from_user()
305 } else { /* n is NOT constant, so laddered copy of 16x,8,4,2,1 */ in raw_copy_from_user()
308 " mov %0,%3 \n" in raw_copy_from_user()
309 " lsr.f lp_count, %3,4 \n" /* 16x bytes */ in raw_copy_from_user()
311 "1: ld.ab %5, [%2, 4] \n" in raw_copy_from_user()
312 "11: ld.ab %6, [%2, 4] \n" in raw_copy_from_user()
313 "12: ld.ab %7, [%2, 4] \n" in raw_copy_from_user()
314 "13: ld.ab %8, [%2, 4] \n" in raw_copy_from_user()
315 " st.ab %5, [%1, 4] \n" in raw_copy_from_user()
316 " st.ab %6, [%1, 4] \n" in raw_copy_from_user()
317 " st.ab %7, [%1, 4] \n" in raw_copy_from_user()
318 " st.ab %8, [%1, 4] \n" in raw_copy_from_user()
319 " sub %0,%0,16 \n" in raw_copy_from_user()
320 "3: and.f %3,%3,0xf \n" /* stragglers */ in raw_copy_from_user()
323 "14: ld.ab %5, [%2,4] \n" in raw_copy_from_user()
324 "15: ld.ab %6, [%2,4] \n" in raw_copy_from_user()
325 " st.ab %5, [%1,4] \n" in raw_copy_from_user()
326 " st.ab %6, [%1,4] \n" in raw_copy_from_user()
327 " sub.f %0,%0,8 \n" in raw_copy_from_user()
328 "31: bbit0 %3,2,32f \n" /* 4 bytes left */ in raw_copy_from_user()
329 "16: ld.ab %5, [%2,4] \n" in raw_copy_from_user()
330 " st.ab %5, [%1,4] \n" in raw_copy_from_user()
331 " sub.f %0,%0,4 \n" in raw_copy_from_user()
335 " sub.f %0,%0,2 \n" in raw_copy_from_user()
336 "33: bbit0 %3,0,34f \n" in raw_copy_from_user()
339 " sub.f %0,%0,1 \n" in raw_copy_from_user()
342 " .align 4 \n" in raw_copy_from_user()
343 "4: j 34b \n" in raw_copy_from_user()
346 " .align 4 \n" in raw_copy_from_user()
347 " .word 1b, 4b \n" in raw_copy_from_user()
348 " .word 11b,4b \n" in raw_copy_from_user()
349 " .word 12b,4b \n" in raw_copy_from_user()
350 " .word 13b,4b \n" in raw_copy_from_user()
351 " .word 14b,4b \n" in raw_copy_from_user()
352 " .word 15b,4b \n" in raw_copy_from_user()
353 " .word 16b,4b \n" in raw_copy_from_user()
354 " .word 17b,4b \n" in raw_copy_from_user()
355 " .word 18b,4b \n" in raw_copy_from_user()
369 long res = 0; in raw_copy_to_user()
374 if (n == 0) in raw_copy_to_user()
375 return 0; in raw_copy_to_user()
379 (((unsigned long)to & 0x3) || ((unsigned long)from & 0x3))) { in raw_copy_to_user()
384 " mov.f lp_count, %0 \n" in raw_copy_to_user()
388 " sub %0, %0, 1 \n" in raw_copy_to_user()
391 " .align 4 \n" in raw_copy_to_user()
392 "4: j 3b \n" in raw_copy_to_user()
395 " .align 4 \n" in raw_copy_to_user()
396 " .word 1b, 4b \n" in raw_copy_to_user()
418 " lsr lp_count, %7,4 \n" in raw_copy_to_user()
420 " ld.ab %3, [%2, 4] \n" in raw_copy_to_user()
421 " ld.ab %4, [%2, 4] \n" in raw_copy_to_user()
422 " ld.ab %5, [%2, 4] \n" in raw_copy_to_user()
423 " ld.ab %6, [%2, 4] \n" in raw_copy_to_user()
424 "1: st.ab %3, [%1, 4] \n" in raw_copy_to_user()
425 "11: st.ab %4, [%1, 4] \n" in raw_copy_to_user()
426 "12: st.ab %5, [%1, 4] \n" in raw_copy_to_user()
427 "13: st.ab %6, [%1, 4] \n" in raw_copy_to_user()
428 " sub %0, %0, 16 \n" in raw_copy_to_user()
431 " .align 4 \n" in raw_copy_to_user()
432 "4: j 3b \n" in raw_copy_to_user()
435 " .align 4 \n" in raw_copy_to_user()
436 " .word 1b, 4b \n" in raw_copy_to_user()
437 " .word 11b,4b \n" in raw_copy_to_user()
438 " .word 12b,4b \n" in raw_copy_to_user()
439 " .word 13b,4b \n" in raw_copy_to_user()
450 " ld.ab %3, [%2,4] \n" in raw_copy_to_user()
451 " ld.ab %4, [%2,4] \n" in raw_copy_to_user()
452 "14: st.ab %3, [%1,4] \n" in raw_copy_to_user()
453 "15: st.ab %4, [%1,4] \n" in raw_copy_to_user()
454 " sub %0, %0, 8 \n" in raw_copy_to_user()
457 " .align 4 \n" in raw_copy_to_user()
458 "4: j 31b \n" in raw_copy_to_user()
461 " .align 4 \n" in raw_copy_to_user()
462 " .word 14b,4b \n" in raw_copy_to_user()
463 " .word 15b,4b \n" in raw_copy_to_user()
470 if (orig_n / 4) { in raw_copy_to_user()
471 orig_n = orig_n % 4; in raw_copy_to_user()
474 " ld.ab %3, [%2,4] \n" in raw_copy_to_user()
475 "16: st.ab %3, [%1,4] \n" in raw_copy_to_user()
476 " sub %0, %0, 4 \n" in raw_copy_to_user()
479 " .align 4 \n" in raw_copy_to_user()
480 "4: j 32b \n" in raw_copy_to_user()
483 " .align 4 \n" in raw_copy_to_user()
484 " .word 16b,4b \n" in raw_copy_to_user()
496 " sub %0, %0, 2 \n" in raw_copy_to_user()
499 " .align 4 \n" in raw_copy_to_user()
500 "4: j 33b \n" in raw_copy_to_user()
503 " .align 4 \n" in raw_copy_to_user()
504 " .word 17b,4b \n" in raw_copy_to_user()
514 " sub %0, %0, 1 \n" in raw_copy_to_user()
517 " .align 4 \n" in raw_copy_to_user()
518 "4: j 34b \n" in raw_copy_to_user()
521 " .align 4 \n" in raw_copy_to_user()
522 " .word 18b,4b \n" in raw_copy_to_user()
528 } else { /* n is NOT constant, so laddered copy of 16x,8,4,2,1 */ in raw_copy_to_user()
531 " mov %0,%3 \n" in raw_copy_to_user()
532 " lsr.f lp_count, %3,4 \n" /* 16x bytes */ in raw_copy_to_user()
534 " ld.ab %5, [%2, 4] \n" in raw_copy_to_user()
535 " ld.ab %6, [%2, 4] \n" in raw_copy_to_user()
536 " ld.ab %7, [%2, 4] \n" in raw_copy_to_user()
537 " ld.ab %8, [%2, 4] \n" in raw_copy_to_user()
538 "1: st.ab %5, [%1, 4] \n" in raw_copy_to_user()
539 "11: st.ab %6, [%1, 4] \n" in raw_copy_to_user()
540 "12: st.ab %7, [%1, 4] \n" in raw_copy_to_user()
541 "13: st.ab %8, [%1, 4] \n" in raw_copy_to_user()
542 " sub %0, %0, 16 \n" in raw_copy_to_user()
543 "3: and.f %3,%3,0xf \n" /* stragglers */ in raw_copy_to_user()
546 " ld.ab %5, [%2,4] \n" in raw_copy_to_user()
547 " ld.ab %6, [%2,4] \n" in raw_copy_to_user()
548 "14: st.ab %5, [%1,4] \n" in raw_copy_to_user()
549 "15: st.ab %6, [%1,4] \n" in raw_copy_to_user()
550 " sub.f %0, %0, 8 \n" in raw_copy_to_user()
551 "31: bbit0 %3,2,32f \n" /* 4 bytes left */ in raw_copy_to_user()
552 " ld.ab %5, [%2,4] \n" in raw_copy_to_user()
553 "16: st.ab %5, [%1,4] \n" in raw_copy_to_user()
554 " sub.f %0, %0, 4 \n" in raw_copy_to_user()
558 " sub.f %0, %0, 2 \n" in raw_copy_to_user()
559 "33: bbit0 %3,0,34f \n" in raw_copy_to_user()
562 " sub.f %0, %0, 1 \n" in raw_copy_to_user()
565 " .align 4 \n" in raw_copy_to_user()
566 "4: j 34b \n" in raw_copy_to_user()
569 " .align 4 \n" in raw_copy_to_user()
570 " .word 1b, 4b \n" in raw_copy_to_user()
571 " .word 11b,4b \n" in raw_copy_to_user()
572 " .word 12b,4b \n" in raw_copy_to_user()
573 " .word 13b,4b \n" in raw_copy_to_user()
574 " .word 14b,4b \n" in raw_copy_to_user()
575 " .word 15b,4b \n" in raw_copy_to_user()
576 " .word 16b,4b \n" in raw_copy_to_user()
577 " .word 17b,4b \n" in raw_copy_to_user()
578 " .word 18b,4b \n" in raw_copy_to_user()
595 " bbit0 %0, 0, 1f \n" in __clear_user()
596 "75: stb.ab %2, [%0,1] \n" in __clear_user()
598 "1: bbit0 %0, 1, 2f \n" in __clear_user()
599 "76: stw.ab %2, [%0,2] \n" in __clear_user()
603 "77: st.ab %2, [%0,4] \n" in __clear_user()
604 " sub %1, %1, 4 \n" in __clear_user()
605 "3: bbit0 %1, 1, 4f \n" in __clear_user()
606 "78: stw.ab %2, [%0,2] \n" in __clear_user()
608 "4: bbit0 %1, 0, 5f \n" in __clear_user()
609 "79: stb.ab %2, [%0,1] \n" in __clear_user()
613 " .align 4 \n" in __clear_user()
617 " .align 4 \n" in __clear_user()
625 : "i"(0) in __clear_user()
636 #include <asm-generic/uaccess.h>