public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jim Wilson <jimw@sifive.com>
To: Kito Cheng <kito.cheng@sifive.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>, Kito Cheng <kito.cheng@gmail.com>
Subject: Re: [PATCH 2/3] RISC-V: Support zicsr and zifencei extension for -march.
Date: Tue, 17 Nov 2020 13:23:21 -0800	[thread overview]
Message-ID: <CAFyWVaYj1Cc39uF0sDhrV=Mr83B6WryoaKZ+PMzxiOrjd7cdkA@mail.gmail.com> (raw)
In-Reply-To: <20201113072910.42353-3-kito.cheng@sifive.com>

On Thu, Nov 12, 2020 at 11:29 PM Kito Cheng <kito.cheng@sifive.com> wrote:

>  - CSR related instructions and fence instructions has to be splitted from
>    baseline ISA, zicsr and zifencei are corresponding sub-extension.
>

It is actually only fence.i that is split off.  fence is still part of the
base ISA.  This is why it is called zifencei.

diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c
> index 738556539f6..2aaa8e96451 100644
> --- a/gcc/config/riscv/riscv.c
> +++ b/gcc/config/riscv/riscv.c
> @@ -3337,6 +3337,9 @@ riscv_memmodel_needs_amo_acquire (enum memmodel
> model)
>  static bool
>  riscv_memmodel_needs_release_fence (enum memmodel model)
>  {
> +  if (!TARGET_ZIFENCEI)
> +    return false;
> +
>    switch (model)
>      {
>        case MEMMODEL_ACQ_REL:
>

This part looks wrong, as riscv_memmodel_needs_release_fence is only used
for fence instructions, not for fence.i.

> diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md
> index f15bad3b29e..756b35fb8c0 100644
> --- a/gcc/config/riscv/riscv.md
> +++ b/gcc/config/riscv/riscv.md
> @@ -1543,19 +1543,20 @@
>                      LCT_NORMAL, VOIDmode, operands[0], Pmode,
>                      operands[1], Pmode, const0_rtx, Pmode);
>  #else
> -  emit_insn (gen_fence_i ());
> +  if (TARGET_ZIFENCEI)
> +    emit_insn (gen_fence_i ());
>  #endif
>    DONE;
>  })
>
>  (define_insn "fence"
>    [(unspec_volatile [(const_int 0)] UNSPECV_FENCE)]
> -  ""
> +  "TARGET_ZIFENCEI"
>    "%|fence%-")
>
>  (define_insn "fence_i"
>    [(unspec_volatile [(const_int 0)] UNSPECV_FENCE_I)]
> -  ""
> +  "TARGET_ZIFENCEI"
>    "fence.i")
>
>  ;;
>

The fence_i and clear_cache patterns are OK.  The fence pattern change is
wrong.

You didn't change sync.md, but it only uses fence, so it needs no change.

Jim

  reply	other threads:[~2020-11-17 21:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-13  7:29 [PATCH 0/3] RISC-V: Support version controling for ISA standard extensions Kito Cheng
2020-11-13  7:29 ` [PATCH 1/3] RISC-V: Handle implied extension in canonical ordering Kito Cheng
2020-11-13  7:29 ` [PATCH 2/3] RISC-V: Support zicsr and zifencei extension for -march Kito Cheng
2020-11-17 21:23   ` Jim Wilson [this message]
2020-11-18  5:44     ` Kito Cheng
2020-11-13  7:29 ` [PATCH 3/3] RISC-V: Support version controling for ISA standard extensions Kito Cheng
2020-11-13  7:34   ` Kito Cheng
2020-12-15  8:08   ` Gerald Pfeifer
2020-12-17  3:44     ` Kito Cheng
     [not found] <Kito Cheng <kito.cheng@sifive.com>
2020-11-13  7:27 ` Kito Cheng
2020-11-13  7:27   ` [PATCH 2/3] RISC-V: Support zicsr and zifencei extension for -march 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='CAFyWVaYj1Cc39uF0sDhrV=Mr83B6WryoaKZ+PMzxiOrjd7cdkA@mail.gmail.com' \
    --to=jimw@sifive.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kito.cheng@gmail.com \
    --cc=kito.cheng@sifive.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).