Is real(16) available on x86 platforms?

Steve Kargl sgk@troutmask.apl.washington.edu
Sun Jan 14 19:32:00 GMT 2007


On Sun, Jan 14, 2007 at 10:50:35AM -0600, Erik Schnetter wrote:
> On Jan 14, 2007, at 09:46:57, Steve Kargl wrote:
> 
> >On Sun, Jan 14, 2007 at 03:52:48PM +0100, Dominique Dhumieres wrote:
> >>Trying to use real kind 16 on x86_64-unknown-linux-gnu
> >>gfortran from gcc version 4.3.0 20061231, I get:
> >>
> >>Error: Invalid real kind 16
> >>
> >>Is real(16) available only on platforms not supporting
> >>real(10)?
> >
> >Your question is sort of wrong.  real(16) is available on
> >targets that support a 128-bit floating point type.  If
> >this FP is unavailable on the target, then real(16) is also
> >unavailable.  On these targets one sometimes fines an
> >80-bit FP type, so gfortran provides a real(10) (which I
> >believe is padded out to 16 bytes).
> 
> I think real(10) is "usually" padded to 12 bytes (on IA32 machines).   
> When the option -m128bit-long-double is given, it is padded to 16  
> bytes.  That means the kind number encodes the accuracy, not the  
> number of bytes.
> 

See the comments in trans-types.c.  It adds 6 bytes of padding.

      /* Only let float/double/long double go through because the fortran
	 library assumes these are the only floating point types.  */

      if (mode != TYPE_MODE (float_type_node)
	  && (mode != TYPE_MODE (double_type_node))
          && (mode != TYPE_MODE (long_double_type_node)))
	continue;

      /* Let the kind equal the precision divided by 8, rounding up.  Again,
	 this insulates the programmer from the underlying byte size.

	 Also, it effectively deals with IEEE extended formats.  There, the
	 total size of the type may equal 16, but it's got 6 bytes of padding
	 and the increased size can get in the way of a real IEEE quad format
	 which may also be supported by the target.

	 We round up so as to handle IA-64 __floatreg (RFmode), which is an
	 82 bit type.  Not to be confused with __float80 (XFmode), which is
	 an 80 bit type also supported by IA-64.  So XFmode should come out
	 to be kind=10, and RFmode should come out to be kind=11.  Egads.  */


-- 
Steve



More information about the Fortran mailing list