This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: float to int conversions
On Wed, Feb 26, 2003 at 02:09:09PM -0800, Richard Henderson wrote:
> On Wed, Feb 26, 2003 at 11:02:57PM +1030, Alan Modra wrote:
> > This is an update of http://gcc.gnu.org/ml/gcc-patches/2002-11/msg00195.html
> > for gcc-3.3 and mainline. It makes powerpc gcc follow the Java
> > conventions for floating point to integer conversions of NANs and
> > values that overflow.
>
> Why do you want this? Particularly unconditionally!
I've seen two independent internal IBM bug reports related to this,
one involving a java certification kit.
> Seems to me that you're slowing down Fortran, C and C++
> for no particular reason.
Yes, I don't have a strong argument for this patch except in the case
of Java, and I don't care much what happens with NANs. However, that
may change when/if the next IEEE754 revision is released, which is
likely to be more explicit in the treatment of float->int conversions.
It seems that people used to working with floating point, and
particularly people who have worked with IBM compilers, expect
float->int conversions to peg at the min/max values. Which is of
course what the underlying machine instructions do on powerpc, and
probably on most architectures.
Should I look at implementing target hooks, so that this patch can be
made Java specific? That way we could enable FLOAT_FIX_NANS_TO_ZERO
and FLOAT_FIX_BOUND_OVERFLOW for Java, and C, C++ and Fortran would
just get FLOAT_FIX_BOUND_OVERFLOW, resulting in minimal overhead.
--
Alan Modra
IBM OzLabs - Linux Technology Centre