Compared to v1, the patch now removes the early VLS rejection
completely, and considers scenarios where `this` has spills while
`other` does not, which can happen when VLS is legal for unknown-iters
loops.  It is also different from the early implementation in that we
now don't trigger the early return when both main loops have spills.  It
has caused several vect dump expectation changes in some testcases, but
the final assembly for them remains identical.

---

When the iteration count is unknown, actually compare the costs of
different VLA modes instead of blindly choosing the bigger LMUL as long
as there's no unexpected spill.  This can prevent some cases when
-mrvv-max-lmul=dynamic emits worse code than -mrvv-max-lmul=m8, and
consistent with the current implementation of
check_vectorise_memory_operation in riscv-string.cc, which chooses the
smallest possible LMUL, instead of m8 for all cases.

This patch used to be a part of the m1-dynamic patch I proposed earlier,
but as this can be justified independently, I split this out.

As I changed the `else if` branch to an independent if-clause, it can
now affect both dynamic and conv-dynamic.  I am not quite sure but I
guess avoiding a VLS loop for unknown niter cases would be reasonable as
well for conv-dynamic when neither is preferred by the conv-dynamic
heuristics.

When running the regression tests, I found several testcases, including
vec_sat_u_sub_zip.c, contain multiline DejaGnu directives that are not
supported by the DejaGnu framework.  I plan to fix them in a separate
testsuite-only patch.

gcc/ChangeLog:

        * config/riscv/riscv-vector-costs.cc (costs::better_main_loop_than_p):
        Compare VLA costs under -mrvv-max-lmul=dynamic.

gcc/testsuite/ChangeLog:

        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul-mixed-1.c: Update
        expectation.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-1.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-2.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-3.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-4.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-5.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-6.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-7.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-1.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-3.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-4.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-5.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-6.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-6.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-12.c: Ditto.
        * gcc.dg/vect/costmodel/riscv/rvv/pr111848.c: Ditto.
        * gcc.target/riscv/rvv/autovec/partial/slp-16.c: Ditto.
        * gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_zip.c: Ditto.
---
 gcc/config/riscv/riscv-vector-costs.cc        | 21 ++-----------------
 .../riscv/rvv/dynamic-lmul-mixed-1.c          |  2 +-
 .../costmodel/riscv/rvv/dynamic-lmul1-1.c     |  2 +-
 .../costmodel/riscv/rvv/dynamic-lmul1-2.c     |  2 +-
 .../costmodel/riscv/rvv/dynamic-lmul1-3.c     |  2 +-
 .../costmodel/riscv/rvv/dynamic-lmul1-4.c     |  2 +-
 .../costmodel/riscv/rvv/dynamic-lmul1-5.c     |  2 +-
 .../costmodel/riscv/rvv/dynamic-lmul1-6.c     |  2 +-
 .../costmodel/riscv/rvv/dynamic-lmul1-7.c     |  2 +-
 .../costmodel/riscv/rvv/dynamic-lmul2-1.c     |  2 +-
 .../costmodel/riscv/rvv/dynamic-lmul2-3.c     |  2 +-
 .../costmodel/riscv/rvv/dynamic-lmul2-4.c     |  2 +-
 .../costmodel/riscv/rvv/dynamic-lmul2-5.c     |  2 +-
 .../costmodel/riscv/rvv/dynamic-lmul2-6.c     |  2 +-
 .../costmodel/riscv/rvv/dynamic-lmul4-6.c     |  4 ++--
 .../costmodel/riscv/rvv/dynamic-lmul8-12.c    |  4 ++--
 .../vect/costmodel/riscv/rvv/pr111848.c       |  2 +-
 .../riscv/rvv/autovec/partial/slp-16.c        |  4 ++--
 .../riscv/rvv/autovec/sat/vec_sat_u_sub_zip.c |  2 +-
 19 files changed, 23 insertions(+), 40 deletions(-)

diff --git a/gcc/config/riscv/riscv-vector-costs.cc 
b/gcc/config/riscv/riscv-vector-costs.cc
index dfb80bee679..a2262548c6c 100644
--- a/gcc/config/riscv/riscv-vector-costs.cc
+++ b/gcc/config/riscv/riscv-vector-costs.cc
@@ -1239,13 +1239,13 @@ costs::better_main_loop_than_p (const vector_costs 
*uncast_other) const
     }
   else if (rvv_max_lmul == RVV_DYNAMIC)
     {
-      if (other->m_has_unexpected_spills_p)
+      if (this->m_has_unexpected_spills_p != other->m_has_unexpected_spills_p)
        {
          if (dump_enabled_p ())
            dump_printf_loc (MSG_NOTE, vect_location,
                             "Preferring smaller LMUL loop because"
                             " it has unexpected spills\n");
-         return true;
+         return !this->m_has_unexpected_spills_p;
        }
       else if (riscv_vla_mode_p (other_loop_vinfo->vector_mode))
        {
@@ -1261,25 +1261,8 @@ costs::better_main_loop_than_p (const vector_costs 
*uncast_other) const
                  return false;
                }
            }
