[all-commits] [llvm/llvm-project] b879f9: [AArch64][ARM] Alter most of arm_neon.h to be targ...
David Green via All-commits
all-commits at lists.llvm.org
Tue Oct 11 01:09:32 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: b879f99f0ec0f34bfc5a6fe60299c308eec71f53
https://github.com/llvm/llvm-project/commit/b879f99f0ec0f34bfc5a6fe60299c308eec71f53
Author: David Green <david.green at arm.com>
Date: 2022-10-11 (Tue, 11 Oct 2022)
Changed paths:
M clang/include/clang/Basic/TargetBuiltins.h
M clang/include/clang/Basic/arm_neon.td
M clang/include/clang/Basic/arm_neon_incl.td
M clang/lib/Basic/Targets/AArch64.cpp
M clang/lib/Basic/Targets/ARM.cpp
M clang/lib/CodeGen/CGBuiltin.cpp
M clang/test/CodeGen/aarch64-neon-sm4-sm3.c
M clang/test/CodeGen/aarch64-v8.2a-neon-intrinsics.c
M clang/test/CodeGen/neon-crypto.c
A clang/test/Sema/aarch64-neon-target.c
A clang/test/Sema/arm-neon-target.c
M clang/utils/TableGen/NeonEmitter.cpp
Log Message:
-----------
[AArch64][ARM] Alter most of arm_neon.h to be target-based, not preprocessor based.
Similar to D131064, this alters most of the intrinsics in arm_neon.h to
be target based, not preprocessor based. The intrinsics that are changed
are the ones with obvious target features (fp16, fp16fml, cryptos, i8mm
and bf16). The ones that are not yet altered are the ones without target
features like rdma (8.1) and complex (8.3). Those will be switched in a
followup patch that allows targeting architecture versions.
The existing ArchGuard in arm_neon.td is split into ArchGuard that still
adds ifdef defines (for example for intrinsics that require __aarch64__),
and TargetGuards for intrinsics dependant on target features. From there
the TargetGuards are used in two ways:
- For intrinsics emitted as functions, __attribute__((target(TargetGuard)))
is added to the definition of the function. Along with the existing
always_inline intrinsic, this will give a compile time error if the
function is used in a context where the target feature is not available.
- For intrinsics emitted as macros, the __builtins are emitted into
arm_neon.inc using TARGET_BUILTIN as opposed to BUILTIN, which includes
the target feature and gives an error if the builtin is found in a
function without the required features, similar to arm_sve.h.
The second method requires that the intrinsics be separable from the
existing _v intrinsics used in other types. For example
__builtin_neon_splat_lane_bf16 is used as opposed to
__builtin_neon_splat_lane_v. There are some adjustments to the CGBuiltin
to account for intrinsics that can be treated similarly, except for
their target features.
Differential Revision: https://reviews.llvm.org/D132034
More information about the All-commits
mailing list