From 1674f414ec1d0307f9b50fbf514dd7272bcfbe66 Mon Sep 17 00:00:00 2001
From: swcompiler <lc@wxiat.com>
Date: Fri, 29 Nov 2024 13:57:15 +0800
Subject: [PATCH 13/23] Sw64: math support

---
 sysdeps/sw_64/fpu/cabsf.c                  |   41 +
 sysdeps/sw_64/fpu/cargf.c                  |   41 +
 sysdeps/sw_64/fpu/cfloat-compat.h          |   69 +
 sysdeps/sw_64/fpu/cimagf.c                 |   40 +
 sysdeps/sw_64/fpu/conjf.c                  |   42 +
 sysdeps/sw_64/fpu/crealf.c                 |   40 +
 sysdeps/sw_64/fpu/e_sqrt.c                 |   26 +
 sysdeps/sw_64/fpu/e_sqrtf.c                |    8 +
 sysdeps/sw_64/fpu/fclrexcpt.c              |   47 +
 sysdeps/sw_64/fpu/fedisblxcpt.c            |   35 +
 sysdeps/sw_64/fpu/feenablxcpt.c            |   35 +
 sysdeps/sw_64/fpu/fegetenv.c               |   47 +
 sysdeps/sw_64/fpu/fegetexcept.c            |   30 +
 sysdeps/sw_64/fpu/fegetmode.c              |   33 +
 sysdeps/sw_64/fpu/fegetround.c             |   32 +
 sysdeps/sw_64/fpu/feholdexcpt.c            |   34 +
 sysdeps/sw_64/fpu/fenv_libc.h              |   37 +
 sysdeps/sw_64/fpu/fesetenv.c               |   56 +
 sysdeps/sw_64/fpu/fesetexcept.c            |   31 +
 sysdeps/sw_64/fpu/fesetmode.c              |   44 +
 sysdeps/sw_64/fpu/fesetround.c             |   43 +
 sysdeps/sw_64/fpu/feupdateenv.c            |   49 +
 sysdeps/sw_64/fpu/fgetexcptflg.c           |   43 +
 sysdeps/sw_64/fpu/fpu_control.h            |  104 ++
 sysdeps/sw_64/fpu/fsetexcptflg.c           |   46 +
 sysdeps/sw_64/fpu/ftestexcept.c            |   32 +
 sysdeps/sw_64/fpu/math-barriers.h          |   35 +
 sysdeps/sw_64/fpu/math-use-builtins-sqrt.h |    9 +
 sysdeps/sw_64/fpu/s_cacosf.c               |   57 +
 sysdeps/sw_64/fpu/s_cacoshf.c              |   56 +
 sysdeps/sw_64/fpu/s_casinf.c               |   54 +
 sysdeps/sw_64/fpu/s_casinhf.c              |   54 +
 sysdeps/sw_64/fpu/s_catanf.c               |   54 +
 sysdeps/sw_64/fpu/s_catanhf.c              |   54 +
 sysdeps/sw_64/fpu/s_ccosf.c                |   54 +
 sysdeps/sw_64/fpu/s_ccoshf.c               |   54 +
 sysdeps/sw_64/fpu/s_cexpf.c                |   54 +
 sysdeps/sw_64/fpu/s_clog10f.c              |   66 +
 sysdeps/sw_64/fpu/s_clogf.c                |   54 +
 sysdeps/sw_64/fpu/s_copysign.c             |   33 +
 sysdeps/sw_64/fpu/s_copysignf.c            |   29 +
 sysdeps/sw_64/fpu/s_cpowf.c                |   54 +
 sysdeps/sw_64/fpu/s_cprojf.c               |   54 +
 sysdeps/sw_64/fpu/s_csinf.c                |   54 +
 sysdeps/sw_64/fpu/s_csinhf.c               |   54 +
 sysdeps/sw_64/fpu/s_csqrtf.c               |   54 +
 sysdeps/sw_64/fpu/s_ctanf.c                |   54 +
 sysdeps/sw_64/fpu/s_ctanhf.c               |   54 +
 sysdeps/sw_64/fpu/s_fabs.c                 |   29 +
 sysdeps/sw_64/fpu/s_fabsf.c                |   28 +
 sysdeps/sw_64/fpu/s_fma.c                  |    2 +
 sysdeps/sw_64/fpu/s_isnan.c                |   57 +
 sysdeps/sw_64/fpu/s_isnanf.c               |    1 +
 sysdeps/sw_64/fpu/s_llrint.c               |    1 +
 sysdeps/sw_64/fpu/s_llrintf.c              |    1 +
 sysdeps/sw_64/fpu/s_llround.c              |    1 +
 sysdeps/sw_64/fpu/s_llroundf.c             |    1 +
 sysdeps/sw_64/fpu/s_lrint.c                |   39 +
 sysdeps/sw_64/fpu/s_lrintf.c               |   41 +
 sysdeps/sw_64/fpu/s_lround.c               |   40 +
 sysdeps/sw_64/fpu/s_lroundf.c              |   76 +
 sysdeps/sw_64/fpu/s_rint.c                 |   47 +
 sysdeps/sw_64/fpu/s_rintf.c                |   53 +
 sysdeps/sw_64/fpu/ulps                     | 1826 ++++++++++++++++++++
 sysdeps/sw_64/hp-timing.h                  |   48 +
 65 files changed, 4471 insertions(+)
 create mode 100644 sysdeps/sw_64/fpu/cabsf.c
 create mode 100644 sysdeps/sw_64/fpu/cargf.c
 create mode 100644 sysdeps/sw_64/fpu/cfloat-compat.h
 create mode 100644 sysdeps/sw_64/fpu/cimagf.c
 create mode 100644 sysdeps/sw_64/fpu/conjf.c
 create mode 100644 sysdeps/sw_64/fpu/crealf.c
 create mode 100644 sysdeps/sw_64/fpu/e_sqrt.c
 create mode 100644 sysdeps/sw_64/fpu/e_sqrtf.c
 create mode 100644 sysdeps/sw_64/fpu/fclrexcpt.c
 create mode 100644 sysdeps/sw_64/fpu/fedisblxcpt.c
 create mode 100644 sysdeps/sw_64/fpu/feenablxcpt.c
 create mode 100644 sysdeps/sw_64/fpu/fegetenv.c
 create mode 100644 sysdeps/sw_64/fpu/fegetexcept.c
 create mode 100644 sysdeps/sw_64/fpu/fegetmode.c
 create mode 100644 sysdeps/sw_64/fpu/fegetround.c
 create mode 100644 sysdeps/sw_64/fpu/feholdexcpt.c
 create mode 100644 sysdeps/sw_64/fpu/fenv_libc.h
 create mode 100644 sysdeps/sw_64/fpu/fesetenv.c
 create mode 100644 sysdeps/sw_64/fpu/fesetexcept.c
 create mode 100644 sysdeps/sw_64/fpu/fesetmode.c
 create mode 100644 sysdeps/sw_64/fpu/fesetround.c
 create mode 100644 sysdeps/sw_64/fpu/feupdateenv.c
 create mode 100644 sysdeps/sw_64/fpu/fgetexcptflg.c
 create mode 100644 sysdeps/sw_64/fpu/fpu_control.h
 create mode 100644 sysdeps/sw_64/fpu/fsetexcptflg.c
 create mode 100644 sysdeps/sw_64/fpu/ftestexcept.c
 create mode 100644 sysdeps/sw_64/fpu/math-barriers.h
 create mode 100644 sysdeps/sw_64/fpu/math-use-builtins-sqrt.h
 create mode 100644 sysdeps/sw_64/fpu/s_cacosf.c
 create mode 100644 sysdeps/sw_64/fpu/s_cacoshf.c
 create mode 100644 sysdeps/sw_64/fpu/s_casinf.c
 create mode 100644 sysdeps/sw_64/fpu/s_casinhf.c
 create mode 100644 sysdeps/sw_64/fpu/s_catanf.c
 create mode 100644 sysdeps/sw_64/fpu/s_catanhf.c
 create mode 100644 sysdeps/sw_64/fpu/s_ccosf.c
 create mode 100644 sysdeps/sw_64/fpu/s_ccoshf.c
 create mode 100644 sysdeps/sw_64/fpu/s_cexpf.c
 create mode 100644 sysdeps/sw_64/fpu/s_clog10f.c
 create mode 100644 sysdeps/sw_64/fpu/s_clogf.c
 create mode 100644 sysdeps/sw_64/fpu/s_copysign.c
 create mode 100644 sysdeps/sw_64/fpu/s_copysignf.c
 create mode 100644 sysdeps/sw_64/fpu/s_cpowf.c
 create mode 100644 sysdeps/sw_64/fpu/s_cprojf.c
 create mode 100644 sysdeps/sw_64/fpu/s_csinf.c
 create mode 100644 sysdeps/sw_64/fpu/s_csinhf.c
 create mode 100644 sysdeps/sw_64/fpu/s_csqrtf.c
 create mode 100644 sysdeps/sw_64/fpu/s_ctanf.c
 create mode 100644 sysdeps/sw_64/fpu/s_ctanhf.c
 create mode 100644 sysdeps/sw_64/fpu/s_fabs.c
 create mode 100644 sysdeps/sw_64/fpu/s_fabsf.c
 create mode 100644 sysdeps/sw_64/fpu/s_fma.c
 create mode 100644 sysdeps/sw_64/fpu/s_isnan.c
 create mode 100644 sysdeps/sw_64/fpu/s_isnanf.c
 create mode 100644 sysdeps/sw_64/fpu/s_llrint.c
 create mode 100644 sysdeps/sw_64/fpu/s_llrintf.c
 create mode 100644 sysdeps/sw_64/fpu/s_llround.c
 create mode 100644 sysdeps/sw_64/fpu/s_llroundf.c
 create mode 100644 sysdeps/sw_64/fpu/s_lrint.c
 create mode 100644 sysdeps/sw_64/fpu/s_lrintf.c
 create mode 100644 sysdeps/sw_64/fpu/s_lround.c
 create mode 100644 sysdeps/sw_64/fpu/s_lroundf.c
 create mode 100644 sysdeps/sw_64/fpu/s_rint.c
 create mode 100644 sysdeps/sw_64/fpu/s_rintf.c
 create mode 100644 sysdeps/sw_64/fpu/ulps
 create mode 100644 sysdeps/sw_64/hp-timing.h

