This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Add support for tune-cpu attribute
ClosedPublic

Authored by Kai on Nov 18 2022, 12:02 PM.

Details

Summary

clang (like gcc) has the -mtune= command line option. This option
adds the "tune-cpu" attribute to a function. The intended functionality
is that the scheduling model of that cpu is used. E.g. -mtune=pwr9 -march=pwr8
generates only instructions supported on pwr8 but uses the scheduling model
of pwr9 for it.
This PR adds the infrastructure to support this feature in LLVM.
clang support was added in D130526.

Diff Detail

Event Timeline

Kai created this revision.Nov 18 2022, 12:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 18 2022, 12:02 PM
Kai requested review of this revision.Nov 18 2022, 12:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 18 2022, 12:02 PM
Kai edited reviewers, added: shchenz; removed: power-llvm-team.Nov 18 2022, 12:21 PM
Kai updated this revision to Diff 476601.Nov 18 2022, 2:04 PM

Fix formatting.

amyk added a comment.Nov 25 2022, 2:04 PM

Do we require an IR test for this new attribute?

llvm/lib/Target/PowerPC/PPCSubtarget.h
157–162

Minor nit.

qiucf accepted this revision.Nov 27 2022, 12:12 AM

It's not easy to give a direct test case to demonstrate effect of tune-cpu. And even so, the case would be volatile. We can adjust features specific to tune-cpu in PPC.td in future patches.

This patch looks good to me. Wait to see if @nemanjai has other comments.

This revision is now accepted and ready to land.Nov 27 2022, 12:12 AM
Kai added a comment.Jan 6 2023, 7:51 AM

@nemanjai Any comments?

nemanjai accepted this revision.Jan 6 2023, 9:06 AM

LGTM. Thanks for adding this support.

This revision was landed with ongoing or failed builds.Jan 6 2023, 10:02 AM
This revision was automatically updated to reflect the committed changes.