This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch, fortran] Fix NEAREST for float formats without infinity
- From: Janne Blomqvist <blomqvist dot janne at gmail dot com>
- To: Ulrich Weigand <uweigand at de dot ibm dot com>
- Cc: gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org
- Date: Thu, 26 Mar 2009 16:40:29 +0200
- Subject: Re: [patch, fortran] Fix NEAREST for float formats without infinity
- References: <200903252032.n2PKWjan025001@d12av02.megacenter.de.ibm.com>
On Wed, Mar 25, 2009 at 22:32, Ulrich Weigand <uweigand@de.ibm.com> wrote:
> Hello,
>
> gfc_conv_intrinsic_nearest currently uses the "__builtin_inf" family
> of intrinsics. ?This is a problem for platforms with floating-point
> formats that do not support infinity, like single-precision float
> on the SPU.
>
> In this situation, fold_builtin_inf will issue a warning "target
> format does not support infinity". ?This may be appropriate for
> explicit uses of the INFINITY macro in C code -- but in fact you
> also get the same warning today whenever you use NEAREST on a
> REAL (4) type in Fortran on the SPU; this seems quite confusing.
>
> I suggest to use __builtin_huge_val instead of __builtin_inf to
> implement NEAREST. ?The implementation of the two is completely
> equivalent -- except that __builtin_huge_val does not issue the
> warning. ?The following patch implements this change.
>
> Tested on spu-elf with no regressions. ?Fixes a number of test
> cases that failed due to the warning on NEAREST.
This looks ok. Thanks.
> OK for mainline?
Well, at the moment mainline is open only for regression and
documentation fixes, so no. But ok for fortran-dev, and merging back
to trunk once stage 1 opens.
--
Janne Blomqvist