public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 1/1] RISC-V: Add Zfbfmin extension to the -march= option
@ 2024-04-12  3:32 Xiao Zeng
  2024-05-06 22:40 ` Jeff Law
  0 siblings, 1 reply; 3+ messages in thread
From: Xiao Zeng @ 2024-04-12  3:32 UTC (permalink / raw)
  To: gcc-patches
  Cc: jeffreyalaw, research_trasio, kito.cheng, palmer, zhengyu, Xiao Zeng

This patch would like to add new sub extension (aka Zfbfmin) to the
-march= option. It introduces a new data type BF16.

1 The Zfbfmin extension depend on 'F', and the FLH, FSH, FMV.X.H, and
FMV.H.X instructions as defined in the Zfh extension.

2 The Zfhmin extension includes the following instructions from the
Zfh extension: FLH, FSH, FMV.X.H, FMV.H.X, FCVT.S.H, and FCVT.H.S.

3 Zfhmin extension depend on 'F'.

4 Simply put, just make Zfbfmin dependent on Zfhmin.

Perhaps in the future, we could propose making the FLH, FSH, FMV.X.H, and
FMV.H.X instructions an independent extension to achieve precise dependency
relationships for the Zfbfmin.

You can locate more information about Zfbfmin from below spec doc.

<https://github.com/riscv/riscv-bfloat16/releases/download/v59042fc71c31a9bcb2f1957621c960ed36fac401/riscv-bfloat16.pdf>

Below test are passed for this patch
    * The riscv fully regression test.
---
 gcc/common/config/riscv/riscv-common.cc    |  3 ++
 gcc/config/riscv/riscv.opt                 |  2 +
 gcc/testsuite/gcc.target/riscv/arch-35.c   |  5 +++
 gcc/testsuite/gcc.target/riscv/arch-36.c   |  5 +++
 gcc/testsuite/gcc.target/riscv/predef-34.c | 47 ++++++++++++++++++++++
 gcc/testsuite/gcc.target/riscv/predef-35.c | 47 ++++++++++++++++++++++
 6 files changed, 109 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/riscv/arch-35.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/arch-36.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/predef-34.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/predef-35.c

diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc
index 43b7549e3ec..49c4783eaf2 100644
--- a/gcc/common/config/riscv/riscv-common.cc
+++ b/gcc/common/config/riscv/riscv-common.cc
@@ -155,6 +155,7 @@ static const riscv_implied_info_t riscv_implied_info[] =
   {"zvksed", "zve32x"},
   {"zvksh",  "zve32x"},
 
+  {"zfbfmin", "zfhmin"},
   {"zfh", "zfhmin"},
   {"zfhmin", "f"},
 
@@ -331,6 +332,7 @@ static const struct riscv_ext_version riscv_ext_version_table[] =
   {"zvl32768b", ISA_SPEC_CLASS_NONE, 1, 0},
   {"zvl65536b", ISA_SPEC_CLASS_NONE, 1, 0},
 
+  {"zfbfmin",   ISA_SPEC_CLASS_NONE, 1, 0},
   {"zfh",       ISA_SPEC_CLASS_NONE, 1, 0},
   {"zfhmin",    ISA_SPEC_CLASS_NONE, 1, 0},
   {"zvfbfmin",  ISA_SPEC_CLASS_NONE, 1, 0},
@@ -1698,6 +1700,7 @@ static const riscv_ext_flag_table_t riscv_ext_flag_table[] =
   {"zvl32768b", &gcc_options::x_riscv_zvl_flags, MASK_ZVL32768B},
   {"zvl65536b", &gcc_options::x_riscv_zvl_flags, MASK_ZVL65536B},
 
+  {"zfbfmin",   &gcc_options::x_riscv_zf_subext, MASK_ZFBFMIN},
   {"zfhmin",    &gcc_options::x_riscv_zf_subext, MASK_ZFHMIN},
   {"zfh",       &gcc_options::x_riscv_zf_subext, MASK_ZFH},
   {"zvfbfmin",  &gcc_options::x_riscv_zf_subext, MASK_ZVFBFMIN},
diff --git a/gcc/config/riscv/riscv.opt b/gcc/config/riscv/riscv.opt
index 8da0764eb4b..5c96e951d45 100644
--- a/gcc/config/riscv/riscv.opt
+++ b/gcc/config/riscv/riscv.opt
@@ -393,6 +393,8 @@ Mask(ZICBOP) Var(riscv_zicmo_subext)
 TargetVariable
 int riscv_zf_subext
 
+Mask(ZFBFMIN)  Var(riscv_zf_subext)
+
 Mask(ZFHMIN)  Var(riscv_zf_subext)
 
 Mask(ZFH)     Var(riscv_zf_subext)
diff --git a/gcc/testsuite/gcc.target/riscv/arch-35.c b/gcc/testsuite/gcc.target/riscv/arch-35.c
new file mode 100644
index 00000000000..6c783769666
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/arch-35.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv32i_zfbfmin -mabi=ilp32f" } */
+int foo()
+{
+}
diff --git a/gcc/testsuite/gcc.target/riscv/arch-36.c b/gcc/testsuite/gcc.target/riscv/arch-36.c
new file mode 100644
index 00000000000..cbdccf12807
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/arch-36.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64i_zfbfmin -mabi=lp64f" } */
+int foo()
+{
+}
diff --git a/gcc/testsuite/gcc.target/riscv/predef-34.c b/gcc/testsuite/gcc.target/riscv/predef-34.c
new file mode 100644
index 00000000000..0a993271f7f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/predef-34.c
@@ -0,0 +1,47 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=rv32i_zfbfmin -mabi=ilp32f -mcmodel=medlow -misa-spec=20191213" } */
+
+int main () {
+
+#ifndef __riscv_arch_test
+#error "__riscv_arch_test"
+#endif
+
+#if __riscv_xlen != 32
+#error "__riscv_xlen"
+#endif
+
+#if !defined(__riscv_i)
+#error "__riscv_i"
+#endif
+
+#if !defined(__riscv_f)
+#error "__riscv_f"
+#endif
+
+#if !defined(__riscv_zfhmin)
+#error "__riscv_zfhmin"
+#endif
+
+#if !defined(__riscv_zfbfmin)
+#error "__riscv_zfbfmin"
+#endif
+
+#if defined(__riscv_v)
+#error "__riscv_v"
+#endif
+
+#if defined(__riscv_d)
+#error "__riscv_d"
+#endif
+
+#if defined(__riscv_c)
+#error "__riscv_c"
+#endif
+
+#if defined(__riscv_a)
+#error "__riscv_a"
+#endif
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/riscv/predef-35.c b/gcc/testsuite/gcc.target/riscv/predef-35.c
new file mode 100644
index 00000000000..76b328a8932
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/predef-35.c
@@ -0,0 +1,47 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=rv64i_zfbfmin -mabi=lp64f -mcmodel=medlow -misa-spec=20191213" } */
+
+int main () {
+
+#ifndef __riscv_arch_test
+#error "__riscv_arch_test"
+#endif
+
+#if __riscv_xlen != 64
+#error "__riscv_xlen"
+#endif
+
+#if !defined(__riscv_i)
+#error "__riscv_i"
+#endif
+
+#if !defined(__riscv_f)
+#error "__riscv_f"
+#endif
+
+#if !defined(__riscv_zfhmin)
+#error "__riscv_zfhmin"
+#endif
+
+#if !defined(__riscv_zfbfmin)
+#error "__riscv_zfbfmin"
+#endif
+
+#if defined(__riscv_v)
+#error "__riscv_v"
+#endif
+
+#if defined(__riscv_d)
+#error "__riscv_d"
+#endif
+
+#if defined(__riscv_c)
+#error "__riscv_c"
+#endif
+
+#if defined(__riscv_a)
+#error "__riscv_a"
+#endif
+
+  return 0;
+}
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] RISC-V: Add Zfbfmin extension to the -march= option
  2024-04-12  3:32 [PATCH 1/1] RISC-V: Add Zfbfmin extension to the -march= option Xiao Zeng
@ 2024-05-06 22:40 ` Jeff Law
  2024-05-07  5:32   ` Xiao Zeng
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Law @ 2024-05-06 22:40 UTC (permalink / raw)
  To: Xiao Zeng, gcc-patches; +Cc: research_trasio, kito.cheng, palmer, zhengyu



On 4/11/24 9:32 PM, Xiao Zeng wrote:
> This patch would like to add new sub extension (aka Zfbfmin) to the
> -march= option. It introduces a new data type BF16.
> 
> 1 The Zfbfmin extension depend on 'F', and the FLH, FSH, FMV.X.H, and
> FMV.H.X instructions as defined in the Zfh extension.
> 
> 2 The Zfhmin extension includes the following instructions from the
> Zfh extension: FLH, FSH, FMV.X.H, FMV.H.X, FCVT.S.H, and FCVT.H.S.
> 
> 3 Zfhmin extension depend on 'F'.
> 
> 4 Simply put, just make Zfbfmin dependent on Zfhmin.
> 
> Perhaps in the future, we could propose making the FLH, FSH, FMV.X.H, and
> FMV.H.X instructions an independent extension to achieve precise dependency
> relationships for the Zfbfmin.
> 
> You can locate more information about Zfbfmin from below spec doc.
> 
> <https://github.com/riscv/riscv-bfloat16/releases/download/v59042fc71c31a9bcb2f1957621c960ed36fac401/riscv-bfloat16.pdf>
> 
> Below test are passed for this patch
>      * The riscv fully regression test.
I wrote a suitable ChangeLog entry and pushed this patch to the trunk.

THanks,
jeff



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Re: [PATCH 1/1] RISC-V: Add Zfbfmin extension to the -march= option
  2024-05-06 22:40 ` Jeff Law
