2005-04-16 15:20:36 -07:00
/ *
Copyright 2 0 0 3 R i c h a r d C u r n o w , S u p e r H ( U K ) L t d .
This f i l e i s s u b j e c t t o t h e t e r m s a n d c o n d i t i o n s o f t h e G N U G e n e r a l P u b l i c
License. S e e t h e f i l e " C O P Y I N G " i n t h e m a i n d i r e c t o r y o f t h i s a r c h i v e
for m o r e d e t a i l s .
Tight v e r s i o n o f m e m p y f o r t h e c a s e o f j u s t c o p y i n g a p a g e .
Prefetch s t r a t e g y e m p i r i c a l l y o p t i m i s e d a g a i n s t R T L s i m u l a t i o n s
of S H 5 - 1 0 1 c u t 2 e v a l c h i p w i t h C a y m a n b o a r d D D R m e m o r y .
Parameters :
2007-11-20 16:51:28 +09:00
r2 : d e s t i n a t i o n e f f e c t i v e a d d r e s s ( s t a r t o f p a g e )
r3 : s o u r c e e f f e c t i v e a d d r e s s ( s t a r t o f p a g e )
2005-04-16 15:20:36 -07:00
Always c o p i e s 4 0 9 6 b y t e s .
Points t o r e v i e w .
* Currently t h e p r e f e t c h i s 4 l i n e s a h e a d a n d t h e a l l o c o i s 2 l i n e s a h e a d .
It s e e m s l i k e t h e p r e f e t c h n e e d s t o b e a t a t l e a s t 4 l i n e s a h e a d t o g e t
the d a t a i n t o t h e c a c h e i n t i m e , a n d t h e a l l o c o s c o n t e n d w i t h o u t s t a n d i n g
prefetches f o r t h e s a m e c a c h e s e t , s o i t ' s b e t t e r t o h a v e t h e n u m b e r s
different.
* /
.section .text . .SHmedia32 , " ax"
.little
.balign 8
2007-11-20 16:51:28 +09:00
.global copy_page
copy_page :
2005-04-16 15:20:36 -07:00
2007-11-20 16:51:28 +09:00
/ * Copy 4 0 9 6 b y t e s w o r t h o f d a t a f r o m r3 t o r2 .
2005-04-16 15:20:36 -07:00
Do p r e f e t c h e s 4 l i n e s a h e a d .
Do a l l o c o 2 l i n e s a h e a d * /
pta 1 f , t r1
pta 2 f , t r2
pta 3 f , t r3
ptabs r18 , t r0
# if 0
/* TAKum03020 */
2007-11-20 16:51:28 +09:00
ld. q r3 , 0 x00 , r63
ld. q r3 , 0 x20 , r63
ld. q r3 , 0 x40 , r63
ld. q r3 , 0 x60 , r63
2005-04-16 15:20:36 -07:00
# endif
2007-11-20 16:51:28 +09:00
alloco r2 , 0 x00
2005-04-16 15:20:36 -07:00
synco ! T A K u m 0 3 0 2 0
2007-11-20 16:51:28 +09:00
alloco r2 , 0 x20
2005-04-16 15:20:36 -07:00
synco ! T A K u m 0 3 0 2 0
movi 3 9 6 8 , r6
2007-11-20 16:51:28 +09:00
add r2 , r6 , r6
2005-04-16 15:20:36 -07:00
addi r6 , 6 4 , r7
addi r7 , 6 4 , r8
2007-11-20 16:51:28 +09:00
sub r3 , r2 , r60
2005-04-16 15:20:36 -07:00
addi r60 , 8 , r61
addi r61 , 8 , r62
addi r62 , 8 , r23
addi r60 , 0 x80 , r22
/ * Minimal c o d e s i z e . T h e e x t r a b r a n c h e s i n s i d e t h e l o o p d o n ' t c o s t m u c h
because t h e y o v e r l a p w i t h t h e t i m e s p e n t w a i t i n g f o r p r e f e t c h e s t o
complete. * /
1 :
# if 0
/* TAKum03020 */
2007-11-20 16:51:28 +09:00
bge/ u r2 , r6 , t r2 ! s k i p p r e f e t c h f o r l a s t 4 l i n e s
ldx. q r2 , r22 , r63 ! p r e f e t c h 4 l i n e s h e n c e
2005-04-16 15:20:36 -07:00
# endif
2 :
2007-11-20 16:51:28 +09:00
bge/ u r2 , r7 , t r3 ! s k i p a l l o c o f o r l a s t 2 l i n e s
alloco r2 , 0 x40 ! a l l o c d e s t i n a t i o n l i n e 2 l i n e s a h e a d
2005-04-16 15:20:36 -07:00
synco ! T A K u m 0 3 0 2 0
3 :
2007-11-20 16:51:28 +09:00
ldx. q r2 , r60 , r36
ldx. q r2 , r61 , r37
ldx. q r2 , r62 , r38
ldx. q r2 , r23 , r39
st. q r2 , 0 , r36
st. q r2 , 8 , r37
st. q r2 , 1 6 , r38
st. q r2 , 2 4 , r39
addi r2 , 3 2 , r2
bgt/ l r8 , r2 , t r1
2005-04-16 15:20:36 -07:00
blink t r0 , r63 ! r e t u r n