[cfe-dev] Option -mtune

David Greene via cfe-dev cfe-dev at lists.llvm.org
Fri Apr 24 07:14:13 PDT 2020


Joerg Sonnenberger via cfe-dev <cfe-dev at lists.llvm.org> writes:

>> * -mcpu implies -target (based on host machine), -march and -mtune
>> 
>>   Example: -mcpu=skylake-avx512 sets
>>     -target=x86_64-unknown-linux-gnu (when run on a Debian system)
>>     -march=skylake-avx512
>>     -mtune=skylake-avx512
>
> This is just wrong. The CPU name has no 1:1 mapping to target
> architectures. skylake-avx512 can still be happily used for
> i386-unknown-linux-gnu to completement your example. The reverse is
> somewhat true: the target triple can provide the default CPU
> (-march/-mcpu).

Fair enough, but for my own education, in what situation would
skylake-avx512 be used with i386-unknown-linux-gnu?

>> Of course one could always pass -triple (or other options) explicitly to
>> suppress the implied behaviors.  We still want -mtune and -march to
>> operate independently of each other (i.e. neither implies the other) so
>> that one can generate backward-compatible binaries while still tuning
>> for recent microarchitectures.
>
> Please submit patches then for making scheduling independent of the
> architecture flags. Until then, this whole discussion seems to be a
> waste of time to me. Always using the/a default scheduling is IMO a
> perfectly sensible behavior and more often than not, what GCC is doing
> anyway.

It's not a waste of time to improve the user experience.  Part of the
problem is that it's not at all clear what the "architecture flags" do.
It seems like we'd want to decide that before changing things.

                       -David


More information about the cfe-dev mailing list