This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: powerpc targets, long double implementation, and c++ programs


Joseph S. Myers wrote:

On Fri, 8 Sep 2006, Edmar Wienskoski wrote:



Ok. I am starting to see the whole picture now.
So the whole thing appears to work with --disable-shared, just because the way
the linker
loads symbols in presence of libgcc_s.so versus libgcc.a.

Follow up question:
The e500 abi actualy defines long double to be 128bits floats.
On rs6000.c, rs6000_init_libfuncs links to __gcc_qadd becasue of
TARGET_HARD_FLOAT
shouldn't that be TARGET_HARD_FLOAT && TARGET_FPRS
and also have:
diff -u t-fprules-softfp~ t-fprules-softfp
--- t-fprules-softfp~   2006-08-09 14:20:24.000000000 -0500
+++ t-fprules-softfp    2006-09-06 12:39:17.000000000 -0500
@@ -1,4 +1,4 @@
-softfp_float_modes := sf df
+softfp_float_modes := sf df tf
softfp_int_modes := si di
softfp_extensions := sfdf
softfp_truncations := dfsf

Would that be right ?



No.


(a) The existing GNU/Linux ABIs use or are intended to use IBM long double, not IEEE long double, and the E500 GNU/Linux ABI should be compatible with the other ABIs in this regard. The present formal ABI documents are not very relevant to the de facto GNU/Linux ABIs.


Well, actually this is part of the problem. We have only one document: the "e500 Sys V ABI",
which was intended to create only one ABI.


(b) To use IEEE long double with soft-fp you'll need to add sftf dftf to softfp_extensions and tfdf tfsf to softfp_truncations.


Humm.

(c) If using IEEE long double on PowerPC, you should be using the standard _q_* functions defined in the psABI, and not the __*tf* functions at all. glibc does provide the _q_* functions (albeit with a typo meaning _q_utoq is missing), though since they don't get built with -mabi=ieeelongdouble they aren't actually usable.


There are 2 issues here:
First, It is libgcc that is generating undefined references to __*tf* functions. If gcc can provide them with "softfp_float_modes := sf df tf", I think is reasonable to do that. For completeness sake you can do as you suggested: change softfp_extensions and softfp_truncations, but they are not absolutely necessary.

Second, is the long double ABI problem. In the past gcc always generated function calls to _q_* functions. (Per ABI Chapter 5)
For this code:
long double foo (long double x, long double y){ return x + y; }
gcc-4.0, target powerpc-eabise and
gcc-4.0, target powerpc-*-linux-gnuspe with -mlong-double-128 option
both generates a call to _q_add.
The same code with gcc-4.2, both targets generates a call to __gcc_qadd.

If there is an intention to change the E500 ABI, then somebody has to step forward and actually change the document (With all the administrative burden that cames with it..).

Edmar



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