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]

Re: hpux 11.11 build


OK, not being a C/C++ guru myself, I have been having this same
problem, not only with gcc-3.0.1, but with any GNU project that
uses the libiberty/floatformat library.

Following the instructions posted by Michael Eager, here is the
cat of the floatformat.i output.  It means little to me, but perhaps
someone out there can enlighten those of us that have to put up
with HP-UX...

====BEGIN=====
# cat pic/floatformat.i
# 20 "../../../gcc-3.0.1/libiberty/floatformat.c"
# 1 "../../../gcc-3.0.1/include/floatformat.h" 1
# 23 "../../../gcc-3.0.1/include/floatformat.h"
# 1 "../../../gcc-3.0.1/include/ansidecl.h" 1
# 24 "../../../gcc-3.0.1/include/floatformat.h" 2
# 33 "../../../gcc-3.0.1/include/floatformat.h"
enum floatformat_byteorders {




  floatformat_little,




  floatformat_big,




  floatformat_littlebyte_bigword

};

enum floatformat_intbit { floatformat_intbit_yes, floatformat_intbit_no
};

struct floatformat
{
  enum floatformat_byteorders byteorder;
  unsigned int totalsize;


  unsigned int sign_start;

  unsigned int exp_start;
  unsigned int exp_len;

  unsigned int exp_bias;



  unsigned int exp_nan;

  unsigned int man_start;
  unsigned int man_len;


  enum floatformat_intbit intbit;


  const char *name;
};



extern const struct floatformat floatformat_ieee_single_big;
extern const struct floatformat floatformat_ieee_single_little;
extern const struct floatformat floatformat_ieee_double_big;
extern const struct floatformat floatformat_ieee_double_little;



extern const struct floatformat
floatformat_ieee_double_littlebyte_bigword;



extern const struct floatformat floatformat_i387_ext;
extern const struct floatformat floatformat_m68881_ext;
extern const struct floatformat floatformat_i960_ext;
extern const struct floatformat floatformat_m88110_ext;
extern const struct floatformat floatformat_arm_ext;





extern void
floatformat_to_double (const struct floatformat *, char *, double *);




extern void
floatformat_from_double (const struct floatformat *, double *, char *);
# 21 "../../../gcc-3.0.1/libiberty/floatformat.c" 2
# 1 "/usr/src/gcc-build/gcc/include/math.h" 1 3
# 14 "/usr/src/gcc-build/gcc/include/math.h" 3
# 1 "/usr/include/sys/stdsyms.h" 1 3
# 15 "/usr/src/gcc-build/gcc/include/math.h" 2 3
# 33 "/usr/src/gcc-build/gcc/include/math.h" 3
#pragma NO_SIDE_EFFECTS fabs
# 46 "/usr/src/gcc-build/gcc/include/math.h" 3
   extern double acos(double);
   extern double asin(double);
   extern double atan(double);
   extern double atan2(double, double);
   extern double cos(double);
   extern double sin(double);
   extern double tan(double);
   extern double cosh(double);
   extern double sinh(double);
   extern double tanh(double);
   extern double exp(double);
   extern double frexp(double, int *);
   extern double ldexp(double, int);
   extern double log(double);
   extern double log10(double);
   extern double modf(double, double *);
   extern double pow(double, double);
   extern double sqrt(double);
   extern double ceil(double);
   extern double fabs(double);
   extern double floor(double);
   extern double fmod(double, double);
# 116 "/usr/src/gcc-build/gcc/include/math.h" 3
   extern int signgam;


#pragma NO_SIDE_EFFECTS isnan







     extern double erf(double);
     extern double erfc(double);
     extern double gamma(double);
     extern double hypot(double, double);
     extern int isnan(double);
     extern double j0(double);
     extern double j1(double);
     extern double jn(int, double);
     extern double lgamma(double);
     extern double y0(double);
     extern double y1(double);
     extern double yn(int, double);
# 159 "/usr/src/gcc-build/gcc/include/math.h" 3
     extern double acosh(double);
     extern double asinh(double);
     extern double atanh(double);
     extern double cbrt(double);
     extern double expm1(double);
     extern int ilogb(double);
     extern double log1p(double);
     extern double logb(double);
     extern double nextafter(double, double);
     extern double remainder(double, double);
     extern double rint(double);
     extern double scalb(double,double);
