diff mbox

PATCH 3/3] powerpc: fmod multiarch

Message ID 54627994.3030705@linux.vnet.ibm.com
State New
Headers show

Commit Message

Adhemerval Zanella Nov. 11, 2014, 9:03 p.m. UTC
This patch adds a multiarch symbol for __ieee754_fmod to select over
POWER8 and default ppc64 version.

Tested on powerpc64 and powerpc64le.

--

	* sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
	[libm-sysdep_routines]: Add fmod implementations.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/e_fmod-power8.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/e_fmod-ppc64.c: New file.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/e_fmod.c: New file.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/e_fmodf-power8.S: New file.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/e_fmodf-ppc64.c: New file.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/e_fmodf.c: New file.

---
diff mbox

Patch

diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
index 0e3eac7..a3af924 100644
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
@@ -24,7 +24,9 @@  libm-sysdep_routines += s_isnan-power7 s_isnan-power6x s_isnan-power6 \
 			s_modff-power5+ s_modff-ppc64 e_hypot-ppc64 \
 			e_hypot-power7 e_hypotf-ppc64 e_hypotf-power7 \
 			s_isnan-power8 s_isinf-power8 s_finite-power8 \
-			s_llrint-power8 s_llround-power8
+			s_llrint-power8 s_llround-power8 \
+			e_fmod-power8 e_fmodf-power8 e_fmod-ppc64 \
+			e_fmodf-ppc64
 
 CFLAGS-s_logbf-power7.c = -mcpu=power7
 CFLAGS-s_logbl-power7.c = -mcpu=power7
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/e_fmod-power8.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/e_fmod-power8.S
new file mode 100644
index 0000000..ee3aca9
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/e_fmod-power8.S
@@ -0,0 +1,26 @@ 
+/* __ieee754_fmod POWER8 version.
+   Copyright (C) 2014 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 <sysdep.h>
+
+#undef strong_alias
+#define strong_alias(name, alias)
+
+#define __ieee754_fmod __ieee754_fmod_power8
+
+#include <sysdeps/powerpc/powerpc64/power8/fpu/e_fmod.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/e_fmod-ppc64.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/e_fmod-ppc64.c
new file mode 100644
index 0000000..d2c30eb
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/e_fmod-ppc64.c
@@ -0,0 +1,26 @@ 
+/* __ieee754_fmod PowerPC64 version.
+   Copyright (C) 2013-2014 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 strong_alias
+#define strong_alias(a, b)
+
+#define __ieee754_fmod __ieee754_fmod_ppc64
+
+#include <sysdeps/ieee754/dbl-64/wordsize-64/e_fmod.c>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/e_fmod.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/e_fmod.c
new file mode 100644
index 0000000..b01b3ee
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/e_fmod.c
@@ -0,0 +1,31 @@ 
+/* Multiple versions of ieee754_fmod.
+   Copyright (C) 2013-2014 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_private.h>
+#include "init-arch.h"
+
+extern __typeof (__ieee754_fmod) __ieee754_fmod_ppc64 attribute_hidden;
+extern __typeof (__ieee754_fmod) __ieee754_fmod_power8 attribute_hidden;
+
+libc_ifunc (__ieee754_fmod,
+	    (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+	    ? __ieee754_fmod_power8
+            : __ieee754_fmod_ppc64);
+
+strong_alias (__ieee754_fmod, __fmod_finite)
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/e_fmodf-power8.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/e_fmodf-power8.S
new file mode 100644
index 0000000..5caf392
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/e_fmodf-power8.S
@@ -0,0 +1,26 @@ 
+/* __ieee_fmodf POWER8 version.
+   Copyright (C) 2014 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 <sysdep.h>
+
+#undef strong_alias
+#define strong_alias(name, alias)
+
+#define __ieee754_fmodf __ieee754_fmodf_power8
+
+#include <sysdeps/powerpc/powerpc64/power8/fpu/e_fmodf.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/e_fmodf-ppc64.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/e_fmodf-ppc64.c
new file mode 100644
index 0000000..8b1d387
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/e_fmodf-ppc64.c
@@ -0,0 +1,26 @@ 
+/* __ieee754_fmodf PowerPC64 version.
+   Copyright (C) 2013-2014 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 strong_alias
+#define strong_alias(a, b)
+
+#define __ieee754_fmodf __ieee754_fmodf_ppc64
+
+#include <sysdeps/ieee754/flt-32/e_fmodf.c>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/e_fmodf.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/e_fmodf.c
new file mode 100644
index 0000000..a11f9bf
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/e_fmodf.c
@@ -0,0 +1,31 @@ 
+/* Multiple versions of ieee754_fmodf.
+   Copyright (C) 2013-2014 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_private.h>
+#include "init-arch.h"
+
+extern __typeof (__ieee754_fmodf) __ieee754_fmodf_ppc64 attribute_hidden;
+extern __typeof (__ieee754_fmodf) __ieee754_fmodf_power8 attribute_hidden;
+
+libc_ifunc (__ieee754_fmodf,
+	    (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+	    ? __ieee754_fmodf_power8
+            : __ieee754_fmodf_ppc64);
+
+strong_alias (__ieee754_fmodf, __fmodf_finite)