(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
[glibc.git] / sysdeps / rs6000 / memcopy.h
blob8bdb6e97662abdea0ac1d99fd5b912eb24dafe25
1 /* Copyright (C) 1991, 1997 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 02111-1307 USA. */
19 #include <sysdeps/generic/memcopy.h>
21 #undef OP_T_THRES
22 #define OP_T_THRES 32
24 #undef BYTE_COPY_FWD
25 #define BYTE_COPY_FWD(dst_bp, src_bp, nbytes) \
26 do \
27 { \
28 size_t __nbytes = nbytes; \
29 asm volatile("mtspr 1,%2\n" \
30 "lsx 6,0,%1\n" \
31 "stsx 6,0,%0" : /* No outputs. */ : \
32 "b" (dst_bp), "b" (src_bp), "r" (__nbytes) : \
33 "6", "7", "8", "9", "10", "11", "12", "13"); \
34 dst_bp += __nbytes; \
35 src_bp += __nbytes; \
36 } while (0)
38 #undef BYTE_COPY_BWD
39 #define BYTE_COPY_BWD(dst_ep, src_ep, nbytes) \
40 do \
41 { \
42 size_t __nbytes = (nbytes); \
43 dst_ep -= __nbytes; \
44 src_ep -= __nbytes; \
45 asm volatile("mtspr 1,%2\n" \
46 "lsx 6,0,%1\n" \
47 "stsx 6,0,%0" : /* No outputs. */ : \
48 "b" (dst_ep), "b" (src_ep), "r" (__nbytes) : \
49 "6", "7", "8", "9", "10", "11", "12", "13"); \
50 } while (0)
52 #undef WORD_COPY_FWD
53 #define WORD_COPY_FWD(dst_bp, src_bp, nbytes_left, nbytes) \
54 do \
55 { \
56 size_t __nblocks = (nbytes) / 32; \
57 if (__nblocks != 0) \
58 asm volatile("mtctr %4\n" \
59 "lsi 6,%1,32\n" \
60 "ai %1,%1,32\n" \
61 "stsi 6,%0,32\n" \
62 "ai %0,%0,32\n" \
63 "bdn $-16" : \
64 "=b" (dst_bp), "=b" (src_bp) : \
65 "0" (dst_bp), "1" (src_bp), "r" (__nblocks) : \
66 "6", "7", "8", "9", "10", "11", "12", "13"); \
67 (nbytes_left) = (nbytes) % 32; \
68 } while (0)
70 #undef WORD_COPY_BWD
71 #define WORD_COPY_BWD(dst_ep, src_ep, nbytes_left, nbytes) \
72 do \
73 { \
74 size_t __nblocks = (nbytes) / 32; \
75 if (__nblocks != 0) \
76 asm volatile("mtctr %4\n" \
77 "ai %1,%1,-32\n" \
78 "lsi 6,%1,32\n" \
79 "ai %0,%0,-32\n" \
80 "stsi 6,%0,32\n" \
81 "bdn $-16" : \
82 "=b" (dst_ep), "=b" (src_ep) : \
83 "0" (dst_ep), "1" (src_ep), "r" (__nblocks) : \
84 "6", "7", "8", "9", "10", "11", "12", "13"); \
85 (nbytes_left) = (nbytes) % 32; \
86 } while (0)