# 194 "/usr/src/gcc-build/gcc/include/math.h" 3
     typedef float float_t;
     typedef double double_t;
# 232 "/usr/src/gcc-build/gcc/include/math.h" 3
#pragma NO_SIDE_EFFECTS copysign, copysignf, fabsf
#pragma NO_SIDE_EFFECTS _Fpclassify, _Fpclassifyf, _Fpclassifyfd
#pragma NO_SIDE_EFFECTS _Isunordered, _Isunorderedf
#pragma NO_SIDE_EFFECTS _Signbit, _Signbitf, _Isnanf, _Isinf, _Isinff
#pragma NO_SIDE_EFFECTS _Isfinite, _Isfinitef, _Isnormal, _Isnormalf,
_Isnormalf
d
# 247 "/usr/src/gcc-build/gcc/include/math.h" 3
     extern double copysign(double, double);
     extern double log2(double);
     extern double lgamma_r(double, int *);
     extern double exp2(double);
     extern double fdim(double, double);
     extern double fmax(double, double);
     extern double fmin(double, double);
     extern double nan(const char *);
     extern double scalbn(double, int);
     extern double nearbyint(double);
     extern double round(double);
     extern double trunc(double);
     extern double remquo(double, double, int *);
     extern long lrint(double);
     extern long lround(double);

       extern long long llrint(double);
       extern long long llround(double);

     extern double cosd(double);
     extern double sind(double);
     extern double tand(double);






     extern double acosd(double);
     extern double asind(double);
     extern double atand(double);
     extern double atan2d(double, double);

     extern float acosf(float);
     extern float asinf(float);
     extern float atanf(float);
     extern float atan2f(float, float);
     extern float cosf(float);
     extern float sinf(float);
     extern float tanf(float);
     extern float coshf(float);
     extern float sinhf(float);
     extern float tanhf(float);
     extern float expf(float);
     extern float logf(float);
     extern float log10f(float);
     extern float powf(float, float);
     extern float sqrtf(float);
     extern float fabsf(float);
     extern float fmodf(float, float);
     extern float cbrtf(float);
     extern float copysignf(float, float);
     extern float nextafterf(float, float);
     extern float log2f(float);
     extern float cosdf(float);
     extern float sindf(float);
     extern float tandf(float);
     extern float acosdf(float);
     extern float asindf(float);
     extern float atandf(float);
     extern float atan2df(float, float);
# 468 "/usr/src/gcc-build/gcc/include/math.h" 3
   extern const double _DINFINITY;
# 484 "/usr/src/gcc-build/gcc/include/math.h" 3
     extern const float _SINFINITY;
     extern const float _SQNAN;
     extern int _Islessgreater(double, double);
     extern int _Islessgreaterf(float, float);
# 531 "/usr/src/gcc-build/gcc/include/math.h" 3
       extern int _Signbit(double);
       extern int _Signbitf(float);
       extern int _Isnanf(float);
       extern int _Isfinite(double);
       extern int _Isfinitef(float);
       extern int _Isinf(double);
       extern int _Isinff(float);
       extern int _Isnormal(double);
       extern int _Isnormalf(float);
       extern int _Isunordered(double, double);
       extern int _Isunorderedf(float, float);
       extern int _Isless(double, double);
       extern int _Islessf(float, float);
       extern int _Islessequal(double, double);
       extern int _Islessequalf(float, float);
       extern int _Isgreater(double, double);
       extern int _Isgreaterf(float, float);
       extern int _Isgreaterequal(double, double);
       extern int _Isgreaterequalf(float, float);




       extern int _Fpclassify(double);
       extern int _Fpclassifyf(float);
# 22 "../../../gcc-3.0.1/libiberty/floatformat.c" 2

