OpenCores
URL https://opencores.org/ocsvn/neorv32/neorv32/trunk

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [sw/] [example/] [floating_point_test/] [neorv32_zfinx_extension_intrinsics.h] - Diff between revs 71 and 74

Show entire file | Details | Blame | View Log

Rev 71 Rev 74
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);
}
}
 
 
 
 
/**********************************************************************//**
/**********************************************************************//**

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.