RISC-V: Check if zcd conflicts with zcmt and zcmp
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gcc_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gcc_check--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 |
success
|
Testing passed
|
rivoscibot/toolchain-ci-rivos-build--linux-rv64gcv-lp64d-multilib |
success
|
Build passed
|
rivoscibot/toolchain-ci-rivos-build--newlib-rv64gcv-lp64d-multilib |
success
|
Build passed
|
rivoscibot/toolchain-ci-rivos-lint |
success
|
Lint passed
|
rivoscibot/toolchain-ci-rivos-apply-patch |
success
|
Patch applied
|
rivoscibot/toolchain-ci-rivos-test |
warning
|
Testing skipped
|
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 |
success
|
Testing passed
|
rivoscibot/toolchain-ci-rivos-build--newlib-rv64gc-lp64d-multilib |
success
|
Build passed
|
rivoscibot/toolchain-ci-rivos-build--linux-rv32gc_zba_zbb_zbc_zbs-ilp32d-non-multilib |
success
|
Build passed
|
rivoscibot/toolchain-ci-rivos-build--linux-rv64gc_zba_zbb_zbc_zbs-lp64d-non-multilib |
success
|
Build passed
|
Commit Message
gcc/ChangeLog:
* common/config/riscv/riscv-common.cc
(riscv_subset_list::check_conflict_ext): Check zcd conflicts
with zcmt and zcmp.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/arch-29.c: New test.
* gcc.target/riscv/arch-30.c: New test.
---
gcc/common/config/riscv/riscv-common.cc | 8 ++++++++
gcc/testsuite/gcc.target/riscv/arch-29.c | 7 +++++++
gcc/testsuite/gcc.target/riscv/arch-30.c | 7 +++++++
3 files changed, 22 insertions(+)
create mode 100644 gcc/testsuite/gcc.target/riscv/arch-29.c
create mode 100644 gcc/testsuite/gcc.target/riscv/arch-30.c
Comments
On Mon, Dec 4, 2023 at 8:48 AM Kito Cheng <kito.cheng@sifive.com> wrote:
LGTM
I've double-checked this in the Zc-1.0.4-3.pdf:
* Zcmp is incompatible with Zcd
* Zcmp depends on Zca
* Zcmt is incompatible with Zcd
* Zcmt depends on Zca and Zicsr
The implies-relations are already implemented.
This patch enforces the incompatibility-relations.
>
> gcc/ChangeLog:
>
> * common/config/riscv/riscv-common.cc
> (riscv_subset_list::check_conflict_ext): Check and conflicts
> with zcmt and zcmp.
>
> gcc/testsuite/ChangeLog:
>
> * gcc.target/riscv/arch-29.c: New test.
> * gcc.target/riscv/arch-30.c: New test.
> ---
> gcc/common/config/riscv/riscv-common.cc | 8 ++++++++
> gcc/testsuite/gcc.target/riscv/arch-29.c | 7 +++++++
> gcc/testsuite/gcc.target/riscv/arch-30.c | 7 +++++++
> 3 files changed, 22 insertions(+)
> create mode 100644 gcc/testsuite/gcc.target/riscv/arch-29.c
> create mode 100644 gcc/testsuite/gcc.target/riscv/arch-30.c
>
> diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc
> index aecb342b164..bfb41827f7a 100644
> --- a/gcc/common/config/riscv/riscv-common.cc
> +++ b/gcc/common/config/riscv/riscv-common.cc
> @@ -1230,6 +1230,14 @@ riscv_subset_list::check_conflict_ext ()
> /* 'H' hypervisor extension requires base ISA with 32 registers. */
> if (lookup ("e") && lookup ("h"))
> error_at (m_loc, "%<-march=%s%>: h extension requires i extension", m_arch);
> +
> + if (lookup ("zcd"))
> + {
> + if (lookup ("zcmt"))
> + error_at (m_loc, "%<-march=%s%>: zcd conflicts with zcmt", m_arch);
> + if (lookup ("zcmp"))
> + error_at (m_loc, "%<-march=%s%>: zcd conflicts with zcmp", m_arch);
> + }
> }
>
> /* Parsing function for multi-letter extensions.
> diff --git a/gcc/testsuite/gcc.target/riscv/arch-29.c b/gcc/testsuite/gcc.target/riscv/arch-29.c
> new file mode 100644
> index 00000000000..f8281275878
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/riscv/arch-29.c
> @@ -0,0 +1,7 @@
> +/* { dg-do compile } */
> +/* { dg-options "-march=rv64id_zcd_zcmt -mabi=lp64d" } */
> +int foo()
> +{
> +}
> +
> +/* { dg-error "zcd conflicts with zcmt" "" { target *-*-* } 0 } */
> diff --git a/gcc/testsuite/gcc.target/riscv/arch-30.c b/gcc/testsuite/gcc.target/riscv/arch-30.c
> new file mode 100644
> index 00000000000..3e67ea0bb06
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/riscv/arch-30.c
> @@ -0,0 +1,7 @@
> +/* { dg-do compile } */
> +/* { dg-options "-march=rv64id_zcd_zcmp -mabi=lp64d" } */
> +int foo()
> +{
> +}
> +
> +/* { dg-error "zcd conflicts with zcmp" "" { target *-*-* } 0 } */
> --
> 2.40.1
>
committed to trunk, thanks :)
On Mon, Dec 4, 2023 at 5:21 PM Christoph Müllner
<christoph.muellner@vrull.eu> wrote:
>
> On Mon, Dec 4, 2023 at 8:48 AM Kito Cheng <kito.cheng@sifive.com> wrote:
>
> LGTM
>
> I've double-checked this in the Zc-1.0.4-3.pdf:
> * Zcmp is incompatible with Zcd
> * Zcmp depends on Zca
> * Zcmt is incompatible with Zcd
> * Zcmt depends on Zca and Zicsr
>
> The implies-relations are already implemented.
> This patch enforces the incompatibility-relations.
>
> >
> > gcc/ChangeLog:
> >
> > * common/config/riscv/riscv-common.cc
> > (riscv_subset_list::check_conflict_ext): Check and conflicts
> > with zcmt and zcmp.
> >
> > gcc/testsuite/ChangeLog:
> >
> > * gcc.target/riscv/arch-29.c: New test.
> > * gcc.target/riscv/arch-30.c: New test.
> > ---
> > gcc/common/config/riscv/riscv-common.cc | 8 ++++++++
> > gcc/testsuite/gcc.target/riscv/arch-29.c | 7 +++++++
> > gcc/testsuite/gcc.target/riscv/arch-30.c | 7 +++++++
> > 3 files changed, 22 insertions(+)
> > create mode 100644 gcc/testsuite/gcc.target/riscv/arch-29.c
> > create mode 100644 gcc/testsuite/gcc.target/riscv/arch-30.c
> >
> > diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc
> > index aecb342b164..bfb41827f7a 100644
> > --- a/gcc/common/config/riscv/riscv-common.cc
> > +++ b/gcc/common/config/riscv/riscv-common.cc
> > @@ -1230,6 +1230,14 @@ riscv_subset_list::check_conflict_ext ()
> > /* 'H' hypervisor extension requires base ISA with 32 registers. */
> > if (lookup ("e") && lookup ("h"))
> > error_at (m_loc, "%<-march=%s%>: h extension requires i extension", m_arch);
> > +
> > + if (lookup ("zcd"))
> > + {
> > + if (lookup ("zcmt"))
> > + error_at (m_loc, "%<-march=%s%>: zcd conflicts with zcmt", m_arch);
> > + if (lookup ("zcmp"))
> > + error_at (m_loc, "%<-march=%s%>: zcd conflicts with zcmp", m_arch);
> > + }
> > }
> >
> > /* Parsing function for multi-letter extensions.
> > diff --git a/gcc/testsuite/gcc.target/riscv/arch-29.c b/gcc/testsuite/gcc.target/riscv/arch-29.c
> > new file mode 100644
> > index 00000000000..f8281275878
> > --- /dev/null
> > +++ b/gcc/testsuite/gcc.target/riscv/arch-29.c
> > @@ -0,0 +1,7 @@
> > +/* { dg-do compile } */
> > +/* { dg-options "-march=rv64id_zcd_zcmt -mabi=lp64d" } */
> > +int foo()
> > +{
> > +}
> > +
> > +/* { dg-error "zcd conflicts with zcmt" "" { target *-*-* } 0 } */
> > diff --git a/gcc/testsuite/gcc.target/riscv/arch-30.c b/gcc/testsuite/gcc.target/riscv/arch-30.c
> > new file mode 100644
> > index 00000000000..3e67ea0bb06
> > --- /dev/null
> > +++ b/gcc/testsuite/gcc.target/riscv/arch-30.c
> > @@ -0,0 +1,7 @@
> > +/* { dg-do compile } */
> > +/* { dg-options "-march=rv64id_zcd_zcmp -mabi=lp64d" } */
> > +int foo()
> > +{
> > +}
> > +
> > +/* { dg-error "zcd conflicts with zcmp" "" { target *-*-* } 0 } */
> > --
> > 2.40.1
> >
@@ -1230,6 +1230,14 @@ riscv_subset_list::check_conflict_ext ()
/* 'H' hypervisor extension requires base ISA with 32 registers. */
if (lookup ("e") && lookup ("h"))
error_at (m_loc, "%<-march=%s%>: h extension requires i extension", m_arch);
+
+ if (lookup ("zcd"))
+ {
+ if (lookup ("zcmt"))
+ error_at (m_loc, "%<-march=%s%>: zcd conflicts with zcmt", m_arch);
+ if (lookup ("zcmp"))
+ error_at (m_loc, "%<-march=%s%>: zcd conflicts with zcmp", m_arch);
+ }
}
/* Parsing function for multi-letter extensions.
new file mode 100644
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64id_zcd_zcmt -mabi=lp64d" } */
+int foo()
+{
+}
+
+/* { dg-error "zcd conflicts with zcmt" "" { target *-*-* } 0 } */
new file mode 100644
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64id_zcd_zcmp -mabi=lp64d" } */
+int foo()
+{
+}
+
+/* { dg-error "zcd conflicts with zcmp" "" { target *-*-* } 0 } */