aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2000-07-21 01:01:00 +0000
committerBenjamin Kosnik <bkoz@gcc.gnu.org>2000-07-21 01:01:00 +0000
commitba62473eba80f412d4da94ef82afa672c1d5f2c3 (patch)
tree3662d0e2d08da38c706006cfdb12c6c9cc79094c
parent538befca2c8bb81a347542366d7e99a0e7dcdff0 (diff)
downloadgcc-ba62473eba80f412d4da94ef82afa672c1d5f2c3.zip
gcc-ba62473eba80f412d4da94ef82afa672c1d5f2c3.tar.gz
gcc-ba62473eba80f412d4da94ef82afa672c1d5f2c3.tar.bz2
atomicity.h (__exchange_and_add): Use extended word instructions to match 64bit _Atomic_word.
2000-07-20 Jakub Jelinek <jakub@redhat.com> * 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. From-SVN: r35166
-rw-r--r--libstdc++-v3/config/cpu/sparc/sparc64/bits/atomicity.h8
-rw-r--r--libstdc++-v3/math/c_logl.c8
-rw-r--r--libstdc++-v3/math/clog10l.c8
-rw-r--r--libstdc++-v3/math/mathconf.h40
-rw-r--r--libstdc++-v3/math/signbitl.c8
5 files changed, 66 insertions, 6 deletions
diff --git a/libstdc++-v3/config/cpu/sparc/sparc64/bits/atomicity.h b/libstdc++-v3/config/cpu/sparc/sparc64/bits/atomicity.h
index 80d0fc8..f32201a 100644
--- a/libstdc++-v3/config/cpu/sparc/sparc64/bits/atomicity.h
+++ b/libstdc++-v3/config/cpu/sparc/sparc64/bits/atomicity.h
@@ -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: ldx [%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: ldx [%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"
diff --git a/libstdc++-v3/math/c_logl.c b/libstdc++-v3/math/c_logl.c
index e1d60cd..d4075f7 100644
--- a/libstdc++-v3/math/c_logl.c
+++ b/libstdc++-v3/math/c_logl.c
@@ -28,8 +28,14 @@
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);
diff --git a/libstdc++-v3/math/clog10l.c b/libstdc++-v3/math/clog10l.c
index e183862..9cec8f8 100644
--- a/libstdc++-v3/math/clog10l.c
+++ b/libstdc++-v3/math/clog10l.c
@@ -27,8 +27,14 @@
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);
diff --git a/libstdc++-v3/math/mathconf.h b/libstdc++-v3/math/mathconf.h
index b3adff9..3f4503c 100644
--- a/libstdc++-v3/math/mathconf.h
+++ b/libstdc++-v3/math/mathconf.h
@@ -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)
diff --git a/libstdc++-v3/math/signbitl.c b/libstdc++-v3/math/signbitl.c
index 682d1d3..3516f07 100644
--- a/libstdc++-v3/math/signbitl.c
+++ b/libstdc++-v3/math/signbitl.c
@@ -27,14 +27,22 @@
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
}