Keith M Wesolowski <[EMAIL PROTECTED]> wrote:

> On Fri, Jul 15, 2005 at 01:39:13AM +0200, Joerg Schilling wrote:
>
> > It seems that there are two basic "reasons":
> > 
> > -   Sun CC as well as GNU CC heavily use built in functions
> >     for floating point support. Of course these builtins are 
> >     incompatible :-(
>
> Some of these are for C99 support, and gcc's are just plain missing.
> There was a header fix that recently went back that will allow these
> functions to work properly with either compiler's builtins.  Since
> they're built-in, there should be no need to provide these in libm.
>
> See 6285517 gcc 3.4.x/4.x c99 math intrinsics support needed
>
> Unfortunately all the good stuff is in the evaluation and suggested
> fix, which aren't available.  Alex Liu cleverly worked around gcc's
> inadequate C99 implementation and anything built with gcc against the
> new math.h should support all the required C99 functions.  Here's the
> data from that bug:
>
> Evaluation
>
> [zaliu 6/17/2005]
> gcc 3.4.3 has partial support for the C99 math intrinsics: none of the six
> classification macros (C99 7.12.3) are directly supported as built-ins.

You are describing the opposite (complementary) problem to the problem I have.
I have a GCC aware implementation from FreeBSD and I need to adopt it to Sun C.

> gcc 4.0.0 implements a type-generic built-in for isnan, along with
> inlined type-specific built-ins for float and double signbit i.e.
> __builtin_signbitf/__builtin_signbit, but no inlined __builtin_signbitl.
>
> In addition, gcc 3.4.x/4.0.0 defines many C99 math intrinsics differently from
> how Sun C defines them.  Specifically:
>
> #define       HUGE_VAL        (__builtin_huge_val())
> #define       HUGE_VALF       (__builtin_huge_valf())
> #define       HUGE_VALL       (__builtin_huge_vall())
> #define       INFINITY        (__builtin_inff())
> #define       NAN             (__builtin_nanf(""))
>
> #define       isgreater(x, y)         __builtin_isgreater(x, y)
> #define       isgreaterequal(x, y)    __builtin_isgreaterequal(x, y)
> #define       isless(x, y)            __builtin_isless(x, y)
> #define       islessequal(x, y)       __builtin_islessequal(x, y)
> #define       islessgreater(x, y)     __builtin_islessgreater(x, y)
> #define       isunordered(u, v)       __builtin_isunordered(u, v)
>
> See  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19933 for more details.

OK

> Suggested Fix
>
> [zaliu 6/17/2005]
> We decided against implementing any of the six classification macros with
> *new* math library entry points.  Instead, with the gcc extension __typeof
> along with *inlined* gcc built-ins __builtin_isunordered, __builtin_fabsf,
> __builtin_fabs, __builtin_fabsl, __FLT_MIN__, __DBL_MIN__ and __LDBL_MIN__,
> we implemented all six classification macros directly in <iso/math_c99.h>
> for gcc 3.4.x and 4.x:
>
> libm/inc/iso/math_c99.h: 1.9 vs. 1.10
> ***************
> *** 1,5 ****
>   /*
> !  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
>    * Use is subject to license terms.
>    */
>   
> --- 1,5 ----
>   /*
> !  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
>    * Use is subject to license terms.
>    */
>   
> ***************
> *** 23,29 ****
> --- 23,108 ----
>   #endif      /* !defined(__P) */
>   
>   #if defined(_STDC_C99) || _XOPEN_SOURCE - 0 >= 600 || 
> defined(__C99FEATURES__)

Unfortunately, this is a file that is not freely redistributable.

Sun's math implementation uses the following files:

  68414   16 -rw-r--r--   1 root     bin        16214 Nov 24  2004 
/usr/include/iso/math_c99.h
  68415    8 -rw-r--r--   1 root     bin         7734 Nov 24  2004 
/usr/include/iso/math_iso.h
  52985   10 -rw-r--r--   1 root     bin         9606 Nov 24  2004 
/usr/include/math.h
  52987    4 -rw-r--r--   1 root     bin         3466 Nov 24  2004 
/usr/include/tgmath.h
  52981    4 -rw-r--r--   1 root     bin         3829 Nov 24  2004 
/usr/include/complex.h
  68102    1 lrwxrwxrwx   1 root     root          10 Mar  3 14:48 
/usr/include/iso/float_iso.h -> ../float.h
  10261    4 -rw-r--r--   1 root     bin         3357 Jan 21 23:19 
/usr/include/float.h
  52983    6 -rw-r--r--   1 root     bin         6116 Nov 24  2004 
/usr/include/floatingpoint.h
  36585    2 -rw-r--r--   1 root     bin         1897 Nov 24  2004 
/usr/include/sys/ieeefp.h
  10272   10 -rw-r--r--   1 root     bin         9503 Jan 21 23:19 
/usr/include/ieeefp.h
  25170    6 -rw-r--r--   1 root     bin         5803 Jan 21 23:19 
/usr/include/sys/fp.h

The following files are not freely redistributable:

  68414   16 -rw-r--r--   1 root     bin        16214 Nov 24  2004 
/usr/include/iso/math_c99.h
  68415    8 -rw-r--r--   1 root     bin         7734 Nov 24  2004 
/usr/include/iso/math_iso.h
  52985   10 -rw-r--r--   1 root     bin         9606 Nov 24  2004 
/usr/include/math.h
  52987    4 -rw-r--r--   1 root     bin         3466 Nov 24  2004 
/usr/include/tgmath.h
  52981    4 -rw-r--r--   1 root     bin         3829 Nov 24  2004 
/usr/include/complex.h
  52983    6 -rw-r--r--   1 root     bin         6116 Nov 24  2004 
/usr/include/floatingpoint.h
  36585    2 -rw-r--r--   1 root     bin         1897 Nov 24  2004 
/usr/include/sys/ieeefp.h

Note that e.g.  /usr/include/floatingpoint.h is a file that belongs to libc

Jörg

-- 
 EMail:[EMAIL PROTECTED] (home) Jörg Schilling D-13353 Berlin
       [EMAIL PROTECTED]                (uni)  
       [EMAIL PROTECTED]        (work) Blog: http://schily.blogspot.com/
 URL:  http://cdrecord.berlios.de/old/private/ ftp://ftp.berlios.de/pub/schily
_______________________________________________
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org

Reply via email to