Update copyright notices with scripts/update-copyrights
[glibc.git] / sysdeps / s390 / s390-32 / multiarch / memcpy.S
blob78ed7379cd7b7cc2362a42c2861203efd727c053
1 /* CPU specific memcpy implementations.  32 bit S/390 version.
2    Copyright (C) 2012-2014 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 = target operands address
25      %r3 = source operands address
26      %r4 = number of bytes to copy.  */
28        .text
30 #if defined SHARED && !defined NOT_IN_libc
32 ENTRY(memcpy_z196)
33         .machine "z196"
34         .machinemode "zarch_nohighgprs"
35         llgfr   %r4,%r4
36         ltgr    %r4,%r4
37         je      .L_Z196_4
38         aghi    %r4,-1
39         lr      %r1,%r2
40         srlg    %r5,%r4,8
41         ltgr    %r5,%r5
42         jne     .L_Z196_5
43 .L_Z196_3:
44         exrl    %r4,.L_Z196_14
45 .L_Z196_4:
46         br      %r14
47 .L_Z196_5:
48         cgfi    %r5,262144      # Switch to mvcle for copies >64MB
49         jh      memcpy_mvcle
50 .L_Z196_2:
51         pfd     1,768(%r3)
52         pfd     2,768(%r1)
53         mvc     0(256,%r1),0(%r3)
54         aghi    %r5,-1
55         la      %r1,256(%r1)
56         la      %r3,256(%r3)
57         jne     .L_Z196_2
58         j       .L_Z196_3
59 .L_Z196_14:
60         mvc     0(1,%r1),0(%r3)
61 END(memcpy_z196)
63 ENTRY(memcpy_z10)
64         .machine "z10"
65         .machinemode "zarch_nohighgprs"
66         llgfr   %r4,%r4
67         cgije   %r4,0,.L_Z10_4
68         aghi    %r4,-1
69         lr      %r1,%r2
70         srlg    %r5,%r4,8
71         cgijlh  %r5,0,.L_Z10_13
72 .L_Z10_3:
73         exrl    %r4,.L_Z10_15
74 .L_Z10_4:
75         br      %r14
76 .L_Z10_13:
77         cgfi    %r5,65535       # Switch to mvcle for copies >16MB
78         jh      memcpy_mvcle
79 .L_Z10_12:
80         pfd     1,768(%r3)
81         pfd     2,768(%r1)
82         mvc     0(256,%r1),0(%r3)
83         la      %r1,256(%r1)
84         la      %r3,256(%r3)
85         brctg   %r5,.L_Z10_12
86         j       .L_Z10_3
87 .L_Z10_15:
88         mvc     0(1,%r1),0(%r3)
89 END(memcpy_z10)
91 #endif
93 #include "../memcpy.S"
95 #if !defined SHARED || defined NOT_IN_libc
96 .globl   memcpy
97 .set     memcpy,memcpy_g5
98 #endif