This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Restrict various P10 options to P10 only.
ClosedPublic

Authored by amyk on Sep 11 2021, 3:05 PM.

Details

Summary

This patch attempts to restrict the following P10 options:

-mprefixed
-mpcrel
-mpaired-vector-memops

To P10 only. This will prevent the use of these options on P9 and earlier.

The behaviour of this patch looks like the following on pre-P10:

$ clang -mcpu=pwr9 -mpaired-vector-memops test.c -o test
error: option '-mpaired-vector-memops' cannot be specified without '-mcpu=pwr10'

$ clang -mcpu=pwr9 -mprefixed test.c -o test
error: option '-mprefixed' cannot be specified without '-mcpu=pwr10'

$ clang -mcpu=pwr9 -mprefixed -mpcrel test.c -o test
error: option '-mpcrel' cannot be specified without '-mcpu=pwr10 -mprefixed'

$ clang -mcpu=pwr9 -mpcrel -mprefixed test.c -o test
error: option '-mpcrel' cannot be specified without '-mcpu=pwr10 -mprefixed'

$ clang -mcpu=pwr9 -mpcrel test.c -o test
error: option '-mpcrel' cannot be specified without '-mcpu=pwr10 -mprefixed'

Diff Detail

Event Timeline

amyk created this revision.Sep 11 2021, 3:05 PM
amyk requested review of this revision.Sep 11 2021, 3:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 11 2021, 3:05 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
Conanap accepted this revision.Sep 20 2021, 10:58 AM
Conanap added a subscriber: Conanap.

LGTM

This revision is now accepted and ready to land.Sep 20 2021, 10:58 AM
lei added a subscriber: lei.Sep 20 2021, 11:27 AM
lei added inline comments.
clang/lib/Basic/Targets/PPC.cpp
585–588

I think this need more thought:

$ clang -mcpu=pwr9 -mprefixed -mpcrel test.c -o test
error: option '-mpcrel' cannot be specified without '-mprefixed'
error: option '-mprefixed' cannot be specified without '-mcpu=pwr10'

$ clang -mcpu=pwr9 -mpcrel test.c -o test
error: option '-mpcrel' cannot be specified without '-mprefixed'

For this, the first err makes not sense since both -mprefixed and -mpcrel is specified:

$ clang -mcpu=pwr9 -mprefixed -mpcrel test.c -o test
error: option '-mpcrel' cannot be specified without '-mprefixed'
error: option '-mprefixed' cannot be specified without '-mcpu=pwr10'

Shouldn't it just give:

$ clang -mcpu=pwr9 -mprefixed -mpcrel test.c -o test
error: option '-mpcrel' cannot be specified without '-mcpu=pwr10 -mprefixed'

For this:

$ clang -mcpu=pwr9 -mpcrel test.c -o test
error: option '-mpcrel' cannot be specified without '-mprefixed'

I think it's better if it says:

$ clang -mcpu=pwr9 -mpcrel test.c -o test
error: option '-mpcrel' cannot be specified without '-mcpu=pwr10 -mprefixed'
amyk updated this revision to Diff 374990.Sep 24 2021, 4:36 PM
amyk edited the summary of this revision. (Show Details)

Addressed Lei's review comments to output:

error: option '-mpcrel' cannot be specified without '-mcpu=pwr10 -mprefixed'

when PC-Rel is specified pre-P10.

Also updated the comment for MMA on pre-P10 so it makes more sense and is more consistent with the comments I've added.

lei accepted this revision.Oct 18 2021, 7:50 AM

LGTM
I think you went a bit overkill with the tests for this patch 🙂. Please cut down the number of run lines before committing.

clang/test/Driver/ppc-p10-features-support-check.c
5

I think you can just use pwr10 and power10 in diff run lines if you need, but no need to test for both in this case.

12

might be an overkill to also test for pwr7/8. I think pwr9/10 test is enough.

20

same comment for the set of runlines below.

This revision was landed with ongoing or failed builds.Oct 19 2021, 7:05 AM
This revision was automatically updated to reflect the committed changes.
amyk marked 3 inline comments as done.Oct 19 2021, 7:06 AM