This is an archive of the discontinued LLVM Phabricator instance.

[X86] Add support 'tune' in target attribute
ClosedPublic

Authored by craig.topper on Aug 18 2020, 6:11 PM.

Details

Summary

This adds parsing and codegen support for tune in target attribute.

I've implemented this so that arch in the target attribute implicitly disables tune from the command line. I'm not sure what gcc does here. But since -march implies -mtune. I assume 'arch' in the target attribute implies tune in the target attribute.

Diff Detail

Event Timeline

craig.topper created this revision.Aug 18 2020, 6:11 PM
craig.topper requested review of this revision.Aug 18 2020, 6:11 PM
craig.topper added a reviewer: efriedma.
erichkeane accepted this revision.Aug 19 2020, 5:57 AM

CFE changes look right to me. Please give the rest of the reviews a little while to take a look though

This revision is now accepted and ready to land.Aug 19 2020, 5:57 AM
aaron.ballman accepted this revision.Aug 19 2020, 6:10 AM

LGTM, but perhaps there should be some changes in AttrDocs.td to document the new support?

Add a note to AttrDocs.td

aaron.ballman accepted this revision.Aug 19 2020, 10:56 AM

Add a note to AttrDocs.td

Thanks for the docs update, continues to LGTM!

craig.topper added inline comments.Aug 19 2020, 11:39 AM
clang/include/clang/AST/Attr.h
346

Was it a bug that BranchProtection wasn't in the original code?

efriedma added inline comments.Aug 19 2020, 12:55 PM
clang/test/Sema/attr-target.c
26

"unsupported tune" seems a little weird. For the command-line flag, we print something like "unknown target CPU 'hiss'"; can we use similar wording here, so it's clear why it's not supported?

aaron.ballman added inline comments.Aug 19 2020, 1:28 PM
clang/include/clang/AST/Attr.h
346

I just dug out the original review which added it (https://reviews.llvm.org/D68711) and there's no mention of why BranchProtection was missed here, so I think it was just a bug.

craig.topper added inline comments.Aug 19 2020, 1:48 PM
clang/test/Sema/attr-target.c
26

Sure. Though there is a subtle issue with even the command line version. We print the same message for old CPUs that don't support x86-64. Those cases should probably be "unsupported" rather than "unknown"

Refine the diagnostic message

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptAug 19 2020, 4:20 PM