|
|
|
@ -428,33 +428,6 @@ default_libc_feupdateenv_test (fenv_t *e, int ex) |
|
|
|
# define HAVE_RM_CTX 0 |
|
|
|
#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_feholdsetround_noex_ctx |
|
|
|
# define libc_feholdsetround_noex_ctx libc_feholdsetround_ctx |
|
|
|
# endif |
|
|
|
# ifndef libc_feholdsetround_noexf_ctx |
|
|
|
# define libc_feholdsetround_noexf_ctx libc_feholdsetroundf_ctx |
|
|
|
# endif |
|
|
|
# ifndef libc_feholdsetround_noexl_ctx |
|
|
|
# define libc_feholdsetround_noexl_ctx libc_feholdsetroundl_ctx |
|
|
|
# endif |
|
|
|
|
|
|
|
# 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 |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
/* Default implementation using standard fenv functions.
|
|
|
|
Avoid unnecessary rounding mode changes by first checking the |
|
|
|
@ -462,7 +435,7 @@ default_libc_feupdateenv_test (fenv_t *e, int ex) |
|
|
|
important for performance. */ |
|
|
|
|
|
|
|
static __always_inline void |
|
|
|
libc_feholdsetround_ctx (struct rm_ctx *ctx, int round) |
|
|
|
default_libc_feholdsetround_ctx (struct rm_ctx *ctx, int round) |
|
|
|
{ |
|
|
|
ctx->updated_status = false; |
|
|
|
|
|
|
|
@ -476,7 +449,7 @@ libc_feholdsetround_ctx (struct rm_ctx *ctx, int round) |
|
|
|
} |
|
|
|
|
|
|
|
static __always_inline void |
|
|
|
libc_feresetround_ctx (struct rm_ctx *ctx) |
|
|
|
default_libc_feresetround_ctx (struct rm_ctx *ctx) |
|
|
|
{ |
|
|
|
/* Restore the rounding mode if updated. */ |
|
|
|
if (__glibc_unlikely (ctx->updated_status)) |
|
|
|
@ -484,7 +457,7 @@ libc_feresetround_ctx (struct rm_ctx *ctx) |
|
|
|
} |
|
|
|
|
|
|
|
static __always_inline void |
|
|
|
libc_feholdsetround_noex_ctx (struct rm_ctx *ctx, int round) |
|
|
|
default_libc_feholdsetround_noex_ctx (struct rm_ctx *ctx, int round) |
|
|
|
{ |
|
|
|
/* Save exception flags and rounding mode, and disable exception
|
|
|
|
traps. */ |
|
|
|
@ -496,12 +469,45 @@ libc_feholdsetround_noex_ctx (struct rm_ctx *ctx, int round) |
|
|
|
} |
|
|
|
|
|
|
|
static __always_inline void |
|
|
|
libc_feresetround_noex_ctx (struct rm_ctx *ctx) |
|
|
|
default_libc_feresetround_noex_ctx (struct rm_ctx *ctx) |
|
|
|
{ |
|
|
|
/* Restore exception flags and rounding mode. */ |
|
|
|
__fesetenv (&ctx->env); |
|
|
|
} |
|
|
|
|
|
|
|
#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_feholdsetround_noex_ctx |
|
|
|
# define libc_feholdsetround_noex_ctx libc_feholdsetround_ctx |
|
|
|
# endif |
|
|
|
# ifndef libc_feholdsetround_noexf_ctx |
|
|
|
# define libc_feholdsetround_noexf_ctx libc_feholdsetroundf_ctx |
|
|
|
# endif |
|
|
|
# ifndef libc_feholdsetround_noexl_ctx |
|
|
|
# define libc_feholdsetround_noexl_ctx libc_feholdsetroundl_ctx |
|
|
|
# endif |
|
|
|
|
|
|
|
# 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 |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
# define libc_feholdsetround_ctx default_libc_feholdsetround_ctx |
|
|
|
# define libc_feresetround_ctx default_libc_feresetround_ctx |
|
|
|
# define libc_feholdsetround_noex_ctx default_libc_feholdsetround_noex_ctx |
|
|
|
# define libc_feresetround_noex_ctx default_libc_feresetround_noex_ctx |
|
|
|
|
|
|
|
# define libc_feholdsetroundf_ctx libc_feholdsetround_ctx |
|
|
|
# define libc_feholdsetroundl_ctx libc_feholdsetround_ctx |
|
|
|
# define libc_feresetroundf_ctx libc_feresetround_ctx |
|
|
|
|