[llvm-bugs] [Bug 25728] New: [linux] clang should define _FP_FAST_FMA, _FP_FAST_FMAF, _FP_FAST_FMAL when fma(), fmaf(), fmal() is faster than an add and a mul
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Dec 3 07:16:33 PST 2015
https://llvm.org/bugs/show_bug.cgi?id=25728
Bug ID: 25728
Summary: [linux] clang should define _FP_FAST_FMA,
_FP_FAST_FMAF, _FP_FAST_FMAL when fma(), fmaf(),
fmal() is faster than an add and a mul
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: nicolasweber at gmx.de
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Linux mathdef.h contains:
/* The GCC 4.6 compiler will define __FP_FAST_FMA{,F,L} if the fma{,f,l}
builtins are supported. */
# if __FP_FAST_FMA
# define FP_FAST_FMA 1
# endif
# if __FP_FAST_FMAF
# define FP_FAST_FMAF 1
# endif
# if __FP_FAST_FMAL
# define FP_FAST_FMAL 1
# endif
The comment isn't quite right; it looks like gcc will define these when the
builtin is replaced with an efficient intrinsic.
thakis at thakis:~/src/chrome/src$ cat test.c
#include <math.h>
#ifdef FP_FAST_FMAF
#warning on
#else
#warning off
#endif
thakis at thakis:~/src/chrome/src$ gcc -c test.c
test.c:6:2: warning: #warning off [-Wcpp]
#warning off
^
thakis at thakis:~/src/chrome/src$ gcc -c test.c -march=core-avx2
test.c:4:2: warning: #warning on [-Wcpp]
#warning on
^
With clang on the other hand it appears that this is never fast, even though
clang does generate vfmadd213sd just fine when calling fma():
thakis at thakis:~/src/chrome/src$
third_party/llvm-build/Release+Asserts/bin/clang -c test.c
test.c:6:2: warning: off [-W#warnings]
#warning off
^
1 warning generated.
thakis at thakis:~/src/chrome/src$
third_party/llvm-build/Release+Asserts/bin/clang -c test.c -march=core-avx2
test.c:6:2: warning: off [-W#warnings]
#warning off
^
1 warning generated.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151203/82248b84/attachment.html>
More information about the llvm-bugs
mailing list