aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/powerpc
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/powerpc')
-rw-r--r--sysdeps/powerpc/fpu/round_to_integer.h4
-rw-r--r--sysdeps/powerpc/fpu/s_trunc.c35
-rw-r--r--sysdeps/powerpc/fpu/s_truncf.c35
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_trunc.S83
-rw-r--r--sysdeps/powerpc/powerpc32/fpu/s_truncf.S83
-rw-r--r--sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-power5+.S33
-rw-r--r--sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-power5+.c3
-rw-r--r--sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-ppc32.S31
-rw-r--r--sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-ppc32.c3
-rw-r--r--sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-power5+.S26
-rw-r--r--sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-power5+.c3
-rw-r--r--sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-ppc32.S27
-rw-r--r--sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-ppc32.c3
-rw-r--r--sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S29
-rw-r--r--sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S30
-rw-r--r--sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile8
-rw-r--r--sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf.c2
-rw-r--r--sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc-power5+.c3
-rw-r--r--sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc-ppc64.c3
-rw-r--r--sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc.c (renamed from sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc.c)0
-rw-r--r--sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf-power5+.c3
-rw-r--r--sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf-ppc64.c3
-rw-r--r--sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf.c (renamed from sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf.c)2
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile2
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc-power5+.S30
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc-ppc64.S30
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf-power5+.S24
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf-ppc64.S24
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_trunc.S72
-rw-r--r--sysdeps/powerpc/powerpc64/fpu/s_truncf.S74
-rw-r--r--sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S30
-rw-r--r--sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S31
32 files changed, 104 insertions, 665 deletions
diff --git a/sysdeps/powerpc/fpu/round_to_integer.h b/sysdeps/powerpc/fpu/round_to_integer.h
index b318e37190..b29d030e2d 100644
--- a/sysdeps/powerpc/fpu/round_to_integer.h
+++ b/sysdeps/powerpc/fpu/round_to_integer.h
@@ -25,7 +25,8 @@ enum round_mode
{
CEIL,
FLOOR,
- ROUND
+ ROUND,
+ TRUNC
};
static inline void
@@ -36,6 +37,7 @@ set_fenv_mode (enum round_mode mode)
{
case CEIL: rmode = FE_UPWARD; break;
case FLOOR: rmode = FE_DOWNWARD; break;
+ case TRUNC:
case ROUND: rmode = FE_TOWARDZERO; break;
default: rmode = FE_TONEAREST; break;
}
diff --git a/sysdeps/powerpc/fpu/s_trunc.c b/sysdeps/powerpc/fpu/s_trunc.c
new file mode 100644
index 0000000000..83caf6b9cc
--- /dev/null
+++ b/sysdeps/powerpc/fpu/s_trunc.c
@@ -0,0 +1,35 @@
+/* Largest integral value not greater than argument. PowerPC 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
+#include <math.h>
+#include <libm-alias-double.h>
+#include <round_to_integer.h>
+
+double
+__trunc (double x)
+{
+#ifdef _ARCH_PWR5X
+ return __builtin_trunc (x);
+#else
+ return round_to_integer_double (TRUNC, x);
+#endif
+}
+#ifndef __trunc
+libm_alias_double (__trunc, trunc)
+#endif
diff --git a/sysdeps/powerpc/fpu/s_truncf.c b/sysdeps/powerpc/fpu/s_truncf.c
new file mode 100644
index 0000000000..c9f091cf2a
--- /dev/null
+++ b/sysdeps/powerpc/fpu/s_truncf.c
@@ -0,0 +1,35 @@
+/* Smallest integral value not less than argument. PowerPC 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
+#include <math.h>
+#include <libm-alias-float.h>
+#include <round_to_integer.h>
+
+float
+__truncf (float x)
+{
+#ifdef _ARCH_PWR5X
+ return __builtin_truncf (x);
+#else
+ return round_to_integer_float (TRUNC, x);
+#endif
+}
+#ifndef __truncf
+libm_alias_float (__trunc, trunc)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_trunc.S b/sysdeps/powerpc/powerpc32/fpu/s_trunc.S
deleted file mode 100644
index 31daff161f..0000000000
--- a/sysdeps/powerpc/powerpc32/fpu/s_trunc.S
+++ /dev/null
@@ -1,83 +0,0 @@
-/* trunc function. PowerPC32 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-double.h>
-
- .section .rodata.cst4,"aM",@progbits,4
- .align 2
-.LC0: /* 2**52 */
- .long 0x59800000
-
-/* double [fp1] trunc (double x [fp1])
- IEEE 1003.1 trunc function. IEEE specifies "trunc to the integer
- value, in floating format, nearest to but no larger in magnitude
- then the argument."
- We set "round toward Zero" mode and trunc by adding +-2**52 then
- subtracting +-2**52. */
-
- .section ".text"
-ENTRY (__trunc)
-#ifdef SHARED
- mflr r11
- cfi_register(lr,r11)
- SETUP_GOT_ACCESS(r9,got_label)
- addis r9,r9,.LC0-got_label@ha
- lfs fp13,.LC0-got_label@l(r9)
- mtlr r11
- cfi_same_value (lr)
-#else
- lis r9,.LC0@ha
- lfs fp13,.LC0@l(r9)
-#endif
- fabs fp0,fp1
- fsub fp12,fp13,fp13 /* generate 0.0 */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */
- mffs fp11 /* Save current FPU rounding mode and
- "inexact" state. */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0) */
- bnl- cr7,.L10
- mtfsfi 7,1 /* Set rounding toward 0 mode. */
- ble- cr6,.L4
- fadd fp1,fp1,fp13 /* x+= TWO52; */
- fsub fp1,fp1,fp13 /* x-= TWO52; */
- fabs fp1,fp1 /* if (x == 0.0) */
- /* x = 0.0; */
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
- "inexact" state. */
- blr
-.L4:
- bge- cr6,.L9 /* if (x < 0.0) */
- fsub fp1,fp1,fp13 /* x-= TWO52; */
- fadd fp1,fp1,fp13 /* x+= TWO52; */
- fnabs fp1,fp1 /* if (x == 0.0) */
- /* x = -0.0; */
-.L9:
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
- "inexact" state. */
- blr
-.L10:
- /* Ensure sNaN input is converted to qNaN. */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadd fp1,fp1,fp1
- blr
- END (__trunc)
-
-libm_alias_double (__trunc, trunc)
diff --git a/sysdeps/powerpc/powerpc32/fpu/s_truncf.S b/sysdeps/powerpc/powerpc32/fpu/s_truncf.S
deleted file mode 100644
index 630300c5dc..0000000000
--- a/sysdeps/powerpc/powerpc32/fpu/s_truncf.S
+++ /dev/null
@@ -1,83 +0,0 @@
-/* truncf function. PowerPC32 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 <libm-alias-float.h>
-
- .section .rodata.cst4,"aM",@progbits,4
- .align 2
-.LC0: /* 2**23 */
- .long 0x4b000000
-
-/* float [fp1] truncf (float x [fp1])
- IEEE 1003.1 trunc function. IEEE specifies "trunc to the integer
- value, in floating format, nearest to but no larger in magnitude
- then the argument."
- We set "round toward Zero" mode and trunc by adding +-2**23 then
- subtracting +-2**23. */
-
- .section ".text"
-ENTRY (__truncf)
-#ifdef SHARED
- mflr r11
- cfi_register(lr,r11)
- SETUP_GOT_ACCESS(r9,got_label)
- addis r9,r9,.LC0-got_label@ha
- lfs fp13,.LC0-got_label@l(r9)
- mtlr r11
- cfi_same_value (lr)
-#else
- lis r9,.LC0@ha
- lfs fp13,.LC0@l(r9)
-#endif
- fabs fp0,fp1
- fsubs fp12,fp13,fp13 /* generate 0.0 */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23) */
- mffs fp11 /* Save current FPU rounding mode and
- "inexact" state. */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0) */
- bnl- cr7,.L10
- mtfsfi 7,1 /* Set rounding toward 0 mode. */
- ble- cr6,.L4
- fadds fp1,fp1,fp13 /* x+= TWO23; */
- fsubs fp1,fp1,fp13 /* x-= TWO23; */
- fabs fp1,fp1 /* if (x == 0.0) */
- /* x = 0.0; */
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
- "inexact" state. */
- blr
-.L4:
- bge- cr6,.L9 /* if (x < 0.0) */
- fsubs fp1,fp1,fp13 /* x-= TWO23; */
- fadds fp1,fp1,fp13 /* x+= TWO23; */
- fnabs fp1,fp1 /* if (x == 0.0) */
- /* x = -0.0; */
-.L9:
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
- "inexact" state. */
- blr
-.L10:
- /* Ensure sNaN input is converted to qNaN. */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadds fp1,fp1,fp1
- blr
- END (__truncf)
-
-libm_alias_float (__trunc, trunc)
-
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-power5+.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-power5+.S
deleted file mode 100644
index 3ed99c3f7e..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-power5+.S
+++ /dev/null
@@ -1,33 +0,0 @@
-/* trunc function. PowerPC32/power5+ 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 <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#undef hidden_def
-#define hidden_def(name)
-#undef weak_alias
-#define weak_alias(name, alias)
-#undef strong_alias
-#define strong_alias(name, alias)
-#undef compat_symbol
-#define compat_symbol(lib, name, alias, ver)
-
-#define __trunc __trunc_power5plus
-
-#include <sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-power5+.c
new file mode 100644
index 0000000000..47abda6810
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-power5+.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __trunc __trunc_power5plus
+#include <sysdeps/powerpc/fpu/s_trunc.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-ppc32.S
deleted file mode 100644
index 67b87c5db1..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-ppc32.S
+++ /dev/null
@@ -1,31 +0,0 @@
-/* trunc function. 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 <sysdep.h>
-#include <math_ldbl_opt.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 __trunc __trunc_ppc32
-
-#include <sysdeps/powerpc/powerpc32/fpu/s_trunc.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-ppc32.c
new file mode 100644
index 0000000000..5b9164295f
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc-ppc32.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __trunc __trunc_ppc32
+#include <sysdeps/powerpc/fpu/s_trunc.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-power5+.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-power5+.S
deleted file mode 100644
index a18af562e6..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-power5+.S
+++ /dev/null
@@ -1,26 +0,0 @@
-/* truncf function. PowerPC32/power5+ 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 <sysdep.h>
-
-#undef weak_alias
-#define weak_alias(name, alias)
-
-#define __truncf __truncf_power5plus
-
-#include <sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-power5+.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-power5+.c
new file mode 100644
index 0000000000..b8e75d4e28
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-power5+.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __truncf __truncf_power5plus
+#include <sysdeps/powerpc/fpu/s_truncf.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-ppc32.S b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-ppc32.S
deleted file mode 100644
index a7bf3943f2..0000000000
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-ppc32.S
+++ /dev/null
@@ -1,27 +0,0 @@
-/* truncf function. 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 <sysdep.h>
-#include <math_ldbl_opt.h>
-
-#undef weak_alias
-#define weak_alias(a,b)
-
-#define __truncf __truncf_ppc32
-
-#include <sysdeps/powerpc/powerpc32/fpu/s_truncf.S>
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-ppc32.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-ppc32.c
new file mode 100644
index 0000000000..f20c82553a
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_truncf-ppc32.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __truncf __truncf_ppc32
+#include <sysdeps/powerpc/fpu/s_truncf.c>
diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S b/sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S
deleted file mode 100644
index 37a24104e7..0000000000
--- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S
+++ /dev/null
@@ -1,29 +0,0 @@
-/* trunc function. PowerPC32/power5+ 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-double.h>
-
- .machine "power5"
-EALIGN (__trunc, 4, 0)
- friz fp1, fp1
- blr
- END (__trunc)
-
-libm_alias_double (__trunc, trunc)
diff --git a/sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S b/sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S
deleted file mode 100644
index f24c1f6cda..0000000000
--- a/sysdeps/powerpc/powerpc32/power5+/fpu/s_truncf.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* truncf function. PowerPC32/power5+ 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 <libm-alias-float.h>
-
- .machine "power5"
-EALIGN (__truncf, 4, 0)
- friz fp1, fp1 /* The rounding instructions are double. */
- frsp fp1, fp1 /* But we need to set ooverflow for float. */
- blr
- END (__truncf)
-
-libm_alias_float (__trunc, trunc)
-
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
index 722f974cfb..53e600f5f6 100644
--- a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/Makefile
@@ -10,7 +10,11 @@ libm-sysdep_routines += s_ceil-power5+ \
s_round-power5+ \
s_round-ppc64 \
s_roundf-power5+ \
- s_roundf-ppc64
+ s_roundf-ppc64 \
+ s_trunc-power5+ \
+ s_trunc-ppc64 \
+ s_truncf-power5+ \
+ s_truncf-ppc64
CFLAGS-s_ceil-power5+.c = -mcpu=power5+
CFLAGS-s_ceilf-power5+.c = -mcpu=power5+
@@ -18,4 +22,6 @@ CFLAGS-s_floor-power5+.c = -mcpu=power5+
CFLAGS-s_floorf-power5+.c = -mcpu=power5+
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+
endif
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf.c
index 640bca5a7a..db6a17c5b2 100644
--- a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf.c
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_roundf.c
@@ -18,8 +18,6 @@
#define NO_MATH_REDIRECT
#include <math.h>
-#include <math_ldbl_opt.h>
-#include <shlib-compat.h>
#include "init-arch.h"
#include <libm-alias-float.h>
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc-power5+.c
new file mode 100644
index 0000000000..47abda6810
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc-power5+.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __trunc __trunc_power5plus
+#include <sysdeps/powerpc/fpu/s_trunc.c>
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc-ppc64.c
new file mode 100644
index 0000000000..21c47308fc
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc-ppc64.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __trunc __trunc_ppc64
+#include <sysdeps/powerpc/fpu/s_trunc.c>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc.c
index 9c96847272..9c96847272 100644
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc.c
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_trunc.c
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf-power5+.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf-power5+.c
new file mode 100644
index 0000000000..b8e75d4e28
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf-power5+.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __truncf __truncf_power5plus
+#include <sysdeps/powerpc/fpu/s_truncf.c>
diff --git a/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf-ppc64.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf-ppc64.c
new file mode 100644
index 0000000000..aa6c6c1f98
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf-ppc64.c
@@ -0,0 +1,3 @@
+#include <math.h>
+#define __truncf __truncf_ppc64
+#include <sysdeps/powerpc/fpu/s_truncf.c>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf.c b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf.c
index be124b2023..b6c8260b69 100644
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf.c
+++ b/sysdeps/powerpc/powerpc64/be/fpu/multiarch/s_truncf.c
@@ -18,8 +18,6 @@
#define NO_MATH_REDIRECT
#include <math.h>
-#include <math_ldbl_opt.h>
-#include <shlib-compat.h>
#include "init-arch.h"
#include <libm-alias-float.h>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
index 11c39f4b35..7d469d79af 100644
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile
@@ -15,8 +15,6 @@ sysdep_calls := s_copysign-power6 s_copysign-ppc64 \
sysdep_routines += $(sysdep_calls)
libm-sysdep_routines += s_llround-power6x \
s_llround-power5+ s_llround-ppc64 \
- s_trunc-power5+ \
- s_trunc-ppc64 s_truncf-power5+ s_truncf-ppc64 \
s_llrint-power6x s_llrint-ppc64 \
s_logb-power7 s_logbf-power7 \
s_logbl-power7 s_logb-ppc64 s_logbf-ppc64 \
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc-power5+.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc-power5+.S
deleted file mode 100644
index 9ce3db48e4..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc-power5+.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* trunc function. PowerPC64/power5+ 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 __trunc __trunc_power5plus
-
-#include <sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc-ppc64.S
deleted file mode 100644
index ca9d831850..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc-ppc64.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* trunc function. PowerPC64 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 __trunc __trunc_ppc64
-
-#include <sysdeps/powerpc/powerpc64/fpu/s_trunc.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf-power5+.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf-power5+.S
deleted file mode 100644
index 4e651172af..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf-power5+.S
+++ /dev/null
@@ -1,24 +0,0 @@
-/* truncf function. PowerPC64/power5+ 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/>. */
-
-#undef weak_alias
-#define weak_alias(a,b)
-
-#define __truncf __truncf_power5plus
-
-#include <sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf-ppc64.S b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf-ppc64.S
deleted file mode 100644
index 5420eb26c7..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_truncf-ppc64.S
+++ /dev/null
@@ -1,24 +0,0 @@
-/* truncf function. PowerPC64 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/>. */
-
-#undef weak_alias
-#define weak_alias(a,b)
-
-#define __truncf __truncf_ppc64
-
-#include <sysdeps/powerpc/powerpc64/fpu/s_truncf.S>
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_trunc.S b/sysdeps/powerpc/powerpc64/fpu/s_trunc.S
deleted file mode 100644
index 628960dd27..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/s_trunc.S
+++ /dev/null
@@ -1,72 +0,0 @@
-/* trunc function. 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-double.h>
-
- .section ".toc","aw"
-.LC0: /* 2**52 */
- .tc FD_43300000_0[TC],0x4330000000000000
- .section ".text"
-
-/* double [fp1] trunc (double x [fp1])
- IEEE 1003.1 trunc function. IEEE specifies "trunc to the integer
- value, in floating format, nearest to but no larger in magnitude
- then the argument."
- We set "round toward Zero" mode and trunc by adding +-2**52 then
- subtracting +-2**52. */
-
-ENTRY (__trunc, 4)
- CALL_MCOUNT 0
- lfd fp13,.LC0@toc(2)
- fabs fp0,fp1
- fsub fp12,fp13,fp13 /* generate 0.0 */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */
- mffs fp11 /* Save current FPU rounding mode and
- "inexact" state. */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0) */
- bnl- cr7,.L10
- mtfsfi 7,1 /* Set rounding toward 0 mode. */
- ble- cr6,.L4
- fadd fp1,fp1,fp13 /* x+= TWO52; */
- fsub fp1,fp1,fp13 /* x-= TWO52; */
- fabs fp1,fp1 /* if (x == 0.0) */
- /* x = 0.0; */
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
- "inexact" state. */
- blr
-.L4:
- bge- cr6,.L9 /* if (x < 0.0) */
- fsub fp1,fp1,fp13 /* x-= TWO52; */
- fadd fp1,fp1,fp13 /* x+= TWO52; */
- fnabs fp1,fp1 /* if (x == 0.0) */
- /* x = -0.0; */
-.L9:
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
- "inexact" state. */
- blr
-.L10:
- /* Ensure sNaN input is converted to qNaN. */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadd fp1,fp1,fp1
- blr
- END (__trunc)
-
-libm_alias_double (__trunc, trunc)
diff --git a/sysdeps/powerpc/powerpc64/fpu/s_truncf.S b/sysdeps/powerpc/powerpc64/fpu/s_truncf.S
deleted file mode 100644
index 7b9294595a..0000000000
--- a/sysdeps/powerpc/powerpc64/fpu/s_truncf.S
+++ /dev/null
@@ -1,74 +0,0 @@
-/* truncf function. 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 <libm-alias-float.h>
-
- .section ".toc","aw"
- .p2align 3
-.LC0: /* 2**23 */
- .long 0x4b000000
- .long 0x0
- .section ".text"
-
-/* float [fp1] truncf (float x [fp1])
- IEEE 1003.1 trunc function. IEEE specifies "trunc to the integer
- value, in floating format, nearest to but no larger in magnitude
- then the argument."
- We set "round toward Zero" mode and trunc by adding +-2**23 then
- subtracting +-2**23. */
-
-ENTRY (__truncf, 4)
- CALL_MCOUNT 0
- lfs fp13,.LC0@toc(2)
- fabs fp0,fp1
- fsubs fp12,fp13,fp13 /* generate 0.0 */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO23) */
- mffs fp11 /* Save current FPU rounding mode and
- "inexact" state. */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0) */
- bnl- cr7,.L10
- mtfsfi 7,1 /* Set rounding toward 0 mode. */
- ble- cr6,.L4
- fadds fp1,fp1,fp13 /* x+= TWO23; */
- fsubs fp1,fp1,fp13 /* x-= TWO23; */
- fabs fp1,fp1 /* if (x == 0.0) */
- /* x = 0.0; */
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
- "inexact" state. */
- blr
-.L4:
- bge- cr6,.L9 /* if (x < 0.0) */
- fsubs fp1,fp1,fp13 /* x-= TWO23; */
- fadds fp1,fp1,fp13 /* x+= TWO23; */
- fnabs fp1,fp1 /* if (x == 0.0) */
- /* x = -0.0; */
-.L9:
- mtfsf 0xff,fp11 /* Restore previous rounding mode and
- "inexact" state. */
- blr
-.L10:
- /* Ensure sNaN input is converted to qNaN. */
- fcmpu cr7,fp1,fp1
- beqlr cr7
- fadds fp1,fp1,fp1
- blr
- END (__truncf)
-
-libm_alias_float (__trunc, trunc)
-
diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S
deleted file mode 100644
index fbd0c318ef..0000000000
--- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S
+++ /dev/null
@@ -1,30 +0,0 @@
-/* trunc function. PowerPC64/power5+ 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-double.h>
-
- .machine "power5"
-ENTRY_TOCLESS (__trunc, 4)
- CALL_MCOUNT 0
- friz fp1, fp1
- blr
- END (__trunc)
-
-libm_alias_double (__trunc, trunc)
diff --git a/sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S b/sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S
deleted file mode 100644
index 91612aa4e9..0000000000
--- a/sysdeps/powerpc/powerpc64/power5+/fpu/s_truncf.S
+++ /dev/null
@@ -1,31 +0,0 @@
-/* truncf function. PowerPC64/power5+ 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 <libm-alias-float.h>
-
- .machine "power5"
-ENTRY_TOCLESS (__truncf, 4)
- CALL_MCOUNT 0
- friz fp1, fp1 /* The rounding instructions are double. */
- frsp fp1, fp1 /* But we need to set ooverflow for float. */
- blr
- END (__truncf)
-
-libm_alias_float (__trunc, trunc)
-