Hi Mohamed Abdelrahman
fadd and fdiv are CW system library functions, normally they are called when application executes floating orations.Thus the frequency of execution these functions depends on user applications. I don't think we have document about these functions.
What do you mean "loops in fadd and fdiv" ? For example, fdiv function is like this:
Is your question about the maximal execution time of this __fdiv(void) function?
_EXTERNC_ void __fdiv(void){
__asm{
SAVE_REGISTERS_TO_BE_USED_BY_FP_ROUTINES
JSR unpack_operands
#ifdef __HANDLE_SPECIAL_OPERATIONS__
BRSET D4, #NAN, return_Nan
BRSET D5, #NAN, return_Nan
BRSET D4, #INFINITY, left_inf
BRSET D5, #INFINITY, return_Zero
BRA check_for_zero_op
left_inf:
BRCLR D5, #INFINITY, second_op_not_inf
#ifdef __FP_EXCEPTIONS__
BSET.B exceptions, #EINVALID
#endif
BRA return_Nan
second_op_not_inf:
BRSET D5, #INFINITY, return_Nan
TBEQ D1, return_left_op
LD D0, left_op_unpacked
BTGL D0, #7
ST D0, left_op_unpacked
BRA return_left_op
check_for_zero_op:
#endif
BRSET D4, #ZERO, left_zero
BRCLR D5, #ZERO, compute_exponent
#ifdef __FP_EXCEPTIONS__
BSET.B exceptions, #EDIVZERO
#endif
JMP return_infinity
left_zero:
BRCLR D5, #ZERO, return_Zero
#ifdef __FP_EXCEPTIONS__
BSET.B exceptions, #EINVALID
#endif
BRA return_Nan
compute_exponent:
EOR D0, D1
SUB D2, D3
ADD D2, #127
LEA S, (-4,S)
CLR.L (0,SP)
LD D4, #31
CLR D5
INC D5
JSR normalize_subnormals
mantissa_division:
CMP D7, D6
BHI shift_mantissa
SUB D6, D7
LSL D6, D6, #1
BSET.L (0,SP), D4
DBPL D4, mantissa_division
BRA quotient
shift_mantissa:
LSL D6, D6, #1
DBPL D4, mantissa_division
quotient:
#ifdef __FP_ROUNDING__
TBEQ D6, END_CMP
SET_STICKY:
BSET.L (0,S), #5
END_CMP:
#endif
PUL D6
#ifdef __FP_EXCEPTIONS__
CMP D2, #1
BNE NO_UNDERFLOW
BRSET D6, #31, NO_UNDERFLOW
BIT D6, #0x000000E0
BEQ NO_UNDERFLOW
BSET.B exceptions, #EUNDERFLOW
BSET.B exceptions, #EINEXACT
NO_UNDERFLOW:
#endif
JMP normalize_mantissa
return_left_op:
JMP return_operand
return_right_op:
MOV.L right_op_unpacked, left_op_unpacked
JMP return_operand
return_Nan:
#ifdef __FP_EXCEPTIONS__
BRSET D4, #SNAN, IS_EINVALID2
BRSET D5, #SNAN, IS_EINVALID2
BRA NO_EINVALID2
IS_EINVALID2:
BSET.B exceptions, #EINVALID
NO_EINVALID2:
#endif
MOV.L #NAN_ENCODING, left_op_unpacked
JMP return_operand
return_Zero:
MOV.L #PLUS_ZERO_ENCODING, left_op_unpacked
EOR D0, D1
BFINS.L left_op_unpacked, D0, #1:31
JMP return_operand
}
}
Have a nice day,
Jun Zhang