diff mbox series

RISC-V: Minimal support for Zimop extension.

Message ID 20240802153220.3861120-1-jiawei@iscas.ac.cn
State New
Headers show
Series RISC-V: Minimal support for Zimop extension. | expand

Commit Message

Jiawei Aug. 2, 2024, 3:32 p.m. UTC
https://github.com/riscv/riscv-isa-manual/blob/main/src/zimop.adoc

gcc/ChangeLog:

	* common/config/riscv/riscv-common.cc: New extension.
	* config/riscv/riscv.opt: New mask.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/arch-42.c: New test.
	* gcc.target/riscv/arch-43.c: New test.

---
 gcc/common/config/riscv/riscv-common.cc  | 8 ++++++++
 gcc/config/riscv/riscv.opt               | 7 +++++++
 gcc/testsuite/gcc.target/riscv/arch-42.c | 5 +++++
 gcc/testsuite/gcc.target/riscv/arch-43.c | 5 +++++
 4 files changed, 25 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/riscv/arch-42.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/arch-43.c

Comments

Jeff Law Aug. 5, 2024, 12:45 a.m. UTC | #1
On 8/2/24 9:32 AM, Jiawei wrote:
> https://github.com/riscv/riscv-isa-manual/blob/main/src/zimop.adoc
> 
> gcc/ChangeLog:
> 
> 	* common/config/riscv/riscv-common.cc: New extension.
> 	* config/riscv/riscv.opt: New mask.
> 
> gcc/testsuite/ChangeLog:
> 
> 	* gcc.target/riscv/arch-42.c: New test.
> 	* gcc.target/riscv/arch-43.c: New test.
Shouldn't the binutils bits go in first?  There's basic support for 
Zimop/Zcmop from Lyut on the binutils list in late 2023 or early 2024. 
I'm pretty sure it marked as DO NOT MERGE because we were waiting for 
the extension to get ratified.

I don't know if Lyut is doing any RISC-V work right now, so if you 
wanted to ping the patch on his behalf, it'd be appreciated and I can 
handle the review on the binutils side too.

I think the GCC bits are fine, but let's get the binutils bits installed 
first.

jeff
Jiawei Aug. 5, 2024, 2:20 a.m. UTC | #2
在 2024/8/5 8:45, Jeff Law 写道:
>
>
> On 8/2/24 9:32 AM, Jiawei wrote:
>> https://github.com/riscv/riscv-isa-manual/blob/main/src/zimop.adoc
>>
>> gcc/ChangeLog:
>>
>>     * common/config/riscv/riscv-common.cc: New extension.
>>     * config/riscv/riscv.opt: New mask.
>>
>> gcc/testsuite/ChangeLog:
>>
>>     * gcc.target/riscv/arch-42.c: New test.
>>     * gcc.target/riscv/arch-43.c: New test.
> Shouldn't the binutils bits go in first?  There's basic support for 
> Zimop/Zcmop from Lyut on the binutils list in late 2023 or early 2024. 
> I'm pretty sure it marked as DO NOT MERGE because we were waiting for 
> the extension to get ratified.

Christoph informed me that Zimop has been ratified, so we may not need 
to worry about the spec lifecycle status:

https://jira.riscv.org/browse/RVS-1603?src=confmacro

>
> I don't know if Lyut is doing any RISC-V work right now, so if you 
> wanted to ping the patch on his behalf, it'd be appreciated and I can 
> handle the review on the binutils side too.

I found that ESWIN's patch to support Zimop on the binutils mailing list 
last month:

https://sourceware.org/pipermail/binutils/2024-June/134592.html

> I think the GCC bits are fine, but let's get the binutils bits 
> installed first.
> jeff

Okay, Thank you for your comments!

BR,

