This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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: Fix powerpc32 llrint, llrintf bad exceptions (bug 16422) [committed]


On Tue, 2015-10-13 at 00:53 +0000, Joseph Myers wrote:
> The versions of llrint and llrintf for older powerpc32 processors
> convert the results of __rint / __rintf to long long int, resulting in
> spurious exceptions from such casts in certain cases.  This patch
> makes glibc work around the problems with the libgcc conversions when
> the compiler used to build glibc doesn't use the fctidz instruction
> for them.
> 
> Tested for powerpc.  Committed.

Thanks Joseph for looking at this.

This look correct as is, but I wonder if we find a way to avoid both the
__rint/__rintf call and the fctidz (trunc & concert) in the normal path.

The __rint implementations requires a -fPIC GOT address set up just to
load a single constant. This is unfortunate as the calling function
(llrint/llrintf) will have just done that.

Also the fctid instruction will do the llrint function in one
instruction and records NAN, overflow, as special values in the result
and inexact in the FPSRC and CR1 (record form).

The primary reason it was not used here was that early 32-bit PPC32
processors did not implement fctid.

As Joseph has gone to the trouble to provide the configure check for
HAVE_PPC_FCFID it seems like shame not to take advantage of it.

Tulio we should look at this again when we have time.



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