]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/s390/s390-64/memcmp.S
1ab3fb131c4078d01d4c249105893ef12e0a8f2e
[thirdparty/glibc.git] / sysdeps / s390 / s390-64 / memcmp.S
1 /* memcmp - compare two memory blocks. 64 bit S/390 version.
2 Copyright (C) 2012-2015 Free Software Foundation, Inc.
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 = address of first memory area
25 %r3 = address of second memory area
26 %r4 = number of bytes to compare. */
27
28 .text
29 #ifdef USE_MULTIARCH
30 ENTRY(__memcmp_default)
31 #else
32 ENTRY(memcmp)
33 #endif
34 .machine "z900"
35 ltgr %r4,%r4
36 je .L_Z900_4
37 aghi %r4,-1
38 srlg %r1,%r4,8
39 ltgr %r1,%r1
40 jne .L_Z900_12
41 .L_Z900_3:
42 larl %r1,.L_Z900_15
43 ex %r4,0(%r1)
44 .L_Z900_4:
45 ipm %r2
46 sllg %r2,%r2,34
47 srag %r2,%r2,62
48 br %r14
49 .L_Z900_12:
50 clc 0(256,%r3),0(%r2)
51 jne .L_Z900_4
52 la %r3,256(%r3)
53 la %r2,256(%r2)
54 brctg %r1,.L_Z900_12
55 j .L_Z900_3
56 .L_Z900_15:
57 clc 0(1,%r3),0(%r2)
58 #ifdef USE_MULTIARCH
59 END(__memcmp_default)
60 #else
61 END(memcmp)
62 libc_hidden_builtin_def (memcmp)
63 weak_alias (memcmp, bcmp)
64 #endif