summaryrefslogtreecommitdiff
path: root/libc/sysdeps/generic
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2013-06-15 17:37:04 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2013-06-15 17:37:04 +0000
commit3625809e03b7287e244a6a2563d5217426e88d5c (patch)
treefecf84cbf45a9412ad727953f17ad0e5ef804e9f /libc/sysdeps/generic
parent8548b3be8c48bf62bd4e20fb0ee958338b01bc6c (diff)
Merge changes between r23217 and r23296 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@23297 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/sysdeps/generic')
-rw-r--r--libc/sysdeps/generic/framestate.c2
-rw-r--r--libc/sysdeps/generic/math-tests.h36
-rw-r--r--libc/sysdeps/generic/math_private.h63
-rw-r--r--libc/sysdeps/generic/sigset-cvt-mask.h4
-rw-r--r--libc/sysdeps/generic/symbol-hacks.h7
5 files changed, 90 insertions, 22 deletions
diff --git a/libc/sysdeps/generic/framestate.c b/libc/sysdeps/generic/framestate.c
index b3a6fcabc..e224ab5e0 100644
--- a/libc/sysdeps/generic/framestate.c
+++ b/libc/sysdeps/generic/framestate.c
@@ -44,7 +44,7 @@ __frame_state_for (void *pc, struct frame_state *frame_state)
#ifndef __USING_SJLJ_EXCEPTIONS__
frame_state_for = fallback_frame_state_for;
#else
- frame_state_for = abort;
+ frame_state_for = abort;
#endif
}
diff --git a/libc/sysdeps/generic/math-tests.h b/libc/sysdeps/generic/math-tests.h
index da8747a94..89b2260d0 100644
--- a/libc/sysdeps/generic/math-tests.h
+++ b/libc/sysdeps/generic/math-tests.h
@@ -40,3 +40,39 @@
#ifndef SNAN_TESTS_TYPE_CAST
# define SNAN_TESTS_TYPE_CAST 1
#endif
+
+/* Indicate whether to run tests involving a given rounding mode for a
+ given floating-point type, given that fesetround succeeds for that
+ mode. All are run if fesetround succeeds unless overridden. */
+#ifndef ROUNDING_TESTS_float
+# define ROUNDING_TESTS_float(MODE) 1
+#endif
+#ifndef ROUNDING_TESTS_double
+# define ROUNDING_TESTS_double(MODE) 1
+#endif
+#ifndef ROUNDING_TESTS_long_double
+# define ROUNDING_TESTS_long_double(MODE) 1
+#endif
+
+#define ROUNDING_TESTS(TYPE, MODE) \
+ (sizeof (TYPE) == sizeof (float) ? ROUNDING_TESTS_float (MODE) \
+ : sizeof (TYPE) == sizeof (double) ? ROUNDING_TESTS_double (MODE) \
+ : ROUNDING_TESTS_long_double (MODE))
+
+/* Indicate whether to run tests of floating-point exceptions for a
+ given floating-point type, given that the exception macros are
+ defined. All are run unless overridden. */
+#ifndef EXCEPTION_TESTS_float
+# define EXCEPTION_TESTS_float 1
+#endif
+#ifndef EXCEPTION_TESTS_double
+# define EXCEPTION_TESTS_double 1
+#endif
+#ifndef EXCEPTION_TESTS_long_double
+# define EXCEPTION_TESTS_long_double 1
+#endif
+
+#define EXCEPTION_TESTS(TYPE) \
+ (sizeof (TYPE) == sizeof (float) ? EXCEPTION_TESTS_float \
+ : sizeof (TYPE) == sizeof (double) ? EXCEPTION_TESTS_double \
+ : EXCEPTION_TESTS_long_double)
diff --git a/libc/sysdeps/generic/math_private.h b/libc/sysdeps/generic/math_private.h
index 9d6ecade6..c0fc03d38 100644
--- a/libc/sysdeps/generic/math_private.h
+++ b/libc/sysdeps/generic/math_private.h
@@ -446,8 +446,8 @@ default_libc_feholdexcept_setround (fenv_t *e, int r)
# define libc_feholdexcept_setroundl default_libc_feholdexcept_setround
#endif
-#ifndef libc_feholdexcept_setround_53bit
-# define libc_feholdexcept_setround_53bit libc_feholdexcept_setround
+#ifndef libc_feholdsetround_53bit
+# define libc_feholdsetround_53bit libc_feholdsetround
#endif
#ifndef libc_fetestexcept
@@ -492,8 +492,8 @@ default_libc_feupdateenv (fenv_t *e)
# define libc_feupdateenvl default_libc_feupdateenv
#endif
-#ifndef libc_feupdateenv_53bit
-# define libc_feupdateenv_53bit libc_feupdateenv
+#ifndef libc_feresetround_53bit
+# define libc_feresetround_53bit libc_feresetround
#endif
static __always_inline int
@@ -553,35 +553,62 @@ default_libc_feupdateenv_test (fenv_t *e, int ex)
# define libc_feresetround_noexl libc_fesetenvl
#endif
+#if HAVE_RM_CTX
+/* Set/Restore Rounding Modes only when necessary. If defined, these functions
+ set/restore floating point state only if the state needed within the lexical
+ block is different from the current state. This saves a lot of time when
+ the floating point unit is much slower than the fixed point units. */
+
+# ifndef libc_feresetround_noex_ctx
+# define libc_feresetround_noex_ctx libc_fesetenv_ctx
+# endif
+# ifndef libc_feresetround_noexf_ctx
+# define libc_feresetround_noexf_ctx libc_fesetenvf_ctx
+# endif
+# ifndef libc_feresetround_noexl_ctx
+# define libc_feresetround_noexl_ctx libc_fesetenvl_ctx
+# endif
+
+# ifndef libc_feholdsetround_53bit_ctx
+# define libc_feholdsetround_53bit_ctx libc_feholdsetround_ctx
+# endif
+
+# ifndef libc_feresetround_53bit_ctx
+# define libc_feresetround_53bit_ctx libc_feresetround_ctx
+# endif
+
+# define SET_RESTORE_ROUND_GENERIC(RM,ROUNDFUNC,CLEANUPFUNC) \
+ struct rm_ctx ctx __attribute__((cleanup(CLEANUPFUNC ## _ctx))); \
+ ROUNDFUNC ## _ctx (&ctx, (RM))
+#else
+# define SET_RESTORE_ROUND_GENERIC(RM, ROUNDFUNC, CLEANUPFUNC) \
+ fenv_t __libc_save_rm __attribute__((cleanup(CLEANUPFUNC))); \
+ ROUNDFUNC (&__libc_save_rm, (RM))
+#endif
+
/* Save and restore the rounding mode within a lexical block. */
#define SET_RESTORE_ROUND(RM) \
- fenv_t __libc_save_rm __attribute__((cleanup(libc_feresetround))); \
- libc_feholdsetround (&__libc_save_rm, (RM))
+ SET_RESTORE_ROUND_GENERIC (RM, libc_feholdsetround, libc_feresetround)
#define SET_RESTORE_ROUNDF(RM) \
- fenv_t __libc_save_rm __attribute__((cleanup(libc_feresetroundf))); \
- libc_feholdsetroundf (&__libc_save_rm, (RM))
+ SET_RESTORE_ROUND_GENERIC (RM, libc_feholdsetroundf, libc_feresetroundf)
#define SET_RESTORE_ROUNDL(RM) \
- fenv_t __libc_save_rm __attribute__((cleanup(libc_feresetroundl))); \
- libc_feholdsetroundl (&__libc_save_rm, (RM))
+ SET_RESTORE_ROUND_GENERIC (RM, libc_feholdsetroundl, libc_feresetroundl)
/* Save and restore the rounding mode within a lexical block, and also
the set of exceptions raised within the block may be discarded. */
#define SET_RESTORE_ROUND_NOEX(RM) \
- fenv_t __libc_save_rm __attribute__((cleanup(libc_feresetround_noex))); \
- libc_feholdsetround (&__libc_save_rm, (RM))
+ SET_RESTORE_ROUND_GENERIC (RM, libc_feholdsetround, libc_feresetround_noex)
#define SET_RESTORE_ROUND_NOEXF(RM) \
- fenv_t __libc_save_rm __attribute__((cleanup(libc_feresetround_noexf))); \
- libc_feholdsetroundf (&__libc_save_rm, (RM))
+ SET_RESTORE_ROUND_GENERIC (RM, libc_feholdsetroundf, libc_feresetround_noexf)
#define SET_RESTORE_ROUND_NOEXL(RM) \
- fenv_t __libc_save_rm __attribute__((cleanup(libc_feresetround_noexl))); \
- libc_feholdsetroundl (&__libc_save_rm, (RM))
+ SET_RESTORE_ROUND_GENERIC (RM, libc_feholdsetroundl, libc_feresetround_noexl)
/* Like SET_RESTORE_ROUND, but also set rounding precision to 53 bits. */
#define SET_RESTORE_ROUND_53BIT(RM) \
- fenv_t __libc_save_rm __attribute__((cleanup(libc_feupdateenv_53bit))); \
- libc_feholdexcept_setround_53bit (&__libc_save_rm, (RM))
+ SET_RESTORE_ROUND_GENERIC (RM, libc_feholdsetround_53bit, \
+ libc_feresetround_53bit)
#define __nan(str) \
(__builtin_constant_p (str) && str[0] == '\0' ? NAN : __nan (str))
diff --git a/libc/sysdeps/generic/sigset-cvt-mask.h b/libc/sysdeps/generic/sigset-cvt-mask.h
index 91d1f8e5b..bc42bdc6f 100644
--- a/libc/sysdeps/generic/sigset-cvt-mask.h
+++ b/libc/sysdeps/generic/sigset-cvt-mask.h
@@ -29,7 +29,7 @@ sigset_set_old_mask (sigset_t *set, int mask)
*set = (unsigned int) mask;
else
{
- register unsigned int __sig;
+ unsigned int __sig;
if (__sigemptyset (set) < 0)
return -1;
@@ -52,7 +52,7 @@ sigset_get_old_mask (const sigset_t *set)
else
{
unsigned int mask = 0;
- register unsigned int sig;
+ unsigned int sig;
for (sig = 1; sig < NSIG && sig <= sizeof (mask) * 8; sig++)
if (__sigismember (set, sig))
diff --git a/libc/sysdeps/generic/symbol-hacks.h b/libc/sysdeps/generic/symbol-hacks.h
index bc7b4c444..9eaf014ff 100644
--- a/libc/sysdeps/generic/symbol-hacks.h
+++ b/libc/sysdeps/generic/symbol-hacks.h
@@ -1 +1,6 @@
-/* Fortunately nothing to do. */
+/* Some compiler optimizations may transform loops into memset/memmove
+ calls and without proper declaration it may generate PLT calls. */
+#if !defined __ASSEMBLER__ && !defined NOT_IN_libc && defined SHARED
+asm ("memmove = __GI_memmove");
+asm ("memset = __GI_memset");
+#endif