This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Fix powerpc32 llrint, llrintf bad exceptions (bug 16422) [committed]
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Steven Munroe <munroesj at linux dot vnet dot ibm dot com>
- Cc: Tulio Machado <tuliom at linux dot vnet dot ibm dot com>, <libc-alpha at sourceware dot org>
- Date: Tue, 13 Oct 2015 10:13:37 +0000
- Subject: Re: Fix powerpc32 llrint, llrintf bad exceptions (bug 16422) [committed]
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot DEB dot 2 dot 10 dot 1510130053350 dot 4306 at digraph dot polyomino dot org dot uk> <1444706718 dot 18824 dot 17 dot camel at oc7878010663>
On Mon, 12 Oct 2015, Steven Munroe wrote:
> 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.
If you configure --with-cpu=power4 then you get versions from
sysdeps/powerpc/powerpc32/power4/fpu which do just that using fctid. I
suppose the issues are:
(a) the GCC condition for TARGET_FCFID is quite complicated and may
include some cases for which use of the power4 sysdeps directories isn't
correct (because of other files there - I haven't checked);
(b) while we have a desired direction for building glibc to choose sysdeps
directories based on how the compiler behaves (see what
sysdeps/arm/preconfigure.ac does), preferring that over glibc --with-cpu=,
that hasn't been implemented for powerpc, so meaning that even if the
compiler was configured with a power4 or later default and so use of the
power4 sysdeps directories would be safe, glibc wouldn't use them without
its own --with-cpu= configure option;
(c) if both implementations were in C then it would be possible for the
default one to do
#if HAVE_PPC_FCTIDZ
# include <sysdeps/...../power4/fpu/s_llrint.c>
#else
/* Other implementation. */
#endif
but with one in C and one in assembler it's a bit more complicated, though
that could still be done with extra source files (but given (b) it's only
worthwhile if there are in fact cases where those implementations can be
used but not the whole power4 sysdeps directory).
--
Joseph S. Myers
joseph@codesourcery.com