diff options
author | Xiao Zeng <zengxiao@eswincomputing.com> | 2024-05-17 13:48:21 +0800 |
---|---|---|
committer | Xiao Zeng <zengxiao@eswincomputing.com> | 2024-05-18 11:05:42 +0800 |
commit | 6da1d6efde2282e6582c00d1631e7457975ad998 (patch) | |
tree | 3151467b7a922529cc15da63ee9d1ea6aa0b48c4 /gcc | |
parent | 34ed2b4593fa98b613632d0dde30b6ba3e7ecad9 (diff) | |
download | gcc-6da1d6efde2282e6582c00d1631e7457975ad998.zip gcc-6da1d6efde2282e6582c00d1631e7457975ad998.tar.gz gcc-6da1d6efde2282e6582c00d1631e7457975ad998.tar.bz2 |
RISC-V: Modify _Bfloat16 to __bf16
According to the description in:
<https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/367>,
the type representation symbol of BF16 has been corrected.
Kito Cheng pointed out relevant information in the email:
<https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651850.html>
gcc/ChangeLog:
* config/riscv/riscv-builtins.cc (riscv_init_builtin_types):
Modify _Bfloat16 to __bf16.
* config/riscv/riscv.cc (riscv_mangle_type): Ditto.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/_Bfloat16-nanboxing.c: Move to...
* gcc.target/riscv/__bf16-nanboxing.c: ...here.
* gcc.target/riscv/bf16_arithmetic.c: Modify _Bfloat16 to __bf16.
* gcc.target/riscv/bf16_call.c: Ditto.
* gcc.target/riscv/bf16_comparison.c: Ditto.
* gcc.target/riscv/bf16_float_libcall_convert.c: Ditto.
* gcc.target/riscv/bf16_integer_libcall_convert.c: Ditto.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config/riscv/riscv-builtins.cc | 6 | ||||
-rw-r--r-- | gcc/config/riscv/riscv.cc | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/riscv/__bf16-nanboxing.c (renamed from gcc/testsuite/gcc.target/riscv/_Bfloat16-nanboxing.c) | 12 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/riscv/bf16_arithmetic.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/riscv/bf16_call.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/riscv/bf16_comparison.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/riscv/bf16_float_libcall_convert.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/riscv/bf16_integer_libcall_convert.c | 2 |
8 files changed, 20 insertions, 20 deletions
diff --git a/gcc/config/riscv/riscv-builtins.cc b/gcc/config/riscv/riscv-builtins.cc index 4c08834..dc54e1a 100644 --- a/gcc/config/riscv/riscv-builtins.cc +++ b/gcc/config/riscv/riscv-builtins.cc @@ -275,7 +275,7 @@ riscv_init_builtin_types (void) lang_hooks.types.register_builtin_type (riscv_float16_type_node, "_Float16"); - /* Provide the _Bfloat16 type and bfloat16_type_node if needed. */ + /* Provide the __bf16 type and bfloat16_type_node if needed. */ if (!bfloat16_type_node) { riscv_bfloat16_type_node = make_node (REAL_TYPE); @@ -286,9 +286,9 @@ riscv_init_builtin_types (void) else riscv_bfloat16_type_node = bfloat16_type_node; - if (!maybe_get_identifier ("_Bfloat16")) + if (!maybe_get_identifier ("__bf16")) lang_hooks.types.register_builtin_type (riscv_bfloat16_type_node, - "_Bfloat16"); + "__bf16"); } /* Implement TARGET_INIT_BUILTINS. */ diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc index 9ac2be8..2be04ec 100644 --- a/gcc/config/riscv/riscv.cc +++ b/gcc/config/riscv/riscv.cc @@ -10276,7 +10276,7 @@ riscv_asan_shadow_offset (void) static const char * riscv_mangle_type (const_tree type) { - /* Half-precision float, _Float16 is "DF16_" and _Bfloat16 is "DF16b". */ + /* Half-precision float, _Float16 is "DF16_" and __bf16 is "DF16b". */ if (SCALAR_FLOAT_TYPE_P (type) && TYPE_PRECISION (type) == 16) { if (TYPE_MODE (type) == HFmode) diff --git a/gcc/testsuite/gcc.target/riscv/_Bfloat16-nanboxing.c b/gcc/testsuite/gcc.target/riscv/__bf16-nanboxing.c index 11a73d2..a9a586c 100644 --- a/gcc/testsuite/gcc.target/riscv/_Bfloat16-nanboxing.c +++ b/gcc/testsuite/gcc.target/riscv/__bf16-nanboxing.c @@ -1,14 +1,14 @@ /* { dg-do compile } */ /* { dg-options "-march=rv64ifd -mabi=lp64d -mcmodel=medlow -O" } */ -_Bfloat16 gvar = 9.87654; +__bf16 gvar = 9.87654; union U { unsigned short i16; - _Bfloat16 f16; + __bf16 f16; }; -_Bfloat16 +__bf16 test1 (unsigned short input) { union U tmp; @@ -16,19 +16,19 @@ test1 (unsigned short input) return tmp.f16; } -_Bfloat16 +__bf16 test2 () { return 1.234f; } -_Bfloat16 +__bf16 test3 () { return gvar; } -_Bfloat16 +__bf16 test () { return 0.0f; diff --git a/gcc/testsuite/gcc.target/riscv/bf16_arithmetic.c b/gcc/testsuite/gcc.target/riscv/bf16_arithmetic.c index 9e48505..190cc1d 100644 --- a/gcc/testsuite/gcc.target/riscv/bf16_arithmetic.c +++ b/gcc/testsuite/gcc.target/riscv/bf16_arithmetic.c @@ -5,9 +5,9 @@ /* 1) bf -> sf (call __extendbfsf2) */ /* 2) sf1 [+|-|*|/] sf2 (call __[add|sub|mul|div]sf3) */ /* 3) sf -> bf (call __truncsfbf2) */ -extern _Bfloat16 bf; -extern _Bfloat16 bf1; -extern _Bfloat16 bf2; +extern __bf16 bf; +extern __bf16 bf1; +extern __bf16 bf2; void bf_add_bf () { bf = bf1 + bf2; } diff --git a/gcc/testsuite/gcc.target/riscv/bf16_call.c b/gcc/testsuite/gcc.target/riscv/bf16_call.c index 29f6771..6ace149 100644 --- a/gcc/testsuite/gcc.target/riscv/bf16_call.c +++ b/gcc/testsuite/gcc.target/riscv/bf16_call.c @@ -4,9 +4,9 @@ /* 1) bf -> sf (call __extendbfsf2) */ /* 2) sf -> bf (call __truncsfbf2) */ -__attribute__ ((noinline)) _Bfloat16 add (_Bfloat16 a, _Bfloat16 b) { return a + b; } +__attribute__ ((noinline)) __bf16 add (__bf16 a, __bf16 b) { return a + b; } -_Bfloat16 test(_Bfloat16 a, _Bfloat16 b) { return add (a, b); } +__bf16 test(__bf16 a, __bf16 b) { return add (a, b); } /* { dg-final { scan-assembler-times "call\t__extendbfsf2" 2 } } */ /* { dg-final { scan-assembler-times "call\t__truncsfbf2" 1 } } */ diff --git a/gcc/testsuite/gcc.target/riscv/bf16_comparison.c b/gcc/testsuite/gcc.target/riscv/bf16_comparison.c index 69db803..2c13b8a 100644 --- a/gcc/testsuite/gcc.target/riscv/bf16_comparison.c +++ b/gcc/testsuite/gcc.target/riscv/bf16_comparison.c @@ -4,9 +4,9 @@ /* 1) bf -> sf (call __extendbfsf2) */ /* 2) sf1 [<|<=|>|>=|==] sf2 (call __[lt|le|gt|ge|eq]sf2) */ -extern _Bfloat16 bf; -extern _Bfloat16 bf1; -extern _Bfloat16 bf2; +extern __bf16 bf; +extern __bf16 bf1; +extern __bf16 bf2; void bf_lt_bf () { bf = (bf1 < bf2) ? bf1 : bf2; } diff --git a/gcc/testsuite/gcc.target/riscv/bf16_float_libcall_convert.c b/gcc/testsuite/gcc.target/riscv/bf16_float_libcall_convert.c index ba6c646..423a071 100644 --- a/gcc/testsuite/gcc.target/riscv/bf16_float_libcall_convert.c +++ b/gcc/testsuite/gcc.target/riscv/bf16_float_libcall_convert.c @@ -14,7 +14,7 @@ * bf -> tf == bf -> sf -> tf (call __extendbfsf2 && __extendsftf2) */ -extern _Bfloat16 bf; +extern __bf16 bf; extern _Float16 hf; extern float sf; extern double df; diff --git a/gcc/testsuite/gcc.target/riscv/bf16_integer_libcall_convert.c b/gcc/testsuite/gcc.target/riscv/bf16_integer_libcall_convert.c index ad71425..2c37302 100644 --- a/gcc/testsuite/gcc.target/riscv/bf16_integer_libcall_convert.c +++ b/gcc/testsuite/gcc.target/riscv/bf16_integer_libcall_convert.c @@ -16,7 +16,7 @@ * bf -> udi/uti (call __fixunssf[d|t]i) */ -extern _Bfloat16 bf; +extern __bf16 bf; extern signed char qi; extern unsigned char uqi; |