xref: /openbsd/sys/lib/libkern/arch/hppa/bcopy.S (revision 73471bf0)
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
35#undef _LOCORE
36#define _LOCORE
37#include <machine/asm.h>
38#include <machine/frame.h>
39
40
41LEAF_ENTRY(bcopy)
42	copy	arg0, ret0
43	copy	arg1, arg0
44	copy	ret0, arg1
45ALTENTRY(memmove)
46	comb,>,n arg0, arg1, $bcopy.reverse
47ALTENTRY(memcpy)
48	copy	arg0, ret0
49
50	comib,>=,n 15, arg2, $bcopy_f.byte
51
52	extru	arg1, 31, 2, t3
53	extru	arg0, 31, 2, t4
54	add	arg2, t4, arg2
55	comb,<> t3, t4, $bcopy_f.unaligned
56	dep	r0, 31, 2, arg1
57
58	addi	-16, arg2, arg2
59$bcopy_f.loop16a
60	ldws,ma	4(sr0, arg1), t1
61	ldws,ma	4(sr0, arg1), t2
62	ldws,ma	4(sr0, arg1), t3
63	ldws,ma	4(sr0, arg1), t4
64	stbys,b,m t1, 4(sr0, arg0)
65	stws,ma	t2, 4(sr0, arg0)
66	stws,ma	t3, 4(sr0, arg0)
67	addib,>= -16, arg2, $bcopy_f.loop16a
68	stws,ma	t4, 4(sr0, arg0)
69
70	addib,<,n 12, arg2, $bcopy_f.cleanup
71$bcopy_f.word
72	ldws,ma	4(sr0, arg1), t1
73	addib,>= -4, arg2, $bcopy_f.word
74	stws,ma	t1, 4(sr0, arg0)
75
76$bcopy_f.cleanup
77	addib,=,n 4, arg2, $bcopy_f.done
78	ldws	0(sr0, arg1), t1
79	add	arg0, arg2, arg0
80	b	$bcopy_f.done
81	stbys,e	t1, 0(sr0, arg0)
82
83$bcopy_f.unaligned
84	sub,>=	t4, t3, t2
85	ldwm	4(sr0, arg1), ret1
86	zdep	t2, 28, 29, t1
87	mtsar	t1
88
89	addi	-16, arg2, arg2
90$bcopy_f.loop16u
91	ldws,ma	4(sr0, arg1), t1
92	ldws,ma	4(sr0, arg1), t2
93	ldws,ma	4(sr0, arg1), t3
94	ldws,ma	4(sr0, arg1), t4
95	vshd	ret1, t1, r31
96	stbys,b,m r31, 4(sr0, arg0)
97	vshd	t1, t2, r31
98	stws,ma	r31, 4(sr0, arg0)
99	vshd	t2, t3, r31
100	stws,ma	r31, 4(sr0, arg0)
101	vshd	t3, t4, r31
102	stws,ma	r31, 4(sr0, arg0)
103	addib,>= -16, arg2, $bcopy_f.loop16u
104	copy	t4, ret1
105
106	addib,<,n 12, arg2, $bcopy_f.cleanup_un
107$bcopy_f.word_un
108	ldws,ma	4(sr0, arg1), t1
109	vshd	ret1, t1, t2
110	addib,<	-4, arg2, $bcopy_f.cleanup1_un
111	stws,ma	t2, 4(sr0, arg0)
112	ldws,ma	4(sr0, arg1), ret1
113	vshd	t1, ret1, t2
114	addib,>= -4, arg2, $bcopy_f.word_un
115	stws,ma	t2, 4(sr0, arg0)
116
117$bcopy_f.cleanup_un
118	addib,<=,n 4, arg2, $bcopy_f.done
119	mfctl	sar, t4
120	add	arg0, arg2, arg0
121	extru	t4, 28, 2, t4
122	sub,<=	arg2, t4, r0
123	ldws,ma	4(sr0, arg1), t1
124	vshd	ret1, t1, t2
125	b	$bcopy_f.done
126	stbys,e	t2, 0(sr0, arg0)
127
128$bcopy_f.cleanup1_un
129	b	$bcopy_f.cleanup_un
130	copy	t1, ret1
131
132$bcopy_f.byte
133	comb,>=,n r0, arg2, $bcopy_f.done
134$bcopy_f.byte_loop
135	ldbs,ma	1(sr0, arg1), t1
136	addib,<> -1, arg2, $bcopy_f.byte_loop
137	stbs,ma	t1, 1(sr0, arg0)
138$bcopy_f.done
139
140	bv	0(rp)
141	nop
142$bcopy.reverse
143	copy	arg0, ret0
144	add	arg1, arg2, arg1
145	add	arg0, arg2, arg0
146
147
148$bcopy_r.byte
149	comb,>=,n r0, arg2, $bcopy_r.done
150$bcopy_r.byte_loop
151	ldbs,mb	-1(sr0, arg1), t1
152	addib,<> -1, arg2, $bcopy_r.byte_loop
153	stbs,mb	t1, -1(sr0, arg0)
154$bcopy_r.done
155
156	bv	0(rp)
157	nop
158EXIT(bcopy)
159
160	.end
161