diff --git a/libstdc++-v3/config/cpu/sparc/sparc64/bits/atomicity.h b/libstdc++-v3/config/cpu/sparc/sparc64/bits/atomicity.h index 80d0fc861e8..f32201a7a07 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 e1d60cdaa1b..d4075f75992 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 #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 e183862ffcc..9cec8f88ffe 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 #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 b3adff957ab..3f4503cc162 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 @@ -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 682d1d30a3b..3516f07339a 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 #include #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 }