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
This commit is contained in:
parent
538befca2c
commit
ba62473eba
@ -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"
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user