-         else
-           {
-             if (dump_enabled_p ())
-               dump_printf_loc (MSG_NOTE, vect_location,
-                                "Keep current LMUL loop because"
-                                " it is unknown NITERS\n");
-             return false;
-           }
        }
     }
-  /* If NITERS is unknown, we should not use VLS modes to vectorize
-     the loop since we don't support partial vectors for VLS modes,
-     that is, we will have full vectors (VLSmodes) on loop body
-     and partial vectors (VLAmodes) on loop epilogue which is very
-     inefficient.  Instead, we should apply partial vectors (VLAmodes)
-     on loop body without an epilogue on unknown NITERS loop.  */
-  else if (!LOOP_VINFO_NITERS_KNOWN_P (this_loop_vinfo)
-          && m_cost_type == VLS_VECTOR_COST)
-    return false;
 
   /* Fall back to generic costing if either iteration count is unknown.  For
      known iteration counts, include loop overhead when comparing different
diff --git 
a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul-mixed-1.c 
b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul-mixed-1.c
index 8d0002805db..47ca3074b40 100644
--- a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul-mixed-1.c
+++ b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul-mixed-1.c
@@ -44,4 +44,4 @@ foo (int32_t *__restrict a, int32_t *__restrict b, int32_t 
*__restrict c,
 /* { dg-final { scan-assembler {e32,m2} } } */
 /* { dg-final { scan-assembler {e32,m8} } } */
 /* { dg-final { scan-assembler-not {csrr} } } */
-/* { dg-final { scan-tree-dump-times "Preferring smaller LMUL loop because it 
has unexpected spills" 2 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Preferring smaller LMUL loop because it 
has unexpected spills" 1 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-1.c 
b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-1.c
index d5fd0f2e320..b40b467651a 100644
--- a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-1.c
+++ b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-1.c
@@ -85,7 +85,7 @@ foo (int32_t *__restrict a, int32_t *__restrict b,    int32_t 
*__restrict c,
 
 /* { dg-final { scan-assembler {e32,m1} } } */
 /* { dg-final { scan-assembler-not {csrr} } } */
-/* { dg-final { scan-tree-dump-times "Preferring smaller LMUL loop because it 
has unexpected spills" 3 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Preferring smaller LMUL loop because it 
has unexpected spills" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 8" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 4" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 2" 1 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-2.c 
b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-2.c
index a0e61303e80..e1fb4b385a7 100644
--- a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-2.c
+++ b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-2.c
@@ -57,7 +57,7 @@ foo (int32_t *__restrict a, int32_t *__restrict b,    int32_t 
*__restrict c,
 /* FIXME: Choosing LMUL = 1 is not the optimal since it can be LMUL = 2 if we 
apply instruction scheduler.  */
 /* { dg-final { scan-assembler {e32,m1} } } */
 /* { dg-final { scan-assembler-not {csrr} } } */
-/* { dg-final { scan-tree-dump-times "Preferring smaller LMUL loop because it 
has unexpected spills" 3 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Preferring smaller LMUL loop because it 
has unexpected spills" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 8" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 4" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 2" 1 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-3.c 
b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-3.c
index 2111c0bbc9a..08f202f8602 100644
--- a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-3.c
+++ b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-3.c
@@ -85,7 +85,7 @@ foo (int8_t *__restrict a, int8_t *__restrict b,    int8_t 
*__restrict c,
 
 /* { dg-final { scan-assembler {e8,m1} } } */
 /* { dg-final { scan-assembler-not {csrr} } } */
-/* { dg-final { scan-tree-dump-times "Preferring smaller LMUL loop because it 
has unexpected spills" 3 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Preferring smaller LMUL loop because it 
has unexpected spills" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 8" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 4" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 2" 1 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-4.c 
b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-4.c
index c47a4c4ceb1..d6c8faaf8f7 100644
--- a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-4.c
+++ b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-4.c
@@ -115,7 +115,7 @@ foo (int32_t *__restrict a, int32_t *__restrict b,    
int32_t *__restrict c,
 
 /* { dg-final { scan-assembler {e32,m1} } } */
 /* { dg-final { scan-assembler-not {csrr} } } */
