math: Add fetestexcept internal alias

To avoid linknamespace issues on old standards.  It is required
if the fallback fma implementation is used if/when it is also
used internally for other implementation.
Reviewed-by: DJ Delorie <dj@redhat.com>
This commit is contained in:
Adhemerval Zanella 2025-08-25 13:38:30 -03:00
parent 41c2f1d9a3
commit 63ba1a1509
21 changed files with 63 additions and 23 deletions

View File

@ -16,6 +16,7 @@ extern int __feupdateenv (const fenv_t *__envp);
extern __typeof (fegetround) __fegetround __attribute_pure__; extern __typeof (fegetround) __fegetround __attribute_pure__;
extern __typeof (feholdexcept) __feholdexcept; extern __typeof (feholdexcept) __feholdexcept;
extern __typeof (fesetround) __fesetround; extern __typeof (fesetround) __fesetround;
extern __typeof (fetestexcept) __fetestexcept;
libm_hidden_proto (feraiseexcept) libm_hidden_proto (feraiseexcept)
libm_hidden_proto (__feraiseexcept) libm_hidden_proto (__feraiseexcept)
@ -32,6 +33,7 @@ libm_hidden_proto (__feholdexcept)
libm_hidden_proto (feupdateenv) libm_hidden_proto (feupdateenv)
libm_hidden_proto (__feupdateenv) libm_hidden_proto (__feupdateenv)
libm_hidden_proto (fetestexcept) libm_hidden_proto (fetestexcept)
libm_hidden_proto (__fetestexcept)
libm_hidden_proto (feclearexcept) libm_hidden_proto (feclearexcept)
libm_hidden_proto (__feclearexcept) libm_hidden_proto (__feclearexcept)

View File

@ -19,9 +19,11 @@
#include <fenv.h> #include <fenv.h>
int int
fetestexcept (int excepts) __fetestexcept (int excepts)
{ {
return 0; return 0;
} }
libm_hidden_def (__fetestexcept)
weak_alias (__fetestexcept, fetestexcept)
libm_hidden_def (fetestexcept) libm_hidden_def (fetestexcept)
stub_warning (fetestexcept) stub_warning (fetestexcept)

View File

@ -20,8 +20,10 @@
#include <fenv_private.h> #include <fenv_private.h>
int int
fetestexcept (int excepts) __fetestexcept (int excepts)
{ {
return libc_fetestexcept_aarch64 (excepts); return libc_fetestexcept_aarch64 (excepts);
} }
libm_hidden_def (__fetestexcept)
weak_alias (__fetestexcept, fetestexcept)
libm_hidden_def (fetestexcept) libm_hidden_def (fetestexcept)

View File

@ -19,7 +19,7 @@
#include <fenv_libc.h> #include <fenv_libc.h>
int int
fetestexcept (int excepts) __fetestexcept (int excepts)
{ {
unsigned long tmp; unsigned long tmp;
@ -28,4 +28,6 @@ fetestexcept (int excepts)
return tmp & excepts & SWCR_STATUS_MASK; return tmp & excepts & SWCR_STATUS_MASK;
} }
libm_hidden_def (__fetestexcept)
weak_alias (__fetestexcept, fetestexcept)
libm_hidden_def (fetestexcept) libm_hidden_def (fetestexcept)

View File

@ -22,7 +22,7 @@
#include <stdio.h> #include <stdio.h>
int int
fetestexcept (int excepts) __fetestexcept (int excepts)
{ {
unsigned int fpsr; unsigned int fpsr;
@ -30,4 +30,6 @@ fetestexcept (int excepts)
return fpsr & excepts; return fpsr & excepts;
} }
libm_hidden_def (__fetestexcept)
weak_alias (__fetestexcept, fetestexcept)
libm_hidden_def (fetestexcept) libm_hidden_def (fetestexcept)

View File

@ -21,7 +21,7 @@
int int
fetestexcept (int excepts) __fetestexcept (int excepts)
{ {
/* Return no exception flags if a VFP unit isn't present. */ /* Return no exception flags if a VFP unit isn't present. */
if (!ARM_HAVE_VFP) if (!ARM_HAVE_VFP)
@ -29,4 +29,6 @@ fetestexcept (int excepts)
return libc_fetestexcept_vfp (excepts); return libc_fetestexcept_vfp (excepts);
} }
libm_hidden_def (__fetestexcept)
weak_alias (__fetestexcept, fetestexcept)
libm_hidden_def (fetestexcept) libm_hidden_def (fetestexcept)

View File