# 1 "/usr/src/gcc-build/gcc/include/stddef.h" 1 3
# 147 "/usr/src/gcc-build/gcc/include/stddef.h" 3
typedef long int ptrdiff_t;
# 287 "/usr/src/gcc-build/gcc/include/stddef.h" 3
typedef unsigned int wchar_t;
# 24 "../../../gcc-3.0.1/libiberty/floatformat.c" 2
extern void *memcpy (void *s1, const void *s2, size_t n);
extern void *memset (void *s, int c, size_t n);
# 37 "../../../gcc-3.0.1/libiberty/floatformat.c"
const struct floatformat floatformat_ieee_single_big =
{
  floatformat_big, 32, 0, 1, 8, 127, 255, 9, 23,
  floatformat_intbit_no,
  "floatformat_ieee_single_big"
};
const struct floatformat floatformat_ieee_single_little =
{
  floatformat_little, 32, 0, 1, 8, 127, 255, 9, 23,
  floatformat_intbit_no,
  "floatformat_ieee_single_little"
};
const struct floatformat floatformat_ieee_double_big =
{
  floatformat_big, 64, 0, 1, 11, 1023, 2047, 12, 52,
  floatformat_intbit_no,
  "floatformat_ieee_double_big"
};
const struct floatformat floatformat_ieee_double_little =
{
  floatformat_little, 64, 0, 1, 11, 1023, 2047, 12, 52,
  floatformat_intbit_no,
  "floatformat_ieee_double_little"
};




const struct floatformat floatformat_ieee_double_littlebyte_bigword =
{
  floatformat_littlebyte_bigword, 64, 0, 1, 11, 1023, 2047, 12, 52,
  floatformat_intbit_no,
  "floatformat_ieee_double_little"
};

const struct floatformat floatformat_i387_ext =
{
  floatformat_little, 80, 0, 1, 15, 0x3fff, 0x7fff, 16, 64,
  floatformat_intbit_yes,
  "floatformat_i387_ext"
};
const struct floatformat floatformat_m68881_ext =
{

  floatformat_big, 96, 0, 1, 15, 0x3fff, 0x7fff, 32, 64,
  floatformat_intbit_yes,
  "floatformat_m68881_ext"
};
const struct floatformat floatformat_i960_ext =
{

  floatformat_little, 96, 16, 17, 15, 0x3fff, 0x7fff, 32, 64,
  floatformat_intbit_yes,
  "floatformat_i960_ext"
};
const struct floatformat floatformat_m88110_ext =
{







  floatformat_big, 80, 0, 1, 15, 0x3fff, 0x7fff, 16, 64,
  floatformat_intbit_yes,
  "floatformat_m88110_ext"

};
const struct floatformat floatformat_arm_ext =
{

  floatformat_big, 96, 0, 17, 15, 0x3fff, 0x7fff, 32, 64,
  floatformat_intbit_yes,
  "floatformat_arm_ext"
};

static unsigned long get_field (unsigned char *, enum
floatformat_byteorders, un
signed int, unsigned int, unsigned int);







static unsigned long
get_field (data, order, total_len, start, len)
     unsigned char *data;
     enum floatformat_byteorders order;
     unsigned int total_len;
     unsigned int start;
     unsigned int len;
{
  unsigned long result;
  unsigned int cur_byte;
  int cur_bitshift;


  cur_byte = (start + len) / 8;
  if (order == floatformat_little)
    cur_byte = (total_len / 8) - cur_byte - 1;
  cur_bitshift =
    ((start + len) % 8) - 8;
  result = *(data + cur_byte) >> (-cur_bitshift);
  cur_bitshift += 8;
  if (order == floatformat_little)
    ++cur_byte;
  else
    --cur_byte;


  while ((unsigned int) cur_bitshift < len)
    {
      if (len - cur_bitshift < 8)


        result |=
          (*(data + cur_byte) & ((1 << (len - cur_bitshift)) - 1))
            << cur_bitshift;
      else
        result |= *(data + cur_byte) << cur_bitshift;
      cur_bitshift += 8;
      if (order == floatformat_little)
        ++cur_byte;
      else
        --cur_byte;
    }
  return result;
}
# 175 "../../../gcc-3.0.1/libiberty/floatformat.c"
void
floatformat_to_double (fmt, from, to)
     const struct floatformat *fmt;
     char *from;
     double *to;
{
  unsigned char *ufrom = (unsigned char *)from;
  double dto;
  long exponent;
  unsigned long mant;
  unsigned int mant_bits, mant_off;
  int mant_bits_left;
  int special_exponent;

  exponent = get_field (ufrom, fmt->byteorder, fmt->totalsize,
                        fmt->exp_start, fmt->exp_len);




  mant_bits_left = fmt->man_len;
  mant_off = fmt->man_start;
  dto = 0.0;

  special_exponent = exponent == 0 || (unsigned long) exponent ==
fmt->exp_nan;


  if (!special_exponent)
    exponent -= fmt->exp_bias;







  if (!special_exponent)
    {
      if (fmt->intbit == floatformat_intbit_no)
        dto = ldexp (1.0, exponent);
      else
        exponent++;
    }

  while (mant_bits_left > 0)
    {
      mant_bits = ((mant_bits_left) < (32) ? (mant_bits_left) : (32));

      mant = get_field (ufrom, fmt->byteorder, fmt->totalsize,
                         mant_off, mant_bits);

      dto += ldexp ((double)mant, exponent - mant_bits);
      exponent -= mant_bits;
      mant_off += mant_bits;
      mant_bits_left -= mant_bits;
    }


  if (get_field (ufrom, fmt->byteorder, fmt->totalsize, fmt->sign_start,
1))
    dto = -dto;
  *to = dto;
}

