2 * (c) Copyright 1986 HEWLETT-PACKARD COMPANY
4 * To anyone who acknowledges that this file is provided "AS IS"
5 * without any express or implied warranty:
6 * permission to use, copy, modify, and distribute this file
7 * for any purpose is hereby granted without fee, provided that
8 * the above copyright notice and this notice appears in all
9 * copies, and that the name of Hewlett-Packard Company not be
10 * used in advertising or publicity pertaining to distribution
11 * of the software without specific, written prior permission.
12 * Hewlett-Packard Company makes no representations about the
13 * suitability of this software for any purpose.
16 /* HPUX_ID: @(#) $Revision: 1.1 $ */
20 * Concatenate s2 on the end of s1. S1's space must be large enough.
38 comb,= r0,s_addr,done /* quit if s2=NULL */
39 copy d_addr,ret0 /* The return value is the value of d_addr. DELAY SLOT*/
41 /* First look for end of s1 (d_addr) */
43 extru d_addr,31,2,tmp1 /* Extract the low two bits of the dest address. */
44 combt,= tmp1,r0,dont_mask
45 dep 0,31,2,d_addr /*set word alignment */
47 sh3add tmp1,r0,save /* build mask based on tmp1 */
53 b,n found_end /* nullified under uxor conditions above and below */
59 found_end: /* at this point d_addr points to word */
60 extru,<> save,7,8,r0 /* following word with null */
61 addib,tr,n -4,d_addr,begin_copy /*set d_addr to end of s1 */
63 addib,tr,n -3,d_addr,begin_copy
71 extru s_addr,31,2,tmp1 /* Extract the low two bits of the source address. */
72 extru d_addr,31,2,tmp6 /* Extract the low two bits of the destination address. */
73 sub,= tmp6,tmp1,tmp3 /* Compute the shift quantity and don't branch if tmp6=tmp1. */
74 b not_aligned /* Not_aligned says that shifts Will be needed. */
75 dep 0,31,2,s_addr /* Compute the word address of the source. DELAY SLOT. */
78 combt,= tmp6,r0,skip_mask
79 ldwm 4(0,s_addr),tmp1 /* tmp1 = *s_addr s_addr += 4 (DELAY SLOT) */
85 b,n first_null /* special case: null in first word */
89 b,n null_found /* delay slot for uxor below */
92 stbys,b,m tmp1,4(d_addr)
98 /* Begin non_aligned code. */
101 sh3add,>= tmp3,r0,tmp4 /* compute the shift amt.and skip load if tmp6 > tmp1. */
102 ldwm 4(0,s_addr),tmp1 /* load up the first word from the source. tmp1 = *s_addr++ */
103 ldwm 4(0,s_addr),tmp2 /* get either first or second word from source. */
104 combt,= tmp6,r0,chunk2 /* don't mask if whole word is valid */
105 mtctl tmp4,11 /* load the shift count into cr11 = shift count register. */
106 vshd tmp1,tmp2,tmp3 /* position data ! (delay slot) */
107 sh3add tmp6,r0,save /* setup r1 */
108 mtctl save,r11 /* set-up cr11 for mask */
111 uxor,nbz tmp3,r0,save
114 mtctl tmp4,11 /* re-load the shift count into cr11 */
118 uxor,nbz tmp3, r0, save
121 stbys,b,m tmp3,4(0,d_addr) /* store ! */
123 ldwm 4(0,s_addr),tmp1 /* get next word ! */
124 vshd tmp2,tmp1,tmp3 /* position data ! */
125 uxor,nbz tmp3, r0, save
132 null_found: /* adjust d_addr and store final word */
135 addib,tr,n 1,d_addr,store_final
136 extru,<> save,15,8,r0
137 addib,tr,n 2,d_addr,store_final
138 extru,<> save,23,8,r0
139 addib,tr 3,d_addr,store_final2
146 stbys,e save,0(d_addr) /* delay slot */
148 first_null: /* null found in first word of aligned (wrt d_addr) */
149 addi -4,s_addr,s_addr
150 ldbx tmp6(s_addr),tmp4
151 add tmp6,s_addr,s_addr
153 stbs,ma tmp4,1(d_addr)
156 stbs,ma tmp4,1(d_addr)
160 first_null2: /* null found in first word of non-aligned (wrt d_addr) */
161 addibt,= -1,tmp6,check3 /* check last 3 bytes of word */
163 addibt,=,n -1,tmp6,check2 /* check last 2 bytes */
165 stbys,b save, 0(d_addr)
169 stbs,ma tmp4,1(d_addr)
171 extru,<> save,23,8,tmp4
173 stbs,ma tmp4,1(d_addr)