committed to trunk, thanks :)

On Mon, Dec 4, 2023 at 5:21 PM Christoph Müllner
<christoph.muell...@vrull.eu> wrote:
>
> On Mon, Dec 4, 2023 at 8:48 AM Kito Cheng <kito.ch...@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
> >

Reply via email to