-/* { dg-final { scan-tree-dump-times "Preferring smaller LMUL loop because it 
has unexpected spills" 3 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Preferring smaller LMUL loop because it 
has unexpected spills" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 8" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 4" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 2" 1 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-5.c 
b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-5.c
index e4b74f037e3..d006918c410 100644
--- a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-5.c
+++ b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-5.c
@@ -143,7 +143,7 @@ foo (int32_t *__restrict a, int32_t *__restrict b,    
int32_t *__restrict c,
 
 /* { dg-final { scan-assembler {e32,m1} } } */
 /* { dg-final { scan-assembler-not {csrr} } } */
-/* { dg-final { scan-tree-dump-times "Preferring smaller LMUL loop because it 
has unexpected spills" 3 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Preferring smaller LMUL loop because it 
has unexpected spills" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 8" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 4" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 2" 1 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-6.c 
b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-6.c
index 73d16dab732..f8b0283252f 100644
--- a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-6.c
+++ b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-6.c
@@ -144,7 +144,7 @@ foo (int8_t *__restrict a, int8_t *__restrict b,    int8_t 
*__restrict c,
 
 /* { dg-final { scan-assembler {e8,m1} } } */
 /* { dg-final { scan-assembler-not {csrr} } } */
-/* { dg-final { scan-tree-dump-times "Preferring smaller LMUL loop because it 
has unexpected spills" 3 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Preferring smaller LMUL loop because it 
has unexpected spills" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 8" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 4" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 2" 1 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-7.c 
b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-7.c
index b76bb4b06b4..a1f9ad0fa71 100644
--- a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-7.c
+++ b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-7.c
@@ -42,7 +42,7 @@ foo (int32_t *__restrict a, int32_t *__restrict b, int32_t 
*__restrict c,
 
 /* { dg-final { scan-assembler {e32,m1} } } */
 /* { dg-final { scan-assembler-not {csrr} { xfail "*-*-*" } } } */
-/* { dg-final { scan-tree-dump-times "Preferring smaller LMUL loop because it 
has unexpected spills" 3 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Preferring smaller LMUL loop because it 
has unexpected spills" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 8" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 4" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 2" 1 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-1.c 
b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-1.c
index 6637f3c3e3f..9eac4cc9221 100644
--- a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-1.c
+++ b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-1.c
@@ -45,7 +45,7 @@ foo (int32_t *__restrict a, int32_t *__restrict b,    int32_t 
*__restrict c,
 
 /* { dg-final { scan-assembler {e32,m2} } } */
 /* { dg-final { scan-assembler-not {csrr} } } */
-/* { dg-final { scan-tree-dump-times "Preferring smaller LMUL loop because it 
has unexpected spills" 2 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Preferring smaller LMUL loop because it 
has unexpected spills" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 8" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 4" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 2" 1 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-3.c 
b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-3.c
index 6637f3c3e3f..9eac4cc9221 100644
--- a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-3.c
+++ b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-3.c
@@ -45,7 +45,7 @@ foo (int32_t *__restrict a, int32_t *__restrict b,    int32_t 
*__restrict c,
 
 /* { dg-final { scan-assembler {e32,m2} } } */
 /* { dg-final { scan-assembler-not {csrr} } } */
-/* { dg-final { scan-tree-dump-times "Preferring smaller LMUL loop because it 
has unexpected spills" 2 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Preferring smaller LMUL loop because it 
has unexpected spills" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 8" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 4" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 2" 1 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-4.c 
b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-4.c
index a8e603f90f3..49cbbdb2420 100644
--- a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-4.c
+++ b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-4.c
@@ -43,7 +43,7 @@ foo (int32_t *__restrict a, int32_t *__restrict b, int32_t 
*__restrict c,
 
 /* { dg-final { scan-assembler {e32,m2} } } */
 /* { dg-final { scan-assembler-not {csrr} } } */
-/* { dg-final { scan-tree-dump-times "Preferring smaller LMUL loop because it 
has unexpected spills" 2 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Preferring smaller LMUL loop because it 
has unexpected spills" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 8" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 4" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 2" 1 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-5.c 
b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-5.c
index dcb20a302c8..75d3ecddc59 100644
--- a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-5.c
+++ b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-5.c
@@ -46,7 +46,7 @@ foo (int32_t *__restrict a, int32_t *__restrict b, int32_t 
*__restrict c,
 /* { dg-final { scan-assembler {e32,m2} } } */
 /* { dg-final { scan-assembler {e8,m8} } } */
 /* { dg-final { scan-assembler-not {csrr} } } */
-/* { dg-final { scan-tree-dump-times "Preferring smaller LMUL loop because it 
has unexpected spills" 2 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Preferring smaller LMUL loop because it 
has unexpected spills" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 8" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 4" 1 "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 2" 1 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-6.c 
b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-6.c
index f5d1a02736a..5bcffff7524 100644
--- a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-6.c
+++ b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-6.c
@@ -48,4 +48,4 @@ foo (int32_t *__restrict a, int32_t *__restrict b, int32_t 
*__restrict c,
 /* { dg-final { scan-assembler {e32,m2} } } */
 /* { dg-final { scan-assembler {e8,m8} } } */
 /* { dg-final { scan-assembler-not {csrr} } } */
-/* { dg-final { scan-tree-dump-times "Preferring smaller LMUL loop because it 
has unexpected spills" 2 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Preferring smaller LMUL loop because it 
has unexpected spills" 1 "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-6.c 
b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-6.c
index 365fdf2a749..ba2eacaccd2 100644
--- a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-6.c
+++ b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-6.c
@@ -20,8 +20,8 @@ foo (uint8_t *restrict a, uint8_t *restrict b, int n)
     }
 }
 
-/* { dg-final { scan-assembler {e8,m4} } } */
-/* { dg-final { scan-assembler-times {csrr} 1 } } */
+/* { dg-final { scan-assembler {e8,m1} } } */
+/* { dg-final { scan-assembler-times {csrr} 0 } } */
 /* Since we don't support VLA SLP for LMUL = 8, dynamic LMUL cost model start 
from LMUL = 4.  */
 /* { dg-final { scan-tree-dump-not "Preferring smaller LMUL loop because it 
has unexpected spills" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 8" "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-12.c 
b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-12.c
index c55546394de..0f75505f1de 100644
--- a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-12.c
+++ b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-12.c
@@ -17,8 +17,8 @@ foo (int *restrict a, int *restrict b, int n)
     }
 }
 
-/* { dg-final { scan-assembler {e32,m8} } } */
-/* { dg-final { scan-assembler-times {csrr} 1 } } */
+/* { dg-final { scan-assembler {e32,m1} } } */
+/* { dg-final { scan-assembler-times {csrr} 0 } } */
 /* { dg-final { scan-tree-dump-not "Preferring smaller LMUL loop because it 
has unexpected spills" "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 4" 1 "vect" { xfail *-*-* 
} } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 2" 1 "vect" { xfail *-*-* 
} } } */
diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/pr111848.c 
b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/pr111848.c
index 339c80f8805..2801ef49925 100644
--- a/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/pr111848.c
+++ b/gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/pr111848.c
@@ -28,7 +28,7 @@ f3 (uint8_t *restrict a, uint8_t *restrict b,
     }
 }
 
-/* { dg-final { scan-assembler {e8,m4} } } */
+/* { dg-final { scan-assembler {e8,m1} } } */
 /* { dg-final { scan-assembler-not {jr} } } */
 /* { dg-final { scan-assembler-times {ret} 1 } } */
 /* { dg-final { scan-tree-dump-not "Preferring smaller LMUL loop because it 
has unexpected spills" "vect" } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp-16.c 
b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp-16.c
index b31453852b2..bf1bed97551 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp-16.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/partial/slp-16.c
@@ -20,6 +20,6 @@ f (uint8_t *restrict a, uint8_t *restrict b, int n)
 }
 
 /* FIXME: Since we don't have VECT cost model yet, LOAD_LANES/STORE_LANES are 
chosen instead of SLP.  */
-/* { dg-final { scan-tree-dump-times "\.VEC_PERM" 1 "optimized" { xfail { 
any-opts "-mrvv-max-lmul=m1" "-mrvv-max-lmul=m2" "-mrvv-max-lmul=m4" 
"-mrvv-max-lmul=m8" } } } } */
-/* { dg-final { scan-assembler {\tvid\.v} { xfail { any-opts 
"-mrvv-max-lmul=m1" "-mrvv-max-lmul=m2" "-mrvv-max-lmul=m4" "-mrvv-max-lmul=m8" 
} } } } */
+/* { dg-final { scan-tree-dump-times "\.VEC_PERM" 1 "optimized" { xfail *-*-* 
} } } */
+/* { dg-final { scan-assembler {\tvid\.v} { xfail *-*-* } } } */
 /* { dg-final { scan-assembler-not {\tvmul} } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_zip.c 
b/gcc/testsuite/gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_zip.c
index 5988df689d0..2a632838d30 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_zip.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/sat/vec_sat_u_sub_zip.c
@@ -17,4 +17,4 @@ DEF_VEC_SAT_U_SUB_ZIP_WRAP(uint16_t, uint32_t)
 /* { dg-final { scan-assembler-times {vssubu\.vv} 1 { target { any-ops
      "-mrvv-vector-bits=zvl"
    } } } } */
-/* { dg-final { scan-assembler-times {vnclipu\.wi} 2 } } */
+/* { dg-final { scan-assembler {vnclipu\.wi} } } */
-- 
2.47.1

Reply via email to