2013-01-18 15:12:18 +05:30
/ *
* Copyright ( C ) 2 0 0 4 , 2 0 0 7 - 2 0 1 0 , 2 0 1 1 - 2 0 1 2 S y n o p s y s , I n c . ( w w w . s y n o p s y s . c o m )
*
* This p r o g r a m i s f r e e s o f t w a r e ; you can redistribute it and/or modify
* it u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e v e r s i o n 2 a s
* published b y t h e F r e e S o f t w a r e F o u n d a t i o n .
* /
/ * If d s t a n d s r c a r e 4 b y t e a l i g n e d , c o p y 8 b y t e s a t a t i m e .
If t h e s r c i s 4 , b u t n o t 8 b y t e a l i g n e d , w e f i r s t r e a d 4 b y t e s t o g e t
it 8 b y t e a l i g n e d . T h u s , w e c a n d o a l i t t l e r e a d - a h e a d , w i t h o u t
dereferencing a c a c h e l i n e t h a t w e s h o u l d n o t t o u c h .
Note t h a t s h o r t a n d l o n g i n s t r u c t i o n s h a v e b e e n s c h e d u l e d t o a v o i d
branch s t a l l s .
The b e q _ s t o r3 z c o u l d b e m a d e u n a l i g n e d & l o n g t o a v o i d a s t a l l
there, b u t t h e i t i s n o t l i k e l y t o b e t a k e n o f t e n , a n d i t
would a l s o b e l i k e y t o c o s t a n u n a l i g n e d m i s p r e d i c t a t t h e n e x t c a l l . * /
2014-02-07 13:47:43 +05:30
# include < l i n u x / l i n k a g e . h >
2013-01-18 15:12:18 +05:30
2014-02-07 13:47:43 +05:30
ENTRY( s t r c p y )
2013-01-18 15:12:18 +05:30
or r2 ,r0 ,r1
bmsk_ s r2 ,r2 ,1
brne. d r2 ,0 ,c h a r l o o p
mov_ s r10 ,r0
ld_ s r3 ,[ r1 ,0 ]
mov r8 ,0 x01 0 1 0 1 0 1
bbit0 . d r1 ,2 ,l o o p _ s t a r t
ror r12 ,r8
sub r2 ,r3 ,r8
bic_ s r2 ,r2 ,r3
tst_ s r2 ,r12
bne r3 z
mov_ s r4 ,r3
.balign 4
loop :
ld. a r3 ,[ r1 ,4 ]
st. a b r4 ,[ r10 ,4 ]
loop_start :
ld. a r4 ,[ r1 ,4 ]
sub r2 ,r3 ,r8
bic_ s r2 ,r2 ,r3
tst_ s r2 ,r12
bne_ s r3 z
st. a b r3 ,[ r10 ,4 ]
sub r2 ,r4 ,r8
bic r2 ,r2 ,r4
tst r2 ,r12
beq l o o p
mov_ s r3 ,r4
# ifdef _ _ L I T T L E _ E N D I A N _ _
r3z : bmsk. f r1 ,r3 ,7
lsr_ s r3 ,r3 ,8
# else
r3z : lsr. f r1 ,r3 ,2 4
asl_ s r3 ,r3 ,8
# endif
bne. d r3 z
stb. a b r1 ,[ r10 ,1 ]
j_ s [ b l i n k ]
.balign 4
charloop :
ldb. a b r3 ,[ r1 ,1 ]
brne. d r3 ,0 ,c h a r l o o p
stb. a b r3 ,[ r10 ,1 ]
j [ b l i n k ]
2014-02-07 13:47:43 +05:30
END( s t r c p y )