This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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 Thu, Mar 26, 2009 at 03:54:50PM +0100, Ulrich Weigand wrote:
> Janne Blomqvist wrote:
> > 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. =A0This 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". =A0This 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. =A0The implementation of the two is completely
> > > equivalent -- except that __builtin_huge_val does not issue the
> > > warning. =A0The following patch implements this change.
> > >
> > > Tested on spu-elf with no regressions. =A0Fixes a number of test
> > > cases that failed due to the warning on NEAREST.
> > 
> > This looks ok.  Thanks.
> 
> Thanks for the review!
> 
> > > 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.
> 
> I guess you could consider this to be a regression: the in-line
> expansion via gfc_conv_intrinsic_nearest was newly introduced
> with GCC 4.4; for GCC 4.3, you'd always get a call to a libgfortran
> library routine.
> 
> This has the effect that using NEAREST on gfortran 4.3 for the SPU
> does *not* result in that warning, but with gfortran 4.4 it does.
> 

Ulrich,

Please commit the patch to trunk.

-- 
Steve


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