Richard Biener <richard.guent...@gmail.com> writes: >> +/* Create vector init for vectorized iv. */ >> +static tree >> +vect_create_nonlinear_iv_init (gimple_seq* stmts, tree init_expr, >> + tree step_expr, poly_uint64 nunits, >> + tree vectype, >> + enum vect_induction_op_type induction_type) >> +{ >> + unsigned HOST_WIDE_INT const_nunits; >> + tree vec_shift, vec_init, new_name; >> + unsigned i; >> + >> + /* iv_loop is the loop to be vectorized. Create: >> + vec_init = [X, X+S, X+2*S, X+3*S] (S = step_expr, X = init_expr). */ >> + new_name = init_expr; >> + switch (induction_type) >> + { >> + case vect_step_op_shr: >> + case vect_step_op_shl: >> + /* Build the Initial value from shift_expr. */ >> + vec_init = gimple_build_vector_from_val (stmts, >> + vectype, >> + new_name); >> + vec_shift = gimple_build (stmts, VEC_SERIES_EXPR, vectype, >> + build_zero_cst (TREE_TYPE (step_expr)), >> + step_expr); > > There might be a more canonical way to build the series expr - Richard?
build_vec_series is shorter if step_expr is known to be a constant. The above looks good for the general case. Thanks, Richard