This is the mail archive of the
mailing list for the GCC project.
[Patch] [Aarch64] PR 86538 - Define __ARM_FEATURE_LSE if LSE is available
- From: Steve Ellcey <sellcey at cavium dot com>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Cc: "richard.earnshaw" <richard dot earnshaw at arm dot com>, "james.greenhalgh" <james dot greenhalgh at arm dot com>, Marcus Shawcroft <Marcus dot Shawcroft at arm dot com>
- Date: Tue, 24 Jul 2018 13:22:02 -0700
- Subject: [Patch] [Aarch64] PR 86538 - Define __ARM_FEATURE_LSE if LSE is available
- Reply-to: sellcey at cavium dot com
This is a patch for PR 86538, to define an __ARM_FEATURE_LSE macro
when LSE is available. Richard Earnshaw closed PR 86538 as WONTFIX
because the ACLE (Arm C Language Extension) does not require this
macro and because he is concerned that it might encourage people to
use inline assembly instead of the __sync and atomic intrinsics.
(See actual comments in the defect report.)
While I agree that we want people to use the intrinsics I still think
there are use cases where people may want to know if LSE is available
or not and there is currrently no (simple) way to determine if this feature
is available since it can be turned or and off independently of the
architecture used. Also, as a general principle, I think any feature
that can be toggled on or off by the compiler should provide a way for
users to determine what its state is.
So what do other ARM maintainers and users think? Is this a useful
feature to have in GCC?
2018-07-24 Steve Ellcey <firstname.lastname@example.org>
* config/aarch64/aarch64-c.c (aarch64_update_cpp_builtins):
Add define of __ARM_FEATURE_LSE.
diff --git a/gcc/config/aarch64/aarch64-c.c b/gcc/config/aarch64/aarch64-c.c
index 40c738c..e057ba9 100644
@@ -154,6 +154,9 @@ aarch64_update_cpp_builtins (cpp_reader *pfile)
aarch64_def_or_undef (TARGET_SM4, "__ARM_FEATURE_SM4", pfile);
aarch64_def_or_undef (TARGET_F16FML, "__ARM_FEATURE_FP16_FML", pfile);
+ /* This is not required by ACLE, but it is useful. */
+ aarch64_def_or_undef (TARGET_LSE, "__ARM_FEATURE_LSE", pfile);
/* Not for ACLE, but required to keep "float.h" correct if we switch
target between implementations that do or do not support ARMv8.2-A
16-bit floating-point extensions. */