Line 84... |
Line 84... |
// ################################################################################################
|
// ################################################################################################
|
// Helper functions
|
// Helper functions
|
// ################################################################################################
|
// ################################################################################################
|
|
|
/**********************************************************************//**
|
/**********************************************************************//**
|
* Flush to zero if denormal number.
|
* Flush to zero if de-normal number.
|
*
|
*
|
* @warning Subnormal numbers are not supported yet! Flush them to zero.
|
* @warning Subnormal numbers are not supported yet! Flush them to zero.
|
*
|
*
|
* @param[in] tmp Source operand.
|
* @param[in] tmp Source operand.
|
* @return Result.
|
* @return Result.
|
**************************************************************************/
|
**************************************************************************/
|
float subnormal_flush(float tmp) {
|
float subnormal_flush(float tmp) {
|
|
|
float res = tmp;
|
float res = tmp;
|
|
|
|
// flush to zero if subnormal
|
if (fpclassify(tmp) == FP_SUBNORMAL) {
|
if (fpclassify(tmp) == FP_SUBNORMAL) {
|
if (signbit(tmp) != 0) {
|
if (signbit(tmp) != 0) {
|
res = -0.0f;
|
res = -0.0f;
|
}
|
}
|
else {
|
else {
|
Line 579... |
Line 580... |
|
|
float opa = subnormal_flush(rs1);
|
float opa = subnormal_flush(rs1);
|
float opb = subnormal_flush(rs2);
|
float opb = subnormal_flush(rs2);
|
|
|
float res = opa + opb;
|
float res = opa + opb;
|
|
|
|
// make NAN canonical
|
|
if (fpclassify(res) == FP_NAN) {
|
|
res = NAN;
|
|
}
|
|
|
return subnormal_flush(res);
|
return subnormal_flush(res);
|
}
|
}
|
|
|
|
|
/**********************************************************************//**
|
/**********************************************************************//**
|
Line 596... |
Line 603... |
|
|
float opa = subnormal_flush(rs1);
|
float opa = subnormal_flush(rs1);
|
float opb = subnormal_flush(rs2);
|
float opb = subnormal_flush(rs2);
|
|
|
float res = opa - opb;
|
float res = opa - opb;
|
|
|
|
// make NAN canonical
|
|
if (fpclassify(res) == FP_NAN) {
|
|
res = NAN;
|
|
}
|
|
|
return subnormal_flush(res);
|
return subnormal_flush(res);
|
}
|
}
|
|
|
|
|
/**********************************************************************//**
|
/**********************************************************************//**
|