OSDN Git Service

2000-07-20 Jakub Jelinek <jakub@redhat.com>
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 21 Jul 2000 01:01:00 +0000 (01:01 +0000)
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 21 Jul 2000 01:01:00 +0000 (01:01 +0000)
        * config/cpu/sparc/sparc64/bits/atomicity.h (__exchange_and_add):
        Use extended word instructions to match 64bit _Atomic_word.
        (__atomic_add): Likewise.
        * math/clog10l.c (clog10l): Use M_PIl if defined.
        * math/c_logl.c (c_logl): Likewise.
        * math/signbitl.c (__signbitl): Adapt for IEEE quad long doubles.
        * math/mathconf.h (ieee_quad_double_shape_type): New type.
        (GET_LDOUBLE_MSW64): New define.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35166 138bc75d-0d04-0410-961f-82ee72b054a4

libstdc++-v3/config/cpu/sparc/sparc64/bits/atomicity.h
libstdc++-v3/math/c_logl.c
libstdc++-v3/math/clog10l.c
libstdc++-v3/math/mathconf.h
libstdc++-v3/math/signbitl.c

index 80d0fc8..f32201a 100644 (file)
@@ -28,9 +28,9 @@ __exchange_and_add (volatile _Atomic_word *__mem, int __val)
 {
   _Atomic_word __tmp1, __tmp2;
 
-  __asm__ __volatile__("1:     lduw    [%2], %0\n\t"
+  __asm__ __volatile__("1:     ld    [%2], %0\n\t"
                       "        add     %0, %3, %1\n\t"
-                      "        cas     [%2], %0, %1\n\t"
+                      "        casx    [%2], %0, %1\n\t"
                       "        sub     %0, %1, %0\n\t"
                       "        brnz,pn %0, 1b\n\t"
                       "         nop"
@@ -46,9 +46,9 @@ __atomic_add (volatile _Atomic_word* __mem, int __val)
 {
   _Atomic_word __tmp1, __tmp2;
 
-  __asm__ __volatile__("1:     lduw    [%2], %0\n\t"
+  __asm__ __volatile__("1:     ld    [%2], %0\n\t"
                       "        add     %0, %3, %1\n\t"
-                      "        cas     [%2], %0, %1\n\t"
+                      "        casx    [%2], %0, %1\n\t"
                       "        sub     %0, %1, %0\n\t"
                       "        brnz,pn %0, 1b\n\t"
                       "         nop"
index e1d60cd..d4075f7 100644 (file)
    the GNU General Public License.  */
 
 
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
 #include <math.h>
 #include "mathconf.h"
+#ifndef M_PIl
+#define M_PIl M_PI
+#endif
 
 /* Thanks to SGI we have to trick here.  At least Irix 6.2 provides hypotl,
    but it has a wrong prototype.  Grrr.  */
@@ -44,7 +50,7 @@ c_logl (__complex__ long double x)
   if (x == 0.0)
     {
       /* Real and imaginary part are 0.0.  */
-      __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
+      __imag__ result = signbit (__real__ x) ? M_PIl : 0.0;
       __imag__ result = copysignl (__imag__ result, __imag__ x);
       /* Yes, the following line raises an exception.  */
       __real__ result = -1.0 / fabsl (__real__ x);
index e183862..9cec8f8 100644 (file)
    invalidate any other reasons why the executable file might be covered by
    the GNU General Public License.  */
 
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
 #include <math.h>
 #include "mathconf.h"
+#ifndef M_PIl
+#define M_PIl M_PI
+#endif
 
 /* Thanks to SGI we have to trick here.  At least Irix 6.2 provides hypotl,
    but it has a wrong prototype.  Grrr.  */
@@ -43,7 +49,7 @@ clog10l (__complex__ long double x)
   if (x == 0.0)
     {
       /* Real and imaginary part are 0.0.  */
-      __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
+      __imag__ result = signbit (__real__ x) ? M_PIl : 0.0;
       __imag__ result = copysignl (__imag__ result, __imag__ x);
       /* Yes, the following line raises an exception.  */
       __real__ result = -1.0 / fabsl (__real__ x);
index b3adff9..3f4503c 100644 (file)
@@ -69,6 +69,8 @@
 
 typedef unsigned int U_int32_t __attribute ((mode (SI)));
 typedef int Int32_t __attribute ((mode (SI)));
+typedef unsigned int U_int64_t __attribute ((mode (DI)));
+typedef int Uint64_t __attribute ((mode (DI)));
 
 #ifdef _GLIBCPP_HAVE_NAN_H
 # include <nan.h>
@@ -326,6 +328,44 @@ do {                                                            \
   (exp) = ge_u.parts.sign_exponent;                             \
 } while (0)
 
+#if BYTE_ORDER == BIG_ENDIAN
+typedef union
+{
+  long double value;
+  struct
+  {
+    U_int64_t msw;
+    U_int64_t lsw;
+  } parts64;
+  struct
+  {
+    U_int32_t w0, w1, w2, w3;
+  } parts32;
+} ieee_quad_double_shape_type;
+#endif
+#if BYTE_ORDER == LITTLE_ENDIAN
+typedef union
+{
+  long double value;
+  struct
+  {
+    U_int64_t lsw;
+    U_int64_t msw;
+  } parts64;
+  struct
+  {
+    U_int32_t w3, w2, w1, w0;
+  } parts32;
+} ieee_quad_double_shape_type;
+#endif
+/* Get most significant 64 bit int from a quad long double.  */
+#define GET_LDOUBLE_MSW64(msw,d)                               \
+do {                                                           \
+  ieee_quad_double_shape_type qw_u;                            \
+  qw_u.value = (d);                                            \
+  (ix0) = qw_u.parts64.msw;                                    \
+} while (0)
+        
 
 /* Replacement for non-existing float functions.  */
 #if !defined(_GLIBCPP_HAVE_FABSF) && !defined(_GLIBCPP_HAVE___BUILTIN_FABSF)
index 682d1d3..3516f07 100644 (file)
    invalidate any other reasons why the executable file might be covered by
    the GNU General Public License.  */
 
+#include <float.h>
 #include <math.h>
 #include "mathconf.h"
 
 int
 __signbitl (long double x)
 {
+#if LDBL_MANT_DIG == 113
+  Int64_t msw;
+
+  GET_LDOUBLE_MSW64 (msw, x);
+  return msw < 0;
+#else
   Int32_t e;
 
   GET_LDOUBLE_EXP (e, x);
   return e & 0x8000;
+#endif
 }