public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Implementing real*16 in Fortran
@ 2003-08-03 12:57 Erik Schnetter
  2003-08-03 20:35 ` Jakub Jelinek
  0 siblings, 1 reply; 3+ messages in thread
From: Erik Schnetter @ 2003-08-03 12:57 UTC (permalink / raw)
  To: gcc

-----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-----

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-08-03 20:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-03 12:57 Implementing real*16 in Fortran Erik Schnetter
2003-08-03 20:35 ` Jakub Jelinek
2003-08-03 21:30   ` Erik Schnetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).