On 6/26/23 06:18, Juzhe-Zhong wrote:
Currently, we are able to generate step vector with base == 0:
  { 0, 0, 2, 2, 4, 4, ... }

ASM:

vid
vand

However, we do wrong for step vector with base != 0:
{ 1, 1, 3, 3, 5, 5, ... }

Before this patch, such case will run fail.

After this patch, we are able to pass the testcase and generate the step vector 
with asm:

vid
vand
vadd

gcc/ChangeLog:

         * config/riscv/riscv-v.cc (expand_const_vector): Fix stepped vector 
with base != 0.

gcc/testsuite/ChangeLog:

         * gcc.target/riscv/rvv/autovec/partial/slp-17.c: New test.
         * gcc.target/riscv/rvv/autovec/partial/slp-18.c: New test.
         * gcc.target/riscv/rvv/autovec/partial/slp-19.c: New test.
         * gcc.target/riscv/rvv/autovec/partial/slp_run-17.c: New test.
         * gcc.target/riscv/rvv/autovec/partial/slp_run-18.c: New test.
         * gcc.target/riscv/rvv/autovec/partial/slp_run-19.c: New test.



diff --git a/gcc/config/riscv/riscv-v.cc b/gcc/config/riscv/riscv-v.cc
index 5518394be1e..cd3422bf711 100644
--- a/gcc/config/riscv/riscv-v.cc
+++ b/gcc/config/riscv/riscv-v.cc
@@ -1258,7 +1258,6 @@ expand_const_vector (rtx target, rtx src)
            }
          emit_move_insn (target, tmp);
        }
-      return;
      }
    else if (CONST_VECTOR_STEPPED_P (src))
      {
Was removal of the "return" intentional here? I'm not real familiar with this code, but it doesn't look related to the case you're trying to fix.

The rest of the code looks quite sensible.

Jeff

Reply via email to