2024-05-17 16:19  Kito Cheng <kito.ch...@gmail.com> wrote:
>
>LGTM, thanks for fixing this :) 
1 Passed CI testing:
<https://patchwork.sourceware.org/project/gcc/patch/20240517081013.12611-1-zengx...@eswincomputing.com/>

2 pushed to trunk.
>
>On Fri, May 17, 2024 at 4:05 PM Xiao Zeng <zengx...@eswincomputing.com> wrote:
>>
>> 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.
>> ---
>>  gcc/config/riscv/riscv-builtins.cc                   |  6 +++---
>>  gcc/config/riscv/riscv.cc                            |  2 +-
>>  .../{_Bfloat16-nanboxing.c => __bf16-nanboxing.c}    | 12 ++++++------
>>  gcc/testsuite/gcc.target/riscv/bf16_arithmetic.c     |  6 +++---
>>  gcc/testsuite/gcc.target/riscv/bf16_call.c           |  4 ++--
>>  gcc/testsuite/gcc.target/riscv/bf16_comparison.c     |  6 +++---
>>  .../gcc.target/riscv/bf16_float_libcall_convert.c    |  2 +-
>>  .../gcc.target/riscv/bf16_integer_libcall_convert.c  |  2 +-
>>  8 files changed, 20 insertions(+), 20 deletions(-)
>>  rename gcc/testsuite/gcc.target/riscv/{_Bfloat16-nanboxing.c => 
>>__bf16-nanboxing.c} (83%)
>>
>> diff --git a/gcc/config/riscv/riscv-builtins.cc 
>> b/gcc/config/riscv/riscv-builtins.cc
>> index 4c08834288a..dc54e1a59b5 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 4067505270e..cf15a12de3a 100644
>> --- a/gcc/config/riscv/riscv.cc
>> +++ b/gcc/config/riscv/riscv.cc
>> @@ -10262,7 +10262,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
>> similarity index 83%
>> rename from gcc/testsuite/gcc.target/riscv/_Bfloat16-nanboxing.c
>> rename to gcc/testsuite/gcc.target/riscv/__bf16-nanboxing.c
>> index 11a73d22234..a9a586c98b9 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 9e485051260..190cc1d574a 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 29f67719999..6ace1494370 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 69db803f403..2c13b8a0c9a 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 ba6c6460bc2..423a071d1a5 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 ad714253a4a..2c37302e294 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;
>> --
>> 2.17.1
>>
Thanks
Xiao Zeng

Reply via email to