This is an archive of the discontinued LLVM Phabricator instance.

[X86] Promote default mtune from generic to sandybridge
AbandonedPublic

Authored by pengfei on Jan 28 2022, 8:17 PM.

Details

Summary

We use x86-64 as default target-cpu for a long time. It may be obsolete
given the old devices are phasing out.

Especially when we have added x86-64-vN for more than one year, more
and more users are using x86-64-v2 now.

Conservatively, I think we have to use x86-64 by default for a while.
But I believe promoting default mtune to sandybridge will do more good
than bad.

Diff Detail

Event Timeline

pengfei requested review of this revision.Jan 28 2022, 8:17 PM
pengfei created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJan 28 2022, 8:17 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
craig.topper added a comment.EditedJan 28 2022, 11:27 PM

I believe the design here was supposed to be that "generic" would be updated in X86.td on an ongoing basis to be more modern. So that if users pass -mtune=generic it would evolve over time.

This matches gcc behavior

‘generic’
Produce code optimized for the most common IA32/AMD64/EM64T processors. If you know the CPU on which your code will run, then you should use the corresponding -mtune or -march option instead of -mtune=generic. But, if you do not know exactly what CPU users of your application will have, then you should use this option.

As new processors are deployed in the marketplace, the behavior of this option will change. Therefore, if you upgrade to a newer version of GCC, code generation controlled by this option will change to reflect the processors that are most common at the time that version of GCC is released.

There is no -march=generic option because -march indicates the instruction set the compiler can use, and there is no generic instruction set applicable to all processors. In contrast, -mtune indicates the processor (or, in this case, collection of processors) for which the code is optimized.

I believe the design here was supposed to be that "generic" would be updated in X86.td on an ongoing basis to be more modern. So that if users pass -mtune=generic it would evolve over time.

This matches gcc behavior

‘generic’
Produce code optimized for the most common IA32/AMD64/EM64T processors. If you know the CPU on which your code will run, then you should use the corresponding -mtune or -march option instead of -mtune=generic. But, if you do not know exactly what CPU users of your application will have, then you should use this option.

As new processors are deployed in the marketplace, the behavior of this option will change. Therefore, if you upgrade to a newer version of GCC, code generation controlled by this option will change to reflect the processors that are most common at the time that version of GCC is released.

There is no -march=generic option because -march indicates the instruction set the compiler can use, and there is no generic instruction set applicable to all processors. In contrast, -mtune indicates the processor (or, in this case, collection of processors) for which the code is optimized.

Thanks for the information, I'll try the other way, thanks Craig!

pengfei abandoned this revision.Jan 29 2022, 3:16 AM

New approch D118534