]> git.ipfire.org Git - thirdparty/gcc.git/commit
aarch64: Add fp8 scalar types
authorClaudio Bantaloukas <Claudio.Bantaloukas@arm.com>
Tue, 1 Oct 2024 12:45:11 +0000 (12:45 +0000)
committerSaurabh Jha <saurabh.jha@arm.com>
Tue, 1 Oct 2024 12:48:03 +0000 (12:48 +0000)
commit35dd5cfbfd7f33b5f22ae209635f40af4ab6863c
tree0afda227141d642b6f524a302827e0a7314fc712
parent27ddda8b4cb51739e841053c29d9b5f503467e99
aarch64: Add fp8 scalar types

The ACLE defines a new scalar type, __mfp8. This is an opaque 8bit types that
can only be used by fp8 intrinsics. Additionally, the mfloat8_t type is made
available in arm_neon.h and arm_sve.h as an alias of the same.

This implementation uses an unsigned INTEGER_TYPE, with precision 8 to
represent __mfp8. Conversions to int and other types are disabled via the
TARGET_INVALID_CONVERSION hook.
Additionally, operations that are typically available to integer types are
disabled via TARGET_INVALID_UNARY_OP and TARGET_INVALID_BINARY_OP hooks.

gcc/ChangeLog:

* config/aarch64/aarch64-builtins.cc (aarch64_mfp8_type_node): Add node
for __mfp8 type.
(aarch64_mfp8_ptr_type_node): Add node for __mfp8 pointer type.
(aarch64_init_fp8_types): New function to initialise fp8 types and
register with language backends.
* config/aarch64/aarch64.cc (aarch64_mangle_type): Add ABI mangling for
new type.
(aarch64_invalid_conversion): Add function implementing
TARGET_INVALID_CONVERSION hook that blocks conversion to and from the
__mfp8 type.
(aarch64_invalid_unary_op): Add function implementing TARGET_UNARY_OP
hook that blocks operations on __mfp8 other than &.
(aarch64_invalid_binary_op): Extend TARGET_BINARY_OP hook to disallow
operations on __mfp8 type.
(TARGET_INVALID_CONVERSION): Add define.
(TARGET_INVALID_UNARY_OP): Likewise.
* config/aarch64/aarch64.h (aarch64_mfp8_type_node): Add node for __mfp8
type.
(aarch64_mfp8_ptr_type_node): Add node for __mfp8 pointer type.
* config/aarch64/arm_private_fp8.h (mfloat8_t): Add typedef.

gcc/testsuite/ChangeLog:

* g++.target/aarch64/fp8_mangling.C: New tests exercising mangling.
* g++.target/aarch64/fp8_scalar_typecheck_2.C: New tests in C++.
* gcc.target/aarch64/fp8_scalar_1.c: New tests in C.
* gcc.target/aarch64/fp8_scalar_typecheck_1.c: Likewise.
gcc/config/aarch64/aarch64-builtins.cc
gcc/config/aarch64/aarch64.cc
gcc/config/aarch64/aarch64.h
gcc/config/aarch64/arm_private_fp8.h
gcc/testsuite/g++.target/aarch64/fp8_mangling.C [new file with mode: 0644]
gcc/testsuite/g++.target/aarch64/fp8_scalar_typecheck_2.C [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/fp8_scalar_1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/fp8_scalar_typecheck_1.c [new file with mode: 0644]