@ -23,8 +23,10 @@
#include <stdio.h> #include <stdio.h>
int int
fetestexcept (int excepts) __fetestexcept (int excepts)
{ {
return libc_fetestexcept_vfp (excepts); return libc_fetestexcept_vfp (excepts);
} }
libm_hidden_def (__fetestexcept)
weak_alias (__fetestexcept, fetestexcept)
libm_hidden_def (fetestexcept) libm_hidden_def (fetestexcept)

View File

@ -82,13 +82,13 @@ default_libc_feholdexcept_setround (fenv_t *e, int r)
#endif #endif
#ifndef libc_fetestexcept #ifndef libc_fetestexcept
# define libc_fetestexcept fetestexcept # define libc_fetestexcept __fetestexcept
#endif #endif
#ifndef libc_fetestexceptf #ifndef libc_fetestexceptf
# define libc_fetestexceptf fetestexcept # define libc_fetestexceptf __fetestexcept
#endif #endif
#ifndef libc_fetestexceptl #ifndef libc_fetestexceptl
# define libc_fetestexceptl fetestexcept # define libc_fetestexceptl __fetestexcept
#endif #endif
static __always_inline void static __always_inline void
@ -130,7 +130,7 @@ default_libc_feupdateenv (fenv_t *e)
static __always_inline int static __always_inline int
default_libc_feupdateenv_test (fenv_t *e, int ex) default_libc_feupdateenv_test (fenv_t *e, int ex)
{ {
int ret = fetestexcept (ex); int ret = __fetestexcept (ex);
__feupdateenv (e); __feupdateenv (e);
return ret; return ret;
} }

View File

@ -19,7 +19,7 @@
#include <fenv.h> #include <fenv.h>
int int
fetestexcept (int excepts) __fetestexcept (int excepts)
{ {
union { unsigned long long l; unsigned int sw[2]; } s; union { unsigned long long l; unsigned int sw[2]; } s;
@ -30,4 +30,6 @@ fetestexcept (int excepts)
return (s.sw[0] >> 27) & excepts & FE_ALL_EXCEPT; return (s.sw[0] >> 27) & excepts & FE_ALL_EXCEPT;
} }
libm_hidden_def (__fetestexcept)
weak_alias (__fetestexcept, fetestexcept)
libm_hidden_def (fetestexcept) libm_hidden_def (fetestexcept)

View File

@ -21,7 +21,7 @@
#include <ldsodefs.h> #include <ldsodefs.h>
int int
fetestexcept (int excepts) __fetestexcept (int excepts)
{ {
short temp; short temp;
int xtemp = 0; int xtemp = 0;
@ -35,4 +35,6 @@ fetestexcept (int excepts)
return (temp | xtemp) & excepts & FE_ALL_EXCEPT; return (temp | xtemp) & excepts & FE_ALL_EXCEPT;
} }
libm_hidden_def (__fetestexcept)
weak_alias (__fetestexcept, fetestexcept)
libm_hidden_def (fetestexcept) libm_hidden_def (fetestexcept)

View File

@ -20,7 +20,7 @@
#include <fpu_control.h> #include <fpu_control.h>
int int
fetestexcept (int excepts) __fetestexcept (int excepts)
{ {
int cw; int cw;
@ -29,4 +29,6 @@ fetestexcept (int excepts)
return cw & excepts & FE_ALL_EXCEPT; return cw & excepts & FE_ALL_EXCEPT;
} }
libm_hidden_def (__fetestexcept)
weak_alias (__fetestexcept, fetestexcept)
libm_hidden_def (fetestexcept) libm_hidden_def (fetestexcept)

View File

@ -19,7 +19,7 @@
#include <fenv.h> #include <fenv.h>
int int
fetestexcept (int excepts) __fetestexcept (int excepts)
{ {
fexcept_t fpsr; fexcept_t fpsr;
@ -28,4 +28,6 @@ fetestexcept (int excepts)
return fpsr & excepts & FE_ALL_EXCEPT; return fpsr & excepts & FE_ALL_EXCEPT;
} }
libm_hidden_def (__fetestexcept)
weak_alias (__fetestexcept, fetestexcept)
libm_hidden_def (fetestexcept) libm_hidden_def (fetestexcept)

View File

@ -20,7 +20,7 @@
#include <fpu_control.h> #include <fpu_control.h>
int int
fetestexcept (int excepts) __fetestexcept (int excepts)
{ {
int cw; int cw;
@ -29,4 +29,6 @@ fetestexcept (int excepts)
return cw & excepts & FE_ALL_EXCEPT; return cw & excepts & FE_ALL_EXCEPT;
} }
libm_hidden_def (__fetestexcept)
weak_alias (__fetestexcept, fetestexcept)
libm_hidden_def (fetestexcept) libm_hidden_def (fetestexcept)

