aarch64: Add bfloat16_t support for aarch64
x86_64/i686 has for a few months working std::bfloat16_t support, __bf16 there is no longer a storage only type, but can be used for arithmetics and is supported in libgcc and libstdc++. The following patch adds similar support for AArch64. Unlike the x86 changes, this one keeps the old __bf16 mangling of u6__bf16 rather than DF16b (so an exception from Itanium ABI), but otherwise __bf16 and decltype (0.0bf16) are the same type and both in C++ act as extended floating-point type. 2023-03-13 Jakub Jelinek <jakub@redhat.com> gcc/ * config/aarch64/aarch64.h (aarch64_bf16_type_node): Remove. (aarch64_bf16_ptr_type_node): Adjust comment. * config/aarch64/aarch64.cc (aarch64_gimplify_va_arg_expr): Use bfloat16_type_node rather than aarch64_bf16_type_node. (aarch64_libgcc_floating_mode_supported_p, aarch64_scalar_mode_supported_p): Also support BFmode. (aarch64_invalid_conversion, aarch64_invalid_unary_op): Remove. (aarch64_invalid_binary_op): Remove BFmode related rejections. (TARGET_INVALID_CONVERSION, TARGET_INVALID_UNARY_OP): Don't redefine. * config/aarch64/aarch64-builtins.cc (aarch64_bf16_type_node): Remove. (aarch64_int_or_fp_type): Use bfloat16_type_node rather than aarch64_bf16_type_node. (aarch64_init_simd_builtin_types): Likewise. (aarch64_init_bf16_types): Likewise. Don't create bfloat16_type_node, which is created in tree.cc already. * config/aarch64/aarch64-sve-builtins.def (svbfloat16_t): Likewise. gcc/testsuite/ * gcc.target/aarch64/sve/acle/general-c/ternary_bfloat16_opt_n_1.c: Don't expect one __bf16 related error. * gcc.target/aarch64/bfloat16_vector_typecheck_1.c: Adjust or remove dg-error directives for __bf16 being an extended arithmetic type. * gcc.target/aarch64/bfloat16_vector_typecheck_2.c: Likewise. * gcc.target/aarch64/bfloat16_scalar_typecheck.c: Likewise. * g++.target/aarch64/bfloat_cpp_typecheck.C: Don't expect two __bf16 related errors. libgcc/ * config/aarch64/t-softfp (softfp_extensions): Add bfsf. (softfp_truncations): Add tfbf dfbf sfbf hfbf. (softfp_extras): Add floatdibf floatundibf floattibf floatuntibf. * config/aarch64/libgcc-softfp.ver (GCC_13.0.0): Export __extendbfsf2 and __trunc{s,d,t,h}fbf2. * config/aarch64/sfp-machine.h (_FP_NANFRAC_B, _FP_NANSIGN_B): Define. * soft-fp/floatundibf.c: New file. * soft-fp/floatdibf.c: New file. libstdc++-v3/ * config/abi/pre/gnu.ver (CXXABI_1.3.14): Also export __bf16 tinfos if it isn't mangled as DF16b but u6__bf16.
Showing
- gcc/config/aarch64/aarch64-builtins.cc 6 additions, 12 deletionsgcc/config/aarch64/aarch64-builtins.cc
- gcc/config/aarch64/aarch64-sve-builtins.def 1 addition, 1 deletiongcc/config/aarch64/aarch64-sve-builtins.def
- gcc/config/aarch64/aarch64.cc 5 additions, 49 deletionsgcc/config/aarch64/aarch64.cc
- gcc/config/aarch64/aarch64.h 2 additions, 3 deletionsgcc/config/aarch64/aarch64.h
- gcc/testsuite/g++.target/aarch64/bfloat_cpp_typecheck.C 2 additions, 2 deletionsgcc/testsuite/g++.target/aarch64/bfloat_cpp_typecheck.C
- gcc/testsuite/gcc.target/aarch64/bfloat16_scalar_typecheck.c 98 additions, 98 deletionsgcc/testsuite/gcc.target/aarch64/bfloat16_scalar_typecheck.c
- gcc/testsuite/gcc.target/aarch64/bfloat16_vector_typecheck_1.c 50 additions, 50 deletions...estsuite/gcc.target/aarch64/bfloat16_vector_typecheck_1.c
- gcc/testsuite/gcc.target/aarch64/bfloat16_vector_typecheck_2.c 50 additions, 50 deletions...estsuite/gcc.target/aarch64/bfloat16_vector_typecheck_2.c
- gcc/testsuite/gcc.target/aarch64/sve/acle/general-c/ternary_bfloat16_opt_n_1.c 1 addition, 1 deletion...get/aarch64/sve/acle/general-c/ternary_bfloat16_opt_n_1.c
- libgcc/config/aarch64/libgcc-softfp.ver 13 additions, 0 deletionslibgcc/config/aarch64/libgcc-softfp.ver
- libgcc/config/aarch64/sfp-machine.h 2 additions, 0 deletionslibgcc/config/aarch64/sfp-machine.h
- libgcc/config/aarch64/t-softfp 4 additions, 3 deletionslibgcc/config/aarch64/t-softfp
- libgcc/soft-fp/floatdibf.c 45 additions, 0 deletionslibgcc/soft-fp/floatdibf.c
- libgcc/soft-fp/floatundibf.c 45 additions, 0 deletionslibgcc/soft-fp/floatundibf.c
- libstdc++-v3/config/abi/pre/gnu.ver 3 additions, 0 deletionslibstdc++-v3/config/abi/pre/gnu.ver
Loading
Please register or sign in to comment