[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patches] E500 port

I have added this E500 port to EGLIBC trunk and 2.5 branch (patches for 
both attached).  This is largely based on Aldy's old SPE add-on for glibc 
2.3 (available in CVS on savannah).

This port will be enabled if you use the ports add-on, configure for 
PowerPC with hardware floating point (do not use --without-fp) but the 
compiler used defines __NO_FPRS__.

This port supports both E500v1 and E500v2; the software floating point 
functions for double precision will be enabled if the compiler defines 
_SOFT_DOUBLE (part of the required GCC patches, see below).  There are no 
optimized .S functions directly using E500v2 double-precision floating 
point, although of course such could be added if desired; there are two 
such functions using E500v1 single-precision floating point and more could 
be added if desired.

Note that the results of the tests of mathematical functions are largely a 
mess since I don't have a kernel with the necessary trap handler support 
for IEEE arithmetic and while glibc mostly works with floating point 
without rounding modes and exceptions, it really doesn't like not having 
subnormals, NaN or infinities either.  This may be hiding real bugs in 
either the port or GCC; I'll look at the failures in due course to check 
for this, and hopefully in future will be able to test properly with a 
kernel with the necessary trap handlers.  At that point, it will make 
sense to add libm-test-ulps files; at present it doesn't make sense to do 

The ideal way of adding a port with a different sort of floating point 
would be to move the existing PowerPC fpu/ directories so that e500/fpu 
and 6xx/fpu exist in parallel, but such rearrangements would cause 
problems in merges from FSF glibc.  To minimise divergence, instead I made 
sure that e500/fpu overrides all files in powerpc/fpu and 
powerpc/powerpc32/fpu - except for a few headers.  In the case of the 
headers, it's desirable to be able to have a single set of headers shared 
between E500 and non-E500 multilibs, so I added appropriate conditionals 
to the headers instead.

In due course I intend to submit a slightly different version of this port 
to FSF glibc; that will have its own copies of the relevant headers, so 
the only changes needed to core glibc will be the _SOFT_FLOAT -> 
__NO_FPRS__ in two headers and the addition of __CONTEXT_EXTRA 
conditionals (which has been chosen to be more likely to be acceptable 
than putting the E500 code, appropriately conditioned, directly in the 
core libc files).

The implementation of the SPE PIM functions (string to fixed point 
conversions) here is not yet tested at all (beyond that it compiles), but 
in principle it should be cleaner and more accurate than that in the old 
SPE add-on (avoiding problems with double rounding).  I did find and 
report five bugs in glibc's strtod implementation in the course of 
adapting it for fixed-point (and fixed them in the copy used here).  I 
intend to add proper testcases for all the functions in all rounding modes 
and fix any problems found.

There are several requirements on the compiler to use this port:

* You need a compiler capable of building glibc, which means GCC 4.1 or 
4.2 branch.  4.3 can't be used until some form of
<http://sourceware.org/ml/libc-hacker/2006-11/msg00001.html> or an 
alternative thereto is accepted for FSF glibc; I'd rather not have EGLIBC 
diverge from FSF glibc in the approach for handling GCC 4.3's C99 inline 

* You need a compiler with working E500 support.  For 4.1 branch this 
means you need a lot of patches that have gone on that branch since 4.1.1 
was released, mostly PowerPC-specific but including some of mine that 
aren't.  For both 4.1 and 4.2 branches you also need my patch 
<http://gcc.gnu.org/ml/gcc-patches/2006-11/msg01700.html> which is only on 
trunk at present.

* You need a compiler with IBM long double support for E500.  This 
requires (a) the underlying soft-float long double support as attached to 
glibc bug 2749 (see <http://www.eglibc.org/prerequisites>) and (b) my 
patch on top of that to support IBM long double for E500.  This latter 
patch is presently only available for 4.1 as branches/csl/sourcerygxx-4_1 
revision 119585.  I'll prepare and test trunk and 4.2 versions in due 

Joseph S. Myers

Attachment: glibc-e500-2.5.bz2
Description: Binary data

Attachment: glibc-e500-trunk.bz2
Description: Binary data