1/* Aligned copy routines specified by Sparc V9 ABI.
2   For 64-bit sparc.
3   Copyright (C) 2010-2022 Free Software Foundation, Inc.
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   <https://www.gnu.org/licenses/>.  */
19
20#include <sysdep.h>
21
22	.text
23	.align	8
24ENTRY(__align_cpy_8)
2510:	cmp	%o0, %o1
26	be,pn	%xcc, 9f
27	 mov	%o0, %o3
28	subcc	%o2, 0x08, %o2
29	be,pn	%xcc, 8f
301:	 ldx	[%o1 + 0x00], %o5
31	ldx	[%o1 + 0x08], %o4
32	subcc	%o2, 0x10, %o2
33	add	%o1, 0x10, %o1
34	stx	%o5, [%o3 + 0x00]
35	stx	%o4, [%o3 + 0x08]
36	bg,pt	%xcc, 1b
37	 add	%o3, 0x10, %o3
38	bne,pn	%xcc, 9f
39	 nop
40	ldx	[%o1 + 0x00], %o5
418:	stx	%o5, [%o3 + 0x00]
429:	retl
43	 nop
44END(__align_cpy_8)
45
46	.align	8
47ENTRY(__align_cpy_4)
4820:	cmp	%o0, %o1
49	be,pn	%xcc, 9f
50	 mov	%o0, %o3
51	subcc	%o2, 0x04, %o2
52	be,pn	%xcc, 8f
531:	 lduw	[%o1 + 0x00], %o5
54	lduw	[%o1 + 0x04], %o4
55	subcc	%o2, 0x08, %o2
56	add	%o1, 0x08, %o1
57	stw	%o5, [%o3 + 0x00]
58	stw	%o4, [%o3 + 0x04]
59	bg,pt	%xcc, 1b
60	 add	%o3, 0x08, %o3
61	bne,pn	%xcc, 9f
62	 nop
63	lduw	[%o1 + 0x00], %o5
648:	stw	%o5, [%o3 + 0x00]
659:	retl
66	 nop
67END(__align_cpy_4)
68
69	.align	8
70ENTRY(__align_cpy_2)
71	or	%o0, %o1, %o3
72	or	%o2, %o3, %o3
73	andcc	%o3, 0x7, %g0
74	be,pt	%xcc, 10b
75	 andcc	%o3, 0x3, %g0
76	be,pt	%xcc, 20b
77	 mov	%o7, %g1
78	call	HIDDEN_JUMPTARGET(memcpy)
79	 mov	%o7, %g1
80END(__align_cpy_2)
81
82weak_alias (__align_cpy_8, __align_cpy_16)
83weak_alias (__align_cpy_2, __align_cpy_1)
84