]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/s390/s390-64/memset.S
cab7855549b8ba57861d14c9e08cad0fda6ea7a7
[thirdparty/glibc.git] / sysdeps / s390 / s390-64 / memset.S
1 /* Set a block of memory to some byte value. 64 bit S/390 version.
2 Copyright (C) 2001-2016 Free Software Foundation, Inc.
3 Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
4 This file is part of the GNU C Library.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
19
20
21 #include <sysdep.h>
22 #include "asm-syntax.h"
23
24 /* INPUT PARAMETERS
25 %r2 = address of memory area
26 %r3 = byte to fill memory with
27 %r4 = number of bytes to fill. */
28
29 .text
30
31 #ifdef USE_MULTIARCH
32 ENTRY(__memset_default)
33 #else
34 ENTRY(memset)
35 #endif
36 .machine "z900"
37 ltgr %r4,%r4
38 je .L_Z900_4
39 stc %r3,0(%r2)
40 cghi %r4,1
41 lgr %r1,%r2
42 je .L_Z900_4
43 aghi %r4,-2
44 srlg %r3,%r4,8
45 ltgr %r3,%r3
46 jne .L_Z900_14
47 .L_Z900_3:
48 larl %r3,.L_Z900_18
49 ex %r4,0(%r3)
50 .L_Z900_4:
51 br %r14
52 .L_Z900_14:
53 mvc 1(256,%r1),0(%r1)
54 la %r1,256(%r1)
55 brctg %r3,.L_Z900_14
56 j .L_Z900_3
57 .L_Z900_18:
58 mvc 1(1,%r1),0(%r1)
59 #ifdef USE_MULTIARCH
60 END(__memset_default)
61 #else
62 END(memset)
63 libc_hidden_builtin_def (memset)
64 #endif