static void put_field (unsigned char *, enum floatformat_byteorders,
unsigned in
t, unsigned int, unsigned int, unsigned long);







static void
put_field (data, order, total_len, start, len, stuff_to_put)
     unsigned char *data;
     enum floatformat_byteorders order;
     unsigned int total_len;
     unsigned int start;
     unsigned int len;
     unsigned long stuff_to_put;
{
  unsigned int cur_byte;
  int cur_bitshift;


  cur_byte = (start + len) / 8;
  if (order == floatformat_little)
    cur_byte = (total_len / 8) - cur_byte - 1;
  cur_bitshift =
    ((start + len) % 8) - 8;
  *(data + cur_byte) &=
    ~(((1 << ((start + len) % 8)) - 1) << (-cur_bitshift));
  *(data + cur_byte) |=
    (stuff_to_put & ((1 << 8) - 1)) << (-cur_bitshift);
  cur_bitshift += 8;
  if (order == floatformat_little)
    ++cur_byte;
  else
    --cur_byte;


  while ((unsigned int) cur_bitshift < len)
    {
      if (len - cur_bitshift < 8)
        {

          *(data + cur_byte) &=
            ~((1 << (len - cur_bitshift)) - 1);
          *(data + cur_byte) |= (stuff_to_put >> cur_bitshift);
        }
      else
        *(data + cur_byte) = ((stuff_to_put >> cur_bitshift)
                              & ((1 << 8) - 1));
      cur_bitshift += 8;
      if (order == floatformat_little)
        ++cur_byte;
      else
        --cur_byte;
    }
}





void
floatformat_from_double (fmt, from, to)
     const struct floatformat *fmt;
     double *from;
     char *to;
{
  double dfrom;
  int exponent;
  double mant;
  unsigned int mant_bits, mant_off;
  int mant_bits_left;
  unsigned char *uto = (unsigned char *)to;

  memcpy (&dfrom, from, sizeof (dfrom));
  memset (uto, 0, fmt->totalsize / 8);
  if (dfrom == 0)
    return;
  if (dfrom != dfrom)
    {

      put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start,
                 fmt->exp_len, fmt->exp_nan);

      put_field (uto, fmt->byteorder, fmt->totalsize, fmt->man_start,
                 32, 1);
      return;
    }


  if (dfrom < 0)
    {
      put_field (uto, fmt->byteorder, fmt->totalsize, fmt->sign_start,
1, 1);
      dfrom = -dfrom;
    }



  mant = frexp (dfrom, &exponent);
  put_field (uto, fmt->byteorder, fmt->totalsize, fmt->exp_start,
fmt->exp_len,
             exponent + fmt->exp_bias - 1);

  mant_bits_left = fmt->man_len;
  mant_off = fmt->man_start;
  while (mant_bits_left > 0)
    {
      unsigned long mant_long;
      mant_bits = mant_bits_left < 32 ? mant_bits_left : 32;

      mant *= 4294967296.0;
      mant_long = (unsigned long)mant;
      mant -= mant_long;





      if ((unsigned int) mant_bits_left == fmt->man_len
          && fmt->intbit == floatformat_intbit_no)
        {
          mant_long &= 0x7fffffff;
          mant_bits -= 1;
        }
      else if (mant_bits < 32)
        {


          mant_long >>= 32 - mant_bits;
        }

      put_field (uto, fmt->byteorder, fmt->totalsize,
                 mant_off, mant_bits, mant_long);
      mant_off += mant_bits;
      mant_bits_left -= mant_bits;
    }
}
#
=====END=====

-- 
Ed Vázquez


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