This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH]: PR29335 use MPFR for builtins fma, fmin and fmax


On Fri, 10 Nov 2006, Richard Guenther wrote:

> > Right.  I wish MIN/MAX_EXPR were suitable for fmin/fmax replacements.
> > There are a lot of optimizations in the middle-end for these EXPRs that
> > I'd rather not duplicate in the builtins.  Instead I'd like to be able to
> > lower the builtins into these codes like we do for fabs->ABS_EXPR.  But
> > that would require work to change all the backends to honor the new
> > behaviors for -0.0 and/or NaN.
> >
> > Actually, I'm not sure if fmin/fmax care about -0.0, but I think they do
> > care about NaN vs a normal number.  Anyone got the standard handy?
>
> In the ISO/IEC 9899 appendix of the C99 standard it says
>
> 'If just one argument is NaN, the fmax functions return the other
> argument (if both
> arguments are NaNs, the functions return NaN).
> "Ideally, fmax would be sensitive to the sign of zero, for example
> fmax (-0.0, 0.0)
> would return 0; however, implementation in software might be impractical."

Thanks for checking.  So I guess if we have -ffinite-math-only set, which
presupposes no NaNs, we can in fact transform fmin/fmax into the EXPRs
(right?)

		--Kaveh
--
Kaveh R. Ghazi			ghazi@caip.rutgers.edu


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]