This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Define __ARM_FEATURE_RCPC
ClosedPublic

Authored by mingmingl on Jun 14 2022, 2:14 PM.

Details

Summary

This patch implements the definition of __ARM_FEATURE_RCPC when clang commands specifies +rcpc.

Diff Detail

Event Timeline

mingmingl created this revision.Jun 14 2022, 2:14 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 14 2022, 2:14 PM
mingmingl requested review of this revision.Jun 14 2022, 2:14 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 14 2022, 2:14 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
mingmingl updated this revision to Diff 436940.Jun 14 2022, 2:16 PM

update commit message with differential revision link.

The patch looks correct to me, but looking at https://github.com/ARM-software/acle/blob/main/main/acle.md where all the ACLE macros are defined, I'm not sure that __ARM_FEATURE_RCPC is there currently. Maybe you also want to submit a patch there, or at least explain the context of this change please?

lenary added a subscriber: lenary.Jun 15 2022, 5:54 AM

The patch looks correct to me, but looking at https://github.com/ARM-software/acle/blob/main/main/acle.md where all the ACLE macros are defined, I'm not sure that __ARM_FEATURE_RCPC is there currently. Maybe you also want to submit a patch there, or at least explain the context of this change please?

thanks for taking a look!

Before this patch, there is a piece of inline assembly like [1] that uses LDAPR and guarded by #if defined(__aarch64__). Since not all aarch64 platforms support LDAPR, we want to further guard the usage of LDAPR by MACRO __ARM_FEATURE_RCPC. May I know if there are alternatives for this use case, if introducing __ARM_FEATURE_RCPC sounds ad-hoc?

I'm glad to send a patch to add __ARM_FEATURE_RCPC to https://github.com/ARM-software/acle/blob/main/main/acle.md if it's conventional to do so. Just let me know your suggestions!

[1]

add x6, x1, x4
ldapr x5, [x6]

Yes. Please submit a PR or Issue to the ACLE, explaining the use-case (the explanation here is good enough, I think).

Once the ACLE changes are merged, then you can proceed with a patch for clang.

Yes. Please submit a PR or Issue to the ACLE, explaining the use-case (the explanation here is good enough, I think).

Once the ACLE changes are merged, then you can proceed with a patch for clang.

This makes sense to me. I created https://github.com/ARM-software/acle/pull/199, yet not able to add reviewer (which is WAI since I don't have write permission).

MaskRay added inline comments.
clang/test/Preprocessor/aarch64-target-features.c
22

The list is alphabetical. RCPC should be moved below.

565

--target=aarch64

mingmingl updated this revision to Diff 437691.Jun 16 2022, 1:42 PM
mingmingl marked an inline comment as done.

In clang/test/Preprocessor/aarch64-target-features.c, move __ARM_FEATURE_RCPC to keep the alphabetical list, and use -target=aarch64.. (the join style) rather than legacy while-space separated style (key value).

mingmingl marked an inline comment as done.Jun 16 2022, 1:42 PM
mingmingl added inline comments.
clang/test/Preprocessor/aarch64-target-features.c
22

good catch. done.

565

done. thanks for pointing this out!

mingmingl updated this revision to Diff 437749.Jun 16 2022, 4:26 PM
mingmingl marked an inline comment as done.

change from -target=aarch64-none-linux-gnu to --target=aarch64-none-linux-gnu to resolve a compile error.

Verified no other compilation error by ninja check-all

mingmingl updated this revision to Diff 437750.Jun 16 2022, 4:41 PM

Use --target=aarch64 rather than --target=aarch64-unknown-linux-gnu, given the former means all ELF based operating systems can expect the feature. (thanks maskray@ for pointing it out!)

mingmingl added a reviewer: fpetrogalli.
mingmingl updated this revision to Diff 461588.Sep 20 2022, 9:26 AM

It has been a while since this patch was updated, rebase for review now that the Github PR was accepted.

mingmingl added a comment.EditedSep 20 2022, 9:27 AM

Hi folks,
The ARM ACLE PR (https://github.com/ARM-software/acle/pull/199) was accepted. Would you take another look of this patch at your convenience? Thanks!

lenary accepted this revision.Sep 20 2022, 9:41 AM
This revision is now accepted and ready to land.Sep 20 2022, 9:41 AM

Thanks! Going to submit.

This revision was landed with ongoing or failed builds.Sep 20 2022, 10:03 AM
This revision was automatically updated to reflect the committed changes.