gcc/libgcc/soft-fp
Xiao Zeng 8c7cee80eb [RISC-V] Add support for _Bfloat16
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>
2024-05-06 15:39:12 -06:00
..
adddf3.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
addsf3.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
addtf3.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
bitint.h libgcc: Fix UB in FP_FROM_BITINT 2024-02-13 10:33:08 +01:00
bitintpow10.c libgcc _BitInt support [PR102989] 2023-09-06 17:33:05 +02:00
bitintpow10.h libgcc: Generated tables for _BitInt <-> _Decimal* conversions [PR102989] 2023-09-06 17:31:23 +02:00
brain.h middle-end, c++, i386, libgcc: std::bfloat16_t and __bf16 arithmetic support 2022-10-14 09:37:01 +02:00
divdf3.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
divsf3.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
divtf3.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
double.h soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
eqdf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
eqhf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
eqsf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
eqtf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
extendbfsf2.c middle-end, c++, i386, libgcc: std::bfloat16_t and __bf16 arithmetic support 2022-10-14 09:37:01 +02:00
extenddftf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
extended.h soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
extendhfdf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
extendhfsf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
extendhftf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
extendhfxf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
extendsfdf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
extendsftf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
extendxftf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
fixddbitint.c libgcc: Fix BIL_TYPE_SIZE == 32 support in _BitInt <-> dfp support 2024-02-10 12:50:52 +01:00
fixddti.c libgcc: Add {unsigned ,}__int128 <-> _Decimal{32,64,128} conversion support [PR65833] 2023-11-09 09:14:07 +01:00
fixdfbitint.c libgcc _BitInt support [PR102989] 2023-09-06 17:33:05 +02:00
fixdfdi.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
fixdfsi.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
fixdfti.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
fixhfdi.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
fixhfsi.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
fixhfti.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
fixsdbitint.c libgcc: Fix BIL_TYPE_SIZE == 32 support in _BitInt <-> dfp support 2024-02-10 12:50:52 +01:00
fixsdti.c libgcc: Add {unsigned ,}__int128 <-> _Decimal{32,64,128} conversion support [PR65833] 2023-11-09 09:14:07 +01:00
fixsfbitint.c libgcc _BitInt support [PR102989] 2023-09-06 17:33:05 +02:00
fixsfdi.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
fixsfsi.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
fixsfti.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
fixtdbitint.c libgcc: Fix BIL_TYPE_SIZE == 32 support in _BitInt <-> dfp support 2024-02-10 12:50:52 +01:00
fixtdti.c libgcc: Add {unsigned ,}__int128 <-> _Decimal{32,64,128} conversion support [PR65833] 2023-11-09 09:14:07 +01:00
fixtfbitint.c libgcc _BitInt support [PR102989] 2023-09-06 17:33:05 +02:00
fixtfdi.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
fixtfsi.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
fixtfti.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
fixunsddti.c libgcc: Add {unsigned ,}__int128 <-> _Decimal{32,64,128} conversion support [PR65833] 2023-11-09 09:14:07 +01:00
fixunsdfdi.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
fixunsdfsi.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
fixunsdfti.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
fixunshfdi.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
fixunshfsi.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
fixunshfti.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
fixunssdti.c libgcc: Add {unsigned ,}__int128 <-> _Decimal{32,64,128} conversion support [PR65833] 2023-11-09 09:14:07 +01:00
fixunssfdi.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
fixunssfsi.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
fixunssfti.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
fixunstdti.c libgcc: Add {unsigned ,}__int128 <-> _Decimal{32,64,128} conversion support [PR65833] 2023-11-09 09:14:07 +01:00
fixunstfdi.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
fixunstfsi.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
fixunstfti.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
fixxfbitint.c libgcc _BitInt support [PR102989] 2023-09-06 17:33:05 +02:00
floatbitintbf.c libgcc _BitInt support [PR102989] 2023-09-06 17:33:05 +02:00
floatbitintdd.c libgcc: Fix a bug in _BitInt -> dfp conversions 2024-02-10 12:51:39 +01:00
floatbitintdf.c libgcc _BitInt support [PR102989] 2023-09-06 17:33:05 +02:00
floatbitinthf.c libgcc _BitInt support [PR102989] 2023-09-06 17:33:05 +02:00
floatbitintsd.c libgcc: Fix a bug in _BitInt -> dfp conversions 2024-02-10 12:51:39 +01:00
floatbitintsf.c libgcc _BitInt support [PR102989] 2023-09-06 17:33:05 +02:00
floatbitinttd.c libgcc: Fix a bug in _BitInt -> dfp conversions 2024-02-10 12:51:39 +01:00
floatbitinttf.c libgcc _BitInt support [PR102989] 2023-09-06 17:33:05 +02:00
floatbitintxf.c libgcc _BitInt support [PR102989] 2023-09-06 17:33:05 +02:00
floatdibf.c aarch64: Add bfloat16_t support for aarch64 2023-03-13 00:16:45 +01:00
floatdidf.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
floatdihf.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
floatdisf.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
floatditf.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
floatsibf.c [RISC-V] Add support for _Bfloat16 2024-05-06 15:39:12 -06:00
floatsidf.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
floatsihf.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
floatsisf.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
floatsitf.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
floattibf.c libgcc, i386: Add __fix{,uns}bfti and __float{,un}tibf [PR107703] 2023-03-10 20:39:54 +01:00
floattidd.c libgcc: Add {unsigned ,}__int128 <-> _Decimal{32,64,128} conversion support [PR65833] 2023-11-09 09:14:07 +01:00
floattidf.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
floattihf.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
floattisd.c libgcc: Add {unsigned ,}__int128 <-> _Decimal{32,64,128} conversion support [PR65833] 2023-11-09 09:14:07 +01:00
floattisf.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
floattitd.c libgcc: Add {unsigned ,}__int128 <-> _Decimal{32,64,128} conversion support [PR65833] 2023-11-09 09:14:07 +01:00
floattitf.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
floatundibf.c aarch64: Add bfloat16_t support for aarch64 2023-03-13 00:16:45 +01:00
floatundidf.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
floatundihf.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
floatundisf.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
floatunditf.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
floatunsibf.c [RISC-V] Add support for _Bfloat16 2024-05-06 15:39:12 -06:00
floatunsidf.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
floatunsihf.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
floatunsisf.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
floatunsitf.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
floatuntibf.c libgcc, i386: Add __fix{,uns}bfti and __float{,un}tibf [PR107703] 2023-03-10 20:39:54 +01:00
floatuntidd.c libgcc: Add {unsigned ,}__int128 <-> _Decimal{32,64,128} conversion support [PR65833] 2023-11-09 09:14:07 +01:00
floatuntidf.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
floatuntihf.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
floatuntisd.c libgcc: Add {unsigned ,}__int128 <-> _Decimal{32,64,128} conversion support [PR65833] 2023-11-09 09:14:07 +01:00
floatuntisf.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
floatuntitd.c libgcc: Add {unsigned ,}__int128 <-> _Decimal{32,64,128} conversion support [PR65833] 2023-11-09 09:14:07 +01:00
floatuntitf.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
gedf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
gesf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
getf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
half.h soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
ledf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
lesf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
letf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
muldf3.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
mulsf3.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
multf3.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
negdf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
negsf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
negtf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
op-1.h soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
op-2.h soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
op-4.h soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
op-8.h soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
op-common.h libgcc _BitInt support [PR102989] 2023-09-06 17:33:05 +02:00
quad.h PR target/107299: Fix build issue when long double is IEEE 128-bit 2023-03-06 17:38:33 -05:00
README
single.h soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
soft-fp.h soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
subdf3.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
subsf3.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
subtf3.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
truncbfhf2.c middle-end, c++, i386, libgcc: std::bfloat16_t and __bf16 arithmetic support 2022-10-14 09:37:01 +02:00
truncdfbf2.c middle-end, c++, i386, libgcc: std::bfloat16_t and __bf16 arithmetic support 2022-10-14 09:37:01 +02:00
truncdfhf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
truncdfsf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
trunchfbf2.c middle-end, c++, i386, libgcc: std::bfloat16_t and __bf16 arithmetic support 2022-10-14 09:37:01 +02:00
truncsfbf2.c middle-end, c++, i386, libgcc: std::bfloat16_t and __bf16 arithmetic support 2022-10-14 09:37:01 +02:00
truncsfhf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
trunctfbf2.c middle-end, c++, i386, libgcc: std::bfloat16_t and __bf16 arithmetic support 2022-10-14 09:37:01 +02:00
trunctfdf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
trunctfhf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
trunctfsf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
trunctfxf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
truncxfbf2.c middle-end, c++, i386, libgcc: std::bfloat16_t and __bf16 arithmetic support 2022-10-14 09:37:01 +02:00
truncxfhf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
unorddf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
unordsf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00
unordtf2.c soft-fp: Update soft-fp from glibc 2022-08-16 23:32:30 +08:00

The files in this directory are part of the GNU C Library, not part of
GCC.  As described at <http://gcc.gnu.org/codingconventions.html>,
changes should be made to the GNU C Library and the changed files then
imported into GCC.