public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Kito Cheng <kito@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-5407] RISC-V: Simplify codes of changing vsetvl instruction Date: Thu, 26 Jan 2023 19:12:15 +0000 (GMT) [thread overview] Message-ID: <20230126191215.F058B3858D28@sourceware.org> (raw) https://gcc.gnu.org/g:aef20243b842284587023306e922e483b2401f34 commit r13-5407-gaef20243b842284587023306e922e483b2401f34 Author: Ju-Zhe Zhong <juzhe.zhong@rivai.ai> Date: Tue Jan 3 15:24:36 2023 +0800 RISC-V: Simplify codes of changing vsetvl instruction This patch is NFC patch. I move these code as a function since we will reuse it in the following patch (Refine phase 3 of VSETVL PASS) gcc/ChangeLog: * config/riscv/riscv-vsetvl.cc (change_vsetvl_insn): New function. (pass_vsetvl::compute_global_backward_infos): Simplify codes. Diff: --- gcc/config/riscv/riscv-vsetvl.cc | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index 4d0e97d7ed7..f6f24f73813 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -880,6 +880,25 @@ change_insn (function_info *ssa, insn_change change, insn_info *insn, return true; } +static void +change_vsetvl_insn (const insn_info *insn, const vector_insn_info &info) +{ + rtx_insn *rinsn; + if (vector_config_insn_p (insn->rtl ())) + { + rinsn = insn->rtl (); + gcc_assert (vsetvl_insn_p (rinsn) && "Can't handle X0, rs1 vsetvli yet"); + } + else + { + gcc_assert (has_vtype_op (insn->rtl ())); + rinsn = PREV_INSN (insn->rtl ()); + gcc_assert (vector_config_insn_p (rinsn)); + } + rtx new_pat = gen_vsetvl_pat (rinsn, info); + change_insn (rinsn, new_pat); +} + avl_info::avl_info (const avl_info &other) { m_value = other.get_value (); @@ -1941,7 +1960,6 @@ pass_vsetvl::compute_global_backward_infos (void) /* Backward propagate to each predecessor. */ FOR_EACH_EDGE (e, ei, cfg_bb->preds) { - rtx new_pat; auto &block_info = m_vector_manager->vector_block_infos[e->src->index]; @@ -2011,21 +2029,7 @@ pass_vsetvl::compute_global_backward_infos (void) be_merged = block_info.local_dem; vector_insn_info new_info = be_merged.merge (prop, true); - rtx_insn *rinsn; - if (vector_config_insn_p (new_info.get_insn ()->rtl ())) - { - rinsn = new_info.get_insn ()->rtl (); - gcc_assert (vsetvl_insn_p (rinsn) - && "Can't handle X0, rs1 vsetvli yet"); - } - else - { - gcc_assert (has_vtype_op (new_info.get_insn ()->rtl ())); - rinsn = PREV_INSN (new_info.get_insn ()->rtl ()); - gcc_assert (vector_config_insn_p (rinsn)); - } - new_pat = gen_vsetvl_pat (rinsn, new_info); - change_insn (rinsn, new_pat); + change_vsetvl_insn (new_info.get_insn (), new_info); if (block_info.local_dem == block_info.reaching_out) block_info.local_dem = new_info; block_info.reaching_out = new_info;
reply other threads:[~2023-01-26 19:12 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230126191215.F058B3858D28@sourceware.org \ --to=kito@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /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: linkBe 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).