S390: Refactor ifunc implementations and enable ifunc-test-framework.
[glibc.git] / sysdeps / s390 / s390-32 / multiarch / memcmp-s390.S
blob8540f67a22a6651f6537352a49c387c2a892100f
1 /* CPU specific memcmp implementations.  32 bit S/390 version.
2    Copyright (C) 2012-2015 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
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.
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.
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/>.  */
20 #include "sysdep.h"
21 #include "asm-syntax.h"
23 /* INPUT PARAMETERS
24      %r2 = address of first memory area
25      %r3 = address of second memory area
26      %r4 = number of bytes to compare.  */
28        .text
30 #if IS_IN (libc)
32 ENTRY(__memcmp_z196)
33         .machine "z196"
34         .machinemode "zarch_nohighgprs"
35         ltr     %r4,%r4
36         je      .L_Z196_4
37         ahi     %r4,-1
38         srlk    %r1,%r4,8
39         ltr     %r1,%r1
40         jne     .L_Z196_2
41 .L_Z196_3:
42         exrl    %r4,.L_Z196_14
43 .L_Z196_4:
44         ipm     %r2
45         sll     %r2,2
46         sra     %r2,30
47         br      %r14
48 .L_Z196_17:
49         la      %r3,256(%r3)
50         la      %r2,256(%r2)
51         ahi     %r1,-1
52         je      .L_Z196_3
53 .L_Z196_2:
54         pfd     1,512(%r3)
55         pfd     1,512(%r2)
56         clc     0(256,%r3),0(%r2)
57         je      .L_Z196_17
58         ipm     %r2
59         sll     %r2,2
60         sra     %r2,30
61         br      %r14
62 .L_Z196_14:
63         clc     0(1,%r3),0(%r2)
64 END(__memcmp_z196)
66 ENTRY(__memcmp_z10)
67         .machine "z10"
68         .machinemode "zarch_nohighgprs"
69         ltr     %r4,%r4
70         je      .L_Z10_4
71         ahi     %r4,-1
72         lr      %r1,%r4
73         srl     %r1,8
74         cijlh   %r1,0,.L_Z10_12
75 .L_Z10_3:
76         exrl    %r4,.L_Z10_15
77 .L_Z10_4:
78         ipm     %r2
79         sll     %r2,2
80         sra     %r2,30
81         br      %r14
82 .L_Z10_12:
83         pfd     1,512(%r3)
84         pfd     1,512(%r2)
85         clc     0(256,%r3),0(%r2)
86         jne     .L_Z10_4
87         la      %r3,256(%r3)
88         la      %r2,256(%r2)
89         brct    %r1,.L_Z10_12
90         j       .L_Z10_3
91 .L_Z10_15:
92         clc     0(1,%r3),0(%r2)
93 END(__memcmp_z10)
95 #endif /* IS_IN (libc) */
97 #include "../memcmp.S"
99 #if !IS_IN (libc)
100 .globl   memcmp
101 .set     memcmp,__memcmp_default
102 .weak    bcmp
103 .set     bcmp,__memcmp_default
104 #endif