On 21 January 2012 17:22, Erik Leunissen wrote: > On 21/01/12 16:33, Jonathan Wakely wrote: >> >> Why do you think you need to use any -march option? > > > Well, for all I knew, absence of any option could mean that gcc generates > code for the machine where I run the compile command, and not for others. No, the docs say: "While picking a specific cpu-type will schedule things appropriately for that particular chip, the compiler will not generate any code that does not run on the i386 without the -march=cpu-type option being used." That applies to x86_64 too, if you don't use -march you will get code that runs on any x86_64 processor, i.e. using just the basic x86_64 instruction set. I've updated that text for the GCC 4.7 manual to say: "While picking a specific cpu-type will schedule things appropriately for that particular chip, the compiler will not generate any code that does not run on the default machine type without the -march=cpu-type option being used. For example, if GCC is configured for i686-pc-linux-gnu then -mtune=pentium4 will generate code that is tuned for Pentium4 but will still run on i686 machines." i.e. if your compiler is configured for amdfam10-unknown-linux-gnu then it will behave as though -march=amdfam10 is given, unless you override it with an explicit -march option. But if it's configured for x86_64-unknown-linux-gnu (the default in most cases) then it generates code that will run on any x86_64. As Tim pointed out, the behaviour you describe is enabled by -march-native, documented like so "Using -march=native will enable all instruction subsets supported by the local machine (hence the result might not run on different machines)."