2009-07-29 22:26:06 +00:00
|
|
|
/* FMA version of fmaf.
|
2015-01-02 16:28:19 +00:00
|
|
|
Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
2009-07-29 22:26:06 +00:00
|
|
|
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
|
2012-02-09 23:18:22 +00:00
|
|
|
License along with the GNU C Library; if not, see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
2009-07-29 22:26:06 +00:00
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <init-arch.h>
|
|
|
|
|
2009-09-03 02:43:04 +00:00
|
|
|
extern float __fmaf_sse2 (float x, float y, float z) attribute_hidden;
|
2009-07-29 22:26:06 +00:00
|
|
|
|
|
|
|
|
2009-09-03 02:43:04 +00:00
|
|
|
static float
|
2011-10-21 02:43:15 +00:00
|
|
|
__fmaf_fma3 (float x, float y, float z)
|
2009-07-29 22:26:06 +00:00
|
|
|
{
|
|
|
|
asm ("vfmadd213ss %3, %2, %0" : "=x" (x) : "0" (x), "x" (y), "xm" (z));
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
2011-10-21 02:43:15 +00:00
|
|
|
|
|
|
|
static float
|
|
|
|
__fmaf_fma4 (float x, float y, float z)
|
|
|
|
{
|
2013-05-15 18:31:53 +00:00
|
|
|
asm ("vfmaddss %3, %2, %1, %0" : "=x" (x) : "x" (x), "x" (y), "x" (z));
|
2011-10-21 02:43:15 +00:00
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-08-13 10:38:47 +00:00
|
|
|
libm_ifunc (__fmaf, HAS_ARCH_FEATURE (FMA_Usable)
|
|
|
|
? __fmaf_fma3 : (HAS_ARCH_FEATURE (FMA4_Usable)
|
|
|
|
? __fmaf_fma4 : __fmaf_sse2));
|
2009-07-29 22:26:06 +00:00
|
|
|
weak_alias (__fmaf, fmaf)
|
|
|
|
|
2015-10-08 15:59:32 +00:00
|
|
|
#define __fmaf __fmaf_sse2
|
2009-07-29 22:26:06 +00:00
|
|
|
|
2010-10-11 13:27:05 +00:00
|
|
|
#include <sysdeps/ieee754/dbl-64/s_fmaf.c>
|