This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] builtin fadd variants implementation
- From: Tejas Joshi <tejasjoshi9673 at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: joseph at codesourcery dot com, Martin Jambor <mjambor at suse dot cz>
- Date: Mon, 9 Sep 2019 21:42:54 +0530
- Subject: Re: [PATCH] builtin fadd variants implementation
- References: <CACMrGjA_V1D9UJ=Ldy+HfkCub3Tw6rdFAVr0nuxvtu6aLGZgYA@mail.gmail.com> <alpine.DEB.2.21.1908211634430.19918@digraph.polyomino.org.uk> <CACMrGjCjsWpp9YCmN5W23sOT=+xMcLA8QbZbdvUz7zgoxsOChw@mail.gmail.com> <alpine.DEB.2.21.1908272239380.31674@digraph.polyomino.org.uk>
Hello.
I am using real_isfinite to check for overflow conditions. How should
I check for underflow? I have tried different ways but they
contradicted other cases to pass.
static bool
fold_const_narrow_binary (real_value *result, const real_value *arg0,
int icode, const real_value *arg1,
const real_format *format)
{
if (REAL_VALUE_ISSIGNALING_NAN (*arg0)
|| REAL_VALUE_ISSIGNALING_NAN (*arg1))
return false;
real_arithmetic (result, icode, arg0, arg1);
if (!exact_real_truncate (format, result)
&& (flag_rounding_math || flag_trapping_math))
return false;
real_convert (result, format, result);
/* Overflow condition. */
if (!real_isfinite (result) && flag_errno_math)
return false;
if (REAL_VALUE_ISNAN (*result)
&& (flag_errno_math || flag_trapping_math))
return false;
return true;
}
Thanks,
Tejas