jiawei
Jeff Law Aug. 5, 2024, 2:15 p.m. UTC | #3
On 8/4/24 8:20 PM, Jiawei wrote:
> 
> 在 2024/8/5 8:45, Jeff Law 写道:
>>
>>
>> On 8/2/24 9:32 AM, Jiawei wrote:
>>> https://github.com/riscv/riscv-isa-manual/blob/main/src/zimop.adoc
>>>
>>> gcc/ChangeLog:
>>>
>>>     * common/config/riscv/riscv-common.cc: New extension.
>>>     * config/riscv/riscv.opt: New mask.
>>>
>>> gcc/testsuite/ChangeLog:
>>>
>>>     * gcc.target/riscv/arch-42.c: New test.
>>>     * gcc.target/riscv/arch-43.c: New test.
>> Shouldn't the binutils bits go in first?  There's basic support for 
>> Zimop/Zcmop from Lyut on the binutils list in late 2023 or early 2024. 
>> I'm pretty sure it marked as DO NOT MERGE because we were waiting for 
>> the extension to get ratified.
> 
> Christoph informed me that Zimop has been ratified, so we may not need 
> to worry about the spec lifecycle status:
> 
> https://jira.riscv.org/browse/RVS-1603?src=confmacro
Agreed.  No concerns about spec lifecycle at this point.

> 
>>
>> I don't know if Lyut is doing any RISC-V work right now, so if you 
>> wanted to ping the patch on his behalf, it'd be appreciated and I can 
>> handle the review on the binutils side too.
> 
> I found that ESWIN's patch to support Zimop on the binutils mailing list 
> last month:
> 
> https://sourceware.org/pipermail/binutils/2024-June/134592.html
I don't watch binutils as closely as perhaps I should.

That patch looks marginally better than Lyut's version.  It has the 
updated version #s for the spec and handles the implied extensions. 
Let's go with Xiao's version.

Xiao, the Zimop/Zcmop patches are OK for binutils.

Jiawei, the GCC patches are OK once Xiao pushes his changes to the 
binutils repo.  Alternately if you have permissions in the binutils 
repo, you can push them for Xiao.

Jeff
Jiawei Aug. 5, 2024, 3:21 p.m. UTC | #4
在 2024/8/5 22:15, Jeff Law 写道:
>
>
> On 8/4/24 8:20 PM, Jiawei wrote:
>>
>> 在 2024/8/5 8:45, Jeff Law 写道:
>>>
>>>
>>> On 8/2/24 9:32 AM, Jiawei wrote:
>>>> https://github.com/riscv/riscv-isa-manual/blob/main/src/zimop.adoc
>>>>
>>>> gcc/ChangeLog:
>>>>
>>>>     * common/config/riscv/riscv-common.cc: New extension.
>>>>     * config/riscv/riscv.opt: New mask.
>>>>
>>>> gcc/testsuite/ChangeLog:
>>>>
>>>>     * gcc.target/riscv/arch-42.c: New test.
>>>>     * gcc.target/riscv/arch-43.c: New test.
>>> Shouldn't the binutils bits go in first?  There's basic support for 
>>> Zimop/Zcmop from Lyut on the binutils list in late 2023 or early 
>>> 2024. I'm pretty sure it marked as DO NOT MERGE because we were 
>>> waiting for the extension to get ratified.
>>
>> Christoph informed me that Zimop has been ratified, so we may not 
>> need to worry about the spec lifecycle status:
>>
>> https://jira.riscv.org/browse/RVS-1603?src=confmacro
> Agreed.  No concerns about spec lifecycle at this point.
>
>>
>>>
>>> I don't know if Lyut is doing any RISC-V work right now, so if you 
>>> wanted to ping the patch on his behalf, it'd be appreciated and I 
>>> can handle the review on the binutils side too.
>>
>> I found that ESWIN's patch to support Zimop on the binutils mailing 
>> list last month:
>>
>> https://sourceware.org/pipermail/binutils/2024-June/134592.html
> I don't watch binutils as closely as perhaps I should.
>
> That patch looks marginally better than Lyut's version.  It has the 
> updated version #s for the spec and handles the implied extensions. 
> Let's go with Xiao's version.
>
> Xiao, the Zimop/Zcmop patches are OK for binutils.
>
> Jiawei, the GCC patches are OK once Xiao pushes his changes to the 
> binutils repo.  Alternately if you have permissions in the binutils 
> repo, you can push them for Xiao.
>
> Jeff

Thanks Jeff! I think I do not have the permissions in the binutils repo, 
let me contact Nelson to ask him give  some help.


