This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Implementing real*16 in Fortran
- From: Erik Schnetter <schnetter at uni-tuebingen dot de>
- To: gcc at gcc dot gnu dot org
- Date: Sun, 3 Aug 2003 13:17:19 +0200
- Subject: Implementing real*16 in Fortran
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I want to implement real*16 in Fortran. For that I seem to need two
things:
(1) For run time libraries, I need a corresponding C type. I think the
best thing would be to use long double for that, but it has to have a
sizeof of 16. On i386, the option -m128bit-long-double does just this.
Is there a way to declare a type that does not need this option? I
tried
typedef long double __attribute__((aligned(16)) real16;
but this did not work; the size is still 12. (Such a mechanism would
also be very useful to interface between C and Fortran in general.)
(2) In the front end, I have to declare such a type to the middle end.
The Fortran front end uses currently
#define PUSH_TYPE(name, node) \
pushdecl (build_decl (TYPE_DECL, get_identifier (name), node))
gfc_real16_type_node = long_double_type_node;
PUSH_TYPE ("real16", gfc_real16_type_node);
but this does not make sure that the size is 16 bytes. The C front end
has the equivalent of
gfc_real16_type_node = make_node (REAL_TYPE);
TYPE_PRECISION (long_double_type_node) = 128;
layout_type (gfc_real16_type_node);
PUSH_TYPE ("real16", gfc_real16_type_node);
but can it really be that easy? Where is the association between the
constant "128" and the corresponding long double assembler statements
made? i386.{c,h,md} still think that a long double has 96 bits.
- -erik
- --
Erik Schnetter <schnetter@uni-tuebingen.de>
Web: http://www.tat.physik.uni-tuebingen.de/~schnette/
My email is as private as my paper mail. I therefore support encrypting
and signing email messages. Get my PGP key from www.keyserver.net.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
iD8DBQE/LO9Em3uiSwno3f0RAjTOAKCr9sKzXVgJU/s+NR2qUrVs9BAP7gCeP+Ct
qnhnJiYso9O6jShvWEy+KQ4=
=o/jM
-----END PGP SIGNATURE-----