RISC-V: Add comments of some functions

Message ID 20230613022611.2189297-1-juzhe.zhong@rivai.ai
State Unresolved
Headers
Series RISC-V: Add comments of some functions |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

juzhe.zhong@rivai.ai June 13, 2023, 2:26 a.m. UTC
  From: Juzhe-Zhong <juzhe.zhong@rivai.ai>

gcc/ChangeLog:

        * config/riscv/riscv-v.cc (rvv_builder::single_step_npatterns_p): Add comment.
        (shuffle_generic_patterns): Ditto.
        (expand_vec_perm_const_1): Ditto.

---
 gcc/config/riscv/riscv-v.cc | 7 +++++++
 1 file changed, 7 insertions(+)
  

Comments

Jeff Law June 13, 2023, 2:05 p.m. UTC | #1
On 6/12/23 20:26, juzhe.zhong@rivai.ai wrote:
> From: Juzhe-Zhong <juzhe.zhong@rivai.ai>
> 
> gcc/ChangeLog:
> 
>          * config/riscv/riscv-v.cc (rvv_builder::single_step_npatterns_p): Add comment.
>          (shuffle_generic_patterns): Ditto.
>          (expand_vec_perm_const_1): Ditto.
OK.  Thanks!
jeff
  
Li, Pan2 via Gcc-patches June 13, 2023, 2:15 p.m. UTC | #2
Committed, thanks Jeff.

Pan

-----Original Message-----
From: Gcc-patches <gcc-patches-bounces+pan2.li=intel.com@gcc.gnu.org> On Behalf Of Jeff Law via Gcc-patches
Sent: Tuesday, June 13, 2023 10:06 PM
To: juzhe.zhong@rivai.ai; gcc-patches@gcc.gnu.org
Cc: kito.cheng@gmail.com; kito.cheng@sifive.com; palmer@dabbelt.com; palmer@rivosinc.com; rdapp.gcc@gmail.com
Subject: Re: [PATCH] RISC-V: Add comments of some functions



On 6/12/23 20:26, juzhe.zhong@rivai.ai wrote:
> From: Juzhe-Zhong <juzhe.zhong@rivai.ai>
> 
> gcc/ChangeLog:
> 
>          * config/riscv/riscv-v.cc (rvv_builder::single_step_npatterns_p): Add comment.
>          (shuffle_generic_patterns): Ditto.
>          (expand_vec_perm_const_1): Ditto.
OK.  Thanks!
jeff
  

Patch

diff --git a/gcc/config/riscv/riscv-v.cc b/gcc/config/riscv/riscv-v.cc
index fb970344521..3ce2eb7f2ad 100644
--- a/gcc/config/riscv/riscv-v.cc
+++ b/gcc/config/riscv/riscv-v.cc
@@ -457,6 +457,9 @@  rvv_builder::single_step_npatterns_p () const
      { 2, 2, 2, 2, 4, 4, 4, 4, 8, 8, 8, 8, 16, 16, 16, 16, ... }
    E.g. NPATTERNS = 8:
      { 2, 2, 2, 2, 2, 2, 2, 2, 8, 8, 8, 8, 8, 8, 8, 8, ... }
+   We only check ele[0] ~ ele[NPATTERNS - 1] whether they are the same.
+   We don't need to check the elements[n] with n >= NPATTERNS since
+   they don't belong to the same pattern.
 */
 bool
 rvv_builder::npatterns_all_equal_p () const
@@ -2478,6 +2481,8 @@  shuffle_generic_patterns (struct expand_vec_perm_d *d)
   return true;
 }
 
+/* This function recognizes and supports different permutation patterns
+   and enable VLA SLP auto-vectorization.  */
 static bool
 expand_vec_perm_const_1 (struct expand_vec_perm_d *d)
 {
@@ -2509,6 +2514,8 @@  expand_vec_perm_const_1 (struct expand_vec_perm_d *d)
   return false;
 }
 
+/* This function implements TARGET_VECTORIZE_VEC_PERM_CONST by using RVV
+ * instructions.  */
 bool
 expand_vec_perm_const (machine_mode vmode, machine_mode op_mode, rtx target,
 		       rtx op0, rtx op1, const vec_perm_indices &sel)