mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-20 11:21:29 +03:00
2004-05-25 Steven Munroe <sjmunroe@us.ibm.com> * sysdeps/powerpc/fpu/Makefile: Make ld.so a dependency of libm.so. * sysdeps/powerpc/fpu/bits/mathinline.h [__LIBC_INERNAL_MATH_INLINES] (__ieee754_sqrt): Define as __MATH_INLINE using fsqrt instruction. (__ieee754_sqrtf): Define as __MATH_INLINE using fsqrts instruction. * sysdeps/powerpc/fpu/e_sqrt.c (__slow_ieee754_sqrt): Moved implementation from w_sqrt.c. * sysdeps/powerpc/fpu/e_sqrtf.c (__slow_ieee754_sqrtf): Moved implementation from w_sqrtf.c. * sysdeps/powerpc/fpu/w_sqrt.c (__sqrt): Wrapper implementation using inline __ieee754_sqrt(). * sysdeps/powerpc/fpu/w_sqrtf.c (__sqrtf): Wrapper implementation using inline __ieee754_sqrtf(). * sysdeps/powerpc/powerpc32/sysdep.h [__ASSEMBLER__]: Include <sysdeps/powerpc/sysdep.h> independent of __ASSEMBLER__. * sysdeps/powerpc/sysdep.h [__ASSEMBLER__] (PPC_FEATURE_*): Define PPC_FEATURE_* independent of __ASSEMBLER__. 2004-05-25 Jakub Jelinek <jakub@redhat.com> * sysdeps/pthread/aio_notify.c: Use <> instead of "" for aio_misc.h include. (aio_start_notify_thread): Define if not defined. (notify_func_wrapper): Use it. * sysdeps/pthread/aio_misc.c: Use <> instead of "" for aio_misc.h include. (aio_create_helper_thread): Define if not defined. (__aio_create_helper_thread): New function. (__aio_enqueue_request): Use aio_create_helper_thread. * nis/ypclnt.c (ypall_data, ypall_foreach): Remove. (struct ypresp_all_data): New type. (__xdr_ypresp_all): Change second argument to struct ypresp_all_data *. Replace ypall_foreach and ypall_data with objp->foreach and objp->data. (yp_all): Remove status variable, add data. Replace all uses of status with data.status. Initialize data.foreach and data.data instead of ypall_foreach and ypall_data. 2004-05-24 Jakub Jelinek <jakub@redhat.com> * elf/dl-lookup.c (add_dependency): Set DF_1_NODELETE bit in l_flags_1, not in l_flags.
177 lines
4.7 KiB
C
177 lines
4.7 KiB
C
/* Inline math functions for powerpc.
|
|
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2004
|
|
Free Software Foundation, Inc.
|
|
This file is part of the GNU C Library.
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with the GNU C Library; if not, write to the Free
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
02111-1307 USA. */
|
|
|
|
#ifndef _MATH_H
|
|
# error "Never use <bits/mathinline.h> directly; include <math.h> instead."
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
# define __MATH_INLINE __inline
|
|
#else
|
|
# define __MATH_INLINE extern __inline
|
|
#endif /* __cplusplus */
|
|
|
|
#if defined __GNUC__ && !defined _SOFT_FLOAT
|
|
|
|
#ifdef __USE_ISOC99
|
|
# if !__GNUC_PREREQ (2,97)
|
|
# define __unordered_cmp(x, y) \
|
|
(__extension__ \
|
|
({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
|
|
unsigned __r; \
|
|
__asm__("fcmpu 7,%1,%2 ; mfcr %0" : "=r" (__r) : "f" (__x), "f"(__y) \
|
|
: "cr7"); \
|
|
__r; }))
|
|
|
|
# undef isgreater
|
|
# undef isgreaterequal
|
|
# undef isless
|
|
# undef islessequal
|
|
# undef islessgreater
|
|
# undef isunordered
|
|
|
|
# define isgreater(x, y) (__unordered_cmp (x, y) >> 2 & 1)
|
|
# define isgreaterequal(x, y) ((__unordered_cmp (x, y) & 6) != 0)
|
|
# define isless(x, y) (__unordered_cmp (x, y) >> 3 & 1)
|
|
# define islessequal(x, y) ((__unordered_cmp (x, y) & 0xA) != 0)
|
|
# define islessgreater(x, y) ((__unordered_cmp (x, y) & 0xC) != 0)
|
|
# define isunordered(x, y) (__unordered_cmp (x, y) & 1)
|
|
|
|
# endif /* __GNUC_PREREQ (2,97) */
|
|
|
|
/* The gcc, version 2.7 or below, has problems with all this inlining
|
|
code. So disable it for this version of the compiler. */
|
|
# if __GNUC_PREREQ (2, 8)
|
|
/* Test for negative number. Used in the signbit() macro. */
|
|
__MATH_INLINE int
|
|
__signbitf (float __x) __THROW
|
|
{
|
|
__extension__ union { float __f; int __i; } __u = { __f: __x };
|
|
return __u.__i < 0;
|
|
}
|
|
__MATH_INLINE int
|
|
__signbit (double __x) __THROW
|
|
{
|
|
__extension__ union { double __d; int __i[2]; } __u = { __d: __x };
|
|
return __u.__i[0] < 0;
|
|
}
|
|
# endif
|
|
#endif /* __USE_ISOC99 */
|
|
|
|
#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__
|
|
|
|
#ifdef __USE_ISOC99
|
|
|
|
# ifndef __powerpc64__
|
|
__MATH_INLINE long int lrint (double __x) __THROW;
|
|
__MATH_INLINE long int
|
|
lrint (double __x) __THROW
|
|
{
|
|
union {
|
|
double __d;
|
|
int __ll[2];
|
|
} __u;
|
|
__asm__ ("fctiw %0,%1" : "=f"(__u.__d) : "f"(__x));
|
|
return __u.__ll[1];
|
|
}
|
|
|
|
__MATH_INLINE long int lrintf (float __x) __THROW;
|
|
__MATH_INLINE long int
|
|
lrintf (float __x) __THROW
|
|
{
|
|
union {
|
|
double __d;
|
|
int __ll[2];
|
|
} __u;
|
|
__asm__ ("fctiw %0,%1" : "=f"(__u.__d) : "f"(__x));
|
|
return __u.__ll[1];
|
|
}
|
|
# endif
|
|
|
|
__MATH_INLINE double fdim (double __x, double __y) __THROW;
|
|
__MATH_INLINE double
|
|
fdim (double __x, double __y) __THROW
|
|
{
|
|
return __x < __y ? 0 : __x - __y;
|
|
}
|
|
|
|
__MATH_INLINE float fdimf (float __x, float __y) __THROW;
|
|
__MATH_INLINE float
|
|
fdimf (float __x, float __y) __THROW
|
|
{
|
|
return __x < __y ? 0 : __x - __y;
|
|
}
|
|
|
|
#endif /* __USE_ISOC99 */
|
|
#endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */
|
|
|
|
/* This code is used internally in the GNU libc. */
|
|
# ifdef __LIBC_INTERNAL_MATH_INLINES
|
|
|
|
#include <sysdep.h>
|
|
#include <ldsodefs.h>
|
|
#include <dl-procinfo.h>
|
|
|
|
extern double __slow_ieee754_sqrt (double);
|
|
__MATH_INLINE double
|
|
__ieee754_sqrt (double __x)
|
|
{
|
|
double __z;
|
|
|
|
/* If the CPU is 64-bit we can use the optional FP instructions we. */
|
|
if ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0)
|
|
{
|
|
/* Volatile is required to prevent the compiler from moving the
|
|
fsqrt instruction above the branch. */
|
|
__asm __volatile (
|
|
" fsqrt %0,%1\n"
|
|
: "=f" (__z)
|
|
: "f" (__x));
|
|
}
|
|
else
|
|
__z = __slow_ieee754_sqrt(__x);
|
|
|
|
return __z;
|
|
}
|
|
|
|
extern float __slow_ieee754_sqrtf (float);
|
|
__MATH_INLINE float
|
|
__ieee754_sqrtf (float __x)
|
|
{
|
|
float __z;
|
|
|
|
/* If the CPU is 64-bit we can use the optional FP instructions we. */
|
|
if ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0)
|
|
{
|
|
/* Volatile is required to prevent the compiler from moving the
|
|
fsqrts instruction above the branch. */
|
|
__asm __volatile (
|
|
" fsqrts %0,%1\n"
|
|
: "=f" (__z)
|
|
: "f" (__x));
|
|
}
|
|
else
|
|
__z = __slow_ieee754_sqrtf(__x);
|
|
|
|
return __z;
|
|
}
|
|
# endif /* __LIBC_INTERNAL_MATH_INLINES */
|
|
#endif /* __GNUC__ && !_SOFT_FLOAT */
|