This is an archive of the discontinued LLVM Phabricator instance.

[X86] Add support for -mvzeroupper and -mno-vzeroupper to match gcc.
ClosedPublic

Authored by craig.topper on Nov 3 2019, 10:58 PM.

Details

Summary

-mvzeroupper will force the vzeroupper insertion pass to run on
CPUs that normally wouldn't. -mno-vzeroupper disables it on CPUs
where it normally runs.

To support this with the default feature handling in clang, we
need a vzeroupper feature flag in X86.td. Since this flag has
the opposite polarity of the fast-partial-ymm-or-zmm-write we
used to use to disable the pass, we now need to add this new
flag to every CPU except KNL/KNM and BTVER2 to keep identical
behavior.

Remove -fast-partial-ymm-or-zmm-write which is no longer used.

Event Timeline

craig.topper created this revision.Nov 3 2019, 10:58 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptNov 3 2019, 10:58 PM
davezarzycki accepted this revision.Nov 3 2019, 11:27 PM

LGTM. Thanks! I'll close my differential proposal then.

This revision is now accepted and ready to land.Nov 3 2019, 11:27 PM

Actually, wait, what does it mean for a CPU without AVX to have FeatureInsertVZEROUPPER?

Actually, wait, what does it mean for a CPU without AVX to have FeatureInsertVZEROUPPER?

Means we’ll do vzeroupper insertion if you add -mavx to the command line and ymm is used. At minimum we need to have it set for pentium4, x86-64, core2, and maybe some others since those are default CPUs on some platforms and we want vzeroupper if someone uses a default cpu and adds -mavx.

This revision was automatically updated to reflect the committed changes.