[AArch64] Alter arm_sve.h to be target-based, not preprocessor based.
authorDavid Green <david.green@arm.com>
Wed, 4 Jan 2023 11:22:20 +0000 (11:22 +0000)
committerDavid Green <david.green@arm.com>
Wed, 4 Jan 2023 11:22:20 +0000 (11:22 +0000)
commit6cac7c285e69f9a3fc96e25453c246d218bd349f
tree76caa93b8093464c9f453f13bebb4eb03988f216
parentf8d008d19f3553315ef481844f96249d0cccb1e6
[AArch64] Alter arm_sve.h to be target-based, not preprocessor based.

This patch makes SVE intrinsics more useable by gating them on the
target, not by ifdef preprocessor macros. See #56480. This alters the
SVEEmitter for arm_sve.h to remove the #ifdef guards and instead use
TARGET_BUILTIN with the correct features so that the existing "'func'
needs target feature sve" error will be generated when sve is not
present.

The ArchGuard containing defines in the SVEEmitter are changed to
TargetGuard containing target features. In the arm_neon.h emitter there
are both existing ArchGuard ifdefs mixed with new TargetGuard target
feature guards, so the name is change in the SVE too for consistency.
The few functions that are present in arm_sve.h (as opposed to builtin
aliases) have __attribute__((target("sve"))) added. Some of the tests
needed to be rejigged a little, as well as updating the error message,
as the error now happens at a later point.

Differential Revision: https://reviews.llvm.org/D131064
clang/include/clang/Basic/BuiltinsSVE.def
clang/include/clang/Basic/arm_sve.td
clang/lib/Basic/Targets/AArch64.cpp
clang/test/Sema/aarch64-sve-intrinsics/acle_sve_bfloat.cpp
clang/test/Sema/aarch64-sve-intrinsics/acle_sve_target.cpp [new file with mode: 0644]
clang/test/Sema/aarch64-sve2-intrinsics/acle_sve2.cpp
clang/test/Sema/aarch64-sve2-intrinsics/acle_sve2_aes_bitperm_sha3_sm4.cpp
clang/test/Sema/aarch64-sve2-intrinsics/acle_sve2_bfloat.cpp
clang/utils/TableGen/SveEmitter.cpp