This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Add support for -mcpu=pwr10 in both clang and llvm
ClosedPublic

Authored by lei on May 15 2020, 10:34 AM.

Details

Summary

This patch simply adds support for the new CPU in anticipation of
Power10. There isn't really any functionality added so there are no
associated test cases at this time.

Diff Detail

Event Timeline

lei created this revision.May 15 2020, 10:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 15 2020, 10:34 AM
jsji added a reviewer: Restricted Project.May 15 2020, 10:37 AM
jsji added a project: Restricted Project.
lei updated this revision to Diff 264301.May 15 2020, 11:39 AM

Add support in llvm.

Herald added a project: Restricted Project. · View Herald TranscriptMay 15 2020, 11:39 AM
lei retitled this revision from [PowerPC] Add support for -mcpu=pwr10 in the front end to [PowerPC] Add support for -mcpu=pwr10 in both clang and llvm.May 15 2020, 11:41 AM
lei updated this revision to Diff 264303.May 15 2020, 11:56 AM
lei retitled this revision from [PowerPC] Add support for -mcpu=pwr10 in both clang and llvm to [PowerPC] Add support for -mcpu=pwr10 in both clang and llvm.

missed a file

Harbormaster failed remote builds in B56899: Diff 264303!
Harbormaster failed remote builds in B56897: Diff 264301!
amyk added a comment.May 15 2020, 4:39 PM

I believe we're also missing IsISA3_1 = false; in PPCSubtarget.cpp.

llvm/lib/Target/PowerPC/PPC.td
338

Are we missing FeatureISA3_1 in P10AdditionalFeatures?

steven.zhang added inline comments.
clang/lib/Basic/Targets/PPC.cpp
272

Do we miss to define this macro ?

__POWER10_VECTOR__
llvm/lib/Target/PowerPC/PPC.td
211

Nit: no ending dot.

steven.zhang added inline comments.May 17 2020, 6:31 PM
clang/lib/Basic/Targets/PPC.cpp
272

Well, pls ignore this comments as that macro should be added when p10 vector feature is added.

Most of my comments are related to the fact that we are now inserting P10 between P9 and Future and so a few things need to change for the Future code to sit on top of P10 now.

clang/test/Preprocessor/init-ppc64.c
652

Since we are adding P10 between P9 and Future we should add another line here:

PPCFUTURE:#define _ARCH_PWR10 1
llvm/lib/Target/PowerPC/PPC.td
340

I think these can be moved up to P10AdditionalFeatures. That way everything on P10 is now inheritable by future and we don't have to specify anything for FutureSpecificFeatures.

351

These features are now no longer FutureSpecificFeatures I would think that they would now be part of Power10 and should be inherited by future CPU.

llvm/test/CodeGen/PowerPC/check-cpu.ll
11

nit:
We should probably update this comment too.

NeHuang added inline comments.
clang/lib/Basic/Targets/PPC.cpp
339

I think we also need to check for ArchDefinePwr10 and ArchDefineFuture based on the comment "// We have __float128 on PPC but not power 9 and above."

!(ArchDefs & ArchDefinePwr9) -> !(ArchDefs & (ArchDefinePwr9 | ArchDefinePwr10 | ArchDefineFuture))

lei updated this revision to Diff 266073.May 25 2020, 1:49 PM
lei marked 7 inline comments as done.

address review comments

clang/lib/Basic/Targets/PPC.cpp
339

I would think this would be redundant since -mcpu=pwr10 also defines ArchDefinePwr9 ...

llvm/lib/Target/PowerPC/PPC.td
211

That's needed to indicate the end of the sentence. Similar to line 208.

NeHuang marked an inline comment as done.May 25 2020, 2:18 PM
NeHuang added inline comments.
clang/lib/Basic/Targets/PPC.cpp
339

Yeah. That makes sense. Thanks for the explanation!

amyk added inline comments.May 25 2020, 9:21 PM
llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
653

Should this comment be updated to include P10 as well?

nemanjai accepted this revision.May 25 2020, 9:29 PM

LGTM aside from a couple of minor nits.

clang/lib/Basic/Targets/PPC.cpp
319

Please remove this since HTM was removed in P10.

clang/test/Preprocessor/init-ppc64.c
644

I am not sure what the story is with not checking for _ARCH_PWR8 for the P9 test, but I don't think we need to continue that precedent.

This revision is now accepted and ready to land.May 25 2020, 9:29 PM
stefanp accepted this revision.May 26 2020, 9:17 AM

LGTM

amyk accepted this revision.May 26 2020, 10:00 AM

I think this looks good aside from the comments I had.

llvm/lib/Target/PowerPC/PPCSubtarget.h
142

Missing IsISA3_1 = false; in PPCSubtarget.cpp.

lei marked 4 inline comments as done.May 26 2020, 11:35 AM
lei updated this revision to Diff 266283.May 26 2020, 11:36 AM

update as per reviewers comments

This revision was automatically updated to reflect the committed changes.
lei reopened this revision.May 26 2020, 12:38 PM
This revision is now accepted and ready to land.May 26 2020, 12:38 PM
lei updated this revision to Diff 266321.May 26 2020, 1:36 PM

change how we generate p10 feature list.

stefanp accepted this revision.May 26 2020, 2:47 PM

LGTM

amyk accepted this revision.May 26 2020, 3:19 PM

This LGTM.

lei updated this revision to Diff 266533.May 27 2020, 7:28 AM

rebased

lei updated this revision to Diff 266548.May 27 2020, 8:03 AM

fix up rebase issue after revert

This revision was automatically updated to reflect the committed changes.