2005-04-17 02:20:36 +04:00
/*---------------------------------------------------------------------------+
| fpu_arith . c |
| |
| Code to implement the FPU register / register arithmetic instructions |
| |
| Copyright ( C ) 1992 , 1993 , 1997 |
| W . Metzenthen , 22 Parker St , Ormond , Vic 3163 , Australia |
| E - mail billm @ suburbia . net |
| |
| |
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
# include "fpu_system.h"
# include "fpu_emu.h"
# include "control_w.h"
# include "status_w.h"
void fadd__ ( void )
{
2008-01-30 15:30:11 +03:00
/* fadd st,st(i) */
int i = FPU_rm ;
clear_C1 ( ) ;
FPU_add ( & st ( i ) , FPU_gettagi ( i ) , 0 , control_word ) ;
2005-04-17 02:20:36 +04:00
}
void fmul__ ( void )
{
2008-01-30 15:30:11 +03:00
/* fmul st,st(i) */
int i = FPU_rm ;
clear_C1 ( ) ;
FPU_mul ( & st ( i ) , FPU_gettagi ( i ) , 0 , control_word ) ;
2005-04-17 02:20:36 +04:00
}
void fsub__ ( void )
{
2008-01-30 15:30:11 +03:00
/* fsub st,st(i) */
clear_C1 ( ) ;
FPU_sub ( 0 , FPU_rm , control_word ) ;
2005-04-17 02:20:36 +04:00
}
void fsubr_ ( void )
{
2008-01-30 15:30:11 +03:00
/* fsubr st,st(i) */
clear_C1 ( ) ;
FPU_sub ( REV , FPU_rm , control_word ) ;
2005-04-17 02:20:36 +04:00
}
void fdiv__ ( void )
{
2008-01-30 15:30:11 +03:00
/* fdiv st,st(i) */
clear_C1 ( ) ;
FPU_div ( 0 , FPU_rm , control_word ) ;
2005-04-17 02:20:36 +04:00
}
void fdivr_ ( void )
{
2008-01-30 15:30:11 +03:00
/* fdivr st,st(i) */
clear_C1 ( ) ;
FPU_div ( REV , FPU_rm , control_word ) ;
2005-04-17 02:20:36 +04:00
}
void fadd_i ( void )
{
2008-01-30 15:30:11 +03:00
/* fadd st(i),st */
int i = FPU_rm ;
clear_C1 ( ) ;
FPU_add ( & st ( i ) , FPU_gettagi ( i ) , i , control_word ) ;
2005-04-17 02:20:36 +04:00
}
void fmul_i ( void )
{
2008-01-30 15:30:11 +03:00
/* fmul st(i),st */
clear_C1 ( ) ;
FPU_mul ( & st ( 0 ) , FPU_gettag0 ( ) , FPU_rm , control_word ) ;
2005-04-17 02:20:36 +04:00
}
void fsubri ( void )
{
2008-01-30 15:30:11 +03:00
/* fsubr st(i),st */
clear_C1 ( ) ;
FPU_sub ( DEST_RM , FPU_rm , control_word ) ;
2005-04-17 02:20:36 +04:00
}
void fsub_i ( void )
{
2008-01-30 15:30:11 +03:00
/* fsub st(i),st */
clear_C1 ( ) ;
FPU_sub ( REV | DEST_RM , FPU_rm , control_word ) ;
2005-04-17 02:20:36 +04:00
}
void fdivri ( void )
{
2008-01-30 15:30:11 +03:00
/* fdivr st(i),st */
clear_C1 ( ) ;
FPU_div ( DEST_RM , FPU_rm , control_word ) ;
2005-04-17 02:20:36 +04:00
}
void fdiv_i ( void )
{
2008-01-30 15:30:11 +03:00
/* fdiv st(i),st */
clear_C1 ( ) ;
FPU_div ( REV | DEST_RM , FPU_rm , control_word ) ;
2005-04-17 02:20:36 +04:00
}
void faddp_ ( void )
{
2008-01-30 15:30:11 +03:00
/* faddp st(i),st */
int i = FPU_rm ;
clear_C1 ( ) ;
if ( FPU_add ( & st ( i ) , FPU_gettagi ( i ) , i , control_word ) > = 0 )
FPU_pop ( ) ;
2005-04-17 02:20:36 +04:00
}
void fmulp_ ( void )
{
2008-01-30 15:30:11 +03:00
/* fmulp st(i),st */
clear_C1 ( ) ;
if ( FPU_mul ( & st ( 0 ) , FPU_gettag0 ( ) , FPU_rm , control_word ) > = 0 )
FPU_pop ( ) ;
2005-04-17 02:20:36 +04:00
}
void fsubrp ( void )
{
2008-01-30 15:30:11 +03:00
/* fsubrp st(i),st */
clear_C1 ( ) ;
if ( FPU_sub ( DEST_RM , FPU_rm , control_word ) > = 0 )
FPU_pop ( ) ;
2005-04-17 02:20:36 +04:00
}
void fsubp_ ( void )
{
2008-01-30 15:30:11 +03:00
/* fsubp st(i),st */
clear_C1 ( ) ;
if ( FPU_sub ( REV | DEST_RM , FPU_rm , control_word ) > = 0 )
FPU_pop ( ) ;
2005-04-17 02:20:36 +04:00
}
void fdivrp ( void )
{
2008-01-30 15:30:11 +03:00
/* fdivrp st(i),st */
clear_C1 ( ) ;
if ( FPU_div ( DEST_RM , FPU_rm , control_word ) > = 0 )
FPU_pop ( ) ;
2005-04-17 02:20:36 +04:00
}
void fdivp_ ( void )
{
2008-01-30 15:30:11 +03:00
/* fdivp st(i),st */
clear_C1 ( ) ;
if ( FPU_div ( REV | DEST_RM , FPU_rm , control_word ) > = 0 )
FPU_pop ( ) ;
2005-04-17 02:20:36 +04:00
}