* [PATCH] RISC-V: Improve vector_insn_info::dump for LMUL and policy
@ 2023-05-12 13:32 Kito Cheng
2023-05-12 17:12 ` Jeff Law
0 siblings, 1 reply; 3+ messages in thread
From: Kito Cheng @ 2023-05-12 13:32 UTC (permalink / raw)
To: gcc-patches, juzhe.zhong; +Cc: Kito Cheng
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] RISC-V: Improve vector_insn_info::dump for LMUL and policy
2023-05-12 13:32 [PATCH] RISC-V: Improve vector_insn_info::dump for LMUL and policy Kito Cheng
@ 2023-05-12 17:12 ` Jeff Law
2023-05-13 6:17 ` Kito Cheng
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Law @ 2023-05-12 17:12 UTC (permalink / raw)
To: Kito Cheng, gcc-patches, juzhe.zhong
On 5/12/23 07:32, Kito Cheng via Gcc-patches wrote:
> 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.
OK
jeff
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] RISC-V: Improve vector_insn_info::dump for LMUL and policy
2023-05-12 17:12 ` Jeff Law
@ 2023-05-13 6:17 ` Kito Cheng
0 siblings, 0 replies; 3+ messages in thread
From: Kito Cheng @ 2023-05-13 6:17 UTC (permalink / raw)
To: Jeff Law; +Cc: Kito Cheng, gcc-patches, juzhe.zhong
committed to trunk.
On Sat, May 13, 2023 at 1:13 AM Jeff Law via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
>
>
> On 5/12/23 07:32, Kito Cheng via Gcc-patches wrote:
> > 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.
> OK
> jeff
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-05-13 6:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-12 13:32 [PATCH] RISC-V: Improve vector_insn_info::dump for LMUL and policy Kito Cheng
2023-05-12 17:12 ` Jeff Law
2023-05-13 6:17 ` Kito Cheng
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).