public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Christoph Müllner" <christoph.muellner@vrull.eu>
To: Kito Cheng <kito.cheng@sifive.com>
Cc: gcc-patches@gcc.gnu.org, palmer@dabbelt.com,
	kito.cheng@gmail.com,  jeffreyalaw@gmail.com
Subject: Re: [PATCH] RISC-V: Check if zcd conflicts with zcmt and zcmp
Date: Mon, 4 Dec 2023 10:21:02 +0100	[thread overview]
Message-ID: <CAEg0e7idAr3XekkwmZ8+oqMGRBw4TmE=8kG8cGcbWuGrdna=ww@mail.gmail.com> (raw)
In-Reply-To: <20231204074823.17970-1-kito.cheng@sifive.com>

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
>

  reply	other threads:[~2023-12-04  9:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-04  7:48 Kito Cheng
2023-12-04  9:21 ` Christoph Müllner [this message]
2023-12-05  9:53   ` Kito Cheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAEg0e7idAr3XekkwmZ8+oqMGRBw4TmE=8kG8cGcbWuGrdna=ww@mail.gmail.com' \
    --to=christoph.muellner@vrull.eu \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.com \
    --cc=kito.cheng@gmail.com \
    --cc=kito.cheng@sifive.com \
    --cc=palmer@dabbelt.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).