On Tue, 29 Aug 2023 at 08:57, Florian Weimer <fweimer@xxxxxxxxxx> wrote: > > * Paul Richards via Gcc-help: > > > I ask, because the documentation doesn't make it clear what happens, > > but at the same time using "-march" with x86-64 psABI levels > > apparently invokes generic tuning and it would be weird if generic > > tuning under "-march=x86-64-v4" wasn't different than generic tuning > > under "-march=x86-64". > > The tuning defaults for -march=x86-64-v* need some discussion. For > example, for -march=x86-64-v4, maybe GCC should tune for 256-bit vector > widths. For both -march=x86-64-v3 and -march=x86-64-v4, there is some > tuning for FMA that could be applied. I'm sure there are other > examples. > Thanks for the reply. Is -mtune=generic adaptive for real cpu -march= options then? For example is generic tuning under -march=nehalem any different to generic tuning under -march=skylake? I'm mostly interested in best practices for setting baseline levels of CPU features. Specifying a baseline level of CPU features is most easily done with -march, but I want to avoid over specializing the optimizations to just the baseline CPU (especially if tuning to the baseline doesn't generalise to others). For that reason I believe it makes sense to use -mtune=generic along with my -march= baseline. >From my reading of the GCC docs this is how I ought to use these options together to achieve this. However, if -mtune=generic isn't adaptive to the -march= level, then -mtune=generic might be detrimental when used with more modern -march= levels.