1 /*---------------------------------------------------------------------------+
4 | Implement a few FPU instructions. |
6 | Copyright (C) 1992,1993,1994 |
7 | W. Metzenthen, 22 Parker St, Ormond, Vic 3163, |
8 | Australia. E-mail billm@vaxc.cc.monash.edu.au |
11 +---------------------------------------------------------------------------*/
13 #include "fpu_system.h"
14 #include "exception.h"
17 #include "reg_constant.h"
20 static void fchs(void)
24 FPU_st0_ptr
->sign
^= SIGN_POS
^SIGN_NEG
;
31 static void fabs(void)
33 if ( FPU_st0_tag
^ TW_Empty
)
35 FPU_st0_ptr
->sign
= SIGN_POS
;
43 static void ftst_(void)
51 if (FPU_st0_ptr
->sign
== SIGN_POS
)
57 if ( (FPU_st0_ptr
->exp
<= EXP_UNDER
) && (denormal_operand()) )
61 if (FPU_st0_ptr
->sign
== SIGN_POS
)
70 setcc(SW_C0
|SW_C2
|SW_C3
); /* Operand is not comparable */
71 EXCEPTION(EX_Invalid
);
74 if (FPU_st0_ptr
->sign
== SIGN_POS
)
80 setcc(SW_C0
|SW_C2
|SW_C3
);
81 EXCEPTION(EX_StackUnder
);
84 setcc(SW_C0
|SW_C2
|SW_C3
); /* Operand is not comparable */
85 EXCEPTION(EX_INTERNAL
|0x14);
90 static void fxam(void)
102 /* This will need to be changed if TW_Denormal is ever used. */
103 if ( FPU_st0_ptr
->exp
<= EXP_UNDER
)
104 c
= SW_C2
|SW_C3
; /* Denormal */
115 if (FPU_st0_ptr
->sign
== SIGN_NEG
)
120 static FUNC
const fp_etc_table
[] = {
121 fchs
, fabs
, FPU_illegal
, FPU_illegal
, ftst_
, fxam
, FPU_illegal
, FPU_illegal
126 (fp_etc_table
[FPU_rm
])();