From: Kito Cheng <kito.cheng@sifive.com>
To: gcc-patches@gcc.gnu.org, juzhe.zhong@rivai.ai
Cc: Kito Cheng <kito.cheng@sifive.com>
Subject: [PATCH] RISC-V: Improve vector_insn_info::dump for LMUL and policy
Date: Fri, 12 May 2023 21:32:54 +0800 [thread overview]
Message-ID: <20230512133254.59478-1-kito.cheng@sifive.com> (raw)
Convert vlmul and policy to human readable string, some example below:
Before:
[VALID,Demand field={1(VL),0(DEMAND_NONZERO_AVL),1(SEW),0(DEMAND_GE_SEW),1(LMUL),0(RATIO),0(TAIL_POLICY),0(MASK_POLICY)}
AVL=(reg:DI 0 zero)
SEW=16,VLMUL=3,RATIO=2,TAIL_POLICY=1,MASK_POLICY=1]
^ ^ ^
After:
[VALID,Demand field={1(VL),0(DEMAND_NONZERO_AVL),1(SEW),0(DEMAND_GE_SEW),1(LMUL),0(RATIO),0(TAIL_POLICY),0(MASK_POLICY)}
AVL=(reg:DI 0 zero)
SEW=16,VLMUL=m8,RATIO=2,TAIL_POLICY=agnostic,MASK_POLICY=agnostic]
^^ ^^^^^^^^ ^^^^^^^^
gcc/ChangeLog:
* config/riscv/riscv-vsetvl.cc (vlmul_to_str): New.
(policy_to_str): New.
(vector_insn_info::dump): Use vlmul_to_str and policy_to_str.
---
gcc/config/riscv/riscv-vsetvl.cc | 39 +++++++++++++++++++++++++++++---
1 file changed, 36 insertions(+), 3 deletions(-)
diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc
index f1c47e8f9be3..5c4b349dd9db 100644
--- a/gcc/config/riscv/riscv-vsetvl.cc
+++ b/gcc/config/riscv/riscv-vsetvl.cc
@@ -2241,6 +2241,39 @@ vector_insn_info::update_fault_first_load_avl (insn_info *insn)
return false;
}
+static const char *
+vlmul_to_str (vlmul_type vlmul)
+{
+ switch (vlmul)
+ {
+ case LMUL_1:
+ return "m1";
+ case LMUL_2:
+ return "m2";
+ case LMUL_4:
+ return "m4";
+ case LMUL_8:
+ return "m8";
+ case LMUL_RESERVED:
+ return "INVALID LMUL";
+ case LMUL_F8:
+ return "mf8";
+ case LMUL_F4:
+ return "mf4";
+ case LMUL_F2:
+ return "mf2";
+
+ default:
+ gcc_unreachable ();
+ }
+}
+
+static const char *
+policy_to_str (bool agnostic_p)
+{
+ return agnostic_p ? "agnostic" : "undisturbed";
+}
+
void
vector_insn_info::dump (FILE *file) const
{
@@ -2272,10 +2305,10 @@ vector_insn_info::dump (FILE *file) const
fprintf (file, "AVL=");
print_rtl_single (file, get_avl ());
fprintf (file, "SEW=%d,", get_sew ());
- fprintf (file, "VLMUL=%d,", get_vlmul ());
+ fprintf (file, "VLMUL=%s,", vlmul_to_str (get_vlmul ()));
fprintf (file, "RATIO=%d,", get_ratio ());
- fprintf (file, "TAIL_POLICY=%d,", get_ta ());
- fprintf (file, "MASK_POLICY=%d", get_ma ());
+ fprintf (file, "TAIL_POLICY=%s,", policy_to_str (get_ta ()));
+ fprintf (file, "MASK_POLICY=%s", policy_to_str (get_ma ()));
fprintf (file, "]\n");
if (valid_p ())
--
2.39.2
next reply other threads:[~2023-05-12 13:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-12 13:32 Kito Cheng [this message]
2023-05-12 17:12 ` Jeff Law
2023-05-13 6:17 ` 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=20230512133254.59478-1-kito.cheng@sifive.com \
--to=kito.cheng@sifive.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=juzhe.zhong@rivai.ai \
/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).