BR,

Jiawei
Jeff Law Aug. 5, 2024, 3:24 p.m. UTC | #5
On 8/5/24 9:21 AM, Jiawei wrote:

> 
> Thanks Jeff! I think I do not have the permissions in the binutils repo, 
> let me contact Nelson to ask him give  some help.
Sounds good.  Thanks for taking care of this.   I just wish I'd noticed 
the patch a month ago so that we could have included it in the 2.43 
release that was just made.

jeff
Xiao Zeng Aug. 6, 2024, 1:14 a.m. UTC | #6
2024-08-05 23:21  Jiawei <jiawei@iscas.ac.cn> wrote:
>
>
>在 2024/8/5 22:15, Jeff Law 写道:
>>
>>
>> On 8/4/24 8:20 PM, Jiawei wrote:
>>>
>>> 在 2024/8/5 8:45, Jeff Law 写道:
>>>>
>>>>
>>>> On 8/2/24 9:32 AM, Jiawei wrote:
>>>>> https://github.com/riscv/riscv-isa-manual/blob/main/src/zimop.adoc
>>>>>
>>>>> gcc/ChangeLog:
>>>>>
>>>>>     * common/config/riscv/riscv-common.cc: New extension.
>>>>>     * config/riscv/riscv.opt: New mask.
>>>>>
>>>>> gcc/testsuite/ChangeLog:
>>>>>
>>>>>     * gcc.target/riscv/arch-42.c: New test.
>>>>>     * gcc.target/riscv/arch-43.c: New test.
>>>> Shouldn't the binutils bits go in first?  There's basic support for
>>>> Zimop/Zcmop from Lyut on the binutils list in late 2023 or early
>>>> 2024. I'm pretty sure it marked as DO NOT MERGE because we were
>>>> waiting for the extension to get ratified.
>>>
>>> Christoph informed me that Zimop has been ratified, so we may not
>>> need to worry about the spec lifecycle status:
>>>
>>> https://jira.riscv.org/browse/RVS-1603?src=confmacro
>> Agreed.  No concerns about spec lifecycle at this point.
>>
>>>
>>>>
>>>> I don't know if Lyut is doing any RISC-V work right now, so if you
>>>> wanted to ping the patch on his behalf, it'd be appreciated and I
>>>> can handle the review on the binutils side too.
>>>
>>> I found that ESWIN's patch to support Zimop on the binutils mailing
>>> list last month:
>>>
>>> https://sourceware.org/pipermail/binutils/2024-June/134592.html
>> I don't watch binutils as closely as perhaps I should.
>>
>> That patch looks marginally better than Lyut's version.  It has the
>> updated version #s for the spec and handles the implied extensions.
>> Let's go with Xiao's version.
>>
>> Xiao, the Zimop/Zcmop patches are OK for binutils.
>>
>> Jiawei, the GCC patches are OK once Xiao pushes his changes to the
>> binutils repo.  Alternately if you have permissions in the binutils
>> repo, you can push them for Xiao.
>>
>> Jeff
>
>Thanks Jeff! I think I do not have the permissions in the binutils repo,
>let me contact Nelson to ask him give  some help. 
I am glad that the patch previously submitted can still be discussed and may be accepted.

If you have any questions, please feel free to contact me.
>
>
>BR,
>
>Jiawei
Thanks
Xiao Zeng
Nelson Chu Aug. 6, 2024, 2:17 a.m. UTC | #7
2.43 was released over an weekend.  Is it possible to let it be supported
after 2.44? cc Nick and jan.

Thanks
Nelson

On Mon, Aug 5, 2024 at 11:24 PM Jeff Law <jeffreyalaw@gmail.com> wrote:

>
>
> On 8/5/24 9:21 AM, Jiawei wrote:
>
> >
> > Thanks Jeff! I think I do not have the permissions in the binutils repo,
> > let me contact Nelson to ask him give  some help.
> Sounds good.  Thanks for taking care of this.   I just wish I'd noticed
> the patch a month ago so that we could have included it in the 2.43
> release that was just made.
>
> jeff
>
>
Jeff Law Aug. 6, 2024, 3:17 a.m. UTC | #8
On 8/5/24 8:17 PM, Nelson Chu wrote:
> 2.43 was released over an weekend.  Is it possible to let it be 
> supported after 2.44? cc Nick and jan.
I don't think it's critical enough to backport to 2.43.  I'd just put it 
on the trunk so that it's available in 2.44.

