2011-10-31 18:48:07 -05:00
/ *
2012-09-19 16:22:02 -05:00
* Copyright ( c ) 2 0 1 0 - 2 0 1 1 , T h e L i n u x F o u n d a t i o n . A l l r i g h t s r e s e r v e d .
2011-10-31 18:48:07 -05:00
*
* 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 n d
* only v e r s i o n 2 a s p u b l i s h e d 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 .
*
* This p r o g r a m i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l ,
* but W I T H O U T A N Y W A R R A N T Y ; without even the implied warranty of
* MERCHANTABILITY o r F I T N E S S F O R A P A R T I C U L A R P U R P O S E . S e e t h e
* GNU G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s .
*
* You s h o u l d h a v e r e c e i v e d a c o p y 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
* along w i t h t h i s p r o g r a m ; if not, write to the Free Software
* Foundation, I n c . , 5 1 F r a n k l i n S t r e e t , F i f t h F l o o r , B o s t o n , M A
* 0 2 1 1 0 - 1 3 0 1 , USA.
* /
/ * Numerology :
* WXYZ
* W : width i n b y t e s
* X : Load=0 , S t o r e =1
* Y : Location 0 =preamble ,8 =loop ,9 =epilog
* Z : Location=0 ,h a n d l e r =9
* /
.text
.global FUNCNAME
.type FUNCNAME, @function
.p2align 5
FUNCNAME :
{
p0 = c m p . g t u ( b y t e s ,#0 )
if ( ! p0 . n e w ) j u m p : n t . L d o n e
r3 = o r ( d s t ,s r c )
r4 = x o r ( d s t ,s r c )
}
{
p1 = c m p . g t u ( b y t e s ,#15 )
p0 = b i t s c l r ( r3 ,#7 )
if ( ! p0 . n e w ) j u m p : n t . L o o p _ n o t _ a l i g n e d _ 8
src_ d s t _ s a v = c o m b i n e ( s r c ,d s t )
}
{
loopcount = l s r ( b y t e s ,#3 )
if ( ! p1 ) j u m p . L s m a l l
}
p3 =sp1loop0 ( . L o o p8 ,l o o p c o u n t )
.Loop8 :
8080 :
8180 :
{
if ( p3 ) m e m d ( d s t + + #8 ) = d _ d b u f
d_ d b u f = m e m d ( s r c + + #8 )
} : endloop0
8190 :
{
memd( d s t + + #8 ) = d _ d b u f
bytes - = a s l ( l o o p c o u n t ,#3 )
jump . L s m a l l
}
.Loop_not_aligned_8 :
{
p0 = b i t s c l r ( r4 ,#7 )
if ( p0 . n e w ) j u m p : n t . L a l i g n
}
{
p0 = b i t s c l r ( r3 ,#3 )
if ( ! p0 . n e w ) j u m p : n t . L o o p _ n o t _ a l i g n e d _ 4
p1 = c m p . g t u ( b y t e s ,#7 )
}
{
if ( ! p1 ) j u m p . L s m a l l
loopcount = l s r ( b y t e s ,#2 )
}
p3 =sp1loop0 ( . L o o p4 ,l o o p c o u n t )
.Loop4 :
4080 :
4180 :
{
if ( p3 ) m e m w ( d s t + + #4 ) = w _ d b u f
w_ d b u f = m e m w ( s r c + + #4 )
} : endloop0
4190 :
{
memw( d s t + + #4 ) = w _ d b u f
bytes - = a s l ( l o o p c o u n t ,#2 )
jump . L s m a l l
}
.Loop_not_aligned_4 :
{
p0 = b i t s c l r ( r3 ,#1 )
if ( ! p0 . n e w ) j u m p : n t . L o o p _ n o t _ a l i g n e d
p1 = c m p . g t u ( b y t e s ,#3 )
}
{
if ( ! p1 ) j u m p . L s m a l l
loopcount = l s r ( b y t e s ,#1 )
}
p3 =sp1loop0 ( . L o o p2 ,l o o p c o u n t )
.Loop2 :
2080 :
2180 :
{
if ( p3 ) m e m h ( d s t + + #2 ) = w _ d b u f
w_ d b u f = m e m u h ( s r c + + #2 )
} : endloop0
2190 :
{
memh( d s t + + #2 ) = w _ d b u f
bytes - = a s l ( l o o p c o u n t ,#1 )
jump . L s m a l l
}
.Loop_not_aligned : /* Works for as small as one byte */
p3 =sp1loop0 ( . L o o p1 ,b y t e s )
.Loop1 :
1080 :
1180 :
{
if ( p3 ) m e m b ( d s t + + #1 ) = w _ d b u f
w_ d b u f = m e m u b ( s r c + + #1 )
} : endloop0
/* Done */
1190 :
{
memb( d s t ) = w _ d b u f
jumpr r31
r0 = #0
}
.Lsmall :
{
p0 = c m p . g t u ( b y t e s ,#0 )
if ( p0 . n e w ) j u m p : n t . L o o p _ n o t _ a l i g n e d
}
.Ldone :
{
r0 = #0
jumpr r31
}
.falign
.Lalign :
1000 :
{
if ( p0 . n e w ) w _ d b u f = m e m u b ( s r c )
p0 = t s t b i t ( s r c ,#0 )
if ( ! p1 ) j u m p . L s m a l l
}
1100 :
{
if ( p0 ) m e m b ( d s t + + #1 ) = w _ d b u f
if ( p0 ) b y t e s = a d d ( b y t e s ,#- 1 )
if ( p0 ) s r c = a d d ( s r c ,#1 )
}
2000 :
{
if ( p0 . n e w ) w _ d b u f = m e m u h ( s r c )
p0 = t s t b i t ( s r c ,#1 )
if ( ! p1 ) j u m p . L s m a l l
}
2100 :
{
if ( p0 ) m e m h ( d s t + + #2 ) = w _ d b u f
if ( p0 ) b y t e s = a d d ( b y t e s ,#- 2 )
if ( p0 ) s r c = a d d ( s r c ,#2 )
}
4000 :
{
if ( p0 . n e w ) w _ d b u f = m e m w ( s r c )
p0 = t s t b i t ( s r c ,#2 )
if ( ! p1 ) j u m p . L s m a l l
}
4100 :
{
if ( p0 ) m e m w ( d s t + + #4 ) = w _ d b u f
if ( p0 ) b y t e s = a d d ( b y t e s ,#- 4 )
if ( p0 ) s r c = a d d ( s r c ,#4 )
jump F U N C N A M E
}
.size FUNCNAME,. - F U N C N A M E