-march=x86-64 (was: illegal instruction (CPU mismatch))

Jeffrey Walton noloader@gmail.com
Sun Sep 18 11:59:00 GMT 2016


On Sun, Sep 18, 2016 at 7:23 AM, Mahmood Naderan <nt_mahmood@yahoo.com> wrote:
>> % echo "" | g++ -c -x c++ -v - 2>&1 | grep march
>
> On both nodes (cluster and compute-0-1) that command returns nothings!

I think this may be the one you want:

$ g++ -march=x86-64 -dM -E - </dev/null | grep  SSE
#define __SSE2_MATH__ 1
#define __SSE_MATH__ 1
#define __SSE2__ 1
#define __SSE__ 1

So -march=x86-64 provides only the minimum feature set. SSE2 is bakes
into the amd64 core instruction set, so all you get is SSE2.

In your particular case, you may be able to use '-march=x86-64 -msse3
-mssse3 -msse4_1 -msse4_2'. That takes you up to AVX and BMI without
including it (some hand waiving).

Ironically, some versions of Clang and -march=native produces the same
defines for GCC and -march=x86-64. We learned about it after adding
code generation tests that performed disassembly on object files.
Effectively, Clang needs the '-march=x86-64 -msse3 -mssse3 -msse4_1
-msse4_2'.

Jeff



More information about the Gcc-help mailing list