PowerPC: llrint/llrintf POWER8 optimization

This patch add a optimized llrint/llrintf implementation for POWER8
using the new Move From VSR Doubleword instruction to gains some
cycles from FP to GRP register move.
This commit is contained in:
Adhemerval Zanella 2014-02-18 09:29:29 -05:00
parent cac626d60a
commit 1ad8950a3e
5 changed files with 94 additions and 3 deletions

View File

@ -1,3 +1,14 @@
2014-02-27 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
* sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile: Add llrint power8
implementation.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint-power8.S: New file:
POWER8 llrint ifunc implementation.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_llrint.c (__lllrint): Add
POWER8 implementation.
* sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S: New file:
POWER8 llrint implementation.
2014-02-27 Adhemerval Zanella <azanella@linux.vnet.ibm.com> 2014-02-27 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
* sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile: Add finite power8 * sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile: Add finite power8

View File

@ -23,7 +23,8 @@ libm-sysdep_routines += s_isnan-power7 s_isnan-power6x s_isnan-power6 \
s_logbl-ppc64 s_modf-power5+ s_modf-ppc64 \ s_logbl-ppc64 s_modf-power5+ s_modf-ppc64 \
s_modff-power5+ s_modff-ppc64 e_hypot-ppc64 \ s_modff-power5+ s_modff-ppc64 e_hypot-ppc64 \
e_hypot-power7 e_hypotf-ppc64 e_hypotf-power7 \ e_hypot-power7 e_hypotf-ppc64 e_hypotf-power7 \
s_isnan-power8 s_isinf-power8 s_finite-power8 s_isnan-power8 s_isinf-power8 s_finite-power8 \
s_llrint-power8
CFLAGS-s_logbf-power7.c = -mcpu=power7 CFLAGS-s_logbf-power7.c = -mcpu=power7
CFLAGS-s_logbl-power7.c = -mcpu=power7 CFLAGS-s_logbl-power7.c = -mcpu=power7

View File

@ -0,0 +1,31 @@
/* Round double to long int. PowerPC64/POWER6X default 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>
#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 __llrint __llrint_power8
#include <sysdeps/powerpc/powerpc64/power8/fpu/s_llrint.S>

View File

@ -30,10 +30,13 @@
extern __typeof (__llrint) __llrint_ppc64 attribute_hidden; extern __typeof (__llrint) __llrint_ppc64 attribute_hidden;
extern __typeof (__llrint) __llrint_power6x attribute_hidden; extern __typeof (__llrint) __llrint_power6x attribute_hidden;
extern __typeof (__llrint) __llrint_power8 attribute_hidden;
libc_ifunc (__llrint, libc_ifunc (__llrint,
(hwcap & PPC_FEATURE_POWER6_EXT) (hwcap2 & PPC_FEATURE2_ARCH_2_07)
? __llrint_power6x ? __llrint_power8 :
(hwcap & PPC_FEATURE_POWER6_EXT)
? __llrint_power6x
: __llrint_ppc64); : __llrint_ppc64);
weak_alias (__llrint, llrint) weak_alias (__llrint, llrint)

View File

@ -0,0 +1,45 @@
/* Round double to long int. POWER8 PowerPC64 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>
#include <math_ldbl_opt.h>
#define MFVSRD_R3_V1 .byte 0x7c,0x23,0x00,0x66 /* mfvsrd r3,vs1 */
/* long long int[r3] __llrint (double x[fp1]) */
ENTRY (__llrint)
CALL_MCOUNT 0
fctid fp1,fp1
MFVSRD_R3_V1
blr
END (__llrint)
strong_alias (__llrint, __lrint)
weak_alias (__llrint, llrint)
weak_alias (__lrint, lrint)
#ifdef NO_LONG_DOUBLE
strong_alias (__llrint, __llrintl)
weak_alias (__llrint, llrintl)
strong_alias (__lrint, __lrintl)
weak_alias (__lrint, lrintl)
#endif
#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
compat_symbol (libm, __llrint, llrintl, GLIBC_2_1)
compat_symbol (libm, __lrint, lrintl, GLIBC_2_1)
#endif