diff --git a/sysdeps/sw_64/fpu/cabsf.c b/sysdeps/sw_64/fpu/cabsf.c
new file mode 100644
index 00000000..7390d3c1
--- /dev/null
+++ b/sysdeps/sw_64/fpu/cabsf.c
@@ -0,0 +1,41 @@
+/* Return the complex absolute value of float complex value.
+   Copyright (C) 2004-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define __cabsf __cabsf_not_defined
+#define cabsf cabsf_not_defined
+
+#include <complex.h>
+#include <math.h>
+#include "cfloat-compat.h"
+
+#undef __cabsf
+#undef cabsf
+
+float
+__c1_cabsf (c1_cfloat_decl (z))
+{
+  return __hypotf (c1_cfloat_real (z), c1_cfloat_imag (z));
+}
+
+float
+__c2_cabsf (c2_cfloat_decl (z))
+{
+  return __hypotf (c2_cfloat_real (z), c2_cfloat_imag (z));
+}
+
+cfloat_versions (cabs);
diff --git a/sysdeps/sw_64/fpu/cargf.c b/sysdeps/sw_64/fpu/cargf.c
new file mode 100644
index 00000000..e8cf5cd6
--- /dev/null
+++ b/sysdeps/sw_64/fpu/cargf.c
@@ -0,0 +1,41 @@
+/* Compute argument of complex float value.
+   Copyright (C) 2004-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define __cargf __cargf_not_defined
+#define cargf cargf_not_defined
+
+#include <complex.h>
+#include <math.h>
+#include "cfloat-compat.h"
+
+#undef __cargf
+#undef cargf
+
+float
+__c1_cargf (c1_cfloat_decl (x))
+{
+  return __atan2f (c1_cfloat_imag (x), c1_cfloat_real (x));
+}
+
+float
+__c2_cargf (c2_cfloat_decl (x))
+{
+  return __atan2f (c2_cfloat_imag (x), c2_cfloat_real (x));
+}
+
+cfloat_versions (carg);
diff --git a/sysdeps/sw_64/fpu/cfloat-compat.h b/sysdeps/sw_64/fpu/cfloat-compat.h
new file mode 100644
index 00000000..e09c4b28
--- /dev/null
+++ b/sysdeps/sw_64/fpu/cfloat-compat.h
@@ -0,0 +1,69 @@
+/* Compatibility macros for old and new Sw_64 complex float ABI.
+   Copyright (C) 2004-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* The behaviour of complex float changed between GCC 3.3 and 3.4.
+
+   In 3.3 and before (below, complex version 1, or "c1"), complex float
+   values were packed into one floating point register.
+
+   In 3.4 and later (below, complex version 2, or "c2"), GCC changed to
+   follow the official Tru64 ABI, which passes the components of a complex
+   as separate parameters.  */
+
+typedef union
+{
+  double d;
+  _Complex float cf;
+} c1_compat;
+#define c1_cfloat_decl(x) double x
+#define c1_cfloat_real(x) __real__ c1_cfloat_value (x)
+#define c1_cfloat_imag(x) __imag__ c1_cfloat_value (x)
+#define c1_cfloat_value(x) (((c1_compat *) (void *) &x)->cf)
+#define c1_cfloat_rettype double
+#define c1_cfloat_return(x)						   \
+  ({									  \
+    c1_compat _;							      \
+    _.cf = (x);							       \
+    _.d;								      \
+  })
+
+#define c2_cfloat_decl(x) _Complex float x
+#define c2_cfloat_real(x) __real__ x
+#define c2_cfloat_imag(x) __imag__ x
+#define c2_cfloat_value(x) x
+#define c2_cfloat_rettype _Complex float
+#define c2_cfloat_return(x) x
+
+/* Get the proper symbol versions defined for each function.  */
+
+#include <shlib-compat.h>
+#include <libm-alias-float.h>
+
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_3_4)
+#  define cfloat_versions_compat(func)					\
+    compat_symbol (libm, __c1_##func, func, GLIBC_2_1)
+#else
+#  define cfloat_versions_compat (func)
+#endif
+
+#define cfloat_versions(func)						 \
+  cfloat_versions_compat(func##f);					   \
+  versioned_symbol(libm, __c2_##func##f, func##f, GLIBC_2_3_4);	      \
+  extern typeof(__c2_##func##f) __##func##f attribute_hidden;		\
+  strong_alias(__c2_##func##f, __##func##f);				 \
+  libm_alias_float_other (__##func, func)
diff --git a/sysdeps/sw_64/fpu/cimagf.c b/sysdeps/sw_64/fpu/cimagf.c
new file mode 100644
index 00000000..f8b3b028
--- /dev/null
+++ b/sysdeps/sw_64/fpu/cimagf.c
@@ -0,0 +1,40 @@
+/* Return imaginary part of complex float value.
+   Copyright (C) 2004-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define __cimagf __cimagf_not_defined
+#define cimagf cimagf_not_defined
+
+#include <complex.h>
+#include "cfloat-compat.h"
+
+#undef __cimagf
+#undef cimagf
+
+float
+__c1_cimagf (c1_cfloat_decl (z))
+{
+  return c1_cfloat_imag (z);
+}
+
+float
+__c2_cimagf (c2_cfloat_decl (z))
+{
+  return c2_cfloat_imag (z);
+}
+
+cfloat_versions (cimag);
diff --git a/sysdeps/sw_64/fpu/conjf.c b/sysdeps/sw_64/fpu/conjf.c
new file mode 100644
index 00000000..156e9458
--- /dev/null
+++ b/sysdeps/sw_64/fpu/conjf.c
@@ -0,0 +1,42 @@
+/* Return complex conjugate of complex float value.
+   Copyright (C) 2004-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define __conjf __conjf_not_defined
+#define conjf conjf_not_defined
+
+#include <complex.h>
+#include "cfloat-compat.h"
+
+#undef __conjf
+#undef conjf
+
+c1_cfloat_rettype
+__c1_conjf (c1_cfloat_decl (z))
+{
+  _Complex float r = ~c1_cfloat_value (z);
+  return c1_cfloat_return (r);
+}
+
+c2_cfloat_rettype
+__c2_conjf (c2_cfloat_decl (z))
+{
+  _Complex float r = ~c2_cfloat_value (z);
+  return c2_cfloat_return (r);
+}
+
+cfloat_versions (conj);
diff --git a/sysdeps/sw_64/fpu/crealf.c b/sysdeps/sw_64/fpu/crealf.c
new file mode 100644
index 00000000..62d921e8
--- /dev/null
+++ b/sysdeps/sw_64/fpu/crealf.c
@@ -0,0 +1,40 @@
+/* Return real part of complex float value.
+   Copyright (C) 2004-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define __crealf __crealf_not_defined
+#define crealf crealf_not_defined
+
+#include <complex.h>
+#include "cfloat-compat.h"
+
+#undef __crealf
+#undef crealf
+
+float
+__c1_crealf (c1_cfloat_decl (z))
+{
+  return c1_cfloat_real (z);
+}
+
+float
+__c2_crealf (c2_cfloat_decl (z))
+{
+  return c2_cfloat_real (z);
+}
+
+cfloat_versions (creal);
diff --git a/sysdeps/sw_64/fpu/e_sqrt.c b/sysdeps/sw_64/fpu/e_sqrt.c
new file mode 100644
index 00000000..9135f95d
--- /dev/null
+++ b/sysdeps/sw_64/fpu/e_sqrt.c
@@ -0,0 +1,26 @@
+/* Copyright (C) 1996-2023 Free Software Foundation, Inc.
+   Contributed by David Mosberger (davidm@cs.arizona.edu).
+   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, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <shlib-compat.h>
+
+#include <sysdeps/ieee754/dbl-64/e_sqrt.c>
+
+#if SHLIB_COMPAT (libm, GLIBC_2_18, GLIBC_2_31)
+strong_alias (__ieee754_sqrt, __sqrt_finite_2_18)
+    compat_symbol (libm, __sqrt_finite_2_18, __sqrt_finite, GLIBC_2_18);
+#endif
diff --git a/sysdeps/sw_64/fpu/e_sqrtf.c b/sysdeps/sw_64/fpu/e_sqrtf.c
new file mode 100644
index 00000000..2290d58c
--- /dev/null
+++ b/sysdeps/sw_64/fpu/e_sqrtf.c
@@ -0,0 +1,8 @@
+#include <shlib-compat.h>
+
+#include <sysdeps/ieee754/flt-32/e_sqrtf.c>
+
+#if SHLIB_COMPAT (libm, GLIBC_2_18, GLIBC_2_31)
+strong_alias (__ieee754_sqrtf, __sqrtf_finite_2_18)
+    compat_symbol (libm, __sqrtf_finite_2_18, __sqrtf_finite, GLIBC_2_18);
+#endif
diff --git a/sysdeps/sw_64/fpu/fclrexcpt.c b/sysdeps/sw_64/fpu/fclrexcpt.c
new file mode 100644
index 00000000..639b3d43
--- /dev/null
+++ b/sysdeps/sw_64/fpu/fclrexcpt.c
@@ -0,0 +1,47 @@
+/* Clear given exceptions in current floating-point environment.
+   Copyright (C) 1997-2023 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson <rth@tamu.edu>, 1997.
+
+   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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv_libc.h>
+
+int
+__feclearexcept (int excepts)
+{
+  unsigned long int swcr;
+
+  /* Get the current state.  */
+  swcr = __ieee_get_fp_control ();
+
+  /* Clear the relevant bits.  */
+  swcr &= ~((unsigned long int) excepts & SWCR_STATUS_MASK);
+
+  /* Put the new state in effect.  */
+  __ieee_set_fp_control (swcr);
+
+  /* Success.  */
+  return 0;
+}
+
+#include <shlib-compat.h>
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__feclearexcept, __old_feclearexcept)
+    compat_symbol (libm, __old_feclearexcept, feclearexcept, GLIBC_2_1);
+#endif
+
+libm_hidden_ver (__feclearexcept, feclearexcept)
+    versioned_symbol (libm, __feclearexcept, feclearexcept, GLIBC_2_2);
diff --git a/sysdeps/sw_64/fpu/fedisblxcpt.c b/sysdeps/sw_64/fpu/fedisblxcpt.c
new file mode 100644
index 00000000..bc7d9a36
--- /dev/null
+++ b/sysdeps/sw_64/fpu/fedisblxcpt.c
@@ -0,0 +1,35 @@
+/* Disable floating-point exceptions.
+   Copyright (C) 2000-2023 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2000.
+
+   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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv_libc.h>
+
+int
+fedisableexcept (int excepts)
+{
+  unsigned long int new_exc, old_exc;
+
+  new_exc = __ieee_get_fp_control ();
+
+  old_exc = (new_exc & SWCR_ENABLE_MASK) << SWCR_ENABLE_SHIFT;
+  new_exc &= ~((excepts >> SWCR_ENABLE_SHIFT) & SWCR_ENABLE_MASK);
+
+  __ieee_set_fp_control (new_exc);
+
+  return old_exc;
+}
diff --git a/sysdeps/sw_64/fpu/feenablxcpt.c b/sysdeps/sw_64/fpu/feenablxcpt.c
new file mode 100644
index 00000000..6a7308c3
--- /dev/null
+++ b/sysdeps/sw_64/fpu/feenablxcpt.c
@@ -0,0 +1,35 @@
+/* Enable floating-point exceptions.
+   Copyright (C) 2000-2023 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2000.
+
+   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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv_libc.h>
+
+int
+feenableexcept (int excepts)
+{
+  unsigned long int new_exc, old_exc;
+
+  new_exc = __ieee_get_fp_control ();
+
+  old_exc = (new_exc & SWCR_ENABLE_MASK) << SWCR_ENABLE_SHIFT;
+  new_exc |= (excepts >> SWCR_ENABLE_SHIFT) & SWCR_ENABLE_MASK;
+
+  __ieee_set_fp_control (new_exc);
+
+  return old_exc;
+}
diff --git a/sysdeps/sw_64/fpu/fegetenv.c b/sysdeps/sw_64/fpu/fegetenv.c
new file mode 100644
index 00000000..9a69b207
--- /dev/null
+++ b/sysdeps/sw_64/fpu/fegetenv.c
@@ -0,0 +1,47 @@
+/* Store current floating-point environment.
+   Copyright (C) 1997-2023 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson <rth@tamu.edu>, 1997
+
+   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, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <fenv_libc.h>
+
+int
+__fegetenv (fenv_t *envp)
+{
+  unsigned long int fpcr;
+  unsigned long int swcr;
+
+  /* Get status from software and hardware.  Note that we don't need an
+     excb because the callsys is an implied trap barrier.  */
+  swcr = __ieee_get_fp_control ();
+  __asm__ __volatile__("rfpcr %0" : "=f"(fpcr));
+  /* Merge the two bits of information.  */
+  *envp = ((fpcr & FPCR_ROUND_MASK) | (swcr & SWCR_ALL_MASK));
+
+  /* Success.  */
+  return 0;
+}
+
+#include <shlib-compat.h>
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__fegetenv, __old_fegetenv)
+    compat_symbol (libm, __old_fegetenv, fegetenv, GLIBC_2_1);
+#endif
+
+libm_hidden_def (__fegetenv)
+    versioned_symbol (libm, __fegetenv, fegetenv, GLIBC_2_2);
+libm_hidden_ver (__fegetenv, fegetenv)
diff --git a/sysdeps/sw_64/fpu/fegetexcept.c b/sysdeps/sw_64/fpu/fegetexcept.c
new file mode 100644
index 00000000..c11b9771
--- /dev/null
+++ b/sysdeps/sw_64/fpu/fegetexcept.c
@@ -0,0 +1,30 @@
+/* Get enabled floating-point exceptions.
+   Copyright (C) 2000-2023 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2000.
+
+   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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv_libc.h>
+
+int
+fegetexcept (void)
+{
+  unsigned long int exc;
+
+  exc = __ieee_get_fp_control ();
+
+  return (exc & SWCR_ENABLE_MASK) << SWCR_ENABLE_SHIFT;
+}
diff --git a/sysdeps/sw_64/fpu/fegetmode.c b/sysdeps/sw_64/fpu/fegetmode.c
new file mode 100644
index 00000000..0e5846a7
--- /dev/null
+++ b/sysdeps/sw_64/fpu/fegetmode.c
@@ -0,0 +1,33 @@
+/* Store current floating-point control modes.  Sw_64 version.
+   Copyright (C) 2016-2023 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, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <fenv_libc.h>
+
+int
+fegetmode (femode_t *modep)
+{
+  unsigned long int fpcr;
+  unsigned long int swcr;
+
+  /* As in fegetenv.  */
+  swcr = __ieee_get_fp_control ();
+  __asm__ __volatile__("rfpcr %0" : "=f"(fpcr));
+  *modep = ((fpcr & FPCR_ROUND_MASK) | (swcr & SWCR_ALL_MASK));
+
+  return 0;
+}
diff --git a/sysdeps/sw_64/fpu/fegetround.c b/sysdeps/sw_64/fpu/fegetround.c
new file mode 100644
index 00000000..77468234
--- /dev/null
+++ b/sysdeps/sw_64/fpu/fegetround.c
@@ -0,0 +1,32 @@
+/* Return current rounding direction.
+   Copyright (C) 1997-2023 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson <rth@tamu.edu>, 1997
+
+   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, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <fenv_libc.h>
+
+int
+__fegetround (void)
+{
+  unsigned long fpcr;
+
+  __asm__ __volatile__("excb; rfpcr %0" : "=f"(fpcr));
+
+  return (fpcr >> FPCR_ROUND_SHIFT) & 3;
+}
+libm_hidden_def (__fegetround) weak_alias (__fegetround, fegetround)
+libm_hidden_weak (fegetround)
diff --git a/sysdeps/sw_64/fpu/feholdexcpt.c b/sysdeps/sw_64/fpu/feholdexcpt.c
new file mode 100644
index 00000000..7832afdc
--- /dev/null
+++ b/sysdeps/sw_64/fpu/feholdexcpt.c
@@ -0,0 +1,34 @@
+/* Store current floating-point environment and clear exceptions.
+   Copyright (C) 1997-2023 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson <rth@tamu.edu>, 1997
+
+   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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv_libc.h>
+
+int
+__feholdexcept (fenv_t *envp)
+{
+  /* Save the current state.  */
+  __fegetenv (envp);
+
+  /* Clear all exception status bits and exception enable bits.  */
+  __ieee_set_fp_control (*envp & SWCR_MAP_MASK);
+
+  return 0;
+}
+libm_hidden_def (__feholdexcept) weak_alias (__feholdexcept, feholdexcept)
+libm_hidden_weak (feholdexcept)
diff --git a/sysdeps/sw_64/fpu/fenv_libc.h b/sysdeps/sw_64/fpu/fenv_libc.h
new file mode 100644
index 00000000..6a42634a
--- /dev/null
+++ b/sysdeps/sw_64/fpu/fenv_libc.h
@@ -0,0 +1,37 @@
+/* Internal libc stuff for floating point environment routines.
+   Copyright (C) 2000-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _FENV_LIBC_H
+#define _FENV_LIBC_H 1
+
+#include <fenv.h>
+
+#define FPCR_ROUND_MASK (3UL << 58)
+#define FPCR_ROUND_SHIFT 58
+
+#define SWCR_MAP_MASK (3UL << 12)
+#define SWCR_ENABLE_SHIFT 16
+#define SWCR_ENABLE_MASK (FE_ALL_EXCEPT >> SWCR_ENABLE_SHIFT)
+#define SWCR_STATUS_MASK (FE_ALL_EXCEPT)
+#define SWCR_ALL_MASK (SWCR_ENABLE_MASK | SWCR_MAP_MASK | SWCR_STATUS_MASK)
+
+/* These are declared for public consumption in <bits/fenv.h>.  */
+libc_hidden_proto (__ieee_set_fp_control)
+    libc_hidden_proto (__ieee_get_fp_control)
+
+#endif /* fenv_libc.h */
diff --git a/sysdeps/sw_64/fpu/fesetenv.c b/sysdeps/sw_64/fpu/fesetenv.c
new file mode 100644
index 00000000..6a691131
--- /dev/null
+++ b/sysdeps/sw_64/fpu/fesetenv.c
@@ -0,0 +1,56 @@
+/* Install given floating-point environment.
+   Copyright (C) 1997-2023 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson <rth@tamu.edu>, 1997
+
+   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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv_libc.h>
+
+int
+__fesetenv (const fenv_t *envp)
+{
+  unsigned long int fpcr;
+  fenv_t env;
+
+  /* Magic encoding of default values: high bit set (never possible for a
+     user-space address) is not indirect.  And we don't even have to get
+     rid of it since we mask things around just below.  */
+  if ((long int) envp >= 0)
+    env = *envp;
+  else
+    env = (unsigned long int) envp;
+
+    /* Reset the rounding mode with the hardware fpcr.  Note that the following
+       system call is an implied trap barrier for our modification.  */
+  __asm__ __volatile__("excb; rfpcr %0" : "=f"(fpcr));
+  fpcr = (fpcr & ~FPCR_ROUND_MASK) | (env & FPCR_ROUND_MASK);
+  __asm__ __volatile__("wfpcr %0" : : "f"(fpcr));
+
+  /* Reset the exception status and mask with the kernel's FP code.  */
+  __ieee_set_fp_control (env & SWCR_ALL_MASK);
+
+  /* Success.  */
+  return 0;
+}
+
+#include <shlib-compat.h>
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__fesetenv, __old_fesetenv)
+    compat_symbol (libm, __old_fesetenv, fesetenv, GLIBC_2_1);
+#endif
+
+libm_hidden_def (__fesetenv) libm_hidden_ver (__fesetenv, fesetenv)
+versioned_symbol (libm, __fesetenv, fesetenv, GLIBC_2_2);
diff --git a/sysdeps/sw_64/fpu/fesetexcept.c b/sysdeps/sw_64/fpu/fesetexcept.c
new file mode 100644
index 00000000..a8a4acda
--- /dev/null
+++ b/sysdeps/sw_64/fpu/fesetexcept.c
@@ -0,0 +1,31 @@
+/* Set given exception flags.  Sw_64 version.
+   Copyright (C) 2016-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv_libc.h>
+
+int
+fesetexcept (int excepts)
+{
+  unsigned long int tmp;
+
+  tmp = __ieee_get_fp_control ();
+  tmp |= excepts & SWCR_STATUS_MASK;
+  __ieee_set_fp_control (tmp);
+
+  return 0;
+}
diff --git a/sysdeps/sw_64/fpu/fesetmode.c b/sysdeps/sw_64/fpu/fesetmode.c
new file mode 100644
index 00000000..05a6bf48
--- /dev/null
+++ b/sysdeps/sw_64/fpu/fesetmode.c
@@ -0,0 +1,44 @@
+/* Install given floating-point control modes.  Sw_64 version.
+   Copyright (C) 2016-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv_libc.h>
+
+int
+fesetmode (const femode_t *modep)
+{
+  unsigned long int fpcr;
+  unsigned long int swcr;
+  femode_t mode;
+
+  /* As in fesetenv.  */
+  if ((long int) modep >= 0)
+    mode = *modep;
+  else
+    mode = (unsigned long int) modep;
+
+  __asm__ __volatile__("excb; rfpcr %0" : "=f"(fpcr));
+  fpcr = (fpcr & ~FPCR_ROUND_MASK) | (mode & FPCR_ROUND_MASK);
+  __asm__ __volatile__("wfpcr %0" : : "f"(fpcr));
+
+  swcr = __ieee_get_fp_control ();
+  swcr = ((mode & SWCR_ALL_MASK & ~SWCR_STATUS_MASK)
+	  | (swcr & SWCR_STATUS_MASK));
+  __ieee_set_fp_control (swcr);
+
+  return 0;
+}
diff --git a/sysdeps/sw_64/fpu/fesetround.c b/sysdeps/sw_64/fpu/fesetround.c
new file mode 100644
index 00000000..38344bbc
--- /dev/null
+++ b/sysdeps/sw_64/fpu/fesetround.c
@@ -0,0 +1,43 @@
+/* Set current rounding direction.
+   Copyright (C) 1997-2023 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson <rth@tamu.edu>, 1997
+
+   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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv_libc.h>
+
+int
+__fesetround (int round)
+{
+  unsigned long fpcr;
+
+  if (round & ~3)
+    return 1;
+
+    /* Get the current state.  */
+  __asm__ __volatile__("excb; rfpcr %0" : "=f"(fpcr));
+
+  /* Set the relevant bits.  */
+  fpcr = ((fpcr & ~FPCR_ROUND_MASK)
+	  | ((unsigned long) round << FPCR_ROUND_SHIFT));
+
+  /* Put the new state in effect.  */
+  __asm__ __volatile__("wfpcr %0; excb" : : "f"(fpcr));
+
+  return 0;
+}
+libm_hidden_def (__fesetround) weak_alias (__fesetround, fesetround)
+libm_hidden_weak (fesetround)
diff --git a/sysdeps/sw_64/fpu/feupdateenv.c b/sysdeps/sw_64/fpu/feupdateenv.c
new file mode 100644
index 00000000..7f18b180
--- /dev/null
+++ b/sysdeps/sw_64/fpu/feupdateenv.c
@@ -0,0 +1,49 @@
+/* Install given floating-point environment and raise exceptions.
+   Copyright (C) 1997-2023 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson <rth@tamu.edu>, 1997.
+
+   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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv_libc.h>
+
+int
+__feupdateenv (const fenv_t *envp)
+{
+  unsigned long int tmp;
+
+  /* Get the current exception state.  */
+  tmp = __ieee_get_fp_control ();
+
+  /* Install new environment.  */
+  __fesetenv (envp);
+
+  /* Raise the saved exception.  Incidently for us the implementation
+     defined format of the values in objects of type fexcept_t is the
+     same as the ones specified using the FE_* constants.  */
+  __feraiseexcept (tmp & SWCR_STATUS_MASK);
+
+  /* Success.  */
+  return 0;
+}
+
+#include <shlib-compat.h>
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__feupdateenv, __old_feupdateenv)
+    compat_symbol (libm, __old_feupdateenv, feupdateenv, GLIBC_2_1);
+#endif
+
+libm_hidden_def (__feupdateenv) libm_hidden_ver (__feupdateenv, feupdateenv)
+versioned_symbol (libm, __feupdateenv, feupdateenv, GLIBC_2_2);
diff --git a/sysdeps/sw_64/fpu/fgetexcptflg.c b/sysdeps/sw_64/fpu/fgetexcptflg.c
new file mode 100644
index 00000000..a892525d
--- /dev/null
+++ b/sysdeps/sw_64/fpu/fgetexcptflg.c
@@ -0,0 +1,43 @@
+/* Store current representation for exceptions.
+   Copyright (C) 1997-2023 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson <rth@tamu.edu>, 1997.
+
+   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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv_libc.h>
+
+int
+__fegetexceptflag (fexcept_t *flagp, int excepts)
+{
+  unsigned long int tmp;
+
+  /* Get the current state.  */
+  tmp = __ieee_get_fp_control ();
+
+  /* Return that portion that corresponds to the requested exceptions.  */
+  *flagp = tmp & excepts & SWCR_STATUS_MASK;
+
+  /* Success.  */
+  return 0;
+}
+
+#include <shlib-compat.h>
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__fegetexceptflag, __old_fegetexceptflag)
+    compat_symbol (libm, __old_fegetexceptflag, fegetexceptflag, GLIBC_2_1);
+#endif
+
+versioned_symbol (libm, __fegetexceptflag, fegetexceptflag, GLIBC_2_2);
diff --git a/sysdeps/sw_64/fpu/fpu_control.h b/sysdeps/sw_64/fpu/fpu_control.h
new file mode 100644
index 00000000..92c2afba
--- /dev/null
+++ b/sysdeps/sw_64/fpu/fpu_control.h
@@ -0,0 +1,104 @@
+/* FPU control word bits.  Sw_64-mapped-to-Intel version.
+   Copyright (C) 1996-2023 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Olaf Flebbe.
+
+   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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _SW_64_FPU_CONTROL_H
+#define _SW_64_FPU_CONTROL_H
+
+/*
+ * Since many programs seem to hardcode the values passed to __setfpucw()
+ * (rather than using the manifest constants) we emulate the x87 interface
+ * here (at least where this makes sense).
+ *
+ *     15-13    12  11-10  9-8     7-6     5    4    3    2    1    0
+ * | reserved | IC | RC  | PC | reserved | PM | UM | OM | ZM | DM | IM
+ *
+ * IM: Invalid operation mask
+ * DM: Denormalized operand mask
+ * ZM: Zero-divide mask
+ * OM: Overflow mask
+ * UM: Underflow mask
+ * PM: Precision (inexact result) mask
+ *
+ * Mask bit is 1 means no interrupt.
+ *
+ * PC: Precision control
+ * 11 - round to extended precision
+ * 10 - round to double precision
+ * 00 - round to single precision
+ *
+ * RC: Rounding control
+ * 00 - rounding to nearest
+ * 01 - rounding down (toward - infinity)
+ * 10 - rounding up (toward + infinity)
+ * 11 - rounding toward zero
+ *
+ * IC: Infinity control
+ * That is for 8087 and 80287 only.
+ *
+ * The hardware default is 0x037f.  I choose 0x1372.
+ */
+
+#include <features.h>
+
+/* masking of interrupts */
+#define _FPU_MASK_IM 0x01
+#define _FPU_MASK_DM 0x02
+#define _FPU_MASK_ZM 0x04
+#define _FPU_MASK_OM 0x08
+#define _FPU_MASK_UM 0x10
+#define _FPU_MASK_PM 0x20
+
+/* precision control -- without effect on Sw_64 */
+#define _FPU_EXTENDED 0x300 /* RECOMMENDED */
+#define _FPU_DOUBLE 0x200
+#define _FPU_SINGLE 0x0 /* DO NOT USE */
+
+/*
+ * rounding control---notice that on the Sw_64 this affects only
+ * instructions with the dynamic rounding mode qualifier (/d).
+ */
+#define _FPU_RC_NEAREST 0x000 /* RECOMMENDED */
+#define _FPU_RC_DOWN 0x400
+#define _FPU_RC_UP 0x800
+#define _FPU_RC_ZERO 0xC00
+
+#define _FPU_RESERVED 0xF0C0 /* Reserved bits in cw */
+
+/* Now two recommended cw */
+
+/* Linux default:
+     - extended precision
+     - rounding to positive infinity.  There is no /p instruction
+       qualifier.  By setting the dynamic rounding mode to +infinity,
+       one can use /d to get round to +infinity with no extra overhead
+       (so long as the default isn't changed, of course...)
+     - no exceptions enabled.  */
+
+#define _FPU_DEFAULT 0x137f
+
+/* IEEE:  same as above.  */
+#define _FPU_IEEE 0x137f
+
+/* Type of the control word.  */
+typedef unsigned int fpu_control_t;
+
+/* Default control word set at startup.  */
+extern fpu_control_t __fpu_control;
+
+#endif /* _SW_64_FPU_CONTROL */
diff --git a/sysdeps/sw_64/fpu/fsetexcptflg.c b/sysdeps/sw_64/fpu/fsetexcptflg.c
new file mode 100644
index 00000000..82df62c1
--- /dev/null
+++ b/sysdeps/sw_64/fpu/fsetexcptflg.c
@@ -0,0 +1,46 @@
+/* Set floating-point environment exception handling.
+   Copyright (C) 1997-2023 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson <rth@tamu.edu>, 1997.
+
+   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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv_libc.h>
+
+int
+__fesetexceptflag (const fexcept_t *flagp, int excepts)
+{
+  unsigned long int tmp;
+
+  /* Get the current exception state.  */
+  tmp = __ieee_get_fp_control ();
+
+  /* Set all the bits that were called for.  */
+  tmp = (tmp & ~SWCR_STATUS_MASK) | (*flagp & excepts & SWCR_STATUS_MASK);
+
+  /* And store it back.  */
+  __ieee_set_fp_control (tmp);
+
+  /* Success.  */
+  return 0;
+}
+
+#include <shlib-compat.h>
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__fesetexceptflag, __old_fesetexceptflag)
+    compat_symbol (libm, __old_fesetexceptflag, fesetexceptflag, GLIBC_2_1);
+#endif
+
+versioned_symbol (libm, __fesetexceptflag, fesetexceptflag, GLIBC_2_2);
diff --git a/sysdeps/sw_64/fpu/ftestexcept.c b/sysdeps/sw_64/fpu/ftestexcept.c
new file mode 100644
index 00000000..ce1104d3
--- /dev/null
+++ b/sysdeps/sw_64/fpu/ftestexcept.c
@@ -0,0 +1,32 @@
+/* Test exception in current environment.
+   Copyright (C) 1997-2023 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson <rth@tamu.edu>, 1997.
+
+   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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv_libc.h>
+
+int
+fetestexcept (int excepts)
+{
+  unsigned long tmp;
+
+  /* Get current exceptions.  */
+  tmp = __ieee_get_fp_control ();
+
+  return tmp & excepts & SWCR_STATUS_MASK;
+}
+libm_hidden_def (fetestexcept)
diff --git a/sysdeps/sw_64/fpu/math-barriers.h b/sysdeps/sw_64/fpu/math-barriers.h
new file mode 100644
index 00000000..379591a3
--- /dev/null
+++ b/sysdeps/sw_64/fpu/math-barriers.h
@@ -0,0 +1,35 @@
+/* Control when floating-point expressions are evaluated.  Sw_64 version.
+   Copyright (C) 2014-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef SW_64_MATH_BARRIERS_H
+#define SW_64_MATH_BARRIERS_H 1
+
+/* Generic code forces values to memory; we don't need to do that.  */
+#define math_opt_barrier(x)						   \
+  ({									  \
+    __typeof (x) __x = (x);						   \
+    __asm ("" : "+frm"(__x));						  \
+    __x;								      \
+  })
+#define math_force_eval(x)						    \
+  ({									  \
+    __typeof (x) __x = (x);						   \
+    __asm __volatile__("" : : "frm"(__x));				    \
+  })
+
+#endif
diff --git a/sysdeps/sw_64/fpu/math-use-builtins-sqrt.h b/sysdeps/sw_64/fpu/math-use-builtins-sqrt.h
new file mode 100644
index 00000000..ebad3a57
--- /dev/null
+++ b/sysdeps/sw_64/fpu/math-use-builtins-sqrt.h
@@ -0,0 +1,9 @@
+#ifdef __sw_64_sw6a__
+#  define USE_SQRT_BUILTIN 1
+#  define USE_SQRTF_BUILTIN 1
+#else
+#  define USE_SQRT_BUILTIN 0
+#  define USE_SQRTF_BUILTIN 0
+#endif
+#define USE_SQRTL_BUILTIN 0
+#define USE_SQRTF128_BUILTIN 0
diff --git a/sysdeps/sw_64/fpu/s_cacosf.c b/sysdeps/sw_64/fpu/s_cacosf.c
new file mode 100644
index 00000000..b2a03f72
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_cacosf.c
@@ -0,0 +1,57 @@
+/* Return arc cosine of complex float value.
+   Copyright (C) 2004-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define __cacosf __cacosf_not_defined
+#define cacosf cacosf_not_defined
+
+#include <complex.h>
+#include <math.h>
+
+#undef __cacosf
+#undef cacosf
+
+static _Complex float internal_cacosf (_Complex float x);
+
+#define M_DECL_FUNC(f) internal_cacosf
+#include <math-type-macros-float.h>
+
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_cacos_template.c>
+
+#include "cfloat-compat.h"
+
+#undef __cacosf
+
+c1_cfloat_rettype
+__c1_cacosf (c1_cfloat_decl (x))
+{
+  _Complex float r = internal_cacosf (c1_cfloat_value (x));
+  return c1_cfloat_return (r);
+}
+
+c2_cfloat_rettype
+__c2_cacosf (c2_cfloat_decl (x))
+{
+  _Complex float r = internal_cacosf (c2_cfloat_value (x));
+  return c2_cfloat_return (r);
+}
+
+cfloat_versions (cacos);
diff --git a/sysdeps/sw_64/fpu/s_cacoshf.c b/sysdeps/sw_64/fpu/s_cacoshf.c
new file mode 100644
index 00000000..089cf201
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_cacoshf.c
@@ -0,0 +1,56 @@
+/* Return arc hyperbole cosine of complex float value.
+   Copyright (C) 2004-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define __cacoshf __cacoshf_not_defined
+#define cacoshf cacoshf_not_defined
+
+#include <complex.h>
+#include <math.h>
+
+#undef __cacoshf
+#undef cacoshf
+
+static _Complex float internal_cacoshf (_Complex float x);
+
+#define M_DECL_FUNC(f) internal_cacoshf
+#include <math-type-macros-float.h>
+
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_cacosh_template.c>
+#include "cfloat-compat.h"
+
+#undef __cacoshf
+
+c1_cfloat_rettype
+__c1_cacoshf (c1_cfloat_decl (x))
+{
+  _Complex float r = internal_cacoshf (c1_cfloat_value (x));
+  return c1_cfloat_return (r);
+}
+
+c2_cfloat_rettype
+__c2_cacoshf (c2_cfloat_decl (x))
+{
+  _Complex float r = internal_cacoshf (c2_cfloat_value (x));
+  return c2_cfloat_return (r);
+}
+
+cfloat_versions (cacosh);
diff --git a/sysdeps/sw_64/fpu/s_casinf.c b/sysdeps/sw_64/fpu/s_casinf.c
new file mode 100644
index 00000000..273097b4
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_casinf.c
@@ -0,0 +1,54 @@
+/* Return arc sine of complex float value.
+   Copyright (C) 2004-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define __casinf __casinf_not_defined
+#define casinf casinf_not_defined
+
+#include <complex.h>
+#include <math.h>
+
+#undef __casinf
+#undef casinf
+
+static _Complex float internal_casinf (_Complex float x);
+
+#define M_DECL_FUNC(f) internal_casinf
+#include <math-type-macros-float.h>
+
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_casin_template.c>
+#include "cfloat-compat.h"
+
+c1_cfloat_rettype
+__c1_casinf (c1_cfloat_decl (x))
+{
+  _Complex float r = internal_casinf (c1_cfloat_value (x));
+  return c1_cfloat_return (r);
+}
+
+c2_cfloat_rettype
+__c2_casinf (c2_cfloat_decl (x))
+{
+  _Complex float r = internal_casinf (c2_cfloat_value (x));
+  return c2_cfloat_return (r);
+}
+
+cfloat_versions (casin);
diff --git a/sysdeps/sw_64/fpu/s_casinhf.c b/sysdeps/sw_64/fpu/s_casinhf.c
new file mode 100644
index 00000000..e6886eea
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_casinhf.c
@@ -0,0 +1,54 @@
+/* Return arc hyperbole sine of complex float value.
+   Copyright (C) 2004-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define __casinhf __casinhf_not_defined
+#define casinhf casinhf_not_defined
+
+#include <complex.h>
+#include <math.h>
+
+#undef __casinhf
+#undef casinhf
+
+static _Complex float internal_casinhf (_Complex float x);
+
+#define M_DECL_FUNC(f) internal_casinhf
+#include <math-type-macros-float.h>
+
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_casinh_template.c>
+#include "cfloat-compat.h"
+
+c1_cfloat_rettype
+__c1_casinhf (c1_cfloat_decl (x))
+{
+  _Complex float r = internal_casinhf (c1_cfloat_value (x));
+  return c1_cfloat_return (r);
+}
+
+c2_cfloat_rettype
+__c2_casinhf (c2_cfloat_decl (x))
+{
+  _Complex float r = internal_casinhf (c2_cfloat_value (x));
+  return c2_cfloat_return (r);
+}
+
+cfloat_versions (casinh);
diff --git a/sysdeps/sw_64/fpu/s_catanf.c b/sysdeps/sw_64/fpu/s_catanf.c
new file mode 100644
index 00000000..aa5e93c6
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_catanf.c
@@ -0,0 +1,54 @@
+/* Return arc tangent of complex float value.
+   Copyright (C) 2004-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define __catanf __catanf_not_defined
+#define catanf catanf_not_defined
+
+#include <complex.h>
+#include <math.h>
+
+#undef __catanf
+#undef catanf
+
+static _Complex float internal_catanf (_Complex float x);
+
+#define M_DECL_FUNC(f) internal_catanf
+#include <math-type-macros-float.h>
+
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_catan_template.c>
+#include "cfloat-compat.h"
+
+c1_cfloat_rettype
+__c1_catanf (c1_cfloat_decl (x))
+{
+  _Complex float r = internal_catanf (c1_cfloat_value (x));
+  return c1_cfloat_return (r);
+}
+
+c2_cfloat_rettype
+__c2_catanf (c2_cfloat_decl (x))
+{
+  _Complex float r = internal_catanf (c2_cfloat_value (x));
+  return c2_cfloat_return (r);
+}
+
+cfloat_versions (catan);
diff --git a/sysdeps/sw_64/fpu/s_catanhf.c b/sysdeps/sw_64/fpu/s_catanhf.c
new file mode 100644
index 00000000..de293708
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_catanhf.c
@@ -0,0 +1,54 @@
+/* Return arc hyperbole tangent of complex float value.
+   Copyright (C) 2004-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define __catanhf __catanhf_not_defined
+#define catanhf catanhf_not_defined
+
+#include <complex.h>
+#include <math.h>
+
+#undef __catanhf
+#undef catanhf
+
+static _Complex float internal_catanhf (_Complex float x);
+
+#define M_DECL_FUNC(f) internal_catanhf
+#include <math-type-macros-float.h>
+
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_catanh_template.c>
+#include "cfloat-compat.h"
+
+c1_cfloat_rettype
+__c1_catanhf (c1_cfloat_decl (x))
+{
+  _Complex float r = internal_catanhf (c1_cfloat_value (x));
+  return c1_cfloat_return (r);
+}
+
+c2_cfloat_rettype
+__c2_catanhf (c2_cfloat_decl (x))
+{
+  _Complex float r = internal_catanhf (c2_cfloat_value (x));
+  return c2_cfloat_return (r);
+}
+
+cfloat_versions (catanh);
diff --git a/sysdeps/sw_64/fpu/s_ccosf.c b/sysdeps/sw_64/fpu/s_ccosf.c
new file mode 100644
index 00000000..9e9cb1c6
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_ccosf.c
@@ -0,0 +1,54 @@
+/* Return cosine of complex float value.
+   Copyright (C) 2004-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define __ccosf __ccosf_not_defined
+#define ccosf ccosf_not_defined
+
+#include <complex.h>
+#include <math.h>
+
+#undef __ccosf
+#undef ccosf
+
+static _Complex float internal_ccosf (_Complex float x);
+
+#define M_DECL_FUNC(f) internal_ccosf
+#include <math-type-macros-float.h>
+
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_ccos_template.c>
+#include "cfloat-compat.h"
+
+c1_cfloat_rettype
+__c1_ccosf (c1_cfloat_decl (x))
+{
+  _Complex float r = internal_ccosf (c1_cfloat_value (x));
+  return c1_cfloat_return (r);
+}
+
+c2_cfloat_rettype
+__c2_ccosf (c2_cfloat_decl (x))
+{
+  _Complex float r = internal_ccosf (c2_cfloat_value (x));
+  return c2_cfloat_return (r);
+}
+
+cfloat_versions (ccos);
diff --git a/sysdeps/sw_64/fpu/s_ccoshf.c b/sysdeps/sw_64/fpu/s_ccoshf.c
new file mode 100644
index 00000000..531e9a5e
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_ccoshf.c
@@ -0,0 +1,54 @@
+/* Return hyperbole cosine of complex float value.
+   Copyright (C) 2004-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define __ccoshf __ccoshf_not_defined
+#define ccoshf ccoshf_not_defined
+
+#include <complex.h>
+#include <math.h>
+
+#undef __ccoshf
+#undef ccoshf
+
+static _Complex float internal_ccoshf (_Complex float x);
+
+#define M_DECL_FUNC(f) internal_ccoshf
+#include <math-type-macros-float.h>
+
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_ccosh_template.c>
+#include "cfloat-compat.h"
+
+c1_cfloat_rettype
+__c1_ccoshf (c1_cfloat_decl (x))
+{
+  _Complex float r = internal_ccoshf (c1_cfloat_value (x));
+  return c1_cfloat_return (r);
+}
+
+c2_cfloat_rettype
+__c2_ccoshf (c2_cfloat_decl (x))
+{
+  _Complex float r = internal_ccoshf (c2_cfloat_value (x));
+  return c2_cfloat_return (r);
+}
+
+cfloat_versions (ccosh);
diff --git a/sysdeps/sw_64/fpu/s_cexpf.c b/sysdeps/sw_64/fpu/s_cexpf.c
new file mode 100644
index 00000000..757b707c
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_cexpf.c
@@ -0,0 +1,54 @@
+/* Return exponent of complex float value.
+   Copyright (C) 2004-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define __cexpf __cexpf_not_defined
+#define cexpf cexpf_not_defined
+
+#include <complex.h>
+#include <math.h>
+
+#undef __cexpf
+#undef cexpf
+
+static _Complex float internal_cexpf (_Complex float x);
+
+#define M_DECL_FUNC(f) internal_cexpf
+#include <math-type-macros-float.h>
+
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_cexp_template.c>
+#include "cfloat-compat.h"
+
+c1_cfloat_rettype
+__c1_cexpf (c1_cfloat_decl (x))
+{
+  _Complex float r = internal_cexpf (c1_cfloat_value (x));
+  return c1_cfloat_return (r);
+}
+
+c2_cfloat_rettype
+__c2_cexpf (c2_cfloat_decl (x))
+{
+  _Complex float r = internal_cexpf (c2_cfloat_value (x));
+  return c2_cfloat_return (r);
+}
+
+cfloat_versions (cexp);
diff --git a/sysdeps/sw_64/fpu/s_clog10f.c b/sysdeps/sw_64/fpu/s_clog10f.c
new file mode 100644
index 00000000..84b1544f
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_clog10f.c
@@ -0,0 +1,66 @@
+/* Return base 10 logarithm of complex float value.
+   Copyright (C) 2004-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define __clog10f __clog10f_not_defined
+#define clog10f clog10f_not_defined
+
+#include <complex.h>
+#include <math.h>
+#include <libm-alias-float.h>
+
+#undef __clog10f
+#undef clog10f
+
+static _Complex float internal_clog10f (_Complex float x);
+
+#define M_DECL_FUNC(f) internal_clog10f
+#include <math-type-macros-float.h>
+
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_clog10_template.c>
+#include "cfloat-compat.h"
+
+c1_cfloat_rettype
+__c1_clog10f (c1_cfloat_decl (x))
+{
+  _Complex float r = internal_clog10f (c1_cfloat_value (x));
+  return c1_cfloat_return (r);
+}
+
+c2_cfloat_rettype
+__c2_clog10f (c2_cfloat_decl (x))
+{
+  _Complex float r = internal_clog10f (c2_cfloat_value (x));
+  return c2_cfloat_return (r);
+}
+
+/* Ug.  __clog10f was exported from GLIBC_2.1.  This is the only
+   complex function whose double-underscore symbol was exported,
+   so we get to handle that specially.  */
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_3_4)
+strong_alias (__c1_clog10f, __c1_clog10f_2);
+compat_symbol (libm, __c1_clog10f, clog10f, GLIBC_2_1);
+compat_symbol (libm, __c1_clog10f_2, __clog10f, GLIBC_2_1);
+#endif
+versioned_symbol (libm, __c2_clog10f, clog10f, GLIBC_2_3_4);
+extern typeof (__c2_clog10f) __clog10f attribute_hidden;
+strong_alias (__c2_clog10f, __clog10f)
+    libm_alias_float_other (__c2_clog10, clog10)
diff --git a/sysdeps/sw_64/fpu/s_clogf.c b/sysdeps/sw_64/fpu/s_clogf.c
new file mode 100644
index 00000000..d84b4403
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_clogf.c
@@ -0,0 +1,54 @@
+/* Return natural logarithm of complex float value.
+   Copyright (C) 2004-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define __clogf __clogf_not_defined
+#define clogf clogf_not_defined
+
+#include <complex.h>
+#include <math.h>
+
+#undef __clogf
+#undef clogf
+
+static _Complex float internal_clogf (_Complex float x);
+
+#define M_DECL_FUNC(f) internal_clogf
+#include <math-type-macros-float.h>
+
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_clog_template.c>
+#include "cfloat-compat.h"
+
+c1_cfloat_rettype
+__c1_clogf (c1_cfloat_decl (x))
+{
+  _Complex float r = internal_clogf (c1_cfloat_value (x));
+  return c1_cfloat_return (r);
+}
+
+c2_cfloat_rettype
+__c2_clogf (c2_cfloat_decl (x))
+{
+  _Complex float r = internal_clogf (c2_cfloat_value (x));
+  return c2_cfloat_return (r);
+}
+
+cfloat_versions (clog);
diff --git a/sysdeps/sw_64/fpu/s_copysign.c b/sysdeps/sw_64/fpu/s_copysign.c
new file mode 100644
index 00000000..2311bce5
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_copysign.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 2000-2023 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson.
+
+   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, see
+   <https://www.gnu.org/licenses/>.  */
+
+#define NO_MATH_REDIRECT
+#include <math.h>
+#include <math_ldbl_opt.h>
+#include <libm-alias-double.h>
+
+double
+__copysign (double x, double y)
+{
+  return __builtin_copysign (x, y);
+}
+
+libm_alias_double (__copysign, copysign)
+#if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+    compat_symbol (libc, __copysign, copysignl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/sw_64/fpu/s_copysignf.c b/sysdeps/sw_64/fpu/s_copysignf.c
new file mode 100644
index 00000000..b9e6d2f6
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_copysignf.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2000-2023 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson.
+
+   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, see
+   <https://www.gnu.org/licenses/>.  */
+
+#define NO_MATH_REDIRECT
+#include <math.h>
+#include <libm-alias-float.h>
+
+float
+__copysignf (float x, float y)
+{
+  return __builtin_copysignf (x, y);
+}
+
+libm_alias_float (__copysign, copysign)
diff --git a/sysdeps/sw_64/fpu/s_cpowf.c b/sysdeps/sw_64/fpu/s_cpowf.c
new file mode 100644
index 00000000..6b9111c9
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_cpowf.c
@@ -0,0 +1,54 @@
+/* Return power of complex float value.
+   Copyright (C) 2004-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define __cpowf __cpowf_not_defined
+#define cpowf cpowf_not_defined
+
+#include <complex.h>
+#include <math.h>
+
+#undef __cpowf
+#undef cpowf
+
+static _Complex float internal_cpowf (_Complex float x, _Complex float c);
+
+#define M_DECL_FUNC(f) internal_cpowf
+#include <math-type-macros-float.h>
+
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_cpow_template.c>
+#include "cfloat-compat.h"
+
+c1_cfloat_rettype
+__c1_cpowf (c1_cfloat_decl (x), c1_cfloat_decl (c))
+{
+  _Complex float r = internal_cpowf (c1_cfloat_value (x), c1_cfloat_value (c));
+  return c1_cfloat_return (r);
+}
+
+c2_cfloat_rettype
+__c2_cpowf (c2_cfloat_decl (x), c2_cfloat_decl (c))
+{
+  _Complex float r = internal_cpowf (c2_cfloat_value (x), c2_cfloat_value (c));
+  return c2_cfloat_return (r);
+}
+
+cfloat_versions (cpow);
diff --git a/sysdeps/sw_64/fpu/s_cprojf.c b/sysdeps/sw_64/fpu/s_cprojf.c
new file mode 100644
index 00000000..9570a16b
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_cprojf.c
@@ -0,0 +1,54 @@
+/* Return projection of complex float value to Riemann sphere.
+   Copyright (C) 2004-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define __cprojf __cprojf_not_defined
+#define cprojf cprojf_not_defined
+
+#include <complex.h>
+#include <math.h>
+
+#undef __cprojf
+#undef cprojf
+
+static _Complex float internal_cprojf (_Complex float x);
+
+#define M_DECL_FUNC(f) internal_cprojf
+#include <math-type-macros-float.h>
+
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_cproj_template.c>
+#include "cfloat-compat.h"
+
+c1_cfloat_rettype
+__c1_cprojf (c1_cfloat_decl (x))
+{
+  _Complex float r = internal_cprojf (c1_cfloat_value (x));
+  return c1_cfloat_return (r);
+}
+
+c2_cfloat_rettype
+__c2_cprojf (c2_cfloat_decl (x))
+{
+  _Complex float r = internal_cprojf (c2_cfloat_value (x));
+  return c2_cfloat_return (r);
+}
+
+cfloat_versions (cproj);
diff --git a/sysdeps/sw_64/fpu/s_csinf.c b/sysdeps/sw_64/fpu/s_csinf.c
new file mode 100644
index 00000000..ff518744
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_csinf.c
@@ -0,0 +1,54 @@
+/* Return sine of complex float value.
+   Copyright (C) 2004-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define __csinf __csinf_not_defined
+#define csinf csinf_not_defined
+
+#include <complex.h>
+#include <math.h>
+
+#undef __csinf
+#undef csinf
+
+static _Complex float internal_csinf (_Complex float x);
+
+#define M_DECL_FUNC(f) internal_csinf
+#include <math-type-macros-float.h>
+
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_csin_template.c>
+#include "cfloat-compat.h"
+
+c1_cfloat_rettype
+__c1_csinf (c1_cfloat_decl (x))
+{
+  _Complex float r = internal_csinf (c1_cfloat_value (x));
+  return c1_cfloat_return (r);
+}
+
+c2_cfloat_rettype
+__c2_csinf (c2_cfloat_decl (x))
+{
+  _Complex float r = internal_csinf (c2_cfloat_value (x));
+  return c2_cfloat_return (r);
+}
+
+cfloat_versions (csin);
diff --git a/sysdeps/sw_64/fpu/s_csinhf.c b/sysdeps/sw_64/fpu/s_csinhf.c
new file mode 100644
index 00000000..38c91dfa
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_csinhf.c
@@ -0,0 +1,54 @@
+/* Return hyperbole sine of complex float value.
+   Copyright (C) 2004-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define __csinhf __csinhf_not_defined
+#define csinhf csinhf_not_defined
+
+#include <complex.h>
+#include <math.h>
+
+#undef __csinhf
+#undef csinhf
+
+static _Complex float internal_csinhf (_Complex float x);
+
+#define M_DECL_FUNC(f) internal_csinhf
+#include <math-type-macros-float.h>
+
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_csinh_template.c>
+#include "cfloat-compat.h"
+
+c1_cfloat_rettype
+__c1_csinhf (c1_cfloat_decl (x))
+{
+  _Complex float r = internal_csinhf (c1_cfloat_value (x));
+  return c1_cfloat_return (r);
+}
+
+c2_cfloat_rettype
+__c2_csinhf (c2_cfloat_decl (x))
+{
+  _Complex float r = internal_csinhf (c2_cfloat_value (x));
+  return c2_cfloat_return (r);
+}
+
+cfloat_versions (csinh);
diff --git a/sysdeps/sw_64/fpu/s_csqrtf.c b/sysdeps/sw_64/fpu/s_csqrtf.c
new file mode 100644
index 00000000..5d332b60
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_csqrtf.c
@@ -0,0 +1,54 @@
+/* Return square root of complex float value.
+   Copyright (C) 2004-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define __csqrtf __csinhf_not_defined
+#define csqrtf csqrtf_not_defined
+
+#include <complex.h>
+#include <math.h>
+
+#undef __csqrtf
+#undef csqrtf
+
+static _Complex float internal_csqrtf (_Complex float x);
+
+#define M_DECL_FUNC(f) internal_csqrtf
+#include <math-type-macros-float.h>
+
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_csqrt_template.c>
+#include "cfloat-compat.h"
+
+c1_cfloat_rettype
+__c1_csqrtf (c1_cfloat_decl (x))
+{
+  _Complex float r = internal_csqrtf (c1_cfloat_value (x));
+  return c1_cfloat_return (r);
+}
+
+c2_cfloat_rettype
+__c2_csqrtf (c2_cfloat_decl (x))
+{
+  _Complex float r = internal_csqrtf (c2_cfloat_value (x));
+  return c2_cfloat_return (r);
+}
+
+cfloat_versions (csqrt);
diff --git a/sysdeps/sw_64/fpu/s_ctanf.c b/sysdeps/sw_64/fpu/s_ctanf.c
new file mode 100644
index 00000000..3fc0c6c7
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_ctanf.c
@@ -0,0 +1,54 @@
+/* Return tangent of complex float value.
+   Copyright (C) 2004-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define __ctanf __ctanf_not_defined
+#define ctanf ctanf_not_defined
+
+#include <complex.h>
+#include <math.h>
+
+#undef __ctanf
+#undef ctanf
+
+static _Complex float internal_ctanf (_Complex float x);
+
+#define M_DECL_FUNC(f) internal_ctanf
+#include <math-type-macros-float.h>
+
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_ctan_template.c>
+#include "cfloat-compat.h"
+
+c1_cfloat_rettype
+__c1_ctanf (c1_cfloat_decl (x))
+{
+  _Complex float r = internal_ctanf (c1_cfloat_value (x));
+  return c1_cfloat_return (r);
+}
+
+c2_cfloat_rettype
+__c2_ctanf (c2_cfloat_decl (x))
+{
+  _Complex float r = internal_ctanf (c2_cfloat_value (x));
+  return c2_cfloat_return (r);
+}
+
+cfloat_versions (ctan);
diff --git a/sysdeps/sw_64/fpu/s_ctanhf.c b/sysdeps/sw_64/fpu/s_ctanhf.c
new file mode 100644
index 00000000..c1b0d254
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_ctanhf.c
@@ -0,0 +1,54 @@
+/* Return hyperbole tangent of complex float value.
+   Copyright (C) 2004-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define __ctanhf __ctanhf_not_defined
+#define ctanhf ctanhf_not_defined
+
+#include <complex.h>
+#include <math.h>
+
+#undef __ctanhf
+#undef ctanhf
+
+static _Complex float internal_ctanhf (_Complex float x);
+
+#define M_DECL_FUNC(f) internal_ctanhf
+#include <math-type-macros-float.h>
+
+/* Disable any aliasing from base template.  */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_ctanh_template.c>
+#include "cfloat-compat.h"
+
+c1_cfloat_rettype
+__c1_ctanhf (c1_cfloat_decl (x))
+{
+  _Complex float r = internal_ctanhf (c1_cfloat_value (x));
+  return c1_cfloat_return (r);
+}
+
+c2_cfloat_rettype
+__c2_ctanhf (c2_cfloat_decl (x))
+{
+  _Complex float r = internal_ctanhf (c2_cfloat_value (x));
+  return c2_cfloat_return (r);
+}
+
+cfloat_versions (ctanh);
diff --git a/sysdeps/sw_64/fpu/s_fabs.c b/sysdeps/sw_64/fpu/s_fabs.c
new file mode 100644
index 00000000..cdee19f5
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_fabs.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2000-2023 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson.
+
+   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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <math.h>
+#include <math_ldbl_opt.h>
+#include <libm-alias-double.h>
+
+double
+__fabs (double x)
+{
+  return __builtin_fabs (x);
+}
+
+libm_alias_double (__fabs, fabs)
diff --git a/sysdeps/sw_64/fpu/s_fabsf.c b/sysdeps/sw_64/fpu/s_fabsf.c
new file mode 100644
index 00000000..6d40a9f5
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_fabsf.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 2000-2023 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson.
+
+   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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <math.h>
+#include <libm-alias-float.h>
+
+float
+__fabsf (float x)
+{
+  return __builtin_fabsf (x);
+}
+
+libm_alias_float (__fabs, fabs)
diff --git a/sysdeps/sw_64/fpu/s_fma.c b/sysdeps/sw_64/fpu/s_fma.c
new file mode 100644
index 00000000..8f626058
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_fma.c
@@ -0,0 +1,2 @@
+/* Always use dbl-64 version because long double is emulated in software.  */
+#include <sysdeps/ieee754/dbl-64/s_fma.c>
diff --git a/sysdeps/sw_64/fpu/s_isnan.c b/sysdeps/sw_64/fpu/s_isnan.c
new file mode 100644
index 00000000..da893b86
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_isnan.c
@@ -0,0 +1,57 @@
+/* Return 1 if argument is a NaN, else 0.
+   Copyright (C) 2007-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* Ugly kludge to avoid declarations.  */
+#define __isnanf not___isnanf
+#define isnanf not_isnanf
+#define __GI___isnanf not__GI___isnanf
+
+#include <math.h>
+#include <math_private.h>
+#include <math_ldbl_opt.h>
+
+#undef __isnanf
+#undef isnanf
+#undef __GI___isnanf
+
+int
+__isnan (double x)
+{
+  uint64_t ix;
+  EXTRACT_WORDS64 (ix, x);
+  return ix * 2 > 0xffe0000000000000ul;
+}
+
+hidden_def (__isnan) weak_alias (__isnan, isnan)
+
+/* It turns out that the 'double' version will also always work for
+   single-precision.  */
+strong_alias (__isnan, __isnanf) weak_alias (__isnan, isnanf)
+
+/* ??? GCC 4.8 fails to look through chains of aliases with asm names
+   attached.  Work around this for now.  */
+hidden_ver (__isnan, __isnanf)
+
+#ifdef NO_LONG_DOUBLE
+    strong_alias (__isnan, __isnanl)
+weak_alias (__isnan, isnanl)
+#endif
+#if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
+    compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
+compat_symbol (libc, isnan, isnanl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/sw_64/fpu/s_isnanf.c b/sysdeps/sw_64/fpu/s_isnanf.c
new file mode 100644
index 00000000..af41e438
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_isnanf.c
@@ -0,0 +1 @@
+/* In s_isnan.c */
diff --git a/sysdeps/sw_64/fpu/s_llrint.c b/sysdeps/sw_64/fpu/s_llrint.c
new file mode 100644
index 00000000..5db97be0
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_llrint.c
@@ -0,0 +1 @@
+/* In s_lrint.c */
diff --git a/sysdeps/sw_64/fpu/s_llrintf.c b/sysdeps/sw_64/fpu/s_llrintf.c
new file mode 100644
index 00000000..18f2885e
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_llrintf.c
@@ -0,0 +1 @@
+/* In s_lrintf.c */
diff --git a/sysdeps/sw_64/fpu/s_llround.c b/sysdeps/sw_64/fpu/s_llround.c
new file mode 100644
index 00000000..b212fbd8
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_llround.c
@@ -0,0 +1 @@
+/* In s_lround.c.  */
diff --git a/sysdeps/sw_64/fpu/s_llroundf.c b/sysdeps/sw_64/fpu/s_llroundf.c
new file mode 100644
index 00000000..73bdf310
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_llroundf.c
@@ -0,0 +1 @@
+/* In s_lroundf.c.  */
diff --git a/sysdeps/sw_64/fpu/s_lrint.c b/sysdeps/sw_64/fpu/s_lrint.c
new file mode 100644
index 00000000..06e6eef6
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_lrint.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 2007-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define __llrint not___llrint
+#define llrint not_llrint
+#include <math.h>
+#include <math_ldbl_opt.h>
+#include <libm-alias-double.h>
+#undef __llrint
+#undef llrint
+
+long int
+__lrint (double x)
+{
+#  ifdef __sw7mc_alias__
+  return _sw7mc_lrint (x);
+#  endif
+  long ret;
+  __asm ("fcvtdl %1,%0" : "=&f"(ret) : "f"(x));
+
+  return ret;
+}
+
+strong_alias (__lrint, __llrint) libm_alias_double (__lrint, lrint)
+libm_alias_double (__llrint, llrint)
diff --git a/sysdeps/sw_64/fpu/s_lrintf.c b/sysdeps/sw_64/fpu/s_lrintf.c
new file mode 100644
index 00000000..8cb89813
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_lrintf.c
@@ -0,0 +1,41 @@
+/* Copyright (C) 2007-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define __llrintf not___llrintf
+#define llrintf not_llrintf
+#include <math.h>
+#include <libm-alias-float.h>
+#undef __llrintf
+#undef llrintf
+
+long int
+__lrintf (float x)
+{
+#  ifdef __sw7mc_alias__
+  return lrint (x);
+#  endif
+  double tmp;
+  long ret;
+  __asm ("fcvtsd %2,%1\n\tfcvtdl %1,%0"
+	: "=&f"(ret), "=&f"(tmp)
+	: "f"(x));
+
+  return ret;
+}
+
+strong_alias (__lrintf, __llrintf) libm_alias_float (__lrint, lrint)
+libm_alias_float (__llrint, llrint)
diff --git a/sysdeps/sw_64/fpu/s_lround.c b/sysdeps/sw_64/fpu/s_lround.c
new file mode 100644
index 00000000..68b6f399
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_lround.c
@@ -0,0 +1,40 @@
+/* Copyright (C) 2007-2023 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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define __llround not___llround
+#define llround not_llround
+#include <math.h>
+#include <math_ldbl_opt.h>
+#include <libm-alias-double.h>
+#undef __llround
+#undef llround
+
+long int
+__lround (double x)
+{
+#  ifdef __sw7mc_alias__
+  return lround (x);
+#  endif
+  double adj, y;
+
+  adj = copysign (0.5, x);
+  asm("faddd %1,%2,%0" : "=&f"(y) : "f"(x), "f"(adj));
+  return y;
+}
+
+strong_alias (__lround, __llround) libm_alias_double (__lround, lround)
+libm_alias_double (__llround, llround)
diff --git a/sysdeps/sw_64/fpu/s_lroundf.c b/sysdeps/sw_64/fpu/s_lroundf.c
new file mode 100644
index 00000000..cb65b719
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_lroundf.c
@@ -0,0 +1,76 @@
+#define __llroundf not___llroundf
+#define llroundf not_llroundf
+#include <fenv.h>
+#include <limits.h>
+#include <math.h>
+#include <ieee754.h>
+#include <math-barriers.h>
+#include <math_private.h>
+#include <libm-alias-float.h>
+#include <tininess.h>
+#include <fix-fp-int-convert-overflow.h>
+#undef __llroundf
+#undef llroundf
+
+long int
+__lroundf (float x)
+{
+  /*
+  #ifdef __sw7mc_alias__
+    return lround (x);
+  #endif
+  */
+  int32_t j0;
+  uint32_t i;
+  long int result;
+  int sign;
+
+  GET_FLOAT_WORD (i, x);
+  j0 = ((i >> 23) & 0xff) - 0x7f;
+  sign = (i & 0x80000000) != 0 ? -1 : 1;
+  i &= 0x7fffff;
+  i |= 0x800000;
+
+  if (j0 < (int32_t) (8 * sizeof (long int)) - 1)
+    {
+      if (j0 < 0)
+	return j0 < -1 ? 0 : sign;
+      else if (j0 >= 23)
+	result = (long int) i << (j0 - 23);
+      else
+	{
+	  i += 0x400000 >> j0;
+
+	  result = i >> (23 - j0);
+	}
+    }
+  else
+    {
+#ifdef FE_INVALID
+      /* The number is too large.  Unless it rounds to LONG_MIN,
+	 FE_INVALID must be raised and the return value is
+	 unspecified.  */
+      if (FIX_FLT_LONG_CONVERT_OVERFLOW && x != (float) LONG_MIN)
+	{
+	  feraiseexcept (FE_INVALID);
+	  return sign == 1 ? LONG_MAX : LONG_MIN;
+	}
+#endif
+
+      if (x == 0x1p63 || x == 0x1p64 || x == 0x1p65
+	  || x == -0x8000010000000000p0 || x == -0x1p64 || x == -0x1p65
+	  || x == 3.40282346638528859811704183485E38
+	  || x == -3.40282346638528859811704183485E38)
+	{
+	  x = (long int) x;
+	  feclearexcept (FE_INEXACT);
+	  return x;
+	}
+      return (long int) x;
+    }
+
+  return sign * result;
+}
+
+strong_alias (__lroundf, __llroundf) libm_alias_float (__lround, lround)
+libm_alias_float (__llround, llround)
diff --git a/sysdeps/sw_64/fpu/s_rint.c b/sysdeps/sw_64/fpu/s_rint.c
new file mode 100644
index 00000000..121c613e
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_rint.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 2000-2023 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson.
+
+   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, see
+   <http://www.gnu.org/licenses/>.  */
+
+#  define NO_MATH_REDIRECT
+#include <math.h>
+#include <math_ldbl_opt.h>
+#include <libm-alias-double.h>
+
+double
+__rint (double x)
+{
+#  ifdef __sw7mc_alias__
+  return rint (x);
+#  endif
+  if (isnan (x))
+    return x + x;
+
+  if (isless (fabs (x), 9007199254740992.0)) /* 1 << DBL_MANT_DIG */
+    {
+      double tmp1, new_x;
+      __asm ("fcvtdl %2,%1\n\t"
+	    "fcvtld %1,%0\n\t"
+	    : "=f"(new_x), "=&f"(tmp1)
+	    : "f"(x));
+      /* rint(-0.1) == -0, and in general we'll always have the same
+	 sign as our input.  */
+      x = copysign (new_x, x);
+    }
+  return x;
+}
+
+libm_alias_double (__rint, rint)
diff --git a/sysdeps/sw_64/fpu/s_rintf.c b/sysdeps/sw_64/fpu/s_rintf.c
new file mode 100644
index 00000000..d24db410
--- /dev/null
+++ b/sysdeps/sw_64/fpu/s_rintf.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 2000-2023 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson.
+
+   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, see
+   <http://www.gnu.org/licenses/>.  */
+#  define NO_MATH_REDIRECT
+#include <math.h>
+#include <libm-alias-float.h>
+
+float
+__rintf (float x)
+{
+#  ifdef __sw7mc_alias__
+  return rint (x);
+#  endif
+  if (isnanf (x))
+    return x + x;
+
+  if (isless (fabsf (x), 16777216.0f)) /* 1 << FLT_MANT_DIG */
+    {
+      /* Note that Sw_64 S_Floating is stored in registers in a
+	 restricted T_Floating format, so we don't even need to
+	 convert back to S_Floating in the end.  The initial
+	 conversion to T_Floating is needed to handle denormals.  */
+
+      float tmp1, tmp2, new_x;
+
+      __asm ("fcvtsd %3,%2\n\t"
+	    "fcvtdl %2,%1\n\t"
+	    "fcvtld %1,%0\n\t"
+	    : "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2)
+	    : "f"(x));
+
+      /* rint(-0.1) == -0, and in general we'll always have the same
+	 sign as our input.  */
+      x = copysignf (new_x, x);
+    }
+  return x;
+}
+
+libm_alias_float (__rint, rint)
diff --git a/sysdeps/sw_64/fpu/ulps b/sysdeps/sw_64/fpu/ulps
new file mode 100644
index 00000000..7dcee999
--- /dev/null
+++ b/sysdeps/sw_64/fpu/ulps
@@ -0,0 +1,1826 @@
+# Begin of automatic generation
+
+# Maximal error of functions:
+Function: "acos":
+double: 1
+float: 1
+float128: 2
+ldouble: 2
+
+Function: "acos_downward":
+double: 1
+float: 1
+float128: 2
+ldouble: 2
+
+Function: "acos_towardzero":
+double: 1
+float: 1
+float128: 2
+ldouble: 2
+
+Function: "acos_upward":
+double: 1
+float: 1
+float128: 2
+ldouble: 2
+
+Function: "acosh":
+double: 2
+float: 2
+float128: 4
+ldouble: 4
+
+Function: "acosh_downward":
+double: 2
+float: 2
+float128: 4
+ldouble: 4
+
+Function: "acosh_towardzero":
+double: 2
+float: 2
+float128: 4
+ldouble: 4
+
+Function: "acosh_upward":
+double: 2
+float: 2
+float128: 3
+ldouble: 3
+
+Function: "asin":
+double: 1
+float: 1
+float128: 2
+ldouble: 2
+
+Function: "asin_downward":
+double: 1
+float: 1
+float128: 2
+ldouble: 2
+
+Function: "asin_towardzero":
+double: 1
+float: 1
+float128: 1
+ldouble: 1
+
+Function: "asin_upward":
+double: 2
+float: 1
+float128: 2
+ldouble: 2
+
+Function: "asinh":
+double: 2
+float: 2
+float128: 4
+ldouble: 4
+
+Function: "asinh_downward":
+double: 3
+float: 3
+float128: 5
+ldouble: 5
+
+Function: "asinh_towardzero":
+double: 2
+float: 2
+float128: 4
+ldouble: 4
+
+Function: "asinh_upward":
+double: 3
+float: 3
+float128: 5
+ldouble: 5
+
+Function: "atan":
+double: 1
+float: 1
+float128: 1
+ldouble: 1
+
+Function: "atan2":
+float: 2
+float128: 2
+ldouble: 2
+
+Function: "atan2_downward":
+double: 1
+float: 2
+float128: 2
+ldouble: 2
+
+Function: "atan2_towardzero":
+double: 1
+float: 2
+float128: 3
+ldouble: 3
+
+Function: "atan2_upward":
+double: 1
+float: 2
+float128: 2
+ldouble: 2
+
+Function: "atan_downward":
+double: 1
+float: 2
+float128: 2
+ldouble: 2
+
+Function: "atan_towardzero":
+double: 1
+float: 1
+float128: 1
+ldouble: 1
+
+Function: "atan_upward":
+double: 1
+float: 2
+float128: 2
+ldouble: 2
+
+Function: "atanh":
+double: 2
+float: 2
+float128: 4
+ldouble: 4
+
+Function: "atanh_downward":
+double: 3
+float: 3
+float128: 5
+ldouble: 5
+
+Function: "atanh_towardzero":
+double: 2
+float: 2
+float128: 5
+ldouble: 4
+
+Function: "atanh_upward":
+double: 3
+float: 3
+float128: 4
+ldouble: 5
+
+Function: "cabs":
+double: 1
+float128: 1
+ldouble: 1
+
+Function: "cabs_downward":
+double: 1
+float128: 1
+ldouble: 1
+
+Function: "cabs_towardzero":
+double: 1
+float128: 1
+ldouble: 1
+
+Function: "cabs_upward":
+double: 1
+float128: 1
+ldouble: 1
+
+Function: Real part of "cacos":
+double: 1
+float: 2
+float128: 2
+ldouble: 2
+
+Function: Imaginary part of "cacos":
+double: 2
+float: 2
+float128: 2
+ldouble: 2
+
+Function: Real part of "cacos_downward":
+double: 3
+float: 2
+float128: 3
+ldouble: 3
+
+Function: Imaginary part of "cacos_downward":
+double: 5
+float: 3
+float128: 6
+ldouble: 6
+
+Function: Real part of "cacos_towardzero":
+double: 3
+float: 2
+float128: 3
+ldouble: 3
+Function: Imaginary part of "cacos_towardzero":
+double: 5
+float: 3
+float128: 5
+ldouble: 5
+
+Function: Real part of "cacos_upward":
+double: 2
+float: 2
+float128: 3
+ldouble: 3
+
+Function: Imaginary part of "cacos_upward":
+double: 5
+float: 7
+float128: 7
+ldouble: 7
+
+Function: Real part of "cacosh":
+double: 2
+float: 2
+float128: 2
+ldouble: 2
+
+Function: Imaginary part of "cacosh":
+double: 1
+float: 2
+float128: 2
+ldouble: 2
+
+Function: Real part of "cacosh_downward":
+double: 5
+float: 3
+float128: 5
+ldouble: 5
+
+Function: Imaginary part of "cacosh_downward":
+double: 3
+float: 3
+float128: 4
+ldouble: 4
+
+Function: Real part of "cacosh_towardzero":
+double: 5
+float: 3
+float128: 5
+ldouble: 5
+
+Function: Imaginary part of "cacosh_towardzero":
+double: 3
+float: 2
+float128: 3
+ldouble: 3
+
+Function: Real part of "cacosh_upward":
+double: 4
+float: 4
+float128: 6
+ldouble: 6
+
+Function: Imaginary part of "cacosh_upward":
+double: 3
+float: 2
+float128: 4
+ldouble: 4
+
+Function: "carg":
+float: 1
+float128: 2
+ldouble: 2
+
+Function: "carg_downward":
+double: 1
+float: 2
+float128: 2
+ldouble: 2
+
+Function: "carg_towardzero":
+double: 1
+float: 2
+float128: 3
+ldouble: 3
+
+Function: "carg_upward":
+double: 1
+float: 2
+float128: 2
+ldouble: 2
+
+Function: Real part of "casin":
+double: 1
+float: 1
+float128: 2
+ldouble: 2
+
+Function: Imaginary part of "casin":
+double: 2
+float: 2
+float128: 2
+ldouble: 2
+
+Function: Real part of "casin_downward":
+double: 3
+float: 2
+float128: 3
+ldouble: 3
+
+Function: Imaginary part of "casin_downward":
+double: 5
+float: 3
+float128: 6
+ldouble: 6
+
+Function: Real part of "casin_towardzero":
+double: 3
+float: 1
+float128: 3
+ldouble: 3
+
+Function: Imaginary part of "casin_towardzero":
+double: 5
+float: 3
+float128: 5
+ldouble: 5
+
+Function: Real part of "casin_upward":
+double: 3
+float: 2
+float128: 3
+ldouble: 3
+
+Function: Imaginary part of "casin_upward":
+double: 5
+float: 7
+float128: 7
+ldouble: 7
+
+Function: Real part of "casinh":
+double: 2
+float: 2
+float128: 2
+ldouble: 2
+
+Function: Imaginary part of "casinh":
+double: 1
+float: 1
+float128: 2
+ldouble: 2
+
+Function: Real part of "casinh_downward":
+double: 5
+float: 3
+float128: 6
+ldouble: 6
+
+Function: Imaginary part of "casinh_downward":
+double: 3
+float: 2
+float128: 3
+ldouble: 3
+
+Function: Real part of "casinh_towardzero":
+double: 5
+float: 3
+float128: 5
+ldouble: 5
+
+Function: Imaginary part of "casinh_towardzero":
+double: 3
+float: 1
+float128: 3
+ldouble: 3
+
+Function: Real part of "casinh_upward":
+double: 5
+float: 7
+float128: 7
+ldouble: 7
+
+Function: Imaginary part of "casinh_upward":
+double: 3
+float: 2
+float128: 3
+ldouble: 3
+
+Function: Real part of "catan":
+double: 1
+float: 1
+float128: 1
+ldouble: 1
+
+Function: Imaginary part of "catan":
+double: 1
+float: 1
+float128: 1
+ldouble: 1
+
+Function: Real part of "catan_downward":
+double: 1
+float: 2
+float128: 2
+ldouble: 2
+
+Function: Imaginary part of "catan_downward":
+double: 2
+float: 2
+float128: 4
+ldouble: 4
+
+Function: Real part of "catan_towardzero":
+double: 1
+float: 2
+float128: 2
+ldouble: 2
+
+Function: Imaginary part of "catan_towardzero":
+double: 2
+float: 2
+float128: 4
+ldouble: 4
+
+Function: Real part of "catan_upward":
+double: 1
+float: 1
+float128: 2
+ldouble: 2
+
+Function: Imaginary part of "catan_upward":
+double: 3
+float: 3
+float128: 3
+ldouble: 3
+
+Function: Real part of "catanh":
+double: 1
+float: 1
+float128: 1
+ldouble: 1
+
+Function: Imaginary part of "catanh":
+double: 1
+float: 1
+float128: 1
+ldouble: 1
+
+Function: Real part of "catanh_downward":
+double: 2
+float: 2
+float128: 4
+ldouble: 4
+
+Function: Imaginary part of "catanh_downward":
+double: 1
+float: 2
+float128: 2
+ldouble: 2
+
+Function: Real part of "catanh_towardzero":
+double: 2
+float: 2
+float128: 2
+ldouble: 4
+
+Function: Imaginary part of "catanh_towardzero":
+double: 1
+float: 2
+float128: 2
+ldouble: 2
+
+Function: Real part of "catanh_upward":
+double: 4
+float: 4
+float128: 4
+ldouble: 4
+
+Function: Imaginary part of "catanh_upward":
+double: 1
+float: 1
+float128: 2
+ldouble: 2
+
+Function: "cbrt":
+double: 4
+float: 1
+float128: 1
+ldouble: 1
+
+Function: "cbrt_downward":
+double: 4
+float: 1
+float128: 1
+ldouble: 1
+
+Function: "cbrt_towardzero":
+double: 3
+float: 1
+float128: 1
+ldouble: 1
+
+Function: "cbrt_upward":
+double: 5
+float: 1
+float128: 1
+ldouble: 1
+
+Function: Real part of "ccos":
+double: 1
+float: 1
+float128: 1
+ldouble: 1
+
+Function: Imaginary part of "ccos":
+double: 1
+float: 1
+float128: 1
+ldouble: 1
+
+Function: Real part of "ccos_downward":
+double: 1
+float: 1
+float128: 3
+ldouble: 3
+
+Function: Imaginary part of "ccos_downward":
+double: 3
+float: 3
+float128: 3
+ldouble: 3
+
+Function: Real part of "ccos_towardzero":
+double: 1
+float: 2
+float128: 3
+ldouble: 3
+
+Function: Imaginary part of "ccos_towardzero":
+double: 3
+float: 3
+float128: 3
+ldouble: 3
+
+Function: Real part of "ccos_upward":
+double: 1
+float: 2
+float128: 3
+ldouble: 3
+
+Function: Imaginary part of "ccos_upward":
+double: 2
+float: 2
+float128: 2
+ldouble: 2
+
+Function: Real part of "ccosh":
+double: 1
+float: 1
+float128: 1
+ldouble: 1
+
+Function: Imaginary part of "ccosh":
+double: 1
+float: 1
+float128: 1
+ldouble: 1
+
+Function: Real part of "ccosh_downward":
+double: 2
+float: 2
+float128: 3
+ldouble: 3
+
+Function: Imaginary part of "ccosh_downward":
+double: 3
+float: 3
+float128: 3
+ldouble: 3
+
+Function: Real part of "ccosh_towardzero":
+double: 2
+float: 3
+float128: 3
+ldouble: 3
+
+Function: Imaginary part of "ccosh_towardzero":
+double: 3
+float: 3
+float128: 3
+ldouble: 3
+
+Function: Real part of "ccosh_upward":
+double: 1
+float: 2
+float128: 3
+ldouble: 3
+
+Function: Imaginary part of "ccosh_upward":
+double: 2
+float: 2
+float128: 2
+ldouble: 2
+
+Function: Real part of "cexp":
+double: 2
+float: 1
+float128: 1
+ldouble: 1
+
+Function: Imaginary part of "cexp":
+double: 1
+float: 2
+float128: 1
+ldouble: 1
+
+Function: Real part of "cexp_downward":
+double: 2
+float: 2
+float128: 3
+ldouble: 3
+
+Function: Imaginary part of "cexp_downward":
+double: 3
+float: 3
+float128: 3
+ldouble: 3
+
+Function: Real part of "cexp_towardzero":
+double: 2
+float: 2
+float128: 3
+ldouble: 3
+
+Function: Imaginary part of "cexp_towardzero":
+double: 3
+float: 3
+float128: 3
+ldouble: 3
+
+Function: Real part of "cexp_upward":
+double: 1
+float: 2
+float128: 3
+ldouble: 3
+
+Function: Imaginary part of "cexp_upward":
+double: 3
+float: 2
+float128: 3
+ldouble: 3
+
+Function: Real part of "clog":
+double: 3
+float: 3
+float128: 3
+ldouble: 3
+
+Function: Imaginary part of "clog":
+double: 1
+float: 1
+float128: 1
+ldouble: 1
+
+Function: Real part of "clog10":
+double: 3
+float: 4
+float128: 4
+ldouble: 4
+
+Function: Imaginary part of "clog10":
+double: 2
+float: 2
+float128: 2
+ldouble: 2
+
+Function: Real part of "clog10_downward":
+double: 5
+float: 5
+float128: 8
+ldouble: 8
+
+Function: Imaginary part of "clog10_downward":
+double: 2
+float: 4
+float128: 3
+ldouble: 3
+
+Function: Real part of "clog10_towardzero":
+double: 5
+float: 5
+float128: 8
+ldouble: 8
+
+Function: Imaginary part of "clog10_towardzero":
+double: 2
+float: 4
+float128: 3
+ldouble: 3
+
+Function: Real part of "clog10_upward":
+double: 6
+float: 5
+float128: 8
+ldouble: 8
+
+Function: Imaginary part of "clog10_upward":
+double: 2
+float: 4
+float128: 3
+ldouble: 3
+
+Function: Real part of "clog_downward":
+double: 4
+float: 3
+float128: 5
+ldouble: 5
+
+Function: Imaginary part of "clog_downward":
+double: 1
+float: 2
+float128: 2
+ldouble: 2
+
+Function: Real part of "clog_towardzero":
+double: 4
+float: 4
+float128: 5
+ldouble: 5
+
+Function: Imaginary part of "clog_towardzero":
+double: 1
+float: 3
+float128: 2
+ldouble: 2
+
+Function: Real part of "clog_upward":
+double: 4
+float: 3
+float128: 4
+ldouble: 4
+
+Function: Imaginary part of "clog_upward":
+double: 1
+float: 2
+float128: 2
+ldouble: 2
+
+Function: "cos":
+double: 1
+float: 1
+float128: 2
+ldouble: 2
+
+Function: "cos_downward":
+double: 1
+float: 1
+float128: 3
+ldouble: 3
+
+Function: "cos_towardzero":
+double: 1
+float: 1
+float128: 2
+ldouble: 2
+
+Function: "cos_upward":
+double: 1
+float: 1
+float128: 2
+ldouble: 2
+
+Function: "cos_vlen16":
+float: 1
+
+Function: "cos_vlen2":
+double: 2
+
+Function: "cos_vlen4":
+double: 2
+float: 1
+
+Function: "cos_vlen4_avx2":
+double: 2
+
+Function: "cos_vlen8":
+double: 2
+float: 1
+
+Function: "cos_vlen8_avx2":
+float: 1
+
+Function: "cosh":
+double: 2
+float: 2
+float128: 3
+ldouble: 3
+
+Function: "cosh_downward":
+double: 3
+float: 1
+float128: 3
+ldouble: 3
+
+Function: "cosh_towardzero":
+double: 3
+float: 1
+float128: 3
+ldouble: 3
+
+Function: "cosh_upward":
+double: 2
+float: 2
+float128: 3
+ldouble: 3
+
+Function: Real part of "cpow":
+double: 2
+float: 5
+float128: 4
+ldouble: 4
+
+Function: Imaginary part of "cpow":
+float: 2
+float128: 4
+ldouble: 4
+
+Function: Real part of "cpow_downward":
+double: 5
+float: 8
+float128: 7
+ldouble: 7
+
+Function: Imaginary part of "cpow_downward":
+double: 1
+float: 2
+float128: 2
+ldouble: 2
+
+Function: Real part of "cpow_towardzero":
+double: 5
+float: 8
+float128: 7
+ldouble: 7
+
+Function: Imaginary part of "cpow_towardzero":
+double: 1
+float: 2
+float128: 2
+ldouble: 2
+
+Function: Real part of "cpow_upward":
+double: 4
+float: 1
+float128: 3
+ldouble: 3
+
+Function: Imaginary part of "cpow_upward":
+double: 1
+float: 2
+float128: 2
+ldouble: 2
+
+Function: Real part of "csin":
+double: 1
+float: 1
+float128: 1
+ldouble: 1
+
+Function: Imaginary part of "csin":
+float128: 1
+ldouble:1
+
+Function: Real part of "csin_downward":
+double: 3
+float: 3
+float128: 3
+ldouble: 3
+
+Function: Imaginary part of "csin_downward":
+double: 1
+float: 2
+float128: 3
+ldouble: 3
+
+Function: Real part of "csin_towardzero":
+double: 3
+float: 3
+float128: 3
+ldouble: 3
+
+Function: Imaginary part of "csin_towardzero":
+double: 2
+float: 2
+float128: 3
+ldouble: 3
+
+Function: Real part of "csin_upward":
+double: 2
+float: 3
+float128: 3
+ldouble: 3
+
+Function: Imaginary part of "csin_upward":
+double: 1
+float: 3
+float128: 3
+ldouble: 3
+
+Function: Real part of "csinh":
+float: 1
+float128: 1
+ldouble: 1
+
+Function: Imaginary part of "csinh":
+double: 1
+float: 1
+float128: 1
+ldouble: 1
+
+Function: Real part of "csinh_downward":
+double: 2
+float: 2
+float128: 3
+ldouble: 3
+
+Function: Imaginary part of "csinh_downward":
+double: 3
+float: 3
+float128: 3
+ldouble: 3
+
+Function: Real part of "csinh_towardzero":
+double: 2
+float: 2
+float128: 3
+ldouble: 3
+
+Function: Imaginary part of "csinh_towardzero":
+double: 3
+float: 3
+float128: 3
+ldouble: 3
+
+Function: Real part of "csinh_upward":
+double: 1
+float: 3
+float128: 3
+ldouble: 3
+
+Function: Imaginary part of "csinh_upward":
+double: 2
+float: 3
+float128: 3
+ldouble: 3
+
+Function: Real part of "csqrt":
+double: 2
+float: 2
+float128: 2
+ldouble: 2
+
+Function: Imaginary part of "csqrt":
+double: 2
+float: 2
+float128: 2
+ldouble: 2
+
+Function: Real part of "csqrt_downward":
+double: 5
+float: 4
+float128: 5
+ldouble: 5
+
+Function: Imaginary part of "csqrt_downward":
+double: 4
+float: 3
+float128: 4
+ldouble: 4
+
+Function: Real part of "csqrt_towardzero":
+double: 4
+float: 3
+float128: 4
+ldouble: 4
+
+Function: Imaginary part of "csqrt_towardzero":
+double: 4
+float: 3
+float128: 4
+ldouble: 4
+
+Function: Real part of "csqrt_upward":
+double: 5
+float: 4
+float128: 5
+ldouble: 5
+
+Function: Imaginary part of "csqrt_upward":
+double: 3
+float: 3
+float128: 4
+ldouble: 4
+
+Function: Real part of "ctan":
+double: 1
+float: 1
+float128: 3
+ldouble: 3
+
+Function: Imaginary part of "ctan":
+double: 2
+float: 2
+float128: 3
+ldouble: 3
+
+Function: Real part of "ctan_downward":
+double: 6
+float: 5
+float128: 5
+ldouble: 5
+
+Function: Imaginary part of "ctan_downward":
+double: 2
+float: 2
+float128: 5
+ldouble: 5
+
+Function: Real part of "ctan_towardzero":
+double: 5
+float: 3
+float128: 5
+ldouble: 5
+
+Function: Imaginary part of "ctan_towardzero":
+double: 2
+float: 2
+float128: 5
+ldouble: 5
+
+Function: Real part of "ctan_upward":
+double: 2
+float: 4
+float128: 5
+ldouble: 5
+
+Function: Imaginary part of "ctan_upward":
+double: 2
+float: 2
+float128: 5
+ldouble: 5
+
+Function: Real part of "ctanh":
+double: 2
+float: 2
+float128: 3
+ldouble: 3
+
+Function: Imaginary part of "ctanh":
+double: 2
+float: 2
+float128: 3
+ldouble: 3
+
+Function: Real part of "ctanh_downward":
+double: 4
+float: 2
+float128: 5
+ldouble: 5
+
+Function: Imaginary part of "ctanh_downward":
+double: 6
+float: 5
+float128: 4
+ldouble: 4
+
+Function: Real part of "ctanh_towardzero":
+double: 2
+float: 2
+float128: 5
+ldouble: 5
+
+Function: Imaginary part of "ctanh_towardzero":
+double: 5
+float: 3
+float128: 3
+ldouble: 3
+
+Function: Real part of "ctanh_upward":
+double: 2
+float: 2
+float128: 5
+ldouble: 5
+
+Function: Imaginary part of "ctanh_upward":
+double: 2
+float: 3
+float128: 5
+ldouble: 5
+
+Function: "erf":
+double: 1
+float: 1
+float128: 1
+ldouble: 1
+
+Function: "erf_downward":
+double: 1
+float: 1
+float128: 2
+ldouble: 2
+
+Function: "erf_towardzero":
+double: 1
+float: 1
+float128: 1
+ldouble: 1
+
+Function: "erf_upward":
+double: 1
+float: 1
+float128: 2
+ldouble: 2
+
+Function: "erfc":
+double: 5
+float: 3
+float128: 5
+ldouble: 5
+
+Function: "erfc_downward":
+double: 5
+float: 6
+float128: 5
+ldouble: 5
+
+Function: "erfc_towardzero":
+double: 3
+float: 4
+float128: 4
+ldouble: 4
+
+Function: "erfc_upward":
+double: 5
+float: 6
+float128: 5
+ldouble: 5
+
+Function: "exp":
+double: 1
+float: 1
+float128: 1
+ldouble: 1
+
+Function: "exp10":
+double: 2
+float: 1
+float128: 2
+ldouble: 2
+
+Function: "exp10_downward":
+double: 3
+float: 1
+float128: 3
+ldouble: 3
+
+Function: "exp10_towardzero":
+double: 3
+float: 1
+float128: 3
+ldouble: 3
+
+Function: "exp10_upward":
+double: 2
+float: 1
+float128: 3
+ldouble: 3
+
+Function: "exp2":
+double: 1
+float: 1
+float128: 1
+ldouble: 1
+
+Function: "exp2_downward":
+double: 1
+float: 1
+float128: 1
+ldouble: 1
+
+Function: "exp2_towardzero":
+double: 1
+float: 1
+float128: 1
+ldouble: 1
+
+Function: "exp2_upward":
+double: 1
+float: 1
+float128: 2
+ldouble: 2
+
+Function: "exp_downward":
+double: 1
+float: 1
+ldouble: 1
+
+Function: "exp_towardzero":
+double: 1
+float: 1
+ldouble: 2
+
+Function: "exp_upward":
+double: 1
+float: 1
+ldouble: 1
+
+Function: "exp_vlen16":
+float: 1
+
+Function: "exp_vlen2":
+double: 1
+
+Function: "exp_vlen4":
+double: 1
+float: 1
+
+Function: "exp_vlen4_avx2":
+double: 1
+
+Function: "exp_vlen8":
+double: 1
+float: 1
+
+Function: "exp_vlen8_avx2":
+float: 1
+
+Function: "expm1":
+double: 1
+float: 1
+float128: 3
+ldouble: 3
+
+Function: "expm1_downward":
+double: 1
+float: 1
+float128: 4
+ldouble: 4
+
+Function: "expm1_towardzero":
+double: 1
+float: 2
+float128: 4
+ldouble: 4
+
+Function: "expm1_upward":
+double: 1
+float: 1
+float128: 4
+ldouble: 4
+
+Function: "gamma":
+double: 4
+float: 7
+ldouble: 5
+
+Function: "gamma_downward":
+double: 5
+float: 7
+ldouble: 8
+
+Function: "gamma_towardzero":
+double: 5
+float: 6
+ldouble: 7
+
+Function: "gamma_upward":
+double: 5
+float: 6
+ldouble: 6
+
+Function: "hypot":
+double: 1
+float128: 1
+ldouble: 1
+
+Function: "hypot_downward":
+double: 1
+float128: 1
+ldouble: 1
+
+Function: "hypot_towardzero":
+double: 1
+float128: 1
+ldouble: 1
+
+Function: "hypot_upward":
+double: 1
+float128: 1
+ldouble: 1
+
+Function: "j0":
+double: 3
+float: 9
+float128: 8
+ldouble: 8
+
+Function: "j0_downward":
+double: 6
+float: 9
+float128: 9
+ldouble: 9
+
+Function: "j0_towardzero":
+double: 7
+float: 9
+float128: 9
+ldouble: 9
+
+Function: "j0_upward":
+double: 9
+float: 9
+float128: 7
+ldouble: 7
+
+Function: "j1":
+double: 4
+float: 9
+float128: 9
+ldouble: 9
+
+Function: "j1_downward":
+double: 6
+float: 8
+float128: 8
+ldouble: 8
+
+Function: "j1_towardzero":
+double: 4
+float: 9
+float128: 9
+ldouble: 9
+
+Function: "j1_upward":
+double: 9
+float: 9
+float128: 9
+ldouble: 9
+
+Function: "jn":
+double: 4
+float: 4
+float128: 7
+ldouble: 7
+
+Function: "jn_downward":
+double: 5
+float: 5
+float128: 8
+ldouble: 8
+
+Function: "jn_towardzero":
+double: 5
+float: 5
+float128: 8
+ldouble: 8
+
+Function: "jn_upward":
+double: 5
+float: 5
+float128: 7
+ldouble: 7
+
+Function: "lgamma":
+double: 4
+float: 7
+float128: 5
+ldouble: 5
+
+Function: "lgamma_downward":
+double: 5
+float: 7
+float128: 8
+ldouble: 8
+
+Function: "lgamma_towardzero":
+double: 5
+float: 6
+float128: 5
+ldouble: 7
+
+Function: "lgamma_upward":
+double: 5
+float: 6
+float128: 8
+ldouble: 8
+
+Function: "log":
+double: 1
+float: 1
+float128: 1
+ldouble: 1
+
+Function: "log10":
+double: 2
+float: 2
+float128: 2
+ldouble: 2
+
+Function: "log10_downward":
+double: 2
+float: 3
+float128: 2
+ldouble: 2
+
+Function: "log10_towardzero":
+double: 2
+float: 2
+float128: 2
+ldouble: 2
+
+Function: "log10_upward":
+double: 2
+float: 2
+float128: 1
+ldouble: 1
+
+Function: "log1p":
+double: 1
+float: 1
+float128: 3
+ldouble: 3
+
+Function: "log1p_downward":
+double: 2
+float: 2
+float128: 4
+ldouble: 4
+
+Function: "log1p_towardzero":
+double: 2
+float: 2
+float128: 4
+ldouble: 4
+
+Function: "log1p_upward":
+double: 2
+float: 2
+float128: 3
+ldouble: 3
+
+Function: "log2":
+double: 2
+float: 1
+float128: 3
+ldouble: 3
+
+Function: "log2_downward":
+double: 3
+float: 3
+float128: 3
+ldouble: 3
+
+Function: "log2_towardzero":
+double: 2
+float: 2
+float128: 1
+ldouble: 1
+
+Function: "log2_upward":
+double: 3
+float: 3
+float128: 1
+ldouble: 1
+
+Function: "log_downward":
+float: 2
+float128: 2
+ldouble: 2
+
+Function: "log_towardzero":
+float: 2
+float128: 2
+ldouble: 2
+
+Function: "log_upward":
+double: 1
+float: 2
+float128: 1
+ldouble: 1
+
+Function: "log_vlen16":
+float: 3
+
+Function: "log_vlen2":
+double: 1
+
+Function: "log_vlen4":
+double: 1
+float: 3
+
+Function: "log_vlen4_avx2":
+double: 1
+
+Function: "log_vlen8":
+double: 1
+float: 3
+
+Function: "log_vlen8_avx2":
+float: 3
+
+Function: "pow":
+double: 1
+float: 1
+float128: 2
+ldouble: 2
+
+Function: "pow_downward":
+double: 1
+float: 1
+float128: 4
+ldouble: 4
+
+Function: "pow_towardzero":
+double: 1
+float: 1
+float128: 4
+ldouble: 4
+
+Function: "pow_upward":
+double: 1
+float: 1
+float128: 4
+ldouble: 4
+
+Function: "pow_vlen16":
+float: 3
+
+Function: "pow_vlen2":
+double: 1
+
+Function: "pow_vlen4":
+double: 1
+float: 3
+
+Function: "pow_vlen4_avx2":
+double: 1
+
+Function: "pow_vlen8":
+double: 1
+float: 3
+
+Function: "pow_vlen8_avx2":
+float: 3
+
+Function: "sin":
+double: 1
+float: 1
+float128: 2
+ldouble: 2
+
+Function: "sin_downward":
+double: 1
+float: 1
+float128: 3
+ldouble: 3
+
+Function: "sin_towardzero":
+double: 1
+float: 1
+float128: 2
+ldouble: 2
+
+Function: "sin_upward":
+double: 1
+float: 1
+float128: 3
+ldouble: 3
+
+Function: "sin_vlen16":
+float: 1
+
+Function: "sin_vlen2":
+double: 2
+
+Function: "sin_vlen4":
+double: 2
+float: 1
+
+Function: "sin_vlen4_avx2":
+double: 2
+
+Function: "sin_vlen8":
+double: 2
+float: 1
+
+Function: "sin_vlen8_avx2":
+float: 1
+
+Function: "sincos":
+double: 1
+float128: 1
+ldouble: 1
+
+Function: "sincos_downward":
+double: 1
+float: 1
+float128: 3
+ldouble: 3
+
+Function: "sincos_towardzero":
+double: 1
+float: 1
+float128: 2
+ldouble: 2
+
+Function: "sincos_upward":
+double: 1
+float: 1
+float128: 3
+ldouble: 3
+
+Function: "sincos_vlen16":
+float: 1
+
+Function: "sincos_vlen2":
+double: 2
+
+Function: "sincos_vlen4":
+double: 2
+float: 1
+
+Function: "sincos_vlen4_avx2":
+double: 2
+
+Function: "sincos_vlen8":
+double: 2
+float: 1
+
+Function: "sincos_vlen8_avx2":
+float: 1
+
+Function: "sinh":
+double: 2
+float: 2
+float128: 2
+ldouble: 3
+
+Function: "sinh_downward":
+double: 3
+float: 3
+float128: 5
+ldouble: 5
+
+Function: "sinh_towardzero":
+double: 3
+float: 2
+float128: 4
+ldouble: 4
+
+Function: "sinh_upward":
+double: 3
+float: 3
+float128: 5
+ldouble: 5
+
+Function: "tan":
+float: 1
+float128: 2
+ldouble: 2
+
+Function: "tan_downward":
+double: 1
+float: 2
+float128: 3
+ldouble: 3
+
+Function: "tan_towardzero":
+double: 1
+float: 1
+float128: 3
+ldouble: 3
+
+Function: "tan_upward":
+double: 1
+float: 1
+float128: 2
+ldouble: 2
+
+Function: "tanh":
+double: 2
+float: 2
+float128: 3
+ldouble: 3
+
+Function: "tanh_downward":
+double: 3
+float: 3
+float128: 4
+ldouble: 4
+
+Function: "tanh_towardzero":
+double: 2
+float: 2
+float128: 3
+ldouble: 3
+
+Function: "tanh_upward":
+double: 3
+float: 3
+float128: 4
+ldouble: 4
+
+Function: "tgamma":
+double: 9
+float: 8
+float128: 5
+ldouble: 5
+
+Function: "tgamma_downward":
+double: 9
+float: 7
+float128: 6
+ldouble: 6
+
+Function: "tgamma_towardzero":
+double: 9
+float: 7
+float128: 6
+ldouble: 6
+
+Function: "tgamma_upward":
+double: 9
+float: 8
+float128: 5
+ldouble: 5
+
+Function: "y0":
+double: 3
+float: 9
+float128: 3
+ldouble: 3
+
+Function: "y0_downward":
+double: 4
+float: 9
+float128: 7
+ldouble: 7
+
+Function: "y0_towardzero":
+double: 4
+float: 9
+float128: 8
+ldouble: 8
+
+Function: "y0_upward":
+double: 3
+float: 9
+float128: 7
+ldouble: 7
+
+Function: "y1":
+double: 6
+float: 9
+float128: 5
+ldouble: 5
+
+Function: "y1_downward":
+double: 6
+float: 9
+float128: 7
+ldouble: 7
+
+Function: "y1_towardzero":
+double: 4
+float: 9
+float128: 6
+ldouble: 6
+
+Function: "y1_upward":
+double: 7
+float: 9
+float128: 9
+ldouble: 9
+
+Function: "yn":
+double: 3
+float: 3
+float128: 5
+ldouble: 5
+
+Function: "yn_downward":
+double: 3
+float: 4
+float128: 5
+ldouble: 5
+
+Function: "yn_towardzero":
+double: 3
+float: 3
+float128: 5
+ldouble: 5
+
+Function: "yn_upward":
+double: 4
+float: 5
+float128: 5
+ldouble: 5
+
+# end of automatic generation
diff --git a/sysdeps/sw_64/hp-timing.h b/sysdeps/sw_64/hp-timing.h
new file mode 100644
index 00000000..b30e6ed5
--- /dev/null
+++ b/sysdeps/sw_64/hp-timing.h
@@ -0,0 +1,48 @@
+/* High precision, low overhead timing functions.  Sw_64 version.
+   Copyright (C) 2001-2023 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson <rth@redhat.com>, 2001.
+
+   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, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _HP_TIMING_SW_64_H
+#define _HP_TIMING_SW_64_H 1
+
+#if IS_IN (rtld)
+/* We always have the timestamp register, but it's got only a 4 second
+   range.  Use it for ld.so profiling only.  */
+#  define HP_TIMING_INLINE (1)
+
+/* We use 32 bit values for the times.  */
+typedef unsigned int hp_timing_t;
+
+/* The "rpcc" instruction returns a 32-bit counting half and a 32-bit
+   "virtual cycle counter displacement".  Subtracting the two gives us
+   a virtual cycle count.  */
+#  define HP_TIMING_NOW(VAR)						  \
+    do									\
+      {								       \
+	unsigned long int x_;						 \
+	asm volatile ("rtc %0" : "=r"(x_));				    \
+	(VAR) = (int) (x_) - (int) (x_ >> 32);				\
+      }								       \
+    while (0)
+#  include <hp-timing-common.h>
+
+#else
+#  include <sysdeps/generic/hp-timing.h>
+#endif /* IS_IN(rtld)  */
+
+#endif /* hp-timing.h */
-- 
2.25.1

