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? Steve Ellcey sell...@cavium.com 2018-07-24 Steve Ellcey <sell...@cavium.com> PR target/86538 * 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 --- a/gcc/config/aarch64/aarch64-c.c +++ b/gcc/config/aarch64/aarch64-c.c @@ -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. */