2005-04-16 15:20:36 -07:00
|
| do_ f u n c . s a 3 . 4 2 / 1 8 / 9 1
|
| Do_ f u n c p e r f o r m s t h e u n i m p l e m e n t e d o p e r a t i o n . T h e o p e r a t i o n
| to b e p e r f o r m e d i s d e t e r m i n e d f r o m t h e l o w e r 7 b i t s o f t h e
| extension w o r d ( e x c e p t i n t h e c a s e o f f m o v e c r a n d f s i n c o s ) .
| The o p c o d e a n d t a g b i t s f o r m a n i n d e x i n t o a j u m p t a b l e i n
| tbldo. s a . C a s e s o f z e r o , i n f i n i t y a n d N a N a r e h a n d l e d i n
| do_ f u n c b y f o r c i n g t h e d e f a u l t r e s u l t . N o r m a l i z e d a n d
| denormalized ( t h e r e a r e n o u n n o r m a l i z e d n u m b e r s a t t h i s
| point) a r e p a s s e d o n t o t h e e m u l a t i o n c o d e .
|
| CMDREG1 B a n d S T A G a r e e x t r a c t e d f r o m t h e f s a v e f r a m e
| and c o m b i n e d t o f o r m t h e t a b l e i n d e x . T h e f u n c t i o n c a l l e d
| will s t a r t w i t h a0 p o i n t i n g t o t h e E T E M P o p e r a n d . D y a d i c
| functions c a n f i n d F P T E M P a t - 1 2 ( a0 ) .
|
| Called f u n c t i o n s r e t u r n t h e i r r e s u l t i n f p0 . S i n c o s r e t u r n s
| sin( x ) i n f p0 a n d c o s ( x ) i n f p1 .
|
| Copyright ( C ) M o t o r o l a , I n c . 1 9 9 0
| All R i g h t s R e s e r v e d
|
2006-02-11 17:55:48 -08:00
| For d e t a i l s o n t h e l i c e n s e f o r t h i s f i l e , p l e a s e s e e t h e
| file, R E A D M E , i n t h i s s a m e d i r e c t o r y .
2005-04-16 15:20:36 -07:00
DO_FUNC : | idnt 2 ,1 | M o t o r o l a 0 4 0 F l o a t i n g P o i n t S o f t w a r e P a c k a g e
| section 8
# include " f p s p . h "
| xref t _ d z 2
| xref t _ o p e r r
| xref t _ i n x2
| xref t _ r e s d n r m
| xref d s t _ n a n
| xref s r c _ n a n
| xref n r m _ s e t
| xref s t o _ c o s
| xref t b l p r e
| xref s l o g n p1 ,s l o g n ,s l o g 1 0 ,s l o g 2
| xref s l o g n d ,s l o g 1 0 d ,s l o g 2 d
| xref s m o d ,s r e m
| xref s s c a l e
| xref s m o v c r
PONE : .long 0x3fff0000 , 0 x8 0 0 0 0 0 0 0 ,0 x00 0 0 0 0 0 0 | + 1
MONE : .long 0xbfff0000 , 0 x8 0 0 0 0 0 0 0 ,0 x00 0 0 0 0 0 0 | - 1
PZERO : .long 0x00000000 , 0 x0 0 0 0 0 0 0 0 ,0 x00 0 0 0 0 0 0 | + 0
MZERO : .long 0x80000000 , 0 x0 0 0 0 0 0 0 0 ,0 x00 0 0 0 0 0 0 | - 0
PINF : .long 0x7fff0000 , 0 x0 0 0 0 0 0 0 0 ,0 x00 0 0 0 0 0 0 | + i n f
MINF : .long 0xffff0000 , 0 x0 0 0 0 0 0 0 0 ,0 x00 0 0 0 0 0 0 | - i n f
QNAN : .long 0x7fff0000 , 0 xffffffff,0 x f f f f f f f f | n o n - s i g n a l i n g n a n
PPIBY2 : .long 0x3FFF0000 , 0 xC9 0 F D A A 2 ,0 x21 6 8 C 2 3 5 | + P I / 2
MPIBY2 : .long 0xbFFF0000 , 0 xC9 0 F D A A 2 ,0 x21 6 8 C 2 3 5 | - P I / 2
.global do_func
do_func :
clrb C U _ O N L Y ( % a6 )
|
| Check f o r f m o v e c r . I t d o e s n o t f o l l o w t h e f o r m a t o f f p g e n
| unimplemented i n s t r u c t i o n s . T h e t e s t i s o n t h e u p p e r 6 b i t s ;
| if t h e y a r e $ 1 7 , t h e i n s t i s f m o v e c r . C a l l e n t r y s m o v c r
| directly.
|
bfextu C M D R E G 1 B ( % a6 ) { #0 : #6 } ,% d0 | g e t o p c l a s s a n d s r c f i e l d s
cmpil #0x17 ,% d0 | i f o p c l a s s a n d s i z e f i e l d s a r e $ 1 7 ,
| ;it is FMOVECR; if not, continue
bnes n o t _ f m o v e c r
jmp s m o v c r | f m o v e c r ; jmp directly to emulation
not_fmovecr :
movew C M D R E G 1 B ( % a6 ) ,% d0
andl #0x7F ,% d0
cmpil #0x38 ,% d0 | i f t h e e x t e n s i o n i s > = $ 3 8 ,
bge s e r r o r | i t i s i l l e g a l
bfextu S T A G ( % a6 ) { #0 : #3 } ,% d1
lsll #3 ,% d0 | m a k e r o o m f o r S T A G
addl % d1 ,% d0 | c o m b i n e f o r f i n a l i n d e x i n t o t a b l e
leal t b l p r e ,% a1 | s t a r t o f m o n s t e r j u m p t a b l e
movel ( % a1 ,% d0 . w * 4 ) ,% a1 | r e a l t a r g e t a d d r e s s
leal E T E M P ( % a6 ) ,% a0 | a0 i s p o i n t e r t o s r c o p
movel U S E R _ F P C R ( % a6 ) ,% d1
andl #0xFF ,% d1 | d i s c a r d a l l b u t r o u n d i n g m o d e / p r e c
fmovel #0 ,% f p c r
jmp ( % a1 )
|
| ERROR
|
.global serror
serror :
st S T O R E _ F L G ( % a6 )
rts
|
| These r o u t i n e s l o a d f o r c e d v a l u e s i n t o f p0 . T h e y a r e c a l l e d
| by i n d e x i n t o t b l d o .
|
| Load a s i g n e d z e r o t o f p0 a n d s e t i n e x2 / a i n e x
|
.global snzrinx
snzrinx :
btstb #s i g n _ b i t , L O C A L _ E X ( % a 0 ) | g e t s i g n o f s o u r c e o p e r a n d
bnes l d _ m z i n x | i f n e g a t i v e , b r a n c h
bsr l d _ p z e r o | b s r s o w e c a n r e t u r n a n d s e t i n x
bra t _ i n x2 | n o w , s e t t h e i n x f o r t h e n e x t i n s t
ld_mzinx :
bsr l d _ m z e r o | i f n e g , l o a d n e g z e r o , r e t u r n h e r e
bra t _ i n x2 | n o w , s e t t h e i n x f o r t h e n e x t i n s t
|
| Load a s i g n e d z e r o t o f p0 ; do not set inex2/ainex
|
.global szero
szero :
btstb #s i g n _ b i t , L O C A L _ E X ( % a 0 ) | g e t s i g n o f s o u r c e o p e r a n d
bne l d _ m z e r o | i f n e g , l o a d n e g z e r o
bra l d _ p z e r o | l o a d p o s i t i v e z e r o
|
| Load a s i g n e d i n f i n i t y t o f p0 ; do not set inex2/ainex
|
.global sinf
sinf :
btstb #s i g n _ b i t , L O C A L _ E X ( % a 0 ) | g e t s i g n o f s o u r c e o p e r a n d
bne l d _ m i n f | i f n e g a t i v e b r a n c h
bra l d _ p i n f
|
| Load a s i g n e d o n e t o f p0 ; do not set inex2/ainex
|
.global sone
sone :
btstb #s i g n _ b i t , L O C A L _ E X ( % a 0 ) | c h e c k s i g n o f s o u r c e
bne l d _ m o n e
bra l d _ p o n e
|
| Load a s i g n e d p i / 2 t o f p0 ; do not set inex2/ainex
|
.global spi_2
spi_2 :
btstb #s i g n _ b i t , L O C A L _ E X ( % a 0 ) | c h e c k s i g n o f s o u r c e
bne l d _ m p i 2
bra l d _ p p i 2
|
| Load e i t h e r a + 0 o r + i n f f o r p l u s / m i n u s o p e r a n d
|
.global szr_inf
szr_inf :
btstb #s i g n _ b i t , L O C A L _ E X ( % a 0 ) | c h e c k s i g n o f s o u r c e
bne l d _ p z e r o
bra l d _ p i n f
|
| Result i s e i t h e r a n o p e r r o r + i n f f o r p l u s / m i n u s o p e r a n d
| [ Used b y s l o g n , s l o g n p1 , s l o g 1 0 , a n d s l o g 2 ]
|
.global sopr_inf
sopr_inf :
btstb #s i g n _ b i t , L O C A L _ E X ( % a 0 ) | c h e c k s i g n o f s o u r c e
bne t _ o p e r r
bra l d _ p i n f
|
| FLOGNP1
|
.global sslognp1
sslognp1 :
fmovemx ( % a0 ) ,% f p0 - % f p0
fcmpb #- 1 ,% f p0
fbgt s l o g n p1
fbeq t _ d z 2 | i f = - 1 , d i v i d e b y z e r o e x c e p t i o n
fmovel #0 ,% F P S R | c l r N f l a g
bra t _ o p e r r | t a k e c a r e o f o p e r a n d s < - 1
|
| FETOXM1
|
.global setoxm1i
setoxm1i :
btstb #s i g n _ b i t , L O C A L _ E X ( % a 0 ) | c h e c k s i g n o f s o u r c e
bne l d _ m o n e
bra l d _ p i n f
|
| FLOGN
|
| Test f o r 1 . 0 a s a n i n p u t a r g u m e n t , r e t u r n i n g + z e r o . A l s o c h e c k
| the s i g n a n d r e t u r n o p e r r i f n e g a t i v e .
|
.global sslogn
sslogn :
btstb #s i g n _ b i t , L O C A L _ E X ( % a 0 )
bne t _ o p e r r | t a k e c a r e o f o p e r a n d s < 0
cmpiw #0x3fff ,L O C A L _ E X ( % a0 ) | t e s t f o r 1 . 0 i n p u t
bne s l o g n
cmpil #0x80000000 ,L O C A L _ H I ( % a0 )
bne s l o g n
tstl L O C A L _ L O ( % a0 )
bne s l o g n
fmovex P Z E R O ,% f p0
rts
.global sslognd
sslognd :
btstb #s i g n _ b i t , L O C A L _ E X ( % a 0 )
beq s l o g n d
bra t _ o p e r r | t a k e c a r e o f o p e r a n d s < 0
|
| FLOG1 0
|
.global sslog10
sslog10 :
btstb #s i g n _ b i t , L O C A L _ E X ( % a 0 )
bne t _ o p e r r | t a k e c a r e o f o p e r a n d s < 0
cmpiw #0x3fff ,L O C A L _ E X ( % a0 ) | t e s t f o r 1 . 0 i n p u t
bne s l o g 1 0
cmpil #0x80000000 ,L O C A L _ H I ( % a0 )
bne s l o g 1 0
tstl L O C A L _ L O ( % a0 )
bne s l o g 1 0
fmovex P Z E R O ,% f p0
rts
.global sslog10d
sslog10d :
btstb #s i g n _ b i t , L O C A L _ E X ( % a 0 )
beq s l o g 1 0 d
bra t _ o p e r r | t a k e c a r e o f o p e r a n d s < 0
|
| FLOG2
|
.global sslog2
sslog2 :
btstb #s i g n _ b i t , L O C A L _ E X ( % a 0 )
bne t _ o p e r r | t a k e c a r e o f o p e r a n d s < 0
cmpiw #0x3fff ,L O C A L _ E X ( % a0 ) | t e s t f o r 1 . 0 i n p u t
bne s l o g 2
cmpil #0x80000000 ,L O C A L _ H I ( % a0 )
bne s l o g 2
tstl L O C A L _ L O ( % a0 )
bne s l o g 2
fmovex P Z E R O ,% f p0
rts
.global sslog2d
sslog2d :
btstb #s i g n _ b i t , L O C A L _ E X ( % a 0 )
beq s l o g 2 d
bra t _ o p e r r | t a k e c a r e o f o p e r a n d s < 0
|
| FMOD
|
pmodt :
| ;$21 fmod
| ;dtag,stag
.long smod | 0 0 , 0 0 norm,n o r m = n o r m a l
.long smod_oper | 0 0 , 0 1 norm,z e r o = n a n w i t h o p e r r
.long smod_fpn | 0 0 , 1 0 norm,i n f = f p n
.long smod_snan | 0 0 , 1 1 norm,n a n = n a n
.long smod_zro | 0 1 , 0 0 zero,n o r m = + - z e r o
.long smod_oper | 0 1 , 0 1 zero,z e r o = n a n w i t h o p e r r
.long smod_zro | 0 1 , 1 0 zero,i n f = + - z e r o
.long smod_snan | 0 1 , 1 1 zero,n a n = n a n
.long smod_oper | 1 0 , 0 0 inf,n o r m = n a n w i t h o p e r r
.long smod_oper | 1 0 , 0 1 inf,z e r o = n a n w i t h o p e r r
.long smod_oper | 1 0 , 1 0 inf,i n f = n a n w i t h o p e r r
.long smod_snan | 1 0 , 1 1 inf,n a n = n a n
.long smod_dnan | 1 1 , 0 0 nan,n o r m = n a n
.long smod_dnan | 1 1 , 0 1 nan,z e r o = n a n
.long smod_dnan | 1 1 , 1 0 nan,i n f = n a n
.long smod_dnan | 1 1 , 1 1 nan,n a n = n a n
.global pmod
pmod :
clrb F P S R _ Q B Y T E ( % a6 ) | c l e a r q u o t i e n t f i e l d
bfextu S T A G ( % a6 ) { #0 : #3 } ,% d0 | s t a g = d0
bfextu D T A G ( % a6 ) { #0 : #3 } ,% d1 | d t a g = d1
|
| Alias e x t e n d e d d e n o r m s t o n o r m s f o r t h e j u m p t a b l e .
|
bclrl #2 ,% d0
bclrl #2 ,% d1
lslb #2 ,% d1
orb % d0 ,% d1 | d1 { 3 : 2 } = d t a g , d1 { 1 : 0 } = s t a g
| ;Tag values:
| ;00 = norm or denorm
| ;01 = zero
| ;10 = inf
| ;11 = nan
lea p m o d t ,% a1
movel ( % a1 ,% d1 . w * 4 ) ,% a1
jmp ( % a1 )
smod_snan :
bra s r c _ n a n
smod_dnan :
bra d s t _ n a n
smod_oper :
bra t _ o p e r r
smod_zro :
moveb E T E M P ( % a6 ) ,% d1 | g e t s i g n o f s r c o p
moveb F P T E M P ( % a6 ) ,% d0 | g e t s i g n o f d s t o p
eorb % d0 ,% d1 | g e t e x o r o f s i g n b i t s
btstl #7 ,% d1 | t e s t f o r s i g n
beqs s m o d _ z s n | i f c l r , d o n o t s e t s i g n b i g
bsetb #q _ s n _ b i t , F P S R _ Q B Y T E ( % a 6 ) | s e t q - b y t e s i g n b i t
smod_zsn :
btstl #7 ,% d0 | t e s t i f + o r -
beq l d _ p z e r o | i f p o s t h e n l o a d + 0
bra l d _ m z e r o | e l s e n e g l o a d - 0
smod_fpn :
moveb E T E M P ( % a6 ) ,% d1 | g e t s i g n o f s r c o p
moveb F P T E M P ( % a6 ) ,% d0 | g e t s i g n o f d s t o p
eorb % d0 ,% d1 | g e t e x o r o f s i g n b i t s
btstl #7 ,% d1 | t e s t f o r s i g n
beqs s m o d _ f s n | i f c l r , d o n o t s e t s i g n b i g
bsetb #q _ s n _ b i t , F P S R _ Q B Y T E ( % a 6 ) | s e t q - b y t e s i g n b i t
smod_fsn :
tstb D T A G ( % a6 ) | f i l t e r o u t d e n o r m a l d e s t i n a t i o n c a s e
bpls s m o d _ n r m |
leal F P T E M P ( % a6 ) ,% a0 | a0 < - a d d r ( F P T E M P )
bra t _ r e s d n r m | f o r c e U N F L ( b u t e x a c t ) r e s u l t
smod_nrm :
fmovel U S E R _ F P C R ( % a6 ) ,% f p c r | u s e u s e r ' s r m o d e a n d p r e c i s i o n
fmovex F P T E M P ( % a6 ) ,% f p0 | r e t u r n d e s t t o f p0
rts
|
| FREM
|
premt :
| ;$25 frem
| ;dtag,stag
.long srem | 0 0 , 0 0 norm,n o r m = n o r m a l
.long srem_oper | 0 0 , 0 1 norm,z e r o = n a n w i t h o p e r r
.long srem_fpn | 0 0 , 1 0 norm,i n f = f p n
.long srem_snan | 0 0 , 1 1 norm,n a n = n a n
.long srem_zro | 0 1 , 0 0 zero,n o r m = + - z e r o
.long srem_oper | 0 1 , 0 1 zero,z e r o = n a n w i t h o p e r r
.long srem_zro | 0 1 , 1 0 zero,i n f = + - z e r o
.long srem_snan | 0 1 , 1 1 zero,n a n = n a n
.long srem_oper | 1 0 , 0 0 inf,n o r m = n a n w i t h o p e r r
.long srem_oper | 1 0 , 0 1 inf,z e r o = n a n w i t h o p e r r
.long srem_oper | 1 0 , 1 0 inf,i n f = n a n w i t h o p e r r
.long srem_snan | 1 0 , 1 1 inf,n a n = n a n
.long srem_dnan | 1 1 , 0 0 nan,n o r m = n a n
.long srem_dnan | 1 1 , 0 1 nan,z e r o = n a n
.long srem_dnan | 1 1 , 1 0 nan,i n f = n a n
.long srem_dnan | 1 1 , 1 1 nan,n a n = n a n
.global prem
prem :
clrb F P S R _ Q B Y T E ( % a6 ) | c l e a r q u o t i e n t f i e l d
bfextu S T A G ( % a6 ) { #0 : #3 } ,% d0 | s t a g = d0
bfextu D T A G ( % a6 ) { #0 : #3 } ,% d1 | d t a g = d1
|
| Alias e x t e n d e d d e n o r m s t o n o r m s f o r t h e j u m p t a b l e .
|
bclr #2 ,% d0
bclr #2 ,% d1
lslb #2 ,% d1
orb % d0 ,% d1 | d1 { 3 : 2 } = d t a g , d1 { 1 : 0 } = s t a g
| ;Tag values:
| ;00 = norm or denorm
| ;01 = zero
| ;10 = inf
| ;11 = nan
lea p r e m t ,% a1
movel ( % a1 ,% d1 . w * 4 ) ,% a1
jmp ( % a1 )
srem_snan :
bra s r c _ n a n
srem_dnan :
bra d s t _ n a n
srem_oper :
bra t _ o p e r r
srem_zro :
moveb E T E M P ( % a6 ) ,% d1 | g e t s i g n o f s r c o p
moveb F P T E M P ( % a6 ) ,% d0 | g e t s i g n o f d s t o p
eorb % d0 ,% d1 | g e t e x o r o f s i g n b i t s
btstl #7 ,% d1 | t e s t f o r s i g n
beqs s r e m _ z s n | i f c l r , d o n o t s e t s i g n b i g
bsetb #q _ s n _ b i t , F P S R _ Q B Y T E ( % a 6 ) | s e t q - b y t e s i g n b i t
srem_zsn :
btstl #7 ,% d0 | t e s t i f + o r -
beq l d _ p z e r o | i f p o s t h e n l o a d + 0
bra l d _ m z e r o | e l s e n e g l o a d - 0
srem_fpn :
moveb E T E M P ( % a6 ) ,% d1 | g e t s i g n o f s r c o p
moveb F P T E M P ( % a6 ) ,% d0 | g e t s i g n o f d s t o p
eorb % d0 ,% d1 | g e t e x o r o f s i g n b i t s
btstl #7 ,% d1 | t e s t f o r s i g n
beqs s r e m _ f s n | i f c l r , d o n o t s e t s i g n b i g
bsetb #q _ s n _ b i t , F P S R _ Q B Y T E ( % a 6 ) | s e t q - b y t e s i g n b i t
srem_fsn :
tstb D T A G ( % a6 ) | f i l t e r o u t d e n o r m a l d e s t i n a t i o n c a s e
bpls s r e m _ n r m |
leal F P T E M P ( % a6 ) ,% a0 | a0 < - a d d r ( F P T E M P )
bra t _ r e s d n r m | f o r c e U N F L ( b u t e x a c t ) r e s u l t
srem_nrm :
fmovel U S E R _ F P C R ( % a6 ) ,% f p c r | u s e u s e r ' s r m o d e a n d p r e c i s i o n
fmovex F P T E M P ( % a6 ) ,% f p0 | r e t u r n d e s t t o f p0
rts
|
| FSCALE
|
pscalet :
| ;$26 fscale
| ;dtag,stag
.long sscale | 0 0 , 0 0 norm,n o r m = r e s u l t
.long sscale | 0 0 , 0 1 norm,z e r o = f p n
.long scl_opr | 0 0 , 1 0 norm,i n f = n a n w i t h o p e r r
.long scl_snan | 0 0 , 1 1 norm,n a n = n a n
.long scl_zro | 0 1 , 0 0 zero,n o r m = + - z e r o
.long scl_zro | 0 1 , 0 1 zero,z e r o = + - z e r o
.long scl_opr | 0 1 , 1 0 zero,i n f = n a n w i t h o p e r r
.long scl_snan | 0 1 , 1 1 zero,n a n = n a n
.long scl_inf | 1 0 , 0 0 inf,n o r m = + - i n f
.long scl_inf | 1 0 , 0 1 inf,z e r o = + - i n f
.long scl_opr | 1 0 , 1 0 inf,i n f = n a n w i t h o p e r r
.long scl_snan | 1 0 , 1 1 inf,n a n = n a n
.long scl_dnan | 1 1 , 0 0 nan,n o r m = n a n
.long scl_dnan | 1 1 , 0 1 nan,z e r o = n a n
.long scl_dnan | 1 1 , 1 0 nan,i n f = n a n
.long scl_dnan | 1 1 , 1 1 nan,n a n = n a n
.global pscale
pscale :
bfextu S T A G ( % a6 ) { #0 : #3 } ,% d0 | s t a g i n d0
bfextu D T A G ( % a6 ) { #0 : #3 } ,% d1 | d t a g i n d1
bclrl #2 ,% d0 | a l i a s d e n o r m i n t o n o r m
bclrl #2 ,% d1 | a l i a s d e n o r m i n t o n o r m
lslb #2 ,% d1
orb % d0 ,% d1 | d1 { 4 : 2 } = d t a g , d1 { 1 : 0 } = s t a g
| ;dtag values stag values:
| ;000 = norm 00 = norm
| ;001 = zero 01 = zero
| ;010 = inf 10 = inf
| ;011 = nan 11 = nan
| ;100 = dnrm
|
|
leal p s c a l e t ,% a1 | l o a d s t a r t o f j u m p t a b l e
movel ( % a1 ,% d1 . w * 4 ) ,% a1 | l o a d a1 w i t h l a b e l d e p e n d i n g o n t a g
jmp ( % a1 ) | g o t o t h e r o u t i n e
scl_opr :
bra t _ o p e r r
scl_dnan :
bra d s t _ n a n
scl_zro :
btstb #s i g n _ b i t , F P T E M P _ E X ( % a 6 ) | t e s t i f + o r -
beq l d _ p z e r o | i f p o s t h e n l o a d + 0
bra l d _ m z e r o | i f n e g t h e n l o a d - 0
scl_inf :
btstb #s i g n _ b i t , F P T E M P _ E X ( % a 6 ) | t e s t i f + o r -
beq l d _ p i n f | i f p o s t h e n l o a d + i n f
bra l d _ m i n f | e l s e n e g l o a d - i n f
scl_snan :
bra s r c _ n a n
|
| FSINCOS
|
.global ssincosz
ssincosz :
btstb #s i g n _ b i t , E T E M P ( % a 6 ) | g e t s i g n
beqs s i n c o s p
fmovex M Z E R O ,% f p0
bras s i n c o s c o m
sincosp :
fmovex P Z E R O ,% f p0
sincoscom :
fmovemx P O N E ,% f p1 - % f p1 | d o n o t a l l o w F P S R t o b e a f f e c t e d
bra s t o _ c o s | s t o r e c o s i n e r e s u l t
.global ssincosi
ssincosi :
fmovex Q N A N ,% f p1 | l o a d N A N
bsr s t o _ c o s | s t o r e c o s i n e r e s u l t
fmovex Q N A N ,% f p0 | l o a d N A N
bra t _ o p e r r
.global ssincosnan
ssincosnan :
movel E T E M P _ E X ( % a6 ) ,F P _ S C R 1 ( % a6 )
movel E T E M P _ H I ( % a6 ) ,F P _ S C R 1 + 4 ( % a6 )
movel E T E M P _ L O ( % a6 ) ,F P _ S C R 1 + 8 ( % a6 )
bsetb #s i g n a n _ b i t , F P _ S C R 1 + 4 ( % a6 )
fmovemx F P _ S C R 1 ( % a6 ) ,% f p1 - % f p1
bsr s t o _ c o s
bra s r c _ n a n
|
| This c o d e f o r c e s d e f a u l t v a l u e s f o r t h e z e r o , i n f , a n d n a n c a s e s
| in t h e t r a n s c e n d e n t a l s c o d e . T h e C C b i t s m u s t b e s e t i n t h e
| stacked F P S R t o b e c o r r e c t l y r e p o r t e d .
|
| * * Returns + P I / 2
.global ld_ppi2
ld_ppi2 :
fmovex P P I B Y 2 ,% f p0 | l o a d + p i / 2
bra t _ i n x2 | s e t i n e x2 e x c
| * * Returns - P I / 2
.global ld_mpi2
ld_mpi2 :
fmovex M P I B Y 2 ,% f p0 | l o a d - p i / 2
orl #n e g _ m a s k , U S E R _ F P S R ( % a 6 ) | s e t N b i t
bra t _ i n x2 | s e t i n e x2 e x c
| * * Returns + i n f
.global ld_pinf
ld_pinf :
fmovex P I N F ,% f p0 | l o a d + i n f
orl #i n f _ m a s k , U S E R _ F P S R ( % a 6 ) | s e t I b i t
rts
| * * Returns - i n f
.global ld_minf
ld_minf :
fmovex M I N F ,% f p0 | l o a d - i n f
orl #n e g _ m a s k + i n f _ m a s k , U S E R _ F P S R ( % a 6 ) | s e t N a n d I b i t s
rts
| * * Returns + 1
.global ld_pone
ld_pone :
fmovex P O N E ,% f p0 | l o a d + 1
rts
| * * Returns - 1
.global ld_mone
ld_mone :
fmovex M O N E ,% f p0 | l o a d - 1
orl #n e g _ m a s k , U S E R _ F P S R ( % a 6 ) | s e t N b i t
rts
| * * Returns + 0
.global ld_pzero
ld_pzero :
fmovex P Z E R O ,% f p0 | l o a d + 0
orl #z _ m a s k , U S E R _ F P S R ( % a 6 ) | s e t Z b i t
rts
| * * Returns - 0
.global ld_mzero
ld_mzero :
fmovex M Z E R O ,% f p0 | l o a d - 0
orl #n e g _ m a s k + z _ m a s k , U S E R _ F P S R ( % a 6 ) | s e t N a n d Z b i t s
rts
| end