View File

@ -20,8 +20,10 @@
#include <fenv_private.h> #include <fenv_private.h>
int int
fetestexcept (int excepts) __fetestexcept (int excepts)
{ {
return libc_fetestexcept_or1k (excepts); return libc_fetestexcept_or1k (excepts);
} }
libm_hidden_def (__fetestexcept)
weak_alias (__fetestexcept, fetestexcept)
libm_hidden_def (fetestexcept) libm_hidden_def (fetestexcept)

View File

@ -19,7 +19,7 @@
#include <fenv_libc.h> #include <fenv_libc.h>
int int
fetestexcept (int excepts) __fetestexcept (int excepts)
{ {
fenv_union_t u; fenv_union_t u;
@ -30,4 +30,6 @@ fetestexcept (int excepts)
just: */ just: */
return u.l & excepts; return u.l & excepts;
} }
libm_hidden_def (__fetestexcept)
weak_alias (__fetestexcept, fetestexcept)
libm_hidden_def (fetestexcept) libm_hidden_def (fetestexcept)

View File

@ -20,8 +20,10 @@
#include "soft-supp.h" #include "soft-supp.h"
int int
fetestexcept (int x) __fetestexcept (int x)
{ {
return __sim_exceptions_thread & x; return __sim_exceptions_thread & x;
} }
libm_hidden_def (__fetestexcept)
weak_alias (__fetestexcept, fetestexcept)
libm_hidden_def (fetestexcept) libm_hidden_def (fetestexcept)

View File

@ -20,8 +20,10 @@
#include <fenv_private.h> #include <fenv_private.h>
int int
fetestexcept (int excepts) __fetestexcept (int excepts)
{ {
return libc_fetestexcept_riscv (excepts); return libc_fetestexcept_riscv (excepts);
} }
libm_hidden_def (__fetestexcept)
weak_alias (__fetestexcept, fetestexcept)
libm_hidden_def (fetestexcept) libm_hidden_def (fetestexcept)

View File

@ -19,8 +19,10 @@
#include <fenv_private.h> #include <fenv_private.h>
int int
fetestexcept (int excepts) __fetestexcept (int excepts)
{ {
return libc_fetestexcept_s390 (excepts); return libc_fetestexcept_s390 (excepts);
} }
libm_hidden_def (__fetestexcept)
weak_alias (__fetestexcept, fetestexcept)
libm_hidden_def (fetestexcept) libm_hidden_def (fetestexcept)

View File

@ -20,7 +20,7 @@
#include <fpu_control.h> #include <fpu_control.h>
int int
fetestexcept (int excepts) __fetestexcept (int excepts)
{ {
fpu_control_t temp; fpu_control_t temp;
@ -29,4 +29,6 @@ fetestexcept (int excepts)
return temp & excepts & FE_ALL_EXCEPT; return temp & excepts & FE_ALL_EXCEPT;
} }
libm_hidden_def (__fetestexcept)
weak_alias (__fetestexcept, fetestexcept)
libm_hidden_def (fetestexcept) libm_hidden_def (fetestexcept)

View File

@ -20,7 +20,7 @@
#include <fenv_private.h> #include <fenv_private.h>
int int
fetestexcept (int excepts) __fetestexcept (int excepts)
{ {
fenv_t tmp; fenv_t tmp;
@ -28,4 +28,6 @@ fetestexcept (int excepts)
return tmp & excepts & FE_ALL_EXCEPT; return tmp & excepts & FE_ALL_EXCEPT;
} }
libm_hidden_def (__fetestexcept)
weak_alias (__fetestexcept, fetestexcept)
libm_hidden_def (fetestexcept) libm_hidden_def (fetestexcept)

View File

@ -19,7 +19,7 @@
#include <fenv.h> #include <fenv.h>
int int
fetestexcept (int excepts) __fetestexcept (int excepts)
{ {
int temp; int temp;
unsigned int mxscr; unsigned int mxscr;
@ -30,4 +30,6 @@ fetestexcept (int excepts)
return (temp | mxscr) & excepts & FE_ALL_EXCEPT; return (temp | mxscr) & excepts & FE_ALL_EXCEPT;
} }
libm_hidden_def (__fetestexcept)
weak_alias (__fetestexcept, fetestexcept)
libm_hidden_def (fetestexcept) libm_hidden_def (fetestexcept)