about summary refs log tree commit diff
path: root/sysdeps/powerpc/powerpc64/be/fpu
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/powerpc/powerpc64/be/fpu')
-rw-r--r--sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile19
-rw-r--r--sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-power5+.c20
-rw-r--r--sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-ppc64.c24
-rw-r--r--sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf.c37
-rw-r--r--sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-power5+.c20
-rw-r--r--sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-ppc64.c26
-rw-r--r--sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff.c31
7 files changed, 176 insertions, 1 deletions
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
index f542e89520..f5fa357d57 100644
--- a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
@@ -1,4 +1,13 @@
 ifeq ($(subdir),math)
+# These functions are built both for libc and libm because they're required
+# by printf.  While the libc objects have the prefix s_, the libm ones are
+# prefixed with  m_.
+sysdep_calls := s_modf-power5+ \
+		s_modf-ppc64 \
+		s_modff-power5+ \
+		s_modff-ppc64
+
+sysdep_routines += $(sysdep_calls)
 libm-sysdep_routines += s_ceil-power5+ \
 			s_ceil-ppc64 \
 			s_ceilf-power5+ \
@@ -22,7 +31,8 @@ libm-sysdep_routines += s_ceil-power5+ \
 			s_llround-power6x \
 			s_llround-power5+ \
 			s_llround-ppc64 \
-			s_llroundf-ppc64
+			s_llroundf-ppc64 \
+			$(sysdep_calls:s_%=m_%)
 
 CFLAGS-s_ceil-power5+.c = -mcpu=power5+
 CFLAGS-s_ceilf-power5+.c = -mcpu=power5+
@@ -37,4 +47,11 @@ CFLAGS-s_llrint-power6x.c += -mcpu=power6x
 CFLAGS-s_llround-power8.c += -mcpu=power8
 CFLAGS-s_llround-power6x.c += -mcpu=power6x
 CFLAGS-s_llround-power5+.c += -mcpu=power5+
+
+CFLAGS-s_modf-power5+.c += -mcpu=power5+
+CFLAGS-s_modff-power5+.c += -mcpu=power5+
+# These files quiet sNaNs in a way that is optimized away without
+# -fsignaling-nans.
+CFLAGS-s_modf-ppc64.c += -fsignaling-nans
+CFLAGS-s_modff-ppc64.c += -fsignaling-nans
 endif
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-power5+.c
new file mode 100644
index 0000000000..6f93c2b652
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-power5+.c
@@ -0,0 +1,20 @@
+/* PowerPC/POWER5+ implementation for modf.
+   Copyright (C) 2013-2019 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 __modf __modf_power5plus
+#include <sysdeps/powerpc/fpu/s_modf.c>
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-ppc64.c
new file mode 100644
index 0000000000..06f0e87281
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf-ppc64.c
@@ -0,0 +1,24 @@
+/* PowerPC64 default implementation for modf.
+   Copyright (C) 2013-2019 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 <math.h>
+#include <math_ldbl_opt.h>
+
+#define __modf __modf_ppc64
+
+#include <sysdeps/ieee754/dbl-64/s_modf.c>
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf.c
new file mode 100644
index 0000000000..af57aaaf85
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modf.c
@@ -0,0 +1,37 @@
+/* Multiple versions of modf.
+   Copyright (C) 2013-2019 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 <math.h>
+#include <math_ldbl_opt.h>
+#include <shlib-compat.h>
+#include "init-arch.h"
+#include <libm-alias-double.h>
+
+extern __typeof (__modf) __modf_ppc64 attribute_hidden;
+extern __typeof (__modf) __modf_power5plus attribute_hidden;
+
+libc_ifunc (__modf,
+	    (hwcap & PPC_FEATURE_POWER5_PLUS)
+	    ? __modf_power5plus
+            : __modf_ppc64);
+
+libm_alias_double (__modf, modf)
+
+#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0)
+compat_symbol (libc, __modf, modfl, GLIBC_2_0);
+#endif
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-power5+.c
new file mode 100644
index 0000000000..2e701881e8
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-power5+.c
@@ -0,0 +1,20 @@
+/* PowerPC/POWER5+ implementation for modff.
+   Copyright (C) 2013-2019 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 __modff __modff_power5plus
+#include <sysdeps/powerpc/fpu/s_modff.c>
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-ppc64.c
new file mode 100644
index 0000000000..5af1887d3b
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff-ppc64.c
@@ -0,0 +1,26 @@
+/* PowerPC64 default implementation for modff.
+   Copyright (C) 2013-2019 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 <math.h>
+
+#undef weak_alias
+#define weak_alias(a,b)
+
+#define __modff __modff_ppc64
+
+#include <sysdeps/ieee754/flt-32/s_modff.c>
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff.c
new file mode 100644
index 0000000000..f048f4abcf
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_modff.c
@@ -0,0 +1,31 @@
+/* Multiple versions of modff.
+   Copyright (C) 2013-2019 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 <math.h>
+#include "init-arch.h"
+#include <libm-alias-float.h>
+
+extern __typeof (__modff) __modff_ppc64 attribute_hidden;
+extern __typeof (__modff) __modff_power5plus attribute_hidden;
+
+libc_ifunc (__modff,
+	    (hwcap & PPC_FEATURE_POWER5_PLUS)
+	    ? __modff_power5plus
+            : __modff_ppc64);
+
+libm_alias_float (__modf, modf)