]> gcc.gnu.org Git - gcc.git/commitdiff
RISC-V: Refactor Dynamic LMUL codes
authorJuzhe-Zhong <juzhe.zhong@rivai.ai>
Tue, 12 Dec 2023 10:54:11 +0000 (18:54 +0800)
committerPan Li <pan2.li@intel.com>
Tue, 12 Dec 2023 23:18:41 +0000 (07:18 +0800)
This patch refactor dynamic LMUL to remove this following variable:
static hash_map<class loop *, autovec_info> loop_autovec_infos;

which will keep growing on-the-fly.

gcc/ChangeLog:

* config/riscv/riscv-vector-costs.cc (get_current_lmul): Remove it.
(compute_estimated_lmul): New function.
(costs::costs): Refactor.
(costs::preferred_new_lmul_p): Ditto.
(preferred_new_lmul_p): Ditto.
(costs::better_main_loop_than_p): Ditto.
* config/riscv/riscv-vector-costs.h (struct autovec_info): Remove it.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul-mixed-1.c: Adapt test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-3.c: Adapt test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-6.c: Adapt test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-1.c: Adapt test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-2.c: Adapt test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-3.c: Adapt test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-4.c: Adapt test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-5.c: Adapt test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-6.c: Adapt test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-1.c: Adapt test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-2.c: Adapt test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-3.c: Adapt test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-4.c: Adapt test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-5.c: Adapt test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-6.c: Adapt test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-7.c: Adapt test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-8.c: Adapt test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-9.c: Adapt test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-1.c: Adapt test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-10.c: Adapt test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-2.c: Adapt test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-3.c: Adapt test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-4.c: Adapt test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-5.c: Adapt test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-6.c: Adapt test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-7.c: Adapt test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-8.c: Adapt test.
* gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-9.c: Adapt test.
* gcc.dg/vect/costmodel/riscv/rvv/pr111848.c: Adapt test.

31 files changed:
gcc/config/riscv/riscv-vector-costs.cc
gcc/config/riscv/riscv-vector-costs.h
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul-mixed-1.c
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-3.c
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul1-6.c
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-1.c
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-2.c
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-3.c
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-4.c
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-5.c
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul2-6.c
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-1.c
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-2.c
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-3.c
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-4.c
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-5.c
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-6.c
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-7.c
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-8.c
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul4-9.c
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-1.c
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-10.c
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-2.c
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-3.c
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-4.c
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-5.c
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-6.c
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-7.c
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-8.c
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/dynamic-lmul8-9.c
gcc/testsuite/gcc.dg/vect/costmodel/riscv/rvv/pr111848.c

index c062c12a263373875b3977ccd9afc2f5c8fbb40d..3fcb5f3176f76d6b22e3caa3bbd1d83c385ed396 100644 (file)
@@ -86,7 +86,6 @@ namespace riscv_vector {
         2. M8 -> M1(M4) -> MF2(M2) -> MF4(M1) (stop analysis here) -> MF8(MF2)
         3. M1(M8) -> MF2(M4) -> MF4(M2) -> MF8(M1)
 */
-static hash_map<class loop *, autovec_info> loop_autovec_infos;
 
 /* Collect all STMTs that are vectorized and compute their program points.
    Note that we don't care about the STMTs that are not vectorized and
@@ -362,13 +361,6 @@ max_number_of_live_regs (const basic_block bb,
   return max_nregs;
 }
 
-/* Return the LMUL of the current analysis.  */
-static int
-get_current_lmul (class loop *loop)
-{
-  return loop_autovec_infos.get (loop)->current_lmul;
-}
-
 /* Get STORE value.  */
 static tree
 get_store_value (gimple *stmt)
@@ -394,6 +386,33 @@ non_contiguous_memory_access_p (stmt_vec_info stmt_info)
          && !adjacent_dr_p (STMT_VINFO_DATA_REF (stmt_info)));
 }
 
+/* Return the LMUL of the current analysis.  */
+static int
+compute_estimated_lmul (loop_vec_info other_loop_vinfo, machine_mode mode)
+{
+  gcc_assert (GET_MODE_BITSIZE (mode).is_constant ());
+  int regno_alignment
+    = riscv_get_v_regno_alignment (other_loop_vinfo->vector_mode);
+  if (known_eq (LOOP_VINFO_SLP_UNROLLING_FACTOR (other_loop_vinfo), 1U))
+    {
+      int estimated_vf = vect_vf_for_cost (other_loop_vinfo);
+      return estimated_vf * GET_MODE_BITSIZE (mode).to_constant ()
+            / TARGET_MIN_VLEN;
+    }
+  else if (regno_alignment > 1)
+    return regno_alignment;
+  else
+    {
+      int ratio;
+      if (can_div_trunc_p (BYTES_PER_RISCV_VECTOR,
+                          LOOP_VINFO_SLP_UNROLLING_FACTOR (other_loop_vinfo),
+                          &ratio))
+       return TARGET_MAX_LMUL / ratio;
+      else
+       gcc_unreachable ();
+    }
+}
+
 /* Update the live ranges according PHI.
 
    Loop:
@@ -520,65 +539,25 @@ update_local_live_ranges (
     }
 }
 
-costs::costs (vec_info *vinfo, bool costing_for_scalar)
-  : vector_costs (vinfo, costing_for_scalar)
-{}
-
 /* Return true that the LMUL of new COST model is preferred.  */
-bool
-costs::preferred_new_lmul_p (const vector_costs *uncast_other) const
+static bool
+preferred_new_lmul_p (loop_vec_info other_loop_vinfo)
 {
-  auto other = static_cast<const costs *> (uncast_other);
-  auto this_loop_vinfo = as_a<loop_vec_info> (this->m_vinfo);
-  auto other_loop_vinfo = as_a<loop_vec_info> (other->m_vinfo);
-  class loop *loop = LOOP_VINFO_LOOP (this_loop_vinfo);
-
-  if (loop_autovec_infos.get (loop) && loop_autovec_infos.get (loop)->end_p)
-    return false;
-  else if (loop_autovec_infos.get (loop))
-    loop_autovec_infos.get (loop)->current_lmul
-      = loop_autovec_infos.get (loop)->current_lmul / 2;
-  else
-    {
-      int regno_alignment
-       = riscv_get_v_regno_alignment (other_loop_vinfo->vector_mode);
-      if (known_eq (LOOP_VINFO_SLP_UNROLLING_FACTOR (other_loop_vinfo), 1U))
-       regno_alignment = RVV_M8;
-      loop_autovec_infos.put (loop, {regno_alignment, regno_alignment, false});
-    }
-
-  int lmul = get_current_lmul (loop);
-  if (dump_enabled_p ())
-    dump_printf_loc (MSG_NOTE, vect_location,
-                    "Comparing two main loops (%s at VF %d vs %s at VF %d)\n",
-                    GET_MODE_NAME (this_loop_vinfo->vector_mode),
-                    vect_vf_for_cost (this_loop_vinfo),
-                    GET_MODE_NAME (other_loop_vinfo->vector_mode),
-                    vect_vf_for_cost (other_loop_vinfo));
-
   /* Compute local program points.
      It's a fast and effective computation.  */
   hash_map<basic_block, vec<stmt_point>> program_points_per_bb;
-  compute_local_program_points (other->m_vinfo, program_points_per_bb);
+  compute_local_program_points (other_loop_vinfo, program_points_per_bb);
 
   /* Compute local live ranges.  */
   hash_map<basic_block, hash_map<tree, pair>> live_ranges_per_bb;
   machine_mode biggest_mode
     = compute_local_live_ranges (program_points_per_bb, live_ranges_per_bb);
 
-  /* If we can use simple VLS modes to handle NITERS element.
-     We don't need to use VLA modes with partial vector auto-vectorization.  */
-  if (LOOP_VINFO_NITERS_KNOWN_P (this_loop_vinfo)
-      && known_le (tree_to_poly_int64 (LOOP_VINFO_NITERS (this_loop_vinfo))
-                    * GET_MODE_SIZE (biggest_mode).to_constant (),
-                  (int) RVV_M8 * BYTES_PER_RISCV_VECTOR)
-      && pow2p_hwi (LOOP_VINFO_INT_NITERS (this_loop_vinfo)))
-    return vector_costs::better_main_loop_than_p (other);
-
   /* Update live ranges according to PHI.  */
-  update_local_live_ranges (other->m_vinfo, program_points_per_bb,
+  update_local_live_ranges (other_loop_vinfo, program_points_per_bb,
                            live_ranges_per_bb, &biggest_mode);
 
+  int lmul = compute_estimated_lmul (other_loop_vinfo, biggest_mode);
   /* TODO: We calculate the maximum live vars base on current STMTS
      sequence.  We can support live range shrink if it can give us
      big improvement in the future.  */
@@ -603,12 +582,7 @@ costs::preferred_new_lmul_p (const vector_costs *uncast_other) const
          live_ranges_per_bb.empty ();
        }
       live_ranges_per_bb.empty ();
-      if (loop_autovec_infos.get (loop)->current_lmul == RVV_M1
-         || max_nregs <= V_REG_NUM)
-       loop_autovec_infos.get (loop)->end_p = true;
-      if (loop_autovec_infos.get (loop)->current_lmul > RVV_M1)
-       return max_nregs > V_REG_NUM;
-      return false;
+      return max_nregs > V_REG_NUM;
     }
   if (!program_points_per_bb.is_empty ())
     {
@@ -625,17 +599,34 @@ costs::preferred_new_lmul_p (const vector_costs *uncast_other) const
   return lmul > RVV_M1;
 }
 
+costs::costs (vec_info *vinfo, bool costing_for_scalar)
+  : vector_costs (vinfo, costing_for_scalar)
+{}
+
 bool
 costs::better_main_loop_than_p (const vector_costs *uncast_other) const
 {
   auto other = static_cast<const costs *> (uncast_other);
+  auto this_loop_vinfo = as_a<loop_vec_info> (this->m_vinfo);
+  auto other_loop_vinfo = as_a<loop_vec_info> (other->m_vinfo);
+
+  if (dump_enabled_p ())
+    dump_printf_loc (MSG_NOTE, vect_location,
+                    "Comparing two main loops (%s at VF %d vs %s at VF %d)\n",
+                    GET_MODE_NAME (this_loop_vinfo->vector_mode),
+                    vect_vf_for_cost (this_loop_vinfo),
+                    GET_MODE_NAME (other_loop_vinfo->vector_mode),
+                    vect_vf_for_cost (other_loop_vinfo));
 
-  if (riscv_autovec_lmul == RVV_DYNAMIC)
+  if (!LOOP_VINFO_NITERS_KNOWN_P (this_loop_vinfo)
+      && riscv_autovec_lmul == RVV_DYNAMIC)
     {
+      if (!riscv_v_ext_vector_mode_p (this_loop_vinfo->vector_mode))
+       return false;
       bool post_dom_available_p = dom_info_available_p (CDI_POST_DOMINATORS);
       if (!post_dom_available_p)
        calculate_dominance_info (CDI_POST_DOMINATORS);
-      bool preferred_p = preferred_new_lmul_p (uncast_other);
+      bool preferred_p = preferred_new_lmul_p (other_loop_vinfo);
       if (!post_dom_available_p)
        free_dominance_info (CDI_POST_DOMINATORS);
       return preferred_p;
index 7b5814a4cffe79bd300a333f44c3e2cd0c3595d0..e18775e230b11cb2a9e976c546af155cf24a7c13 100644 (file)
@@ -33,13 +33,6 @@ struct stmt_point
 /* Pair typedef used by live range: <start, end>.  */
 typedef std::pair<unsigned int, unsigned int> pair;
 
-struct autovec_info
-{
-  unsigned int initial_lmul;
-  unsigned int current_lmul;
-  bool end_p;
-};
-
 /* rvv-specific vector costs.  */
 class costs : public vector_costs
 {
@@ -56,8 +49,6 @@ private:
                              tree vectype, int misalign,
                              vect_cost_model_location where) override;
   void finish_cost (const vector_costs *) override;
-
-  bool preferred_new_lmul_p (const vector_costs *) const;
 };
 
 } // namespace riscv_vector
index 5f18262f1f2608def726180780095b9358a200d8..9e2c65110e825598aeaf6c385adaa02719db4613 100644 (file)
@@ -44,7 +44,7 @@ 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 "Maximum lmul = 8" 2 "vect" } } */
+/* { dg-final { scan-tree-dump "Maximum lmul = 8" "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 4" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Maximum lmul = 2" 1 "vect" } } */
+/* { dg-final { scan-tree-dump "Maximum lmul = 2" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 1" "vect" } } */
index d0481dc57ecb10ad7420a687180003fa499f6210..e2511da135e13ff250026732c7be6840092e26ed 100644 (file)
@@ -88,4 +88,4 @@ foo (int8_t *__restrict a, int8_t *__restrict b,    int8_t *__restrict c,
 /* { 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" } } */
-/* { dg-final { scan-tree-dump-times "Maximum lmul = 1" 1 "vect" } } */
+/* { dg-final { scan-tree-dump "Maximum lmul = 1" "vect" } } */
index e6ccd0e2063c40beeab138c9b614e939bb84377a..f6be585b9274478d48450582b6f052992dabee1e 100644 (file)
@@ -147,4 +147,4 @@ foo (int8_t *__restrict a, int8_t *__restrict b,    int8_t *__restrict c,
 /* { 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" } } */
-/* { dg-final { scan-tree-dump-times "Maximum lmul = 1" 1 "vect" } } */
+/* { dg-final { scan-tree-dump "Maximum lmul = 1" "vect" } } */
index 8df0e0a48d7ec73e6bf5e47989c819dc2840c05f..81cb6954d4934af8132fb1eba7f328acf94461a4 100644 (file)
@@ -47,5 +47,5 @@ foo (int32_t *__restrict a, int32_t *__restrict b,    int32_t *__restrict c,
 /* { dg-final { scan-assembler-not {csrr} } } */
 /* { 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" } } */
+/* { dg-final { scan-tree-dump "Maximum lmul = 2" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 1" "vect" } } */
index 8f2423700cd95adee52aadf1ec98e2ab91e23cc4..a0e2311c2e0d22381f2768a31c1769d4ff344556 100644 (file)
@@ -47,5 +47,5 @@ foo (int8_t *__restrict a, int8_t *__restrict b,    int8_t *__restrict c,
 /* { dg-final { scan-assembler-not {csrr} } } */
 /* { 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" } } */
+/* { dg-final { scan-tree-dump "Maximum lmul = 2" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 1" "vect" } } */
index 8df0e0a48d7ec73e6bf5e47989c819dc2840c05f..81cb6954d4934af8132fb1eba7f328acf94461a4 100644 (file)
@@ -47,5 +47,5 @@ foo (int32_t *__restrict a, int32_t *__restrict b,    int32_t *__restrict c,
 /* { dg-final { scan-assembler-not {csrr} } } */
 /* { 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" } } */
+/* { dg-final { scan-tree-dump "Maximum lmul = 2" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 1" "vect" } } */
index b3498ad8210776f5e1e5dbcdf3d294396ecba37c..5169dcba846163becd2a4efd37bb38066b1b7252 100644 (file)
@@ -45,5 +45,5 @@ foo (int32_t *__restrict a, int32_t *__restrict b, int32_t *__restrict c,
 /* { dg-final { scan-assembler-not {csrr} } } */
 /* { 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" } } */
+/* { dg-final { scan-tree-dump "Maximum lmul = 2" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 1" "vect" } } */
index a238050f28f2dba6904ee80ca738d4d1250cf531..2bc4c6831fc4c9dffd8143f296aa91c7f106b814 100644 (file)
@@ -48,5 +48,5 @@ foo (int32_t *__restrict a, int32_t *__restrict b, int32_t *__restrict c,
 /* { dg-final { scan-assembler-not {csrr} } } */
 /* { 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" } } */
+/* { dg-final { scan-tree-dump "Maximum lmul = 2" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 1" "vect" } } */
index a155c080047ea9d18b212025bafd77e01bf74d8d..c667ab78a3c5bb9e39f3167e1f9d8dc22c3f4b40 100644 (file)
@@ -48,7 +48,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 "Maximum lmul = 8" 2 "vect" } } */
+/* { dg-final { scan-tree-dump "Maximum lmul = 8" "vect" } } */
 /* { dg-final { scan-tree-dump-times "Maximum lmul = 4" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Maximum lmul = 2" 1 "vect" } } */
+/* { dg-final { scan-tree-dump "Maximum lmul = 2" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 1" "vect" } } */
index 97eb88f9447df18b39ef61ae46270f4833acd07b..28fc49a2252a531a4cdfe1c1b8c03dbb82325f39 100644 (file)
@@ -30,6 +30,6 @@ foo (int32_t *__restrict a, int32_t *__restrict b, int32_t *__restrict c,
 /* { dg-final { scan-assembler {e32,m4} } } */
 /* { dg-final { scan-assembler-not {csrr} } } */
 /* { 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 "Maximum lmul = 4" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 2" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 1" "vect" } } */
index a9edfb0d9803d724fb7661ce7756292a341e22ce..4b6bd85b4a8e114653bd2f9b1bf56ad410ec6ca7 100644 (file)
@@ -30,6 +30,6 @@ foo (int8_t *__restrict a, int8_t *__restrict b, int8_t *__restrict c,
 /* { dg-final { scan-assembler {e8,m4} } } */
 /* { dg-final { scan-assembler-not {csrr} } } */
 /* { 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 "Maximum lmul = 4" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 2" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 1" "vect" } } */
index c064bfaeb5018fdf170ebaf8b29a2af9147d54e0..c61c53be80342513b91f08978e5d752a9ac93b77 100644 (file)
@@ -42,6 +42,6 @@ void foo2 (int64_t *__restrict a,
 /* { dg-final { scan-assembler {e64,m4} } } */
 /* { dg-final { scan-assembler-not {csrr} } } */
 /* { 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 "Maximum lmul = 4" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 2" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 1" "vect" } } */
index 4a90e5ef78796025a33d168b11b31d9b78900cd9..01a359bc7c8bc1376840c931712e643d35146120 100644 (file)
@@ -42,6 +42,6 @@ void foo2 (int64_t *__restrict a,
 /* { dg-final { scan-assembler {e64,m4} } } */
 /* { dg-final { scan-assembler-not {csrr} } } */
 /* { 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 "Maximum lmul = 4" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 2" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 1" "vect" } } */
index 1a361ed4226f0f954cdd91727c7d14fe747b0ddc..1df1cca5e43ecac71f8340e4c571d3a10fcf9229 100644 (file)
@@ -42,6 +42,6 @@ void foo2 (int16_t *__restrict a,
 /* { dg-final { scan-assembler {e16,m2} } } */
 /* { dg-final { scan-assembler-not {csrr} } } */
 /* { 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 "Maximum lmul = 4" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 2" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 1" "vect" } } */
index c7b886359239e2afb287ea0d72a6fb0e525cf3f8..0abbdb614931f4d99dc4d48084319893f9fbb39b 100644 (file)
@@ -22,6 +22,6 @@ 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-tree-dump-not "Maximum lmul = 8" "vect" } } */
-/* { dg-final { scan-tree-dump-times "Maximum lmul = 4" 1 "vect" } } */
+/* { dg-final { scan-tree-dump "Maximum lmul = 4" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 2" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 1" "vect" } } */
index 800b4e4e03c346409e4189e37f293d688e2874ab..e4769df316a548e0581673d4f44bdb0d94c01417 100644 (file)
@@ -42,6 +42,6 @@ void foo2 (int8_t *__restrict a,
 /* { dg-final { scan-assembler {e64,m4} } } */
 /* { dg-final { scan-assembler-not {csrr} } } */
 /* { 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 "Maximum lmul = 4" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 2" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 1" "vect" } } */
index 4d9175e86f8f31f0554258e8817f90b8578b4f88..6d2a56474285ed892fe9895404409b34f4f7a1ae 100644 (file)
@@ -31,6 +31,6 @@ 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-tree-dump-not "Maximum lmul = 8" "vect" } } */
-/* { dg-final { scan-tree-dump-times "Maximum lmul = 4" 1 "vect" } } */
+/* { dg-final { scan-tree-dump "Maximum lmul = 4" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 2" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 1" "vect" } } */
index d05cd158f22bf6c392bba8168936769592f703ff..7fda83ab978063e2d8a3226da9df716df0b0fe61 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-march=rv32gcv -mabi=ilp32 -O3 -ftree-vectorize --param riscv-autovec-lmul=dynamic -fselective-scheduling -fdump-tree-vect-details" } */
+/* { dg-options "-march=rv64gcv -mabi=lp64d -O3 -ftree-vectorize --param riscv-autovec-lmul=dynamic -fselective-scheduling -fdump-tree-vect-details" } */
 
 #include <stdint-gcc.h>
 
@@ -8,23 +8,19 @@
 int a[N];
 
 __attribute__ ((noinline)) int
-foo (){
+foo (int n){
   int i,j;
   int sum,x;
 
-  for (i = 0; i < N; i++) {
+  for (i = 0; i < n; i++) {
     sum = 0;
-    for (j = 0; j < N; j++) {
+    for (j = 0; j < n; j++) {
       sum += (i + j);
     }
     a[i] = sum;
   }
+  return 0;
 }
 
-/* { dg-final { scan-assembler {e32,m4} } } */
 /* { dg-final { scan-assembler-not {jr} } } */
 /* { dg-final { scan-assembler-times {ret} 1 } } */
-/* { 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-not "Maximum lmul = 2" "vect" } } */
-/* { dg-final { scan-tree-dump-not "Maximum lmul = 1" "vect" } } */
index e8afc77e4522fc9d64c5c4bd76fffa5574330bb6..31ee58a4b138bc5a4f6e72e77c102699d1a519e2 100644 (file)
@@ -12,7 +12,7 @@ foo (int32_t *__restrict a, int32_t *__restrict b, int n)
 
 /* { dg-final { scan-assembler {e32,m8} } } */
 /* { dg-final { scan-assembler-not {csrr} } } */
-/* { dg-final { scan-tree-dump-times "Maximum lmul = 8" 1 "vect" } } */
+/* { dg-final { scan-tree-dump "Maximum lmul = 8" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 4" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 2" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 1" "vect" } } */
index cb4540e42188e4cefd814fe8fa0906e55fa64b1c..d767d2726a6875949e7ff1d11309025ebe711c70 100644 (file)
@@ -16,7 +16,7 @@ foo (int *x, int n, int res)
 
 /* { dg-final { scan-assembler {e32,m8} } } */
 /* { dg-final { scan-assembler-times {csrr} 1 } } */
-/* { dg-final { scan-tree-dump-times "Maximum lmul = 8" 1 "vect" } } */
+/* { dg-final { scan-tree-dump "Maximum lmul = 8" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 4" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 2" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 1" "vect" } } */
index d6348247dbf9ac7af0a6cafe0c275a0f8f1b2266..4fa6d2f5b282847faf78d3bdaa32f28e04a3a009 100644 (file)
@@ -12,7 +12,7 @@ foo (int32_t *__restrict a, int16_t *__restrict b, int n)
 
 /* { dg-final { scan-assembler {e16,m4} } } */
 /* { dg-final { scan-assembler-not {csrr} } } */
-/* { dg-final { scan-tree-dump-times "Maximum lmul = 8" 1 "vect" } } */
+/* { dg-final { scan-tree-dump "Maximum lmul = 8" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 4" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 2" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 1" "vect" } } */
index edf5dabc37dc4fa8cab303a9941c96f9bdf8b82f..c9f4fbca0d832cda9b732c97d381c96db0e60872 100644 (file)
@@ -12,7 +12,7 @@ foo (int8_t *__restrict a, int8_t *__restrict b, int n)
 
 /* { dg-final { scan-assembler {e8,m8} } } */
 /* { dg-final { scan-assembler-not {csrr} } } */
-/* { dg-final { scan-tree-dump-times "Maximum lmul = 8" 1 "vect" } } */
+/* { dg-final { scan-tree-dump "Maximum lmul = 8" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 4" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 2" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 1" "vect" } } */
index 99191ddeb75cd9e19ad332367ea72b864eda072c..e6d1b167041840312c3ad89fd65c20f04822b580 100644 (file)
@@ -13,7 +13,7 @@ foo (size_t *__restrict a, size_t *__restrict b, int n)
 
 /* { dg-final { scan-assembler {e64,m8} } } */
 /* { dg-final { scan-assembler-not {csrr} } } */
-/* { dg-final { scan-tree-dump-times "Maximum lmul = 8" 1 "vect" } } */
+/* { dg-final { scan-tree-dump "Maximum lmul = 8" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 4" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 2" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 1" "vect" } } */
index 0abface480ff6f746525601bd41cbee0d80b22a6..3276585bacd265e917f759d144cec2229f94e707 100644 (file)
@@ -19,7 +19,7 @@ foo (int8_t *__restrict a, int8_t *__restrict b, int n)
 
 /* { dg-final { scan-assembler {e8,m8} } } */
 /* { dg-final { scan-assembler-not {csrr} } } */
-/* { dg-final { scan-tree-dump-times "Maximum lmul = 8" 1 "vect" } } */
+/* { dg-final { scan-tree-dump "Maximum lmul = 8" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 4" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 2" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 1" "vect" } } */
index e7caabdc84304e5c9983c8513e0513187947a772..918b47f301a821ded6589220048335456c5c73b9 100644 (file)
@@ -17,7 +17,7 @@ foo (int8_t *__restrict a, int8_t *__restrict b, int8_t *__restrict a2,
 
 /* { dg-final { scan-assembler {e8,m8} } } */
 /* { dg-final { scan-assembler-not {csrr} } } */
-/* { dg-final { scan-tree-dump-times "Maximum lmul = 8" 1 "vect" } } */
+/* { dg-final { scan-tree-dump "Maximum lmul = 8" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 4" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 2" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 1" "vect" } } */
index 2be7a955f87120073531c8293b531671e93b1c37..b0fb62aebb06cd4f4911be92cdfc24fad8afa31a 100644 (file)
@@ -17,7 +17,7 @@ foo (int32_t *__restrict a, int32_t *__restrict b, int32_t *__restrict a2,
 
 /* { dg-final { scan-assembler {e32,m8} } } */
 /* { dg-final { scan-assembler-not {csrr} } } */
-/* { dg-final { scan-tree-dump-times "Maximum lmul = 8" 1 "vect" } } */
+/* { dg-final { scan-tree-dump "Maximum lmul = 8" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 4" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 2" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 1" "vect" } } */
index 1d94f341668fc3243b9d1f34b7da3332f51cbbd6..d64c30ae11456fbdbbd1e23e2dfd9c6d6796f0ac 100644 (file)
@@ -13,7 +13,7 @@ foo (int8_t *__restrict a, int8_t init, int n)
 
 /* { dg-final { scan-assembler {e8,m8} } } */
 /* { dg-final { scan-assembler-not {csrr} } } */
-/* { dg-final { scan-tree-dump-times "Maximum lmul = 8" 1 "vect" } } */
+/* { dg-final { scan-tree-dump "Maximum lmul = 8" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 4" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 2" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 1" "vect" } } */
index 2d2e64bfc949662fadaedfc66138bcd055bd57cc..2cf7de44e44be422aacfe04d88cc4f5931dd3871 100644 (file)
@@ -13,7 +13,7 @@ foo (int64_t *__restrict a, int64_t init, int n)
 
 /* { dg-final { scan-assembler {e64,m8} } } */
 /* { dg-final { scan-assembler-not {csrr} } } */
-/* { dg-final { scan-tree-dump-times "Maximum lmul = 8" 1 "vect" } } */
+/* { dg-final { scan-tree-dump "Maximum lmul = 8" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 4" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 2" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 1" "vect" } } */
index 31cac047d2c1ba4568a81741b16bda8a68933e62..533f6d6dec9615f343110e623902d425f8e16a76 100644 (file)
@@ -31,6 +31,7 @@ f3 (uint8_t *restrict a, uint8_t *restrict b,
 /* { dg-final { scan-assembler {e8,m4} } } */
 /* { dg-final { scan-assembler-not {jr} } } */
 /* { dg-final { scan-assembler-times {ret} 1 } } */
-/* { dg-final { scan-tree-dump-times "Maximum lmul = 4" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-not "Maximum lmul = 8" "vect" } } */
+/* { dg-final { scan-tree-dump "Maximum lmul = 4" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 2" "vect" } } */
 /* { dg-final { scan-tree-dump-not "Maximum lmul = 1" "vect" } } */
This page took 0.107699 seconds and 5 git commands to generate.