[PATCH] D82178: [AArch64][SVE] Guard svbfloat16_t with feature macro in ACLE
Cullen Rhodes via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 19 05:53:32 PDT 2020
c-rhodes created this revision.
c-rhodes added reviewers: sdesmalen, efriedma, stuij, fpetrogalli.
Herald added subscribers: cfe-commits, danielkiss, psnobl, rkruppe, kristof.beyls, tschuett.
Herald added a reviewer: rengolin.
Herald added a project: clang.
sdesmalen added inline comments.
================
Comment at: clang/utils/TableGen/SveEmitter.cpp:1091
+ OS << "#if defined(__ARM_FEATURE_SVE_BF16)\n";
+ OS << "typedef __SVBFloat16_t svbfloat16_t;\n";
+ OS << "#endif\n\n";
----------------
Can you also add an error if `__ARM_FEATURE_SVE_BF16` is defined, but `__ARM_FEATURE_BF16_SCALAR_ARITHMETIC` isn't?
something like:
```#ifndef __ARM_FEATURE_BF16_SCALAR_ARITHMETIC
#error "__ARM_FEATURE_BF16_SCALAR_ARITHMETIC must be defined when __ARM_FEATURE_SVE_BF16 is defined"
#endif
```
`svbfloat16_t` should only be defined if the `__ARM_FEATURE_SVE_BF16`
feature macro is enabled, similar to the scalar `bfloat16_t` type. Patch
also contains a fix for ld1ro intrinsic which should be guarded on
`__ARM_FEATURE_SVE_BF16` rather than `__ARM_FEATURE_BF16_SCALAR_ARITHMETIC`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D82178
Files:
clang/include/clang/Basic/arm_sve.td
clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_ld1ro-bfloat.c
clang/utils/TableGen/SveEmitter.cpp
Index: clang/utils/TableGen/SveEmitter.cpp
===================================================================
--- clang/utils/TableGen/SveEmitter.cpp
+++ clang/utils/TableGen/SveEmitter.cpp
@@ -1085,8 +1085,11 @@
OS << "typedef __SVUint16_t svuint16_t;\n";
OS << "typedef __SVUint32_t svuint32_t;\n";
OS << "typedef __SVUint64_t svuint64_t;\n";
- OS << "typedef __SVFloat16_t svfloat16_t;\n";
- OS << "typedef __SVBFloat16_t svbfloat16_t;\n\n";
+ OS << "typedef __SVFloat16_t svfloat16_t;\n\n";
+
+ OS << "#if defined(__ARM_FEATURE_SVE_BF16)\n";
+ OS << "typedef __SVBFloat16_t svbfloat16_t;\n";
+ OS << "#endif\n\n";
OS << "#ifdef __ARM_FEATURE_BF16_SCALAR_ARITHMETIC\n";
OS << "typedef __bf16 bfloat16_t;\n";
Index: clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_ld1ro-bfloat.c
===================================================================
--- clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_ld1ro-bfloat.c
+++ clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_ld1ro-bfloat.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -D__ARM_FEATURE_SVE_MATMUL_FP64 -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +bf16 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang_cc1 -D__ARM_FEATURE_SVE_MATMUL_FP64 -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -D__ARM_FEATURE_SVE -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +bf16 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE_MATMUL_FP64 -D__ARM_FEATURE_SVE_BF16 -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -D__ARM_FEATURE_SVE -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +bf16 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -D__ARM_FEATURE_SVE_MATMUL_FP64 -D__ARM_FEATURE_SVE_BF16 -D__ARM_FEATURE_BF16_SCALAR_ARITHMETIC -D__ARM_FEATURE_SVE -DSVE_OVERLOADED_FORMS -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +bf16 -fallow-half-arguments-and-returns -S -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s
#include <arm_sve.h>
Index: clang/include/clang/Basic/arm_sve.td
===================================================================
--- clang/include/clang/Basic/arm_sve.td
+++ clang/include/clang/Basic/arm_sve.td
@@ -484,8 +484,8 @@
let ArchGuard = "defined(__ARM_FEATURE_SVE_MATMUL_FP64)" in {
def SVLD1RO : SInst<"svld1ro[_{2}]", "dPc", "csilUcUsUiUlhfd", MergeNone, "aarch64_sve_ld1ro">;
}
-let ArchGuard = "defined(__ARM_FEATURE_SVE_MATMUL_FP64) && defined(__ARM_FEATURE_BF16_SCALAR_ARITHMETIC)" in {
- def SVLD1RO_BF : SInst<"svld1ro[_{2}]", "dPc", "b", MergeNone, "aarch64_sve_ld1ro">;
+let ArchGuard = "defined(__ARM_FEATURE_SVE_MATMUL_FP64) && defined(__ARM_FEATURE_SVE_BF16)" in {
+ def SVLD1RO_BF16 : SInst<"svld1ro[_{2}]", "dPc", "b", MergeNone, "aarch64_sve_ld1ro">;
}
////////////////////////////////////////////////////////////////////////////////
// Stores
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82178.272027.patch
Type: text/x-patch
Size: 3117 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200619/4b83f3cd/attachment-0001.bin>
More information about the cfe-commits
mailing list