@ 2024-05-07  5:32   ` Xiao Zeng
  0 siblings, 0 replies; 3+ messages in thread
From: Xiao Zeng @ 2024-05-07  5:32 UTC (permalink / raw)
  To: jeffreyalaw, gcc-patches; +Cc: research_trasio, kito.cheng, palmer, zhengyu

2024-05-07 06:40  Jeff Law <jeffreyalaw@gmail.com> wrote:
>
 
>
>
>On 4/11/24 9:32 PM, Xiao Zeng wrote:
>> This patch would like to add new sub extension (aka Zfbfmin) to the
>> -march= option. It introduces a new data type BF16.
>>
>> 1 The Zfbfmin extension depend on 'F', and the FLH, FSH, FMV.X.H, and
>> FMV.H.X instructions as defined in the Zfh extension.
>>
>> 2 The Zfhmin extension includes the following instructions from the
>> Zfh extension: FLH, FSH, FMV.X.H, FMV.H.X, FCVT.S.H, and FCVT.H.S.
>>
>> 3 Zfhmin extension depend on 'F'.
>>
>> 4 Simply put, just make Zfbfmin dependent on Zfhmin.
>>
>> Perhaps in the future, we could propose making the FLH, FSH, FMV.X.H, and
>> FMV.H.X instructions an independent extension to achieve precise dependency
>> relationships for the Zfbfmin.
>>
>> You can locate more information about Zfbfmin from below spec doc.
>>
>> <https://github.com/riscv/riscv-bfloat16/releases/download/v59042fc71c31a9bcb2f1957621c960ed36fac401/riscv-bfloat16.pdf>
>>
>> Below test are passed for this patch
>>      * The riscv fully regression test.
>I wrote a suitable ChangeLog entry and pushed this patch to the trunk. 
Thanks, jeff

>
>THanks,
>jeff
>
 
Thanks
Xiao Zeng


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-05-07  5:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-12  3:32 [PATCH 1/1] RISC-V: Add Zfbfmin extension to the -march= option Xiao Zeng
2024-05-06 22:40 ` Jeff Law
2024-05-07  5:32   ` Xiao Zeng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).