2005-04-16 15:20:36 -07:00
/ *
* arch/ a l p h a / l i b / e v67 - s t r c a t . S
* 2 1 2 6 4 version c o n t r i b u t e d b y R i c k G o r t o n < r i c k . g o r t o n @alpha-processor.com>
*
* Append a n u l l - t e r m i n a t e d s t r i n g f r o m S R C t o D S T .
*
* Much o f t h e i n f o r m a t i o n a b o u t 2 1 2 6 4 s c h e d u l i n g / c o d i n g c o m e s f r o m :
* Compiler W r i t e r ' s G u i d e f o r t h e A l p h a 2 1 2 6 4
* abbreviated a s ' C W G ' i n o t h e r c o m m e n t s h e r e
* ftp. d i g i t a l . c o m / p u b / D i g i t a l / i n f o / s e m i c o n d u c t o r / l i t e r a t u r e / d s c - l i b r a r y . h t m l
* Scheduling n o t a t i o n :
* E - e i t h e r c l u s t e r
* U - u p p e r s u b c l u s t e r ; U0 - subcluster U0; U1 - subcluster U1
* L - l o w e r s u b c l u s t e r ; L0 - subcluster L0; L1 - subcluster L1
* Try n o t t o c h a n g e t h e a c t u a l a l g o r i t h m i f p o s s i b l e f o r c o n s i s t e n c y .
* Commentary : It s e e m s b o g u s t o w a l k t h e i n p u t s t r i n g t w i c e - o n c e
* to d e t e r m i n e t h e l e n g t h , a n d t h e n a g a i n w h i l e d o i n g t h e c o p y .
* A s i g n i f i c a n t ( f u t u r e ) e n h a n c e m e n t w o u l d b e t o o n l y r e a d t h e i n p u t
* string o n c e .
* /
2016-01-11 09:51:29 -05:00
# include < a s m / e x p o r t . h >
2005-04-16 15:20:36 -07:00
.text
.align 4
.globl strcat
.ent strcat
strcat :
.frame $ 3 0 , 0 , $ 2 6
.prologue 0
mov $ 1 6 , $ 0 # E : s e t u p r e t u r n v a l u e
/* Find the end of the string. */
ldq_ u $ 1 , 0 ( $ 1 6 ) # L : l o a d f i r s t q u a d w o r d ( a 0 m a y b e m i s a l i g n e d )
lda $ 2 , - 1 # E :
insqh $ 2 , $ 1 6 , $ 2 # U :
andnot $ 1 6 , 7 , $ 1 6 # E :
or $ 2 , $ 1 , $ 1 # E :
cmpbge $ 3 1 , $ 1 , $ 2 # E : b i t s s e t i f f b y t e = = 0
bne $ 2 , $ f o u n d # U :
$ loop : ldq $ 1 , 8 ( $ 1 6 ) # L :
addq $ 1 6 , 8 , $ 1 6 # E :
cmpbge $ 3 1 , $ 1 , $ 2 # E :
beq $ 2 , $ l o o p # U :
$ found : cttz $ 2 , $ 3 # U 0 :
addq $ 1 6 , $ 3 , $ 1 6 # E :
/* Now do the append. */
mov $ 2 6 , $ 2 3 # E :
br _ _ s t x c p y # L 0 :
.end strcat
2016-01-11 09:51:29 -05:00
EXPORT_ S Y M B O L ( s t r c a t )