--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O3 -fprofile-generate -mcpu=neoverse-v1" } */
+
+int
+foo() {
+ int flag = 1;
+ for (; flag <= 1 << 21; flag <<= 1)
+ ;
+ return 0;
+}
+
return true;
}
+/* Return true if vectorizer can peel for nonlinear iv. */
+static bool
+vect_can_peel_nonlinear_iv_p (loop_vec_info loop_vinfo,
+ enum vect_induction_op_type induction_type)
+{
+ tree niters_skip;
+ /* Init_expr will be update by vect_update_ivs_after_vectorizer,
+ if niters or vf is unkown:
+ For shift, when shift mount >= precision, there would be UD.
+ For mult, don't known how to generate
+ init_expr * pow (step, niters) for variable niters.
+ For neg, it should be ok, since niters of vectorized main loop
+ will always be multiple of 2. */
+ if ((!LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
+ || !LOOP_VINFO_VECT_FACTOR (loop_vinfo).is_constant ())
+ && induction_type != vect_step_op_neg)
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "Peeling for epilogue is not supported"
+ " for nonlinear induction except neg"
+ " when iteration count is unknown.\n");
+ return false;
+ }
+
+ /* Also doens't support peel for neg when niter is variable.
+ ??? generate something like niter_expr & 1 ? init_expr : -init_expr? */
+ niters_skip = LOOP_VINFO_MASK_SKIP_NITERS (loop_vinfo);
+ if ((niters_skip != NULL_TREE
+ && TREE_CODE (niters_skip) != INTEGER_CST)
+ || (!vect_use_loop_mask_for_alignment_p (loop_vinfo)
+ && LOOP_VINFO_PEELING_FOR_ALIGNMENT (loop_vinfo) < 0))
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "Peeling for alignement is not supported"
+ " for nonlinear induction when niters_skip"
+ " is not constant.\n");
+ return false;
+ }
+
+ return true;
+}
+
/* Function vect_can_advance_ivs_p
In case the number of iterations that LOOP iterates is unknown at compile
}
-/* Return true if vectorizer can peel for nonlinear iv. */
-bool
-vect_can_peel_nonlinear_iv_p (loop_vec_info loop_vinfo,
- enum vect_induction_op_type induction_type)
-{
- tree niters_skip;
- /* Init_expr will be update by vect_update_ivs_after_vectorizer,
- if niters is unkown:
- For shift, when shift mount >= precision, there would be UD.
- For mult, don't known how to generate
- init_expr * pow (step, niters) for variable niters.
- For neg, it should be ok, since niters of vectorized main loop
- will always be multiple of 2. */
- if (!LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
- && induction_type != vect_step_op_neg)
- {
- if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "Peeling for epilogue is not supported"
- " for nonlinear induction except neg"
- " when iteration count is unknown.\n");
- return false;
- }
-
- /* Also doens't support peel for neg when niter is variable.
- ??? generate something like niter_expr & 1 ? init_expr : -init_expr? */
- niters_skip = LOOP_VINFO_MASK_SKIP_NITERS (loop_vinfo);
- if ((niters_skip != NULL_TREE
- && TREE_CODE (niters_skip) != INTEGER_CST)
- || (!vect_use_loop_mask_for_alignment_p (loop_vinfo)
- && LOOP_VINFO_PEELING_FOR_ALIGNMENT (loop_vinfo) < 0))
- {
- if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "Peeling for alignement is not supported"
- " for nonlinear induction when niters_skip"
- " is not constant.\n");
- return false;
- }
-
- return true;
-}
-
/* Function vectorizable_induction
Check if STMT_INFO performs an nonlinear induction computation that can be
return false;
}
- if (!vect_can_peel_nonlinear_iv_p (loop_vinfo, induction_type))
- return false;
-
if (!INTEGRAL_TYPE_P (TREE_TYPE (vectype)))
{
if (dump_enabled_p ())
/* Nonlinear induction. */
extern tree vect_peel_nonlinear_iv_init (gimple_seq*, tree, tree,
tree, enum vect_induction_op_type);
-extern bool
-vect_can_peel_nonlinear_iv_p (loop_vec_info loop_vinfo,
- enum vect_induction_op_type induction_type);
/* In tree-vect-slp.cc. */
extern void vect_slp_init (void);