-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[main] Add feature macro __ARM_FEATURE_RCPC #199
Conversation
Hello @minglotus-6, thank you for your patch. May I ask you to go through the checklist I have added to the description of the PR? The Contribution Agreement in the CONTRIBUTING page allows you or the company you work for to retain copyright for the changes. Kind regards, Francesco |
Broadly, I am supportive of this from a technical perspective. However, I do have some minor comments. The armv8a Arm ARM (https://developer.arm.com/documentation/ddi0487/ha/) defines the following values for the ID field for LRCPC in
It would make sense for this macro, therefore, to match these values, as this gives a better idea of which instructions these enable in inline assembly. We do something similar with I would also like the description to reference the official I think leaving the macro name as |
Sure. I saw the checklist but was not sure if I should list them before. Did it this time. |
Keeping macro value consistent with register field value makes a lot of sense to me. This allows inline assembly users to further gate the usage of I'd like to mention one thing and hear feedback :) I wonder if using bitmaps is a recommended approach, say more values could be added to To elaborate,
[1] https://github.com/ARM-software/acle/blob/main/main/acle.md#hardware-floating-point
|
A side-topic that's more relevant with Clang/LLVM but less relevant here, is that As a result, for armv8.2 with rcpc2 extensions, there isn't a way for user to tell compiler to set [1] https://github.com/llvm/llvm-project/blob/40d2ef841b68f6b493ce88bd750a92105a2b567d/llvm/include/llvm/Support/AArch64TargetParser.def#L129 is where features are defined, and https://godbolt.org/z/Gh4safcx7 exemplifies it |
@minglotus-6 - thank you for updating the list. May I ask you to add also the copyright statement (it is required in the contribution agreement) and update the variable WRT the copyright statements, what you need to do is described in the checklist of the description of the PR. Please let me know if anything is unclear! Thank you, Francesco |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to mention one thing and hear feedback :) I wonder if using bitmaps is a recommended approach, say more values could be added to LRCPC field of ID_AA64ISAR1_EL1 in the future.
Please do not propose a bitmap in this case. FEAT_LRCPC2 implies FEAT_LRCPC, while they have what look like orthogonal bitmap values, this is just a coincidence from assigning 1 then 2.
I much prefer your example (1), especially so programmers can write __ARM_FEATURE_RCPC >= 1
if they only have a version which requires LDAPR
.
With respect to the FP and CDE extensions, the values in there are orthogonal (though the FP one tells you the exact values that preprocessor definition will ever have, showing it's not fully orthogonal).
Below, I'm broadly happy, though I have one comment about the table entry.
Thanks for pointing this out Francesco! I've just read some guidelines inside the company I worked for and will also consult to see what I plan to fill in looks good. I'll update once I get some guidance inside the company. As you may see I'm not very familiar with this contributing process and I appreciate your patience and guidance here! |
Acknowledged, thanks for taking a look!
This makes sense.
Applied the suggestions. |
To guard the usage of Load-AcquirePC instructions in inline assembly, https://reviews.llvm.org/D127798 introduces macro __ARM_FEATURE_RCPC in Clang/LLVM. This patch documents the existence of the feature MACRO, and its use case. Co-authored-by: Sam Elliott <[email protected]>
Historically we have not added #defines to ACLE unless they guard, or describe, features or intrinsics provided by ACLE and that are visible directly to C programmers (ie, providing macros to conditionalize assembly language is out of scope). So exactly what does this new macro guard? |
Hi Francesco, |
This is to guard the usage of FEAT_RCPC and FEAT_RCPC2 instructions in the inline assembly. An example usage is in #199 (comment). I wonder if the use case looks reasonable, or are there better alternatives? |
A bump of this PR :-) |
I am happy with this from the technical side. I find the sentence about |
ARM-software/acle#199 adds a new feature macro for RCPC, for use in things like inline assembly. This patch adds the associated support to GCC. Also, RCPC is required for Armv8.3-A and later, but the armv8.3-a entry didn't include it. This was probably harmless in practice since GCC simply ignored the extension until now. (The GAS definition is OK.) gcc/ * config/aarch64/aarch64.h (AARCH64_ISA_RCPC): New macro. * config/aarch64/aarch64-arches.def (armv8.3-a): Include RCPC. * config/aarch64/aarch64-cores.def (thunderx3t110, zeus, neoverse-v1) (neoverse-512tvb, saphira): Remove RCPC from these Armv8.3-A+ cores. * config/aarch64/aarch64-c.cc (aarch64_update_cpp_builtins): Define __ARM_FEATURE_RCPC when appropriate. gcc/testsuite/ * gcc.target/aarch64/pragma_cpp_predefs_1.c: Add RCPC tests.
ARM-software/acle#199 adds a new feature macro for RCPC, for use in things like inline assembly. This patch adds the associated support to GCC. Also, RCPC is required for Armv8.3-A and later, but the armv8.3-a entry didn't include it. This was probably harmless in practice since GCC simply ignored the extension until now. (The GAS definition is OK.) gcc/ * config/aarch64/aarch64.h (AARCH64_FL_FOR_ARCH8_3): Add AARCH64_FL_RCPC. (AARCH64_ISA_RCPC): New macro. * config/aarch64/aarch64-cores.def (thunderx3t110, zeus, neoverse-v1) (neoverse-512tvb, saphira): Remove RCPC from these Armv8.3-A+ cores. * config/aarch64/aarch64-c.cc (aarch64_update_cpp_builtins): Define __ARM_FEATURE_RCPC when appropriate. gcc/testsuite/ * gcc.target/aarch64/pragma_cpp_predefs_1.c: Add RCPC tests.
ARM-software/acle#199 adds a new feature macro for RCPC, for use in things like inline assembly. This patch adds the associated support to GCC. Also, RCPC is required for Armv8.3-A and later, but the armv8.3-a entry didn't include it. This was probably harmless in practice since GCC simply ignored the extension until now. (The GAS definition is OK.) gcc/ * config/aarch64/aarch64.h (AARCH64_FL_FOR_ARCH8_3): Add AARCH64_FL_RCPC. (AARCH64_ISA_RCPC): New macro. * config/aarch64/aarch64-cores.def (thunderx3t110, zeus, neoverse-v1) (neoverse-512tvb, saphira): Remove RCPC from these Armv8.3-A+ cores. * config/aarch64/aarch64-c.c (aarch64_update_cpp_builtins): Define __ARM_FEATURE_RCPC when appropriate. gcc/testsuite/ * gcc.target/aarch64/pragma_cpp_predefs_1.c: Add RCPC tests.
ARM-software/acle#199 adds a new feature macro for RCPC, for use in things like inline assembly. This patch adds the associated support to GCC. Also, RCPC is required for Armv8.3-A and later, but the armv8.3-a entry didn't include it. This was probably harmless in practice since GCC simply ignored the extension until now. (The GAS definition is OK.) gcc/ * config/aarch64/aarch64.h (AARCH64_FL_FOR_ARCH8_3): Add AARCH64_FL_RCPC. (AARCH64_ISA_RCPC): New macro. * config/aarch64/aarch64-cores.def (thunderx3t110, zeus, neoverse-v1) (neoverse-512tvb, saphira): Remove RCPC from these Armv8.3-A+ cores. * config/aarch64/aarch64-c.c (aarch64_update_cpp_builtins): Define __ARM_FEATURE_RCPC when appropriate. gcc/testsuite/ * gcc.target/aarch64/pragma_cpp_predefs_1.c: Add RCPC tests.
@all-contributors please add @lenary for review. |
I've put up a pull request to add @lenary! 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
Reference: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=c1b0a767f04a8ccbaff2a7b71d5c817cdb469630 ARM-software/acle#199 adds a new feature macro for RCPC, for use in things like inline assembly. This patch adds the associated support to GCC. Also, RCPC is required for Armv8.3-A and later, but the armv8.3-a entry didn't include it. This was probably harmless in practice since GCC simply ignored the extension until now. (The GAS definition is OK.) gcc/ * config/aarch64/aarch64.h (AARCH64_ISA_RCPC): New macro. * config/aarch64/aarch64-arches.def (armv8.3-a): Include RCPC. * config/aarch64/aarch64-cores.def (thunderx3t110, zeus, neoverse-v1) (neoverse-512tvb, saphira): Remove RCPC from these Armv8.3-A+ cores. * config/aarch64/aarch64-c.cc (aarch64_update_cpp_builtins): Define __ARM_FEATURE_RCPC when appropriate. gcc/testsuite/ * gcc.target/aarch64/pragma_cpp_predefs_1.c: Add RCPC tests.
To guard the usage of Load-AcquirePC instructions in inline assembly, https://reviews.llvm.org/D127798 introduces macro __ARM_FEATURE_RCPC in Clang/LLVM.
This patch documents the existence of the feature MACRO, its availability and use case.
Checklist: (mark with
X
those which apply)PR (do not bother creating the issue if all you want to do is
fixing the bug yourself).
SPDX-FileCopyrightText
lines on topof any file I have edited. Format is
SPDX-FileCopyrightText: Copyright {year} {entity or name} <{contact informations}>
(Please update existing copyright lines if applicable. You can
specify year ranges with hyphen , as in
2017-2019
, and usecommas to separate gaps, as in
2018-2020, 2022
).Copyright
section of the sources of thespecification I have edited (this will show up in the text
rendered in the PDF and other output format supported). The
format is the same described in the previous item.
tricky to set up on non-*nix machines). The sequence can be
found in the contribution
guidelines. Don't
worry if you cannot run these scripts on your machine, your
patch will be automatically checked in the Actions of the pull
request.
introduced in this PR in the section Changes for next
release of the section Change Control/Document history
of the document. Create Changes for next release if it does
not exist. Notice that changes that are not modifying the
content and rendering of the specifications (both HTML and PDF)
do not need to be listed.
correctness of the result in the PDF output (please refer to the
instructions on how to build the PDFs
locally).
draftversion
is set totrue
in the YAML headerof the sources of the specifications I have modified.
in the README page of the project.