]>
Commit | Line | Data |
---|---|---|
08f43f9b | 1 | /* CPU specific memcpy implementations. 32 bit S/390 version. |
bfff8b1b | 2 | Copyright (C) 2012-2017 Free Software Foundation, Inc. |
08f43f9b AK |
3 | This file is part of the GNU C Library. |
4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | |
6 | modify it under the terms of the GNU Lesser General Public | |
7 | License as published by the Free Software Foundation; either | |
8 | version 2.1 of the License, or (at your option) any later version. | |
9 | ||
10 | The GNU C Library is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | Lesser General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU Lesser General Public | |
16 | License along with the GNU C Library; if not, see | |
17 | <http://www.gnu.org/licenses/>. */ | |
18 | ||
19 | ||
20 | #include "sysdep.h" | |
21 | #include "asm-syntax.h" | |
22 | ||
23 | /* INPUT PARAMETERS | |
24 | %r2 = target operands address | |
25 | %r3 = source operands address | |
26 | %r4 = number of bytes to copy. */ | |
27 | ||
28 | .text | |
29 | ||
4f41c682 | 30 | #if defined SHARED && IS_IN (libc) |
08f43f9b | 31 | |
4c011268 SL |
32 | ENTRY(____mempcpy_z196) |
33 | .machine "z196" | |
34 | .machinemode "zarch_nohighgprs" | |
35 | lr %r1,%r2 # Use as dest | |
36 | la %r2,0(%r4,%r2) # Return dest + n | |
37 | j .L_Z196_start | |
38 | END(____mempcpy_z196) | |
39 | ||
1d532483 | 40 | ENTRY(__memcpy_z196) |
08f43f9b | 41 | .machine "z196" |
14c996c8 | 42 | .machinemode "zarch_nohighgprs" |
4c011268 SL |
43 | lr %r1,%r2 # r1: Use as dest ; r2: Return dest |
44 | .L_Z196_start: | |
31556246 SL |
45 | llgfr %r4,%r4 |
46 | ltgr %r4,%r4 | |
47 | je .L_Z196_4 | |
48 | aghi %r4,-1 | |
31556246 SL |
49 | srlg %r5,%r4,8 |
50 | ltgr %r5,%r5 | |
51 | jne .L_Z196_5 | |
08f43f9b | 52 | .L_Z196_3: |
31556246 | 53 | exrl %r4,.L_Z196_14 |
08f43f9b | 54 | .L_Z196_4: |
31556246 | 55 | br %r14 |
08f43f9b | 56 | .L_Z196_5: |
31556246 SL |
57 | cgfi %r5,262144 # Switch to mvcle for copies >64MB |
58 | jh __memcpy_mvcle | |
08f43f9b | 59 | .L_Z196_2: |
31556246 SL |
60 | pfd 1,768(%r3) |
61 | pfd 2,768(%r1) | |
62 | mvc 0(256,%r1),0(%r3) | |
63 | aghi %r5,-1 | |
64 | la %r1,256(%r1) | |
65 | la %r3,256(%r3) | |
66 | jne .L_Z196_2 | |
67 | j .L_Z196_3 | |
08f43f9b | 68 | .L_Z196_14: |
31556246 | 69 | mvc 0(1,%r1),0(%r3) |
1d532483 | 70 | END(__memcpy_z196) |
08f43f9b | 71 | |
4c011268 SL |
72 | ENTRY(____mempcpy_z10) |
73 | .machine "z10" | |
74 | .machinemode "zarch_nohighgprs" | |
75 | lr %r1,%r2 # Use as dest | |
76 | la %r2,0(%r4,%r2) # Return dest + n | |
77 | j .L_Z10_start | |
78 | END(____mempcpy_z10) | |
79 | ||
1d532483 | 80 | ENTRY(__memcpy_z10) |
08f43f9b | 81 | .machine "z10" |
14c996c8 | 82 | .machinemode "zarch_nohighgprs" |
4c011268 SL |
83 | lr %r1,%r2 # r1: Use as dest ; r2: Return dest |
84 | .L_Z10_start: | |
31556246 SL |
85 | llgfr %r4,%r4 |
86 | cgije %r4,0,.L_Z10_4 | |
87 | aghi %r4,-1 | |
31556246 SL |
88 | srlg %r5,%r4,8 |
89 | cgijlh %r5,0,.L_Z10_13 | |
08f43f9b | 90 | .L_Z10_3: |
31556246 | 91 | exrl %r4,.L_Z10_15 |
08f43f9b | 92 | .L_Z10_4: |
31556246 | 93 | br %r14 |
08f43f9b | 94 | .L_Z10_13: |
31556246 SL |
95 | cgfi %r5,65535 # Switch to mvcle for copies >16MB |
96 | jh __memcpy_mvcle | |
08f43f9b | 97 | .L_Z10_12: |
31556246 SL |
98 | pfd 1,768(%r3) |
99 | pfd 2,768(%r1) | |
100 | mvc 0(256,%r1),0(%r3) | |
101 | la %r1,256(%r1) | |
102 | la %r3,256(%r3) | |
103 | brctg %r5,.L_Z10_12 | |
104 | j .L_Z10_3 | |
08f43f9b | 105 | .L_Z10_15: |
31556246 | 106 | mvc 0(1,%r1),0(%r3) |
1d532483 | 107 | END(__memcpy_z10) |
08f43f9b | 108 | |
4c011268 | 109 | # define __mempcpy ____mempcpy_default |
31556246 | 110 | #endif /* SHARED && IS_IN (libc) */ |
08f43f9b | 111 | |
4c011268 | 112 | #define memcpy __memcpy_default |
08f43f9b | 113 | #include "../memcpy.S" |
4c011268 | 114 | #undef memcpy |
08f43f9b | 115 | |
71655832 SL |
116 | #if defined SHARED && IS_IN (libc) |
117 | .globl __GI_memcpy | |
118 | .set __GI_memcpy,__memcpy_default | |
4c011268 SL |
119 | .globl __GI_mempcpy |
120 | .set __GI_mempcpy,____mempcpy_default | |
121 | .globl __GI___mempcpy | |
122 | .set __GI___mempcpy,____mempcpy_default | |
71655832 | 123 | #else |
08f43f9b | 124 | .globl memcpy |
31556246 | 125 | .set memcpy,__memcpy_default |
4c011268 SL |
126 | .weak mempcpy |
127 | .set mempcpy,__mempcpy | |
08f43f9b | 128 | #endif |