2009-07-29 22:26:06 +00:00
|
|
|
/* FMA version of fma.
|
2016-01-04 16:05:18 +00:00
|
|
|
Copyright (C) 2009-2016 Free Software Foundation, Inc.
|
2009-07-29 22:26:06 +00:00
|
|
|
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
|
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 double __fma_sse2 (double x, double y, double z) attribute_hidden;
|
2009-07-29 22:26:06 +00:00
|
|
|
|
|
|
|
|
2009-09-03 02:43:04 +00:00
|
|
|
static double
|
2011-10-21 02:43:15 +00:00
|
|
|
__fma_fma3 (double x, double y, double z)
|
2009-07-29 22:26:06 +00:00
|
|
|
{
|
|
|
|
asm ("vfmadd213sd %3, %2, %0" : "=x" (x) : "0" (x), "x" (y), "xm" (z));
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
2011-10-21 02:43:15 +00:00
|
|
|
|
|
|
|
static double
|
|
|
|
__fma_fma4 (double x, double y, double z)
|
|
|
|
{
|
2013-05-15 18:31:53 +00:00
|
|
|
asm ("vfmaddsd %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 (__fma, HAS_ARCH_FEATURE (FMA_Usable)
|
|
|
|
? __fma_fma3 : (HAS_ARCH_FEATURE (FMA4_Usable)
|
|
|
|
? __fma_fma4 : __fma_sse2));
|
2009-07-29 22:26:06 +00:00
|
|
|
weak_alias (__fma, fma)
|
|
|
|
|
2015-10-08 15:59:32 +00:00
|
|
|
#define __fma __fma_sse2
|
2009-07-29 22:26:06 +00:00
|
|
|
|
2010-10-14 02:27:03 +00:00
|
|
|
#include <sysdeps/ieee754/dbl-64/s_fma.c>
|