This is an archive of the discontinued LLVM Phabricator instance.

[X86] Separate CPU Feature lists in X86.td between architecture features and tuning features
ClosedPublic

Authored by craig.topper on Jul 29 2020, 11:29 AM.

Details

Summary

After the recent change to the tuning settings for pentium4 to improve our default 32-bit behavior, I've decided to see about implementing -mtune support. This way we could have a default architecture CPU of "pentium4" or "x86-64" and a default tuning cpu of "generic". And we could change our "pentium4" tuning settings back to what they were before.

As a step to supporting this, this patch separates all of the features lists for the CPUs into 2 lists. I'm using the Proc class and a new ProcModel class to concat the 2 lists before passing to the target independent ProcessorModel. Future work to truly support mtune would change ProcessorModel to take 2 lists separately. I've diffed the X86GenSubtargetInfo.inc file before and after this patch to ensure that the final feature list for the CPUs isn't changed.

Diff Detail

Event Timeline

craig.topper created this revision.Jul 29 2020, 11:29 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 29 2020, 11:29 AM
Herald added subscribers: jfb, hiraditya. · View Herald Transcript
craig.topper requested review of this revision.Jul 29 2020, 11:29 AM
craig.topper added inline comments.
llvm/lib/Target/X86/X86.td
620

Oops. I left some tuning flags in here. I'll fix and upload a new patch soon.

Fixed BDWAdditionalFeatures

RKSimon added inline comments.Jul 29 2020, 11:35 AM
llvm/lib/Target/X86/X86.td
562

I keep forgetting to ask - why do targets without AVX implement FeatureInsertVZEROUPPER?

craig.topper added inline comments.Jul 29 2020, 11:58 AM
llvm/lib/Target/X86/X86.td
562

It starts with an assumption that "-mavx" without a -march should insert vzeroupper. Since in that case the CPU will be pentium4 or x86-64 so those CPUs need the feature. Maybe also i486 or i686 if you're on the BSD that uses those as the default 32-bit CPU. After that it was just to apply consistent behavior if you wrote something like "-march=nehalem -mavx" for some reason.

RKSimon accepted this revision.Jul 30 2020, 12:43 PM

LGTM - thanks for taking this on!

This revision is now accepted and ready to land.Jul 30 2020, 12:43 PM