]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
aarch64: PR target/115475 Implement missing __ARM_FEATURE_SVE_BF16 macro
authorKyrylo Tkachov <ktkachov@nvidia.com>
Fri, 28 Jun 2024 07:52:37 +0000 (13:22 +0530)
committerKyrylo Tkachov <ktkachov@nvidia.com>
Tue, 9 Jul 2024 11:54:28 +0000 (17:24 +0530)
The ACLE requires __ARM_FEATURE_SVE_BF16 to be enabled when SVE and BF16
and the associated intrinsics are available.
GCC does support the required intrinsics for TARGET_SVE_BF16 so define
this macro too.

Bootstrapped and tested on aarch64-none-linux-gnu.

gcc/

PR target/115475
* config/aarch64/aarch64-c.c (aarch64_update_cpp_builtins):
Define __ARM_FEATURE_SVE_BF16 for TARGET_SVE_BF16.

gcc/testsuite/

PR target/115475
* gcc.target/aarch64/acle/bf16_sve_feature.c: New test.

Signed-off-by: Kyrylo Tkachov <ktkachov@nvidia.com>
(cherry picked from commit 6492c7130d6ae9992298fc3d072e2589d1131376)

gcc/config/aarch64/aarch64-c.c
gcc/testsuite/gcc.target/aarch64/acle/bf16_sve_feature.c [new file with mode: 0644]

index f6d90affd3744004483c2c819587dd532e3d2d4e..ba732e4d877c7345dc72548bee83c4a0fbb1a1c9 100644 (file)
@@ -202,6 +202,9 @@ aarch64_update_cpp_builtins (cpp_reader *pfile)
                        "__ARM_FEATURE_BF16_SCALAR_ARITHMETIC", pfile);
   aarch64_def_or_undef (TARGET_BF16_FP,
                        "__ARM_FEATURE_BF16", pfile);
+  aarch64_def_or_undef (TARGET_SVE_BF16,
+                       "__ARM_FEATURE_SVE_BF16", pfile);
+
   aarch64_def_or_undef (AARCH64_ISA_RCPC, "__ARM_FEATURE_RCPC", pfile);
 
   /* Not for ACLE, but required to keep "float.h" correct if we switch
diff --git a/gcc/testsuite/gcc.target/aarch64/acle/bf16_sve_feature.c b/gcc/testsuite/gcc.target/aarch64/acle/bf16_sve_feature.c
new file mode 100644 (file)
index 0000000..cb3ddac
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+
+#pragma GCC target "+sve+bf16"
+#ifndef __ARM_FEATURE_SVE_BF16
+#error "__ARM_FEATURE_SVE_BF16 is not defined but should be!"
+#endif
+
+void
+foo (void) {}
+