public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kito Cheng <kito.cheng@gmail.com>
To: Fei Gao <gaofei@eswincomputing.com>
Cc: gcc-patches@gcc.gnu.org, palmer@dabbelt.com,
	jeffreyalaw@gmail.com,  sinan.lin@linux.alibaba.com,
	jiawei@iscas.ac.cn
Subject: Re: [PATCH 2/4] [RISC-V] support cm.popretz in zcmp
Date: Thu, 13 Jul 2023 16:31:41 +0800	[thread overview]
Message-ID: <CA+yXCZCWLrv4i+FCZKmO4JMnvk-QeiYnK9DEF0D4TGFeqJYOCQ@mail.gmail.com> (raw)
In-Reply-To: <20230607055215.29332-3-gaofei@eswincomputing.com>

I was thinking does it possible to using peephole2 to optimize this
case, but I realized their is several barrier, like stack tie and
note...so it seems hard to just leverage peephole2.

And the patch is LGTM, only a few minor coding format issues, but you
don't need to send new patch, I can fix those stuff when I push, and I
would strongly suggest you setup git-format-patch, <gcc-src>/contrib
has a clang format setting , that can release you from the boring
coding format issues.

# Copy to <gcc-src>/.clang-format, so that clang-format can found that
automatically.
$ cp contrib/clang-format .clang-format


> @@ -5747,6 +5748,80 @@ riscv_adjust_libcall_cfi_epilogue ()
>    return dwarf;
>  }
>
> +/* return true if popretz pattern can be matched.
> +   set (reg 10 a0) (const_int 0)
> +   use (reg 10 a0)
> +   NOTE_INSN_EPILOGUE_BEG  */
> +static rtx_insn *
> +riscv_zcmp_can_use_popretz(void)

Need space between function name and (void)

> +{
> +  rtx_insn *insn = NULL, *use = NULL, *clear = NULL;
> +
> +  /* sequence stack for NOTE_INSN_EPILOGUE_BEG*/
> +  struct sequence_stack * outer_seq = get_current_sequence ()->next;
> +  if (!outer_seq)
> +    return NULL;
> +  insn = outer_seq->first;
> +  if(!insn || !NOTE_P (insn) || NOTE_KIND (insn) != NOTE_INSN_EPILOGUE_BEG)
> +    return NULL;
> +
> +  /* sequence stack for the insn before NOTE_INSN_EPILOGUE_BEG*/
> +  outer_seq = outer_seq->next;
> +  if (outer_seq)
> +    insn = outer_seq->last;
> +
> +  /* skip notes  */
> +  while (insn && NOTE_P (insn))
> +    {
> +      insn = PREV_INSN (insn);
> +    }
> +  use = insn;
> +
> +  /* match use (reg 10 a0)  */
> +  if (use == NULL || !INSN_P (use)
> +      || GET_CODE (PATTERN (use)) != USE
> +      || !REG_P(XEXP(PATTERN (use), 0))
> +      || REGNO(XEXP(PATTERN (use), 0)) != A0_REGNUM)
> +    return NULL;
> +
> +  /* match set (reg 10 a0) (const_int 0 [0])  */
> +  clear = PREV_INSN (use);
> +  if (clear != NULL && INSN_P (clear)
> +      && GET_CODE (PATTERN (clear)) == SET
> +      && REG_P (SET_DEST (PATTERN (clear)))
> +      && REGNO (SET_DEST (PATTERN (clear))) == A0_REGNUM
> +      && SET_SRC (PATTERN (clear)) == const0_rtx)
> +    return clear;
> +
> +  return NULL;
> +}
> +
> +static void
> +riscv_gen_multi_pop_insn(bool use_multi_pop_normal, unsigned mask,
> +                         unsigned multipop_size)

Same issue here, need space between argument and function name.

  reply	other threads:[~2023-07-13  8:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-07  5:52 [PATCH 0/4] [RISC-V] support zcmp extention Fei Gao
2023-06-07  5:52 ` [PATCH 1/4][V4][RISC-V] support cm.push cm.pop cm.popret in zcmp Fei Gao
2023-06-07 10:11   ` jiawei
2023-08-16  8:33   ` Kito Cheng
2023-08-16  8:38     ` Kito Cheng
2023-08-16  9:03       ` Fei Gao
2023-08-20 10:53       ` Fei Gao
2023-08-28  8:04         ` Fei Gao
2023-08-17 11:39     ` Fei Gao
2023-06-07  5:52 ` [PATCH 2/4] [RISC-V] support cm.popretz " Fei Gao
2023-07-13  8:31   ` Kito Cheng [this message]
2023-06-07  5:52 ` [PATCH 3/4] [RISC-V] resolve confilct between zcmp multi push/pop and shrink-wrap-separate Fei Gao
2023-06-12 15:17   ` Kito Cheng
2023-06-12 19:26   ` Jeff Law
2023-06-13  2:35     ` Fei Gao
2023-06-07  5:52 ` [PATCH 4/4] [RISC-V] support cm.mva01s cm.mvsa01 in zcmp Fei Gao
2023-07-13  8:18   ` 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=CA+yXCZCWLrv4i+FCZKmO4JMnvk-QeiYnK9DEF0D4TGFeqJYOCQ@mail.gmail.com \
    --to=kito.cheng@gmail.com \
    --cc=gaofei@eswincomputing.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.com \
    --cc=jiawei@iscas.ac.cn \
    --cc=palmer@dabbelt.com \
    --cc=sinan.lin@linux.alibaba.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).