From 377adacbaaa3974408b708a20912474e45cd383b Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 20 Aug 2015 08:56:52 -0700 Subject: Add i386 s_fma family multiarch functions --- sysdeps/i386/i686/multiarch/Makefile | 6 ------ sysdeps/i386/i686/multiarch/s_fma-fma.c | 29 ------------------------- sysdeps/i386/i686/multiarch/s_fma.c | 36 -------------------------------- sysdeps/i386/i686/multiarch/s_fmaf-fma.c | 29 ------------------------- sysdeps/i386/i686/multiarch/s_fmaf.c | 36 -------------------------------- sysdeps/i386/multiarch/Makefile | 6 ++++++ sysdeps/i386/multiarch/s_fma-fma.c | 29 +++++++++++++++++++++++++ sysdeps/i386/multiarch/s_fma.c | 36 ++++++++++++++++++++++++++++++++ sysdeps/i386/multiarch/s_fmaf-fma.c | 29 +++++++++++++++++++++++++ sysdeps/i386/multiarch/s_fmaf.c | 36 ++++++++++++++++++++++++++++++++ 10 files changed, 136 insertions(+), 136 deletions(-) delete mode 100644 sysdeps/i386/i686/multiarch/s_fma-fma.c delete mode 100644 sysdeps/i386/i686/multiarch/s_fma.c delete mode 100644 sysdeps/i386/i686/multiarch/s_fmaf-fma.c delete mode 100644 sysdeps/i386/i686/multiarch/s_fmaf.c create mode 100644 sysdeps/i386/multiarch/s_fma-fma.c create mode 100644 sysdeps/i386/multiarch/s_fma.c create mode 100644 sysdeps/i386/multiarch/s_fmaf-fma.c create mode 100644 sysdeps/i386/multiarch/s_fmaf.c diff --git a/sysdeps/i386/i686/multiarch/Makefile b/sysdeps/i386/i686/multiarch/Makefile index 74333caee5..101bb7d4c3 100644 --- a/sysdeps/i386/i686/multiarch/Makefile +++ b/sysdeps/i386/i686/multiarch/Makefile @@ -25,9 +25,3 @@ sysdep_routines += wcscmp-sse2 wcscmp-c wcslen-sse2 wcslen-c \ wmemcmp-sse4 wmemcmp-ssse3 wmemcmp-c wcschr-sse2 \ wcschr-c wcsrchr-sse2 wcsrchr-c wcscpy-ssse3 wcscpy-c endif - -ifeq (mathyes,$(subdir)$(config-cflags-avx)) -libm-sysdep_routines += s_fma-fma s_fmaf-fma -CFLAGS-s_fma-fma.c += -mavx -mfpmath=sse -CFLAGS-s_fmaf-fma.c += -mavx -mfpmath=sse -endif diff --git a/sysdeps/i386/i686/multiarch/s_fma-fma.c b/sysdeps/i386/i686/multiarch/s_fma-fma.c deleted file mode 100644 index 1a8b48bd58..0000000000 --- a/sysdeps/i386/i686/multiarch/s_fma-fma.c +++ /dev/null @@ -1,29 +0,0 @@ -/* FMA version of fma. - Copyright (C) 2010-2015 Free Software Foundation, Inc. - Contributed by Intel Corporation. - 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 - -#ifdef HAVE_AVX_SUPPORT -double -__fma_fma (double x, double y, double z) -{ - asm ("vfmadd213sd %3, %2, %0" : "=x" (x) : "0" (x), "x" (y), "xm" (z)); - return x; -} -#endif diff --git a/sysdeps/i386/i686/multiarch/s_fma.c b/sysdeps/i386/i686/multiarch/s_fma.c deleted file mode 100644 index cf2ede5309..0000000000 --- a/sysdeps/i386/i686/multiarch/s_fma.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Multiple versions of fma. - Copyright (C) 2010-2015 Free Software Foundation, Inc. - Contributed by Intel Corporation. - 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 - -#ifdef HAVE_AVX_SUPPORT -#include -#include - -extern double __fma_ia32 (double x, double y, double z) attribute_hidden; -extern double __fma_fma (double x, double y, double z) attribute_hidden; - -libm_ifunc (__fma, - HAS_ARCH_FEATURE (FMA_Usable) ? __fma_fma : __fma_ia32); -weak_alias (__fma, fma) - -# define __fma __fma_ia32 -#endif - -#include diff --git a/sysdeps/i386/i686/multiarch/s_fmaf-fma.c b/sysdeps/i386/i686/multiarch/s_fmaf-fma.c deleted file mode 100644 index 1775ef5dd0..0000000000 --- a/sysdeps/i386/i686/multiarch/s_fmaf-fma.c +++ /dev/null @@ -1,29 +0,0 @@ -/* FMA version of fmaf. - Copyright (C) 2010-2015 Free Software Foundation, Inc. - Contributed by Intel Corporation. - 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 - -#ifdef HAVE_AVX_SUPPORT -float -__fmaf_fma (float x, float y, float z) -{ - asm ("vfmadd213ss %3, %2, %0" : "=x" (x) : "0" (x), "x" (y), "xm" (z)); - return x; -} -#endif diff --git a/sysdeps/i386/i686/multiarch/s_fmaf.c b/sysdeps/i386/i686/multiarch/s_fmaf.c deleted file mode 100644 index 526cdf16e4..0000000000 --- a/sysdeps/i386/i686/multiarch/s_fmaf.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Multiple versions of fmaf. - Copyright (C) 2010-2015 Free Software Foundation, Inc. - Contributed by Intel Corporation. - 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 - -#ifdef HAVE_AVX_SUPPORT -#include -#include - -extern float __fmaf_ia32 (float x, float y, float z) attribute_hidden; -extern float __fmaf_fma (float x, float y, float z) attribute_hidden; - -libm_ifunc (__fmaf, - HAS_ARCH_FEATURE (FMA_Usable) ? __fmaf_fma : __fmaf_ia32); -weak_alias (__fmaf, fmaf) - -# define __fmaf __fmaf_ia32 -#endif - -#include diff --git a/sysdeps/i386/multiarch/Makefile b/sysdeps/i386/multiarch/Makefile index 8a9ecf3a3a..32d37832f4 100644 --- a/sysdeps/i386/multiarch/Makefile +++ b/sysdeps/i386/multiarch/Makefile @@ -23,3 +23,9 @@ sysdep_routines += bcopy-i386 bcopy-i686 bcopy-sse2-unaligned \ memrchr-i386 memrchr-sse2-bsf memrchr-sse2 \ rawmemchr-sse2-bsf rawmemchr-sse2 endif + +ifeq (mathyes,$(subdir)$(config-cflags-avx)) +libm-sysdep_routines += s_fma-fma s_fmaf-fma +CFLAGS-s_fma-fma.c += -mavx -mfpmath=sse +CFLAGS-s_fmaf-fma.c += -mavx -mfpmath=sse +endif diff --git a/sysdeps/i386/multiarch/s_fma-fma.c b/sysdeps/i386/multiarch/s_fma-fma.c new file mode 100644 index 0000000000..1a8b48bd58 --- /dev/null +++ b/sysdeps/i386/multiarch/s_fma-fma.c @@ -0,0 +1,29 @@ +/* FMA version of fma. + Copyright (C) 2010-2015 Free Software Foundation, Inc. + Contributed by Intel Corporation. + 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 + +#ifdef HAVE_AVX_SUPPORT +double +__fma_fma (double x, double y, double z) +{ + asm ("vfmadd213sd %3, %2, %0" : "=x" (x) : "0" (x), "x" (y), "xm" (z)); + return x; +} +#endif diff --git a/sysdeps/i386/multiarch/s_fma.c b/sysdeps/i386/multiarch/s_fma.c new file mode 100644 index 0000000000..ab4d8c3af8 --- /dev/null +++ b/sysdeps/i386/multiarch/s_fma.c @@ -0,0 +1,36 @@ +/* Multiple versions of fma. + Copyright (C) 2010-2015 Free Software Foundation, Inc. + Contributed by Intel Corporation. + 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 + +#ifdef HAVE_AVX_SUPPORT +#include +#include + +extern double __fma_i386 (double x, double y, double z) attribute_hidden; +extern double __fma_fma (double x, double y, double z) attribute_hidden; + +libm_ifunc (__fma, + HAS_ARCH_FEATURE (FMA_Usable) ? __fma_fma : __fma_i386); +weak_alias (__fma, fma) + +# define __fma __fma_i386 +#endif + +#include diff --git a/sysdeps/i386/multiarch/s_fmaf-fma.c b/sysdeps/i386/multiarch/s_fmaf-fma.c new file mode 100644 index 0000000000..1775ef5dd0 --- /dev/null +++ b/sysdeps/i386/multiarch/s_fmaf-fma.c @@ -0,0 +1,29 @@ +/* FMA version of fmaf. + Copyright (C) 2010-2015 Free Software Foundation, Inc. + Contributed by Intel Corporation. + 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 + +#ifdef HAVE_AVX_SUPPORT +float +__fmaf_fma (float x, float y, float z) +{ + asm ("vfmadd213ss %3, %2, %0" : "=x" (x) : "0" (x), "x" (y), "xm" (z)); + return x; +} +#endif diff --git a/sysdeps/i386/multiarch/s_fmaf.c b/sysdeps/i386/multiarch/s_fmaf.c new file mode 100644 index 0000000000..3c9af052fc --- /dev/null +++ b/sysdeps/i386/multiarch/s_fmaf.c @@ -0,0 +1,36 @@ +/* Multiple versions of fmaf. + Copyright (C) 2010-2015 Free Software Foundation, Inc. + Contributed by Intel Corporation. + 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 + +#ifdef HAVE_AVX_SUPPORT +#include +#include + +extern float __fmaf_i386 (float x, float y, float z) attribute_hidden; +extern float __fmaf_fma (float x, float y, float z) attribute_hidden; + +libm_ifunc (__fmaf, + HAS_ARCH_FEATURE (FMA_Usable) ? __fmaf_fma : __fmaf_i386); +weak_alias (__fmaf, fmaf) + +# define __fmaf __fmaf_i386 +#endif + +#include -- cgit 1.4.1