https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69471
Thiago Macieira <thiago at kde dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |thiago at kde dot org
--- Comment #5 from Thiago Macieira <thiago at kde dot org> ---
Same thing here. User passes CFLAGS="-march=native" for their system, but
library needs to build one .cpp source with -march=haswell for additional
functionality (runtime-checked via CPUID). Unfortunately, -march=native
supersedes all other -march options, regardless of order, unlike all other
options.
Examples:
$ gcc -dM -E -xc /dev/null -march=sandybridge -march=haswell | grep AVX
#define __AVX__ 1
#define __AVX2__ 1
$ gcc -dM -E -xc /dev/null -march=haswell -march=sandybridge | grep AVX
#define __AVX__ 1
$ gcc -dM -E -xc /dev/null -march=sandybridge -march=native | grep AVX
#define __AVX__ 1
#define __AVX2__ 1
$ gcc -dM -E -xc /dev/null -march=native -march=sandybridge | grep AVX
#define __AVX__ 1
#define __AVX2__ 1
Qt is affected: https://bugreports.qt.io/browse/QTBUG-71564. The problem began
when we switched from appending -mavx2 to appending -march=haswell, so we'd get
FMA and BMI1/2 in the same file.