]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/s390/s390-64/memcpy.S
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / s390 / s390-64 / memcpy.S
CommitLineData
c891b2df 1/* memcpy - copy a block from source to destination. 64 bit S/390 version.
f7a9f785 2 Copyright (C) 2012-2016 Free Software Foundation, Inc.
41bdb6e2 3 This file is part of the GNU C Library.
847b055c
AJ
4
5 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
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.
847b055c
AJ
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
41bdb6e2 13 Lesser General Public License for more details.
847b055c 14
41bdb6e2 15 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
847b055c 18
08f43f9b 19
56e7d3ad 20#include <sysdep.h>
08f43f9b
AK
21#include "asm-syntax.h"
22
ffeac417 23/* INPUT PARAMETERS
c891b2df
UD
24 %r2 = address of destination memory area
25 %r3 = address of source memory area
ffeac417 26 %r4 = number of bytes to copy. */
847b055c 27
847b055c 28
08f43f9b
AK
29 .text
30
31#ifdef USE_MULTIARCH
31556246 32ENTRY(__memcpy_default)
08f43f9b 33#else
ffeac417 34ENTRY(memcpy)
08f43f9b
AK
35#endif
36 .machine "z900"
31556246
SL
37 ltgr %r4,%r4
38 je .L_Z900_4
39 aghi %r4,-1
40 srlg %r5,%r4,8
41 ltgr %r5,%r5
42 lgr %r1,%r2
43 jne .L_Z900_13
08f43f9b 44.L_Z900_3:
31556246
SL
45 larl %r5,.L_Z900_15
46 ex %r4,0(%r5)
08f43f9b 47.L_Z900_4:
31556246 48 br %r14
08f43f9b 49.L_Z900_13:
31556246
SL
50 chi %r5,4096 # Switch to mvcle for copies >1MB
51 jh __memcpy_mvcle
08f43f9b 52.L_Z900_12:
31556246
SL
53 mvc 0(256,%r1),0(%r3)
54 la %r1,256(%r1)
55 la %r3,256(%r3)
56 brctg %r5,.L_Z900_12
57 j .L_Z900_3
08f43f9b 58.L_Z900_15:
31556246 59 mvc 0(1,%r1),0(%r3)
08f43f9b
AK
60
61#ifdef USE_MULTIARCH
31556246 62END(__memcpy_default)
08f43f9b 63#else
c891b2df 64END(memcpy)
85dd1003 65libc_hidden_builtin_def (memcpy)
08f43f9b
AK
66#endif
67
1d532483 68ENTRY(__memcpy_mvcle)
08f43f9b
AK
69 # Using as standalone function will result in unexpected
70 # results since the length field is incremented by 1 in order to
71 # compensate the changes already done in the functions above.
72 aghi %r4,1 # length + 1
73 lgr %r5,%r4 # source length
74 lgr %r4,%r3 # source address
75 lgr %r3,%r5 # destination length = source length
76.L_MVCLE_1:
77 mvcle %r2,%r4,0 # thats it, MVCLE is your friend
78 jo .L_MVCLE_1
79 lgr %r2,%r1 # return destination address
80 br %r14
1d532483 81END(__memcpy_mvcle)