Does the -march=corei7-avx -mtune=corei7-avx
or -march=corei7 -mtune=corei7 -mavx
command line options to MinGW with the -mfpmath=sse
command line option (or even with -mfpmath=both
) enables using of AVX instruction for math routines? Note, that --with-fpmath=avx
from here does not work (that is "unrecognized option" for recent builds on MinGW).
Asked
Active
Viewed 1,236 times
0

Tomilov Anatoliy
- 15,657
- 10
- 64
- 169
1 Answers
3
AVX is enabled by either -march=corei7-avx
or -mavx
. The -mtune
option is neither necessary nor sufficient to enable AVX.
A -mfpmath=avx
does not make any sense, because with this switch you control the generation of scalar floating point code. It makes no difference if you use only one float of a 4 float vector register or only one element of a 8 float vector register. If you have march=avx
enabled, scalar floating point instructions will use the VEX encoding anyway, which will save a few mov instructions.
Note that on x86_64 -mfpmath
defaults to SSE, so using this switch is usually not necessary or even harmful if you don't exactly know what you are doing.

Gunther Piez
- 29,760
- 6
- 71
- 103