GCC supports a -march
switch that allows you to specify the architecture you are targeting - allowing it to tune instruction sequences for that platform as well as using instructions that might be available on the platform which aren't available on the "default" or base version of the architecture.
For example, -march=skylake
will tell the compiler to target Skylake CPUs, including using instruction sets available on Skylake such as AVX2.
How can I tell what values for -march
the local version of gcc
supports? Newer versions helpfully list the valid arguments when an invalid argument is passed, but older versions do not.