diff options
author | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2011-10-25 00:37:10 +0000 |
---|---|---|
committer | joseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d> | 2011-10-25 00:37:10 +0000 |
commit | 4bbe4e2185c5484328182720ff7b3bb4f9593bff (patch) | |
tree | cd67e40a74928c0f58d4f5b79d2e260e4099fee7 /libc/sysdeps/x86_64/fpu/multiarch/s_fmaf.c | |
parent | 91b4be71461f78cabe1fb5f164cea71b60e9e98a (diff) |
Merge changes between r15223 and r15532 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@15545 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/sysdeps/x86_64/fpu/multiarch/s_fmaf.c')
-rw-r--r-- | libc/sysdeps/x86_64/fpu/multiarch/s_fmaf.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/libc/sysdeps/x86_64/fpu/multiarch/s_fmaf.c b/libc/sysdeps/x86_64/fpu/multiarch/s_fmaf.c new file mode 100644 index 000000000..0dcf273ea --- /dev/null +++ b/libc/sysdeps/x86_64/fpu/multiarch/s_fmaf.c @@ -0,0 +1,58 @@ +/* FMA version of fmaf. + Copyright (C) 2009, 2010, 2011 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, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <config.h> +#include <math.h> +#include <init-arch.h> + +#ifdef HAVE_AVX_SUPPORT + +extern float __fmaf_sse2 (float x, float y, float z) attribute_hidden; + + +static float +__fmaf_fma3 (float x, float y, float z) +{ + asm ("vfmadd213ss %3, %2, %0" : "=x" (x) : "0" (x), "x" (y), "xm" (z)); + return x; +} + + +# ifdef HAVE_FMA4_SUPPORT +static float +__fmaf_fma4 (float x, float y, float z) +{ + asm ("vfmaddss %3, %2, %1, %0" : "=x" (x) : "x" (x), "xm" (y), "xm" (z)); + return x; +} +# else +# undef HAS_FMA4 +# define HAS_FMA4 0 +# define __fmaf_fma4 ((void *) 0) +# endif + + +libm_ifunc (__fmaf, HAS_FMA + ? __fmaf_fma3 : (HAS_FMA4 ? __fmaf_fma4 : __fmaf_sse2)); +weak_alias (__fmaf, fmaf) + +# define __fmaf __fmaf_sse2 +#endif + +#include <sysdeps/ieee754/dbl-64/s_fmaf.c> |