[patch, libgfortran] Towards __float128 support
FX
fxcoudert@gmail.com
Fri Aug 27 15:54:00 GMT 2010
Hi all,
Here's a first patch to the library working towards __float128 support. It does need front-end support and is independent from the rest of the library work, and it's rather a lot of generated files, which is why I'd like it to go in separately than the rest. It allows
What it does is fix all math intrinsics in generated/ by modifying their source in m4/ [*], so that they can accept that sometimes real(kind=16) corresponds to long double, and sometimes it corresponds to __float128. Because this is decided at compilation time (and not m4-preprocessing time), we need m4 to build preprocessor macros, which do the right thing:
-- the m4 hasmathfunc() macro expands to the correct code for checking presence of a math function: hasmathfunc(exp) expands to "defined (EXPF)" if we're currently working on real(kind=4) code, and to "(defined(GFC_WITH_QUAD_LIB) || defined(HAVE_EXPL))" if we're working on real(kind=16) code.
-- the m4 mathfunc_macro() defines a CPP macro MATHFUNC, which returns the appropriate variant for the floating-point kind in use: MATHFUNC(exp) expands to "expf" if we're dealing with real(kind=4), and to either "expq" or "expl" if we're dealing with real(kind=16), depending on the presence of GFC_REAL_16_IS_FLOAT128
For now, because nothing defines GFC_WITH_QUAD_LIB or GFC_REAL_16_IS_FLOAT128, the compiled code is exactly the same.
Bootstrapped and regtested on x86_64-linux (both -m32 and -m64).
OK to commit?
FX
[*] I will not indulge here in saying how much I hate writing these m4 macros, because these mailing-lists have a strict 400 KB size limit. Let's just say it gives a good occasion to write strings that you usually do not create in daily programming, such as this beauty (from mathfunc_macro, mtype.m4): '```#'''```#'''` 'q))') Happy reviewing!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: library_m4.diff
Type: application/octet-stream
Size: 8342 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20100827/623bbda8/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: library_m4.ChangeLog
Type: application/octet-stream
Size: 1531 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20100827/623bbda8/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: library_generated.diff
Type: application/octet-stream
Size: 27179 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20100827/623bbda8/attachment-0002.obj>
More information about the Fortran
mailing list