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, fortran] Fix NEAREST for float formats without infinity


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


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