diff options
author | Palmer Dabbelt <palmer.dabbelt@eecs.berkeley.edu> | 2015-08-10 14:56:43 -0700 |
---|---|---|
committer | Palmer Dabbelt <palmer.dabbelt@eecs.berkeley.edu> | 2015-08-10 14:56:43 -0700 |
commit | e16d8fc5de759d01e16b9bf0c9f1adbfec3793b3 (patch) | |
tree | d65ad18fac7d010bfebbbd0ef8967d84f5b623bc /glibc | |
parent | fbdada0ac2373d0e604eeb273684bc9b158d2bf5 (diff) | |
download | riscv-gnu-toolchain-e16d8fc5de759d01e16b9bf0c9f1adbfec3793b3.zip riscv-gnu-toolchain-e16d8fc5de759d01e16b9bf0c9f1adbfec3793b3.tar.gz riscv-gnu-toolchain-e16d8fc5de759d01e16b9bf0c9f1adbfec3793b3.tar.bz2 |
Replace riscv/fpu/bits/mathinline.h with Tilera's version
As per but #73, this was causing some compile failures related to
nothrow when using C++ and pedantic. The actual fix is to wrap this
with "__NTH", but Tilera's version looks simpler because it just calls
a GCC builtin rather than providing a second implementation.
I tried removing this file, but then I don't get inlined versions of
these calls.
Diffstat (limited to 'glibc')
-rw-r--r-- | glibc/sysdeps/riscv/fpu/bits/mathinline.h | 64 |
1 files changed, 18 insertions, 46 deletions
diff --git a/glibc/sysdeps/riscv/fpu/bits/mathinline.h b/glibc/sysdeps/riscv/fpu/bits/mathinline.h index db5985e..4b7a1f9 100644 --- a/glibc/sysdeps/riscv/fpu/bits/mathinline.h +++ b/glibc/sysdeps/riscv/fpu/bits/mathinline.h @@ -1,8 +1,6 @@ -/* Inline math functions for RISC-V. - Copyright (C) 2011 - Free Software Foundation, Inc. +/* Copyright (C) 2011-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Jakub Jelinek <jakub@redhat.com>. + Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -15,58 +13,32 @@ 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. */ + License along with the GNU C Library. If not, see + <http://www.gnu.org/licenses/>. */ #ifndef _MATH_H # error "Never use <bits/mathinline.h> directly; include <math.h> instead." #endif -#include <bits/wordsize.h> - -#ifdef __GNUC__ - -#if defined __USE_ISOC99 -# undef isgreater -# undef isgreaterequal -# undef isless -# undef islessequal -# undef islessgreater -# undef isunordered +#ifndef __extern_always_inline +# define __MATH_INLINE __inline +#else +# define __MATH_INLINE __extern_always_inline +#endif -# define isgreater(x, y) ((x) > (y)) -# define isgreaterequal(x, y) ((x) >= (y)) -# define isless(x, y) ((x) < (y)) -# define islessequal(x, y) ((x) <= (y)) -# define islessgreater(x, y) (!!(isless(x, y) + isgreater(x, y))) -# define isunordered(x, y) (((x) == (x)) + ((y) == (y)) < 2) -# ifndef __extern_inline -# define __MATH_INLINE __inline -# else -# define __MATH_INLINE __extern_inline -# endif /* __cplusplus */ +#if defined __USE_ISOC99 && defined __GNUC__ -__MATH_INLINE int __attribute_used__ __signbit (double __x) +/* Test for negative number. Used in the signbit() macro. */ +__MATH_INLINE int +__NTH (__signbitf (float __x)) { - union { double __d; long __i[sizeof(double)/sizeof(long)]; } __u; - __u.__d = __x; - return __u.__i[sizeof(double)/sizeof(long)-1] < 0; + return __builtin_signbitf (__x); } - -__MATH_INLINE int __attribute_used__ __signbitf (float __x) +__MATH_INLINE int +__NTH (__signbit (double __x)) { - union { float __d; int __i; } __u; - __u.__d = __x; - return __u.__i < 0; + return __builtin_signbit (__x); } -#endif /* __USE_ISOC99 */ - -#if (!defined __NO_MATH_INLINES || defined __LIBC_INTERNAL_MATH_INLINES) && defined __OPTIMIZE__ - -/* Nothing yet. */ - -#endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */ -#endif /* __GNUC__ */ +#endif |