
1 At point <https://github.com/riscv/riscv-bfloat16>, BF16 has already been completed "post public review". 2 LLVM has also added support for RISCV BF16 in <https://reviews.llvm.org/D151313> and <https://reviews.llvm.org/D150929>. 3 According to the discussion <https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/367>, this use __bf16 and use DF16b in riscv_mangle_type like x86. Below test are passed for this patch * The riscv fully regression test. gcc/ChangeLog: * config/riscv/iterators.md: New mode iterator HFBF. * config/riscv/riscv-builtins.cc (riscv_init_builtin_types): Initialize data type _Bfloat16. * config/riscv/riscv-modes.def (FLOAT_MODE): New. (ADJUST_FLOAT_FORMAT): New. * config/riscv/riscv.cc (riscv_mangle_type): Support for BFmode. (riscv_scalar_mode_supported_p): Ditto. (riscv_libgcc_floating_mode_supported_p): Ditto. (riscv_init_libfuncs): Set the conversion method for BFmode and HFmode. (riscv_block_arith_comp_libfuncs_for_mode): Set the arithmetic and comparison libfuncs for the mode. * config/riscv/riscv.md (mode" ): Add BF. (movhf): Support for BFmode. (mov<mode>): Ditto. (*movhf_softfloat): Ditto. (*mov<mode>_softfloat): Ditto. libgcc/ChangeLog: * config/riscv/sfp-machine.h (_FP_NANFRAC_B): New. (_FP_NANSIGN_B): Ditto. * config/riscv/t-softfp32: Add support for BF16 libfuncs. * config/riscv/t-softfp64: Ditto. * soft-fp/floatsibf.c: For si -> bf16. * soft-fp/floatunsibf.c: For unsi -> bf16. gcc/testsuite/ChangeLog: * gcc.target/riscv/bf16_arithmetic.c: New test. * gcc.target/riscv/bf16_call.c: New test. * gcc.target/riscv/bf16_comparison.c: New test. * gcc.target/riscv/bf16_float_libcall_convert.c: New test. * gcc.target/riscv/bf16_integer_libcall_convert.c: New test. Co-authored-by: Jin Ma <jinma@linux.alibaba.com>
52 lines
1.2 KiB
Text
52 lines
1.2 KiB
Text
ABI_SINGLE:=$(findstring __riscv_float_abi_single,$(shell $(gcc_compile_bare) -dM -E - </dev/null))
|
|
ABI_DOUBLE:=$(findstring __riscv_float_abi_double,$(shell $(gcc_compile_bare) -dM -E - </dev/null))
|
|
ABI_QUAD:=$(findstring __riscv_float_abi_quad,$(shell $(gcc_compile_bare) -dM -E - </dev/null))
|
|
|
|
softfp_int_modes := si di
|
|
softfp_exclude_libgcc2 := n
|
|
|
|
ifndef ABI_QUAD
|
|
ifdef ABI_DOUBLE
|
|
|
|
softfp_float_modes := tf
|
|
softfp_extensions := sftf dftf
|
|
softfp_truncations := tfsf tfdf
|
|
|
|
# Enable divide routines to make -mno-fdiv work.
|
|
softfp_extras += divsf3 divdf3
|
|
|
|
else
|
|
# !ABI_DOUBLE
|
|
|
|
softfp_float_modes := df tf
|
|
softfp_extensions := sfdf sftf dftf
|
|
softfp_truncations := dfsf tfsf tfdf
|
|
|
|
ifndef ABI_SINGLE
|
|
softfp_float_modes += sf
|
|
else
|
|
# ABI_SINGLE
|
|
|
|
# Enable divide routines to make -mno-fdiv work.
|
|
softfp_extras += divsf3
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
else
|
|
# ABI_QUAD
|
|
|
|
# Enable divide routines to make -mno-fdiv work.
|
|
softfp_extras += divsf3 divdf3 divtf3
|
|
|
|
endif
|
|
|
|
softfp_extensions += hfsf hfdf hftf \
|
|
bfsf
|
|
softfp_truncations += tfhf dfhf sfhf \
|
|
tfbf dfbf sfbf \
|
|
hfbf bfhf
|
|
softfp_extras += fixhfsi fixhfdi fixunshfsi fixunshfdi \
|
|
floatsihf floatdihf floatunsihf floatundihf \
|
|
floatsibf floatdibf floatunsibf floatundibf
|