I just pushed it to the trunk.

Thanks,
Saurabh

On 9/20/2024 3:09 PM, Claudio Bantaloukas wrote:

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.
---
Hi,
Is this ok for master? I do not have commit rights yet, if ok, can someone 
commit it on my behalf?

Regression tested with aarch64-unknown-linux-gnu.

Compared to V1 of the patch, in version 2:
- mangling for the __mfp8 type was added along with tests
- unneeded comments were removed
- simplified type checks in hooks
- simplified initialization of aarch64_mfp8_type_node
- separated mfloat8_t define from other fp types in arm_sve.h
- C++ tests were moved to g++.target/aarch64
- added more tests around binary operations, function declaration,
   type traits
- added tests exercising loads and stores from floating point registers

Compared to V2 of the patch, in version 3:
- typedefs for mfloat8_t are defined in arm_private_fp8.h rather than 
arm_neon.h and arm_sve.h

Thanks,
Claudio Bantaloukas

  gcc/config/aarch64/aarch64-builtins.cc        |  20 +
  gcc/config/aarch64/aarch64.cc                 |  54 ++-
  gcc/config/aarch64/aarch64.h                  |   5 +
  gcc/config/aarch64/arm_private_fp8.h          |   2 +
  .../g++.target/aarch64/fp8_mangling.C         |  44 ++
  .../aarch64/fp8_scalar_typecheck_2.C          | 381 ++++++++++++++++++
  .../gcc.target/aarch64/fp8_scalar_1.c         | 134 ++++++
  .../aarch64/fp8_scalar_typecheck_1.c          | 356 ++++++++++++++++
  8 files changed, 994 insertions(+), 2 deletions(-)
  create mode 100644 gcc/testsuite/g++.target/aarch64/fp8_mangling.C
  create mode 100644 gcc/testsuite/g++.target/aarch64/fp8_scalar_typecheck_2.C
  create mode 100644 gcc/testsuite/gcc.target/aarch64/fp8_scalar_1.c
  create mode 100644 gcc/testsuite/gcc.target/aarch64/fp8_scalar_typecheck_1.c


Reply via email to