diff options
author | Kyrylo Tkachov <ktkachov@nvidia.com> | 2024-06-27 16:10:41 +0530 |
---|---|---|
committer | Kyrylo Tkachov <ktkachov@nvidia.com> | 2024-07-04 12:21:19 +0530 |
commit | 7785289f8d1f6350a3f48232ce578009b0e23534 (patch) | |
tree | 7cc841ad0c439da326df24db09793e38cb52120c | |
parent | a26c560d3f679d5237dd5191869e845740b94759 (diff) | |
download | gcc-7785289f8d1f6350a3f48232ce578009b0e23534.zip gcc-7785289f8d1f6350a3f48232ce578009b0e23534.tar.gz gcc-7785289f8d1f6350a3f48232ce578009b0e23534.tar.bz2 |
aarch64: PR target/115457 Implement missing __ARM_FEATURE_BF16 macro
The ACLE asks the user to test for __ARM_FEATURE_BF16 before using the
<arm_bf16.h> header but GCC doesn't set this up.
LLVM does, so this is an inconsistency between the compilers.
This patch enables that macro for TARGET_BF16_FP.
Bootstrapped and tested on aarch64-none-linux-gnu.
gcc/
PR target/115457
* config/aarch64/aarch64-c.cc (aarch64_update_cpp_builtins):
Define __ARM_FEATURE_BF16 for TARGET_BF16_FP.
gcc/testsuite/
PR target/115457
* gcc.target/aarch64/acle/bf16_feature.c: New test.
Signed-off-by: Kyrylo Tkachov <ktkachov@nvidia.com>
(cherry picked from commit c10942134fa759843ac1ed1424b86fcb8e6368ba)
-rw-r--r-- | gcc/config/aarch64/aarch64-c.cc | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/aarch64/acle/bf16_feature.c | 10 |
2 files changed, 12 insertions, 0 deletions
diff --git a/gcc/config/aarch64/aarch64-c.cc b/gcc/config/aarch64/aarch64-c.cc index 6c5331a..51709d6 100644 --- a/gcc/config/aarch64/aarch64-c.cc +++ b/gcc/config/aarch64/aarch64-c.cc @@ -202,6 +202,8 @@ aarch64_update_cpp_builtins (cpp_reader *pfile) "__ARM_FEATURE_BF16_VECTOR_ARITHMETIC", pfile); aarch64_def_or_undef (TARGET_BF16_FP, "__ARM_FEATURE_BF16_SCALAR_ARITHMETIC", pfile); + aarch64_def_or_undef (TARGET_BF16_FP, + "__ARM_FEATURE_BF16", pfile); aarch64_def_or_undef (TARGET_LS64, "__ARM_FEATURE_LS64", pfile); aarch64_def_or_undef (AARCH64_ISA_RCPC, "__ARM_FEATURE_RCPC", pfile); diff --git a/gcc/testsuite/gcc.target/aarch64/acle/bf16_feature.c b/gcc/testsuite/gcc.target/aarch64/acle/bf16_feature.c new file mode 100644 index 0000000..96584b4 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/acle/bf16_feature.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ + +#pragma GCC target "+bf16" +#ifndef __ARM_FEATURE_BF16 +#error "__ARM_FEATURE_BF16 is not defined but should be!" +#endif + +void +foo (void) {} + |