jeff
Nelson Chu Aug. 6, 2024, 6:17 a.m. UTC | #9
On Tue, Aug 6, 2024 at 11:17 AM Jeff Law <jeffreyalaw@gmail.com> wrote:

>
> On 8/5/24 8:17 PM, Nelson Chu wrote:
> > 2.43 was released over an weekend.  Is it possible to let it be
> > supported after 2.44? cc Nick and jan.
> I don't think it's critical enough to backport to 2.43.  I'd just put it
> on the trunk so that it's available in 2.44.
>

 Thanks, committed the binutils part of zimop and zcmop from Xiao into
trunk.

Nelson
Nick Clifton Aug. 6, 2024, 9:31 a.m. UTC | #10
Hi Jeff,

>> 2.43 was released over an weekend.  Is it possible to let it be supported after 2.44? cc Nick and jan.
> I don't think it's critical enough to backport to 2.43.  I'd just put it on the trunk so that it's available in 2.44.

It might be worth adding it to the 2.43 branch as well.  It is looking
like there will be need to create a point release this time as several
other last-minute problems have been uncovered and fixed just too late
to make it into the 2.43 release.

Cheers
   Nick
Jeff Law Aug. 6, 2024, 1:34 p.m. UTC | #11
On 8/6/24 3:31 AM, Nick Clifton wrote:
> Hi Jeff,
> 
>>> 2.43 was released over an weekend.  Is it possible to let it be 
>>> supported after 2.44? cc Nick and jan.
>> I don't think it's critical enough to backport to 2.43.  I'd just put 
>> it on the trunk so that it's available in 2.44.
> 
> It might be worth adding it to the 2.43 branch as well.  It is looking
> like there will be need to create a point release this time as several
> other last-minute problems have been uncovered and fixed just too late
> to make it into the 2.43 release.
I certainly wouldn't object.  It'll make my life marginally easier as 
we're carrying Lyut's version as one of the very few remaining local 
changes to binutils+gdb.

Jeff
Nelson Chu Aug. 6, 2024, 11:30 p.m. UTC | #12
On Tue, Aug 6, 2024 at 9:35 PM Jeff Law <jeffreyalaw@gmail.com> wrote:

>
>
> On 8/6/24 3:31 AM, Nick Clifton wrote:
> > Hi Jeff,
> >
> >>> 2.43 was released over an weekend.  Is it possible to let it be
> >>> supported after 2.44? cc Nick and jan.
> >> I don't think it's critical enough to backport to 2.43.  I'd just put
> >> it on the trunk so that it's available in 2.44.
> >
> > It might be worth adding it to the 2.43 branch as well.  It is looking
> > like there will be need to create a point release this time as several
> > other last-minute problems have been uncovered and fixed just too late
> > to make it into the 2.43 release.
> I certainly wouldn't object.  It'll make my life marginally easier as
> we're carrying Lyut's version as one of the very few remaining local
> changes to binutils+gdb.
>

Sounds good to me, too.  Once get the approval, I will backport them to
binutils-2_43-branch :-)

Thanks
Nelson
Nick Clifton Aug. 7, 2024, 7:57 a.m. UTC | #13
Hi Nelson,

> Sounds good to me, too.  Once get the approval, I will backport them to binutils-2_43-branch :-)

Please could you ping me once you have done that.

I will make sure not to make the point release before receiving your message.

Cheers
   Nick
Nelson Chu Aug. 7, 2024, 8:28 a.m. UTC | #14
Hi Nick,

Done for cherry-picking two patches to support riscv zimop and zcmop into
binutils-2_43-branch.
Commit bb566d7f, RISC-V: Add support for Zcmop extension
Commit 305fe5ed, RISC-V: Add support for Zimop extension

And also for gas/NEWS in the trunk, moved the entry into 2.43 section due
to the backport.
Commit 643f8ace, gas/NEWS: Moved RISC-V Zimop/Zcmop changes into 2.43
section due to backport.

Thanks
Nelson

On Wed, Aug 7, 2024 at 3:57 PM Nick Clifton <nickc@redhat.com> wrote:

> Hi Nelson,
>
> > Sounds good to me, too.  Once get the approval, I will backport them to
> binutils-2_43-branch :-)
>
> Please could you ping me once you have done that.
>
> I will make sure not to make the point release before receiving your
> message.
>
> Cheers
>    Nick
>
>
>
diff mbox series

Patch

diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc
index 1944c7785c4..62c6e1dab1f 100644
--- a/gcc/common/config/riscv/riscv-common.cc
+++ b/gcc/common/config/riscv/riscv-common.cc
@@ -97,6 +97,8 @@  static const riscv_implied_info_t riscv_implied_info[] =
   {"zabha", "zaamo"},
   {"zacas", "zaamo"},
 
+  {"zcmop", "zca"},
+
   {"b", "zba"},
   {"b", "zbb"},
   {"b", "zbs"},
@@ -319,6 +321,9 @@  static const struct riscv_ext_version riscv_ext_version_table[] =
   {"zicclsm",  ISA_SPEC_CLASS_NONE, 1, 0},
   {"ziccrse",  ISA_SPEC_CLASS_NONE, 1, 0},
 
+  {"zimop", ISA_SPEC_CLASS_NONE, 1, 0},
+  {"zcmop", ISA_SPEC_CLASS_NONE, 1, 0},
+
   {"zicntr", ISA_SPEC_CLASS_NONE, 2, 0},
   {"zihpm",  ISA_SPEC_CLASS_NONE, 2, 0},
 
@@ -1629,6 +1634,9 @@  static const riscv_ext_flag_table_t riscv_ext_flag_table[] =
   {"zicbop", &gcc_options::x_riscv_zicmo_subext, MASK_ZICBOP},
   {"zic64b", &gcc_options::x_riscv_zicmo_subext, MASK_ZIC64B},
 
+  {"zimop",    &gcc_options::x_riscv_mop_subext, MASK_ZIMOP},
+  {"zcmop",    &gcc_options::x_riscv_mop_subext, MASK_ZCMOP},
+
   {"zve32x",   &gcc_options::x_target_flags, MASK_VECTOR},
   {"zve32f",   &gcc_options::x_target_flags, MASK_VECTOR},
   {"zve64x",   &gcc_options::x_target_flags, MASK_VECTOR},
diff --git a/gcc/config/riscv/riscv.opt b/gcc/config/riscv/riscv.opt
index 2e340e5324f..a8758abc918 100644
--- a/gcc/config/riscv/riscv.opt
+++ b/gcc/config/riscv/riscv.opt
@@ -406,6 +406,13 @@  Mask(ZICBOP) Var(riscv_zicmo_subext)
 
 Mask(ZIC64B) Var(riscv_zicmo_subext)
 
+TargetVariable
+int riscv_mop_subext
+
+Mask(ZIMOP) Var(riscv_mop_subext)
+
+Mask(ZCMOP) Var(riscv_mop_subext)
+
 TargetVariable
 int riscv_zf_subext
 
diff --git a/gcc/testsuite/gcc.target/riscv/arch-42.c b/gcc/testsuite/gcc.target/riscv/arch-42.c
new file mode 100644
index 00000000000..83f78d28dbe
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/arch-42.c
@@ -0,0 +1,5 @@ 
+/* { dg-do compile } */
+/* { dg-options "-march=rv64i_zimop -mabi=lp64" } */
+int foo()
+{
+}
diff --git a/gcc/testsuite/gcc.target/riscv/arch-43.c b/gcc/testsuite/gcc.target/riscv/arch-43.c
new file mode 100644
index 00000000000..4a300a165fd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/arch-43.c
@@ -0,0 +1,5 @@ 
+/* { dg-do compile } */
+/* { dg-options "-march=rv64i_zcmop -mabi=lp64" } */
+int foo()
+{
+}