xref: /openbsd/lib/libc/arch/hppa/string/memmove.S (revision d89ec533)
1/* This is a generated file. DO NOT EDIT. */
2/*
3 * Generated from:
4 *
5 *	OpenBSD: bcopy.m4
6 */
7/*
8 * Copyright (c) 1999 Michael Shalayeff
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 *    notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 *    notice, this list of conditions and the following disclaimer in the
18 *    documentation and/or other materials provided with the distribution.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS' AND ANY EXPRESS OR
21 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
31 */
32
33
34#include "SYS.h"
35
36
37LEAF_ENTRY(bcopy)
38	copy	arg0, ret0
39	copy	arg1, arg0
40	copy	ret0, arg1
41ALTENTRY(memmove)
42	comb,>,n arg0, arg1, $bcopy.reverse
43// ALTENTRY(memcpy)
44	copy	arg0, ret0
45
46	comib,>=,n 15, arg2, $bcopy_f.byte
47
48	extru	arg1, 31, 2, t3
49	extru	arg0, 31, 2, t4
50	add	arg2, t4, arg2
51	comb,<> t3, t4, $bcopy_f.unaligned
52	dep	r0, 31, 2, arg1
53
54	addi	-16, arg2, arg2
55$bcopy_f.loop16a
56	ldws,ma	4(sr0, arg1), t1
57	ldws,ma	4(sr0, arg1), t2
58	ldws,ma	4(sr0, arg1), t3
59	ldws,ma	4(sr0, arg1), t4
60	stbys,b,m t1, 4(sr0, arg0)
61	stws,ma	t2, 4(sr0, arg0)
62	stws,ma	t3, 4(sr0, arg0)
63	addib,>= -16, arg2, $bcopy_f.loop16a
64	stws,ma	t4, 4(sr0, arg0)
65
66	addib,<,n 12, arg2, $bcopy_f.cleanup
67$bcopy_f.word
68	ldws,ma	4(sr0, arg1), t1
69	addib,>= -4, arg2, $bcopy_f.word
70	stws,ma	t1, 4(sr0, arg0)
71
72$bcopy_f.cleanup
73	addib,=,n 4, arg2, $bcopy_f.done
74	ldws	0(sr0, arg1), t1
75	add	arg0, arg2, arg0
76	b	$bcopy_f.done
77	stbys,e	t1, 0(sr0, arg0)
78
79$bcopy_f.unaligned
80	sub,>=	t4, t3, t2
81	ldwm	4(sr0, arg1), ret1
82	zdep	t2, 28, 29, t1
83	mtsar	t1
84
85	addi	-16, arg2, arg2
86$bcopy_f.loop16u
87	ldws,ma	4(sr0, arg1), t1
88	ldws,ma	4(sr0, arg1), t2
89	ldws,ma	4(sr0, arg1), t3
90	ldws,ma	4(sr0, arg1), t4
91	vshd	ret1, t1, r31
92	stbys,b,m r31, 4(sr0, arg0)
93	vshd	t1, t2, r31
94	stws,ma	r31, 4(sr0, arg0)
95	vshd	t2, t3, r31
96	stws,ma	r31, 4(sr0, arg0)
97	vshd	t3, t4, r31
98	stws,ma	r31, 4(sr0, arg0)
99	addib,>= -16, arg2, $bcopy_f.loop16u
100	copy	t4, ret1
101
102	addib,<,n 12, arg2, $bcopy_f.cleanup_un
103$bcopy_f.word_un
104	ldws,ma	4(sr0, arg1), t1
105	vshd	ret1, t1, t2
106	addib,<	-4, arg2, $bcopy_f.cleanup1_un
107	stws,ma	t2, 4(sr0, arg0)
108	ldws,ma	4(sr0, arg1), ret1
109	vshd	t1, ret1, t2
110	addib,>= -4, arg2, $bcopy_f.word_un
111	stws,ma	t2, 4(sr0, arg0)
112
113$bcopy_f.cleanup_un
114	addib,<=,n 4, arg2, $bcopy_f.done
115	mfctl	sar, t4
116	add	arg0, arg2, arg0
117	extru	t4, 28, 2, t4
118	sub,<=	arg2, t4, r0
119	ldws,ma	4(sr0, arg1), t1
120	vshd	ret1, t1, t2
121	b	$bcopy_f.done
122	stbys,e	t2, 0(sr0, arg0)
123
124$bcopy_f.cleanup1_un
125	b	$bcopy_f.cleanup_un
126	copy	t1, ret1
127
128$bcopy_f.byte
129	comb,>=,n r0, arg2, $bcopy_f.done
130$bcopy_f.byte_loop
131	ldbs,ma	1(sr0, arg1), t1
132	addib,<> -1, arg2, $bcopy_f.byte_loop
133	stbs,ma	t1, 1(sr0, arg0)
134$bcopy_f.done
135
136	bv	0(rp)
137	nop
138$bcopy.reverse
139	copy	arg0, ret0
140	add	arg1, arg2, arg1
141	add	arg0, arg2, arg0
142
143
144$bcopy_r.byte
145	comb,>=,n r0, arg2, $bcopy_r.done
146$bcopy_r.byte_loop
147	ldbs,mb	-1(sr0, arg1), t1
148	addib,<> -1, arg2, $bcopy_r.byte_loop
149	stbs,mb	t1, -1(sr0, arg0)
150$bcopy_r.done
151
152	bv	0(rp)
153	nop
154EXIT_WEAK(bcopy)
155ALTEXIT_STRONG(memmove)
156
157	.end
158