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


On Jan 12, 2006, at 11:10 AM, Gabriel Dos Reis wrote:

Perry Smith <pedz@easesoftware.net> writes:

| Thanks Gaby...
|
| To recap, my current quest is to resolve references to symbols like
| __floatdidf. This is in a library for ppc64/soft-float.
|
| Ian pointed me to ppc64-fp.c. When I try to compile it, TFtype is
| undefined. It is suppose to get defined in fp-bit.h but only if
| __LDBL_MANT_DIG__ is set to 113 or 106. Right now, in the
| environment that I have now, ___LDBL_MANT_DIG__ is set to 53. In the
| RS/6000, long doubles are 106. (I'm not sure if "long double" is the
| right term to use here.)
|
| I am compiling with -maix64. It appears to me that some parts of gcc
| or libgcc assume that this implies long double but c-cppbuiltin.c
| appears to not make that assumption.



hmm, it looks to me that there is some communication mismatch between the target back-end and the front-end. From gcc/c-cppbuiltin.c:builtin_define_float_constants:

  fmt = REAL_MODE_FORMAT (TYPE_MODE (type));
  gcc_assert (fmt->b != 10);
  gcc_assert (fmt->b != 10);

  /* The radix of the exponent representation.  */
  if (type == float_type_node)
    builtin_define_with_int_value ("__FLT_RADIX__", fmt->b);
  log10_b = log10_2 * fmt->log2_b;

  /* The number of radix digits, p, in the floating-point
  significand.  */
  sprintf (name, "__%s_MANT_DIG__", name_prefix);
  builtin_define_with_int_value (name, fmt->p);


So, for some reasons, it looks like TYPE_MODE (long_double_type_node) does not have the information you would like it to report (106, instead of 53).

do I understand correctly that -maix64 is supposed to change the
layout for long double?

I think I went down the wrong path. Sorry.


First, -mlong-double-128 is used to get the larger floating point numbers. Second, the routines like __floattidf, I got confused. If you look at this as __float xx yy, I thought the xx part ("ti") was the long double. But its long long. (The df is for double -- tf would be for long double.)

So, now the libgcc2.h macros make sense. They are changing routines from regular sized long to long long.

So, at this point, it looks like I just need to make parts of ppc64- fp.c conditionally compiled. The routines that refer to TFtype should not be compiled in my case. What I plan to do is use TMODE (which is defined in fp-bits.h) to accomplish this. It is the same macro that governs if TFtype gets defined or not.

Thanks all...


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