public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Lehua Ding <lhtin@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-4209] RISC-V: Adjusting the comments of the emit_vlmax_insn/emit_vlmax_insn_lra/emit_nonvlmax_insn functio Date: Thu, 21 Sep 2023 10:12:53 +0000 (GMT) [thread overview] Message-ID: <20230921101253.2994F3861829@sourceware.org> (raw) https://gcc.gnu.org/g:5ff4431675c0d0c800d4a983254e94a6b401c14d commit r14-4209-g5ff4431675c0d0c800d4a983254e94a6b401c14d Author: Lehua Ding <lehua.ding@rivai.ai> Date: Thu Sep 21 15:02:32 2023 +0800 RISC-V: Adjusting the comments of the emit_vlmax_insn/emit_vlmax_insn_lra/emit_nonvlmax_insn functions V2 Change: Use Robin's comments. This patch adjusts the comments of the emit_vlmax_insn/emit_vlmax_insn_lra/emit_nonvlmax_insn functions. The purpose of the adjustment is to make it clear that vlmax here is not VLMAX as defined inside the RVV ISA. This is because this function is used by RVV mode (e.g. RVVM1SImode) in addition to VLS mode (V16QI). For RVV mode, it means the same thing, for VLS mode, it indicates setting the vl to the number of units of the mode. Changed the comment because I didn't think of a better name. If there is a suitable name, feel free to discuss it. gcc/ChangeLog: * config/riscv/riscv-v.cc (emit_vlmax_insn): Adjust comments. (emit_nonvlmax_insn): Adjust comments. (emit_vlmax_insn_lra): Adjust comments. Co-Authored-By: Robin Dapp <rdapp.gcc@gmail.com> Diff: --- gcc/config/riscv/riscv-v.cc | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/gcc/config/riscv/riscv-v.cc b/gcc/config/riscv/riscv-v.cc index 366f0659817..4b9a494f8eb 100644 --- a/gcc/config/riscv/riscv-v.cc +++ b/gcc/config/riscv/riscv-v.cc @@ -347,33 +347,42 @@ private: expand_operand m_ops[MAX_OPERANDS]; }; -/* Emit RVV insn which vl is VLMAX. - This function can only be used before LRA pass or - for VLS_AVL_IMM modes. */ +/* Emit an RVV insn with a vector length that equals the number of units of the + vector mode. For VLA modes this corresponds to VLMAX. + + Unless the vector length can be encoded in the vsetivl[i] instruction this + function must only be used as long as we can create pseudo registers. This is + because it will set a pseudo register to VLMAX using vsetvl and use this as + definition for the vector length. */ void emit_vlmax_insn (unsigned icode, unsigned insn_flags, rtx *ops) { insn_expander<RVV_INSN_OPERANDS_MAX> e (insn_flags, true); + gcc_assert (can_create_pseudo_p () || const_vlmax_p (e.get_vtype_mode (ops))); + e.emit_insn ((enum insn_code) icode, ops); } -/* Emit RVV insn which vl is VL. */ +/* Like emit_vlmax_insn but must only be used when we cannot create pseudo + registers anymore. This function, however, takes a predefined vector length + from the value in VL. */ void -emit_nonvlmax_insn (unsigned icode, unsigned insn_flags, rtx *ops, rtx vl) +emit_vlmax_insn_lra (unsigned icode, unsigned insn_flags, rtx *ops, rtx vl) { - insn_expander<RVV_INSN_OPERANDS_MAX> e (insn_flags, false); + gcc_assert (!can_create_pseudo_p ()); + + insn_expander<RVV_INSN_OPERANDS_MAX> e (insn_flags, true); e.set_vl (vl); e.emit_insn ((enum insn_code) icode, ops); } -/* Emit RVV insn which vl is VL but the AVL_TYPE insn attr is VLMAX. - This function used after LRA pass that cann't create pseudo register. */ +/* Emit an RVV insn with a predefined vector length. Contrary to + emit_vlmax_insn the instruction's vector length is not deduced from its mode + but taken from the value in VL. */ void -emit_vlmax_insn_lra (unsigned icode, unsigned insn_flags, rtx *ops, rtx vl) +emit_nonvlmax_insn (unsigned icode, unsigned insn_flags, rtx *ops, rtx vl) { - gcc_assert (!can_create_pseudo_p ()); - - insn_expander<RVV_INSN_OPERANDS_MAX> e (insn_flags, true); + insn_expander<RVV_INSN_OPERANDS_MAX> e (insn_flags, false); e.set_vl (vl); e.emit_insn ((enum insn_code) icode, ops); }
reply other threads:[~2023-09-21 10: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=20230921101253.2994F3861829@sourceware.org \ --to=lhtin@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).