http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59390
Bug ID: 59390
Summary: presence of __attribute__((target("fma")))
declaration breaks __builtin_fma
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: jtaylor.debian at googlemail dot com
compiling this code leads to a compilation error on -O3:
#include "math.h"
void fun() __attribute__((target("fma")));
void
other_fun(double *restrict out, double * restrict a, double * restrict b,
double * restrict c, int n)
{
int i;
for (i = 0; i < n; i++) {
out[i] = fma(a[i], b[i], c[i]);
}
}
$ cc-4.9 fma.c -c -std=c99 -O3
fma.c: In function ‘other_fun’:
fma.c:9:21: error: ‘__builtin_ia32_vfmaddpd’ needs isa option -m32 -mfma4 -mfma
out[i] = fma(a[i], b[i], c[i]);
^
removing the attribute from the unused declaration fixes it, as does using
-fno-builtin or a lower optimization level.
$ gcc-4.9 -v
Using built-in specs.
COLLECT_GCC=/home/jtaylor/tmp/gcc-local/bin/../bin/gcc
COLLECT_LTO_WRAPPER=/home/jtaylor/tmp/gcc-local/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/jtaylor/tmp/gcc/configure
--enable-languages=c,c++,fortran --enable-tls
--prefix=/home/jtaylor/tmp/gcc-local --with-gmp=/usr --with-mpfr=/usr
--with-mpc=/usr --with-cloog=/usr --with-ppl=/usr --with-isl=/usr
Thread model: posix
gcc version 4.9.0 20131204 (experimental) (GCC)
also affects gcc 4.8.1