Unable to activate the SSE instruction set by "-march=native" in gcc or any other flags in Core2 chip

545 views Asked by At

My machine is Core2 microarchitecture and I tried to compile some arithmetic code targeting the SSE instruction set. I searched on the web and official manual, and I believe that all I need to do is to add the flag -march=native, because my chip supports SSE.

But when I use gcc -march=native -Q --help=target -v to check if the flag really works, the result displayed on-screen is not what I expected. For example:

-msse                               [disabled]
-msse2                              [disabled]
-msse2avx                           [disabled]
-msse3                              [disabled]
-msse4                              [disabled]
-msse4.1                            [disabled]
-msse4.2                            [disabled]
-msse4a                             [disabled]
-msse5                              
-msseregparm                        [disabled]
-mssse3                             [disabled]

I find all the SSE (and even MMX) instructions are disabled. Can anybody tell me why and how to solve it? Many thanks!

1

There are 1 answers

0
Phizes On

The output of gcc -march=native -Q --help=target -v does not include the overrides defined by -march, as gcc returns the output prior to running the code which handles the architecture specific overrides.

See the bug report on this matter, and specifically that it keeps confusing users, such as myself.