Search notes:

gcc -march

-march is an option that selects the used Instruction Set Architecture (ISA).
gcc -march=native produces code that is optimized for the CPU that is used to compile the program.
Code proceduced with -march=native is not backwards compatible, for example, an executable procuded on an Intel Core CPU won't be able to run on an (old) Intel Atom CPU.)
Other possible values for the x86 family are:

prog.c

#include <stdio.h>
int main() {

  int fac_10 =1*2*3*4*5*6*7*8*9*10;

  printf("10! = %d\n", fac_10);

  return 0;
}
Github repository about-gcc, path: /options/m_/arch/prog.c

Makefile

a.out: prog_native.s
	gcc $<

prog_native.s: prog.c Makefile
	gcc -march=native -S $< -o $@
Github repository about-gcc, path: /options/m_/arch/Makefile

TODO

Show enabled and disabled options

gcc -c -Q -march=native --help=target

-mwindows

Apparently, there is also the possibility to set arch to windows: -mwindows.

See also

-march=cpu-type implies -mtune=cpy-type
-mcpu (which is deprecated for/on x86 or x86-64 systems)j
Other -m options
GCC options

Links

resolve-march-native is a command line tool to resolve -march=native into explicit GCC flags.

Index