From 4fc34c6e2f2abb08d56ebb7ce4860e1d337e0e84 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Tue, 9 Apr 2013 13:36:56 -0500 Subject: PowerPC: llrint/llrintf multilib for PowerPC32 --- sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile | 4 ++ .../powerpc/powerpc32/fpu/multiarch/s_llrint-c.c | 13 ++++++ .../powerpc32/fpu/multiarch/s_llrint-power4.S | 37 +++++++++++++++++ .../powerpc32/fpu/multiarch/s_llrint-power6.S | 37 +++++++++++++++++ sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint.c | 43 ++++++++++++++++++++ .../powerpc/powerpc32/fpu/multiarch/s_llrintf-c.c | 3 ++ .../powerpc32/fpu/multiarch/s_llrintf-power4.S | 36 +++++++++++++++++ .../powerpc32/fpu/multiarch/s_llrintf-power6.S | 36 +++++++++++++++++ .../powerpc/powerpc32/fpu/multiarch/s_llrintf.c | 34 ++++++++++++++++ sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S | 46 ---------------------- sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S | 38 ------------------ sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S | 46 ---------------------- sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S | 38 ------------------ 13 files changed, 243 insertions(+), 168 deletions(-) create mode 100644 sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile create mode 100644 sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-c.c create mode 100644 sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-power4.S create mode 100644 sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-power6.S create mode 100644 sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint.c create mode 100644 sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-c.c create mode 100644 sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-power4.S create mode 100644 sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-power6.S create mode 100644 sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf.c delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S delete mode 100644 sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S delete mode 100644 sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S delete mode 100644 sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile new file mode 100644 index 0000000000..4c63e5d810 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/Makefile @@ -0,0 +1,4 @@ +ifeq ($(subdir),math) +libm-sysdep_routines += s_llrintf-power6 s_llrintf-power4 s_llrintf-c \ + s_llrint-power6 s_llrint-power4 s_llrint-c +endif diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-c.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-c.c new file mode 100644 index 0000000000..a83db3f1e5 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-c.c @@ -0,0 +1,13 @@ +#include + +#undef __llrint +#define __llrint __llrint_ppc32 + +#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) + +#include diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-power4.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-power4.S new file mode 100644 index 0000000000..5dcefc0b4f --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-power4.S @@ -0,0 +1,37 @@ +/* Round double to long int. PowerPC32 on PowerPC64 version. + Copyright (C) 2004-2013 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 + . */ + +#include +#include + +/* long long int[r3, r4] __llrint (double x[fp1]) */ + .machine power4 +ENTRY (__llrint_power4) + CALL_MCOUNT + stwu r1,-16(r1) + cfi_adjust_cfa_offset (16) + fctid fp13,fp1 + stfd fp13,8(r1) + nop /* Insure the following load is in a different dispatch group */ + nop /* to avoid pipe stall on POWER4&5. */ + nop + lwz r3,8(r1) + lwz r4,12(r1) + addi r1,r1,16 + blr +END (__llrint_power4) diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-power6.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-power6.S new file mode 100644 index 0000000000..3fc9b0f8df --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint-power6.S @@ -0,0 +1,37 @@ +/* Round double to long int. PowerPC32 on PowerPC64 version. + Copyright (C) 2004-2013 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 + . */ + +#include +#include + +/* long long int[r3, r4] __llrint (double x[fp1]) */ + .machine power6 +ENTRY (__llrint_power6) + CALL_MCOUNT + stwu r1,-16(r1) + cfi_adjust_cfa_offset (16) + fctid fp13,fp1 + stfd fp13,8(r1) +/* Insure the following load is in a different dispatch group by + inserting "group ending nop". */ + ori r1,r1,0 + lwz r3,8(r1) + lwz r4,12(r1) + addi r1,r1,16 + blr +END (__llrint_power6) diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint.c new file mode 100644 index 0000000000..c89c249575 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrint.c @@ -0,0 +1,43 @@ +/* Multiple versions of s_llrint. + Copyright (C) 2013 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 + . */ + +#include +#include +#include +#include "init-arch.h" + +extern __typeof (__llrint) __llrint_ppc32 attribute_hidden; +extern __typeof (__llrint) __llrint_power4 attribute_hidden; +extern __typeof (__llrint) __llrint_power6 attribute_hidden; + +libc_ifunc (__llrint, + (hwcap & PPC_FEATURE_ARCH_2_05) + ? __llrint_power6 : + (hwcap & PPC_FEATURE_POWER4) + ? __llrint_power4 + : __llrint_ppc32); + +weak_alias (__llrint, llrint) + +#ifdef NO_LONG_DOUBLE +strong_alias (__llrint, __llrintl) +weak_alias (__llrint, llrintl) +#endif +#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) +compat_symbol (libm, __llrint, llrintl, GLIBC_2_1); +#endif diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-c.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-c.c new file mode 100644 index 0000000000..5019f99abe --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-c.c @@ -0,0 +1,3 @@ +#undef __llrintf +#define __llrintf __llrintf_ppc32 +#include diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-power4.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-power4.S new file mode 100644 index 0000000000..f6bab6c182 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-power4.S @@ -0,0 +1,36 @@ +/* Round float to long int. PowerPC32 on PowerPC64 version. + Copyright (C) 2004-2013 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 + . */ + +#include + +/* long long int[r3, r4] __llrintf (float x[fp1]) */ + .machine power4 +ENTRY (__llrintf_power4) + CALL_MCOUNT + stwu r1,-16(r1) + cfi_adjust_cfa_offset (16) + fctid fp13,fp1 + stfd fp13,8(r1) + nop /* Insure the following load is in a different dispatch group */ + nop /* to avoid pipe stall on POWER4&5. */ + nop + lwz r3,8(r1) + lwz r4,12(r1) + addi r1,r1,16 + blr +END (__llrintf_power4) diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-power6.S b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-power6.S new file mode 100644 index 0000000000..596f2d5f35 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf-power6.S @@ -0,0 +1,36 @@ +/* Round float to long int. PowerPC32 on PowerPC64 version. + Copyright (C) 2004-2013 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 + . */ + +#include + +/* long long int[r3, r4] __llrintf (float x[fp1]) */ + .machine power6 +ENTRY (__llrintf_power6) + CALL_MCOUNT + stwu r1,-16(r1) + cfi_adjust_cfa_offset (16) + fctid fp13,fp1 + stfd fp13,8(r1) +/* Insure the following load is in a different dispatch group by + inserting "group ending nop". */ + ori r1,r1,0 + lwz r3,8(r1) + lwz r4,12(r1) + addi r1,r1,16 + blr +END (__llrintf_power6) diff --git a/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf.c b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf.c new file mode 100644 index 0000000000..3c854157b3 --- /dev/null +++ b/sysdeps/powerpc/powerpc32/fpu/multiarch/s_llrintf.c @@ -0,0 +1,34 @@ +/* Multiple versions of s_llrintf. + Copyright (C) 2013 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 + . */ + +#include +#include +#include "init-arch.h" + +extern __typeof (__llrintf) __llrintf_ppc32 attribute_hidden; +extern __typeof (__llrintf) __llrintf_power4 attribute_hidden; +extern __typeof (__llrintf) __llrintf_power6 attribute_hidden; + +libc_ifunc (__llrintf, + (hwcap & PPC_FEATURE_ARCH_2_05) + ? __llrintf_power6 : + (hwcap & PPC_FEATURE_POWER4) + ? __llrintf_power4 + : __llrintf_ppc32); + +weak_alias (__llrintf, llrintf) diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S b/sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S deleted file mode 100644 index 2ac986db8b..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/s_llrint.S +++ /dev/null @@ -1,46 +0,0 @@ -/* Round double to long int. PowerPC32 on PowerPC64 version. - Copyright (C) 2004-2013 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 - . */ - -#include -#include - -/* long long int[r3, r4] __llrint (double x[fp1]) */ -ENTRY (__llrint) - CALL_MCOUNT - stwu r1,-16(r1) - cfi_adjust_cfa_offset (16) - fctid fp13,fp1 - stfd fp13,8(r1) - nop /* Insure the following load is in a different dispatch group */ - nop /* to avoid pipe stall on POWER4&5. */ - nop - lwz r3,8(r1) - lwz r4,12(r1) - addi r1,r1,16 - blr - END (__llrint) - -weak_alias (__llrint, llrint) - -#ifdef NO_LONG_DOUBLE -strong_alias (__llrint, __llrintl) -weak_alias (__llrint, llrintl) -#endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __llrint, llrintl, GLIBC_2_1) -#endif diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S b/sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S deleted file mode 100644 index 98e3aafc8e..0000000000 --- a/sysdeps/powerpc/powerpc32/power4/fpu/s_llrintf.S +++ /dev/null @@ -1,38 +0,0 @@ -/* Round float to long int. PowerPC32 on PowerPC64 version. - Copyright (C) 2004-2013 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 - . */ - -#include - -/* long long int[r3, r4] __llrintf (float x[fp1]) */ -ENTRY (__llrintf) - CALL_MCOUNT - stwu r1,-16(r1) - cfi_adjust_cfa_offset (16) - fctid fp13,fp1 - stfd fp13,8(r1) - nop /* Insure the following load is in a different dispatch group */ - nop /* to avoid pipe stall on POWER4&5. */ - nop - lwz r3,8(r1) - lwz r4,12(r1) - addi r1,r1,16 - blr - END (__llrintf) - -weak_alias (__llrintf, llrintf) - diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S b/sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S deleted file mode 100644 index 86f51bb4f7..0000000000 --- a/sysdeps/powerpc/powerpc32/power6/fpu/s_llrint.S +++ /dev/null @@ -1,46 +0,0 @@ -/* Round double to long int. PowerPC32 on PowerPC64 version. - Copyright (C) 2004-2013 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 - . */ - -#include -#include - -/* long long int[r3, r4] __llrint (double x[fp1]) */ -ENTRY (__llrint) - CALL_MCOUNT - stwu r1,-16(r1) - cfi_adjust_cfa_offset (16) - fctid fp13,fp1 - stfd fp13,8(r1) -/* Insure the following load is in a different dispatch group by - inserting "group ending nop". */ - ori r1,r1,0 - lwz r3,8(r1) - lwz r4,12(r1) - addi r1,r1,16 - blr - END (__llrint) - -weak_alias (__llrint, llrint) - -#ifdef NO_LONG_DOUBLE -strong_alias (__llrint, __llrintl) -weak_alias (__llrint, llrintl) -#endif -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __llrint, llrintl, GLIBC_2_1) -#endif diff --git a/sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S b/sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S deleted file mode 100644 index 1b06e2b9ba..0000000000 --- a/sysdeps/powerpc/powerpc32/power6/fpu/s_llrintf.S +++ /dev/null @@ -1,38 +0,0 @@ -/* Round float to long int. PowerPC32 on PowerPC64 version. - Copyright (C) 2004-2013 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 - . */ - -#include - -/* long long int[r3, r4] __llrintf (float x[fp1]) */ -ENTRY (__llrintf) - CALL_MCOUNT - stwu r1,-16(r1) - cfi_adjust_cfa_offset (16) - fctid fp13,fp1 - stfd fp13,8(r1) -/* Insure the following load is in a different dispatch group by - inserting "group ending nop". */ - ori r1,r1,0 - lwz r3,8(r1) - lwz r4,12(r1) - addi r1,r1,16 - blr - END (__llrintf) - -weak_alias (__llrintf, llrintf) - -- cgit 1.4.1