@@ -14,7 +14,10 @@ libm-sysdep_routines += s_ceil-power5+ \
s_trunc-power5+ \
s_trunc-ppc64 \
s_truncf-power5+ \
- s_truncf-ppc64
+ s_truncf-ppc64 \
+ s_llrint-power8 \
+ s_llrint-power6x \
+ s_llrint-ppc64
CFLAGS-s_ceil-power5+.c = -mcpu=power5+
CFLAGS-s_ceilf-power5+.c = -mcpu=power5+
@@ -24,4 +27,6 @@ CFLAGS-s_round-power5+.c = -mcpu=power5+
CFLAGS-s_roundf-power5+.c = -mcpu=power5+
CFLAGS-s_trunc-power5+.c = -mcpu=power5+
CFLAGS-s_truncf-power5+.c = -mcpu=power5+
+CFLAGS-s_llrint-power8.c += -mcpu=power8
+CFLAGS-s_llrint-power6x.c += -mcpu=power6x
endif
new file mode 100644
@@ -0,0 +1,2 @@
+#define __llrint __llrint_power6x
+#include <sysdeps/powerpc/powerpc64/fpu/s_llrint.c>
new file mode 100644
@@ -0,0 +1,2 @@
+#define __llrint __llrint_power8
+#include <sysdeps/powerpc/powerpc64/fpu/s_llrint.c>
new file mode 100644
@@ -0,0 +1,2 @@
+#define __llrint __llrint_ppc64
+#include <sysdeps/powerpc/powerpc64/fpu/s_llrint.c>
similarity index 100%
rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint.c
rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrint.c
similarity index 100%
rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrintf.c
rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_llrintf.c
similarity index 100%
rename from sysdeps/powerpc/powerpc64/fpu/multiarch/s_lrint.c
rename to sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_lrint.c
new file mode 100644
@@ -0,0 +1,5 @@
+ifeq ($(subdir),math)
+# lrintf and llrintf are aliased to llrint, so suppress compiler builtins to
+# avoid mismatched signatures.
+CFLAGS-s_llrint.c += -fno-builtin-lrintf -fno-builtin-llrintf
+endif
@@ -8,12 +8,11 @@ sysdep_calls := s_modf-power5+ s_modf-ppc64 \
sysdep_routines += $(sysdep_calls)
libm-sysdep_routines += s_llround-power6x \
s_llround-power5+ s_llround-ppc64 \
- s_llrint-power6x s_llrint-ppc64 \
s_logb-power7 s_logbf-power7 \
s_logbl-power7 s_logb-ppc64 s_logbf-ppc64 \
s_logbl-ppc64 e_hypot-ppc64 \
e_hypot-power7 e_hypotf-ppc64 e_hypotf-power7 \
- s_llrint-power8 s_llround-power8 s_llroundf-ppc64 \
+ s_llround-power8 s_llroundf-ppc64 \
e_expf-power8 e_expf-ppc64 \
$(sysdep_calls:s_%=m_%)
deleted file mode 100644
@@ -1,30 +0,0 @@
-/* Round double to long int. PowerPC64/POWER6X default version.
- 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 <shlib-compat.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-#undef strong_alias
-#define strong_alias(a,b)
-#undef compat_symbol
-#define compat_symbol(a,b,c,d)
-
-#define __llrint __llrint_power6x
-
-#include <sysdeps/powerpc/powerpc64/power6x/fpu/s_llrint.S>
deleted file mode 100644
@@ -1,30 +0,0 @@
-/* Round double to long int. PowerPC64/POWER6X default version.
- Copyright (C) 2014-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 <shlib-compat.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-#undef strong_alias
-#define strong_alias(a,b)
-#undef compat_symbol
-#define compat_symbol(a,b,c,d)
-
-#define __llrint __llrint_power8
-
-#include <sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S>
deleted file mode 100644
@@ -1,30 +0,0 @@
-/* Round double to long int. PowerPC32 default version.
- 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 <shlib-compat.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-#undef strong_alias
-#define strong_alias(a,b)
-#undef compat_symbol
-#define compat_symbol(a,b,c,d)
-
-#define __llrint __llrint_ppc64
-
-#include <sysdeps/powerpc/powerpc64/fpu/s_llrint.S>
deleted file mode 100644
@@ -1,45 +0,0 @@
-/* Round double to long int. PowerPC64 version.
- Copyright (C) 2004-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 <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-float.h>
-#include <libm-alias-double.h>
-
-/* long long int[r3] __llrint (double x[fp1]) */
-ENTRY_TOCLESS (__llrint)
- CALL_MCOUNT 0
- fctid fp13,fp1
- stfd fp13,-16(r1)
- nop /* Insure the following load is in a different dispatch group */
- nop /* to avoid pipe stall on POWER4&5. */
- nop
- ld r3,-16(r1)
- blr
- END (__llrint)
-
-strong_alias (__llrint, __lrint)
-libm_alias_double (__llrint, llrint)
-libm_alias_double (__lrint, lrint)
-/* The double version also works for single-precision as both float and
- double parameters are passed in 64bit FPRs and both versions are expected
- to return [long] long type. */
-strong_alias (__llrint, __llrintf)
-libm_alias_float (__llrint, llrint)
-strong_alias (__lrint, __lrintf)
-libm_alias_float (__lrint, lrint)
new file mode 100644
@@ -0,0 +1,55 @@
+/* Round to nearest integer. PowerPC64 version.
+ Copyright (C) 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If
+ not, see <http://www.gnu.org/licenses/>. */
+
+#define NO_MATH_REDIRECT
+#define lrint __redirect_lrint
+#define lrintf __redirect_lrintf
+#define llrintf __redirect_llrintf
+#define __lrint __redirect___lrint
+#define __lrintf __redirect___lrintf
+#define __llrintf __redirect___llrintf
+#include <math.h>
+#undef lrint
+#undef lrintf
+#undef llrintf
+#undef __lrint
+#undef __lrintf
+#undef __llrintf
+#include <libm-alias-float.h>
+#include <libm-alias-double.h>
+
+long long int
+__llrint (double x)
+{
+ long int ret;
+ __asm__ ("fctid %0, %1" : "=d" (ret) : "d" (x));
+ return ret;
+}
+#ifndef __llrint
+strong_alias (__llrint, __lrint)
+libm_alias_double (__llrint, llrint)
+libm_alias_double (__lrint, lrint)
+
+/* The double version also works for single-precision as both float and
+ double parameters are passed in 64bit FPRs and both versions are expected
+ to return [long] long type. */
+strong_alias (__llrint, __llrintf)
+libm_alias_float (__llrint, llrint)
+strong_alias (__lrint, __lrintf)
+libm_alias_float (__lrint, lrint)
+#endif
deleted file mode 100644
@@ -1 +0,0 @@
-/* __llrintf is in s_llrint.S. */
new file mode 100644
@@ -0,0 +1 @@
+/* llrintf is implemented at s_llrint.c */
deleted file mode 100644
@@ -1 +0,0 @@
-/* __lrint is in s_llrint.c */
new file mode 100644
@@ -0,0 +1 @@
+/* lrint is implemented at s_llrint.c */
new file mode 100644
@@ -0,0 +1 @@
+/* lrintf is implemented at s_llrint.c */
deleted file mode 100644
@@ -1,42 +0,0 @@
-/* Round double to long int. POWER6x PowerPC64 version.
- Copyright (C) 2006-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 <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-float.h>
-#include <libm-alias-double.h>
-
- .machine "power6"
-/* long long int[r3] __llrint (double x[fp1]) */
-ENTRY_TOCLESS (__llrint)
- CALL_MCOUNT 0
- fctid fp13,fp1
- mftgpr r3,fp13
- blr
- END (__llrint)
-
-strong_alias (__llrint, __lrint)
-libm_alias_double (__llrint, llrint)
-libm_alias_double (__lrint, lrint)
-/* The double version also works for single-precision as both float and
- double parameters are passed in 64bit FPRs and both versions are expected
- to return [long] long type. */
-strong_alias (__llrint, __llrintf)
-libm_alias_float (__llrint, llrint)
-strong_alias (__lrint, __lrintf)
-libm_alias_float (__lrint, lrint)
deleted file mode 100644
@@ -1,43 +0,0 @@
-/* Round double to long int. POWER8 PowerPC64 version.
- Copyright (C) 2014-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 <sysdep.h>
-#include <math_ldbl_opt.h>
-#include <libm-alias-float.h>
-#include <libm-alias-double.h>
-
-#define MFVSRD_R3_V1 .long 0x7c230066 /* mfvsrd r3,vs1 */
-
-/* long long int[r3] __llrint (double x[fp1]) */
-ENTRY_TOCLESS (__llrint)
- CALL_MCOUNT 0
- fctid fp1,fp1
- MFVSRD_R3_V1
- blr
-END (__llrint)
-
-strong_alias (__llrint, __lrint)
-libm_alias_double (__llrint, llrint)
-libm_alias_double (__lrint, lrint)
-/* The double version also works for single-precision as both float and
- double parameters are passed in 64bit FPRs and both versions are expected
- to return [long] long type. */
-strong_alias (__llrint, __llrintf)
-libm_alias_float (__llrint, llrint)
-strong_alias (__lrint, __lrintf)
-libm_alias_float (__lrint, lrint)