RISC-V: Refactor Dynamic LMUL codes

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.
This commit is contained in:
Juzhe-Zhong 2023-12-12 18:54:11 +08:00 committed by Pan Li
parent 788e0d48ec
commit 26250632df
31 changed files with 88 additions and 109 deletions

View 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 (riscv_autovec_lmul == RVV_DYNAMIC)
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 (!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;

View 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

View 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" } } */

View 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" } } */

View 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" } } */

View 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" } } */

View 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" } } */

View 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" } } */

View 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" } } */

View 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" } } */

View 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" } } */

View 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" } } */

View 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" } } */

View 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" } } */

View 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" } } */

View 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" } } */

View 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" } } */

View 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" } } */

View 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" } } */

View 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" } } */

View 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" } } */

View 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" } } */

View 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" } } */

View 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" } } */

View 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" } } */

View 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" } } */

View 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" } } */

View 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" } } */

View 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" } } */

View 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" } } */

View 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" } } */