diff options
author | Keith Packard via Newlib <newlib@sourceware.org> | 2020-08-09 01:34:13 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2020-08-10 22:04:12 +0300 |
commit | a44bc679a47403e5439ae46106a886fcb6240233 (patch) | |
tree | 268aada7e68226f8ebfd99c3852a888af2d374d1 /newlib/libm/common | |
parent | 0c1989070ee1d849c7a25ad2eb6c8e3fb1df6393 (diff) |
libm/machine/arm: Add optimized fmaf and fma when available
When HAVE_FAST_FMAF is set, use the vfma.f32 instruction, when
HAVE_FAST_FMA is set, use the vfma.f64 instruction.
Usually the compiler built-ins will already have inlined these
instructions, but provide these symbols for cases where that doesn't
work instead of falling back to the (inaccurate) common code versions.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'newlib/libm/common')
-rw-r--r-- | newlib/libm/common/s_fma.c | 4 | ||||
-rw-r--r-- | newlib/libm/common/sf_fma.c | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/newlib/libm/common/s_fma.c b/newlib/libm/common/s_fma.c index ab9e525b0..15c7d23f5 100644 --- a/newlib/libm/common/s_fma.c +++ b/newlib/libm/common/s_fma.c @@ -38,6 +38,8 @@ ANSI C, POSIX. #include "fdlibm.h" +#if !HAVE_FAST_FMA + #ifndef _DOUBLE_IS_32BITS #ifdef __STDC__ @@ -54,3 +56,5 @@ ANSI C, POSIX. } #endif /* _DOUBLE_IS_32BITS */ + +#endif /* !HAVE_FAST_FMA */ diff --git a/newlib/libm/common/sf_fma.c b/newlib/libm/common/sf_fma.c index 4360f400b..ce7f13bb2 100644 --- a/newlib/libm/common/sf_fma.c +++ b/newlib/libm/common/sf_fma.c @@ -6,6 +6,8 @@ #include "fdlibm.h" +#if !HAVE_FAST_FMAF + #ifdef __STDC__ float fmaf(float x, float y, float z) #else @@ -25,6 +27,8 @@ return (float) (((double) x * (double) y) + (double) z); } +#endif + #ifdef _DOUBLE_IS_32BITS #ifdef __STDC__ |