is nonnull. */
static bool
-vect_supportable_direct_optab_p (vec_info *, tree otype, tree_code code,
+vect_supportable_direct_optab_p (vec_info *vinfo, tree otype, tree_code code,
tree itype, tree *vecotype_out,
tree *vecitype_out = NULL)
{
- tree vecitype = get_vectype_for_scalar_type (itype);
+ tree vecitype = get_vectype_for_scalar_type (vinfo, itype);
if (!vecitype)
return false;
- tree vecotype = get_vectype_for_scalar_type (otype);
+ tree vecotype = get_vectype_for_scalar_type (vinfo, otype);
if (!vecotype)
return false;
vect_split_statement (stmt_vec_info stmt2_info, tree new_rhs,
gimple *stmt1, tree vectype)
{
+ vec_info *vinfo = stmt2_info->vinfo;
if (is_pattern_stmt_p (stmt2_info))
{
/* STMT2_INFO is part of a pattern. Get the statement to which
two-statement pattern now. */
gcc_assert (!STMT_VINFO_RELATED_STMT (stmt2_info));
tree lhs_type = TREE_TYPE (gimple_get_lhs (stmt2_info->stmt));
- tree lhs_vectype = get_vectype_for_scalar_type (lhs_type);
+ tree lhs_vectype = get_vectype_for_scalar_type (vinfo, lhs_type);
if (!lhs_vectype)
return false;
vect_convert_input (stmt_vec_info stmt_info, tree type,
vect_unpromoted_value *unprom, tree vectype)
{
+ vec_info *vinfo = stmt_info->vinfo;
+
/* Check for a no-op conversion. */
if (types_compatible_p (type, TREE_TYPE (unprom->op)))
return unprom->op;
unsigned promotion. */
tree midtype = build_nonstandard_integer_type
(TYPE_PRECISION (type), TYPE_UNSIGNED (unprom->type));
- tree vec_midtype = get_vectype_for_scalar_type (midtype);
+ tree vec_midtype = get_vectype_for_scalar_type (vinfo, midtype);
if (vec_midtype)
{
input = vect_recog_temp_ssa_var (midtype, NULL);
tree_code orig_code, tree_code wide_code,
bool shift_p, const char *name)
{
+ vec_info *vinfo = last_stmt_info->vinfo;
gimple *last_stmt = last_stmt_info->stmt;
vect_unpromoted_value unprom[2];
TYPE_UNSIGNED (half_type));
/* Check target support */
- tree vectype = get_vectype_for_scalar_type (half_type);
- tree vecitype = get_vectype_for_scalar_type (itype);
+ tree vectype = get_vectype_for_scalar_type (vinfo, half_type);
+ tree vecitype = get_vectype_for_scalar_type (vinfo, itype);
enum tree_code dummy_code;
int dummy_int;
auto_vec<tree> dummy_vec;
&dummy_int, &dummy_vec))
return NULL;
- *type_out = get_vectype_for_scalar_type (type);
+ *type_out = get_vectype_for_scalar_type (vinfo, type);
if (!*type_out)
return NULL;
if (node->simd_clones == NULL)
return NULL;
}
- *type_out = get_vectype_for_scalar_type (TREE_TYPE (base));
+ *type_out = get_vectype_for_scalar_type (vinfo, TREE_TYPE (base));
if (!*type_out)
return NULL;
tree def = vect_recog_temp_ssa_var (TREE_TYPE (base), NULL);
if (TREE_CODE (exp) == REAL_CST
&& real_equal (&TREE_REAL_CST (exp), &dconsthalf))
{
- *type_out = get_vectype_for_scalar_type (TREE_TYPE (base));
+ *type_out = get_vectype_for_scalar_type (vinfo, TREE_TYPE (base));
if (*type_out
&& direct_internal_fn_supported_p (IFN_SQRT, *type_out,
OPTIMIZE_FOR_SPEED))
vect_pattern_detected ("vect_recog_over_widening_pattern", last_stmt);
- *type_out = get_vectype_for_scalar_type (type);
+ *type_out = get_vectype_for_scalar_type (vinfo, type);
if (!*type_out)
return NULL;
wants to rewrite anyway. If targets have a minimum element size
for some optabs, we should pattern-match smaller ops to larger ops
where beneficial. */
- tree new_vectype = get_vectype_for_scalar_type (new_type);
- tree op_vectype = get_vectype_for_scalar_type (op_type);
+ tree new_vectype = get_vectype_for_scalar_type (vinfo, new_type);
+ tree op_vectype = get_vectype_for_scalar_type (vinfo, op_type);
if (!new_vectype || !op_vectype)
return NULL;
(target_precision, TYPE_UNSIGNED (new_type));
/* Check for target support. */
- tree new_vectype = get_vectype_for_scalar_type (new_type);
+ tree new_vectype = get_vectype_for_scalar_type (vinfo, new_type);
if (!new_vectype
|| !direct_internal_fn_supported_p
(ifn, new_vectype, OPTIMIZE_FOR_SPEED))
/* The IR requires a valid vector type for the cast result, even though
it's likely to be discarded. */
- *type_out = get_vectype_for_scalar_type (lhs_type);
+ *type_out = get_vectype_for_scalar_type (vinfo, lhs_type);
if (!*type_out)
return NULL;
TYPE_UNSIGNED (new_type));
/* Check for target support. */
- tree new_vectype = get_vectype_for_scalar_type (new_type);
+ tree new_vectype = get_vectype_for_scalar_type (vinfo, new_type);
if (!new_vectype
|| !direct_internal_fn_supported_p (ifn, new_vectype,
OPTIMIZE_FOR_SPEED))
/* The IR requires a valid vector type for the cast result, even though
it's likely to be discarded. */
- *type_out = get_vectype_for_scalar_type (type);
+ *type_out = get_vectype_for_scalar_type (vinfo, type);
if (!*type_out)
return NULL;
the unnecessary widening and narrowing. */
vect_pattern_detected ("vect_recog_cast_forwprop_pattern", last_stmt);
- *type_out = get_vectype_for_scalar_type (lhs_type);
+ *type_out = get_vectype_for_scalar_type (vinfo, lhs_type);
if (!*type_out)
return NULL;
}
type = TREE_TYPE (lhs);
- vectype = get_vectype_for_scalar_type (type);
+ vectype = get_vectype_for_scalar_type (vinfo, type);
if (vectype == NULL_TREE)
return NULL;
&& dt != vect_external_def)
return NULL;
- vectype = get_vectype_for_scalar_type (type);
+ vectype = get_vectype_for_scalar_type (vinfo, type);
if (vectype == NULL_TREE)
return NULL;
}
else
{
- tree vecstype = get_vectype_for_scalar_type (stype);
+ tree vecstype = get_vectype_for_scalar_type (vinfo, stype);
if (vecstype == NULL_TREE)
return NULL;
if (!def_vinfo)
return NULL;
- *type_out = get_vectype_for_scalar_type (TREE_TYPE (oprnd0));
+ *type_out = get_vectype_for_scalar_type (vinfo, TREE_TYPE (oprnd0));
if (*type_out == NULL_TREE)
return NULL;
TYPE_PRECISION (TREE_TYPE (oprnd1)));
def = vect_recog_temp_ssa_var (TREE_TYPE (rhs1), NULL);
def_stmt = gimple_build_assign (def, BIT_AND_EXPR, rhs1, mask);
- tree vecstype = get_vectype_for_scalar_type (TREE_TYPE (rhs1));
+ tree vecstype = get_vectype_for_scalar_type (vinfo,
+ TREE_TYPE (rhs1));
append_pattern_def_seq (stmt_vinfo, def_stmt, vecstype);
}
}
if (!possible)
return NULL;
- tree vectype = get_vectype_for_scalar_type (multtype);
+ tree vectype = get_vectype_for_scalar_type (vinfo, multtype);
if (!vectype
|| !target_supports_mult_synth_alg (&alg, variant,
static gimple *
vect_recog_mult_pattern (stmt_vec_info stmt_vinfo, tree *type_out)
{
+ vec_info *vinfo = stmt_vinfo->vinfo;
gimple *last_stmt = stmt_vinfo->stmt;
tree oprnd0, oprnd1, vectype, itype;
gimple *pattern_stmt;
|| !type_has_mode_precision_p (itype))
return NULL;
- vectype = get_vectype_for_scalar_type (itype);
+ vectype = get_vectype_for_scalar_type (vinfo, itype);
if (vectype == NULL_TREE)
return NULL;
static gimple *
vect_recog_divmod_pattern (stmt_vec_info stmt_vinfo, tree *type_out)
{
+ vec_info *vinfo = stmt_vinfo->vinfo;
gimple *last_stmt = stmt_vinfo->stmt;
tree oprnd0, oprnd1, vectype, itype, cond;
gimple *pattern_stmt, *def_stmt;
return NULL;
scalar_int_mode itype_mode = SCALAR_INT_TYPE_MODE (itype);
- vectype = get_vectype_for_scalar_type (itype);
+ vectype = get_vectype_for_scalar_type (vinfo, itype);
if (vectype == NULL_TREE)
return NULL;
{
tree utype
= build_nonstandard_integer_type (prec, 1);
- tree vecutype = get_vectype_for_scalar_type (utype);
+ tree vecutype = get_vectype_for_scalar_type (vinfo, utype);
tree shift
= build_int_cst (utype, GET_MODE_BITSIZE (itype_mode)
- tree_log2 (oprnd1));
static gimple *
vect_recog_mixed_size_cond_pattern (stmt_vec_info stmt_vinfo, tree *type_out)
{
+ vec_info *vinfo = stmt_vinfo->vinfo;
gimple *last_stmt = stmt_vinfo->stmt;
tree cond_expr, then_clause, else_clause;
tree type, vectype, comp_vectype, itype = NULL_TREE, vecitype;
return NULL;
comp_scalar_type = TREE_TYPE (TREE_OPERAND (cond_expr, 0));
- comp_vectype = get_vectype_for_scalar_type (comp_scalar_type);
+ comp_vectype = get_vectype_for_scalar_type (vinfo, comp_scalar_type);
if (comp_vectype == NULL_TREE)
return NULL;
if (GET_MODE_BITSIZE (type_mode) == cmp_mode_size)
return NULL;
- vectype = get_vectype_for_scalar_type (type);
+ vectype = get_vectype_for_scalar_type (vinfo, type);
if (vectype == NULL_TREE)
return NULL;
|| GET_MODE_BITSIZE (SCALAR_TYPE_MODE (itype)) != cmp_mode_size)
return NULL;
- vecitype = get_vectype_for_scalar_type (itype);
+ vecitype = get_vectype_for_scalar_type (vinfo, itype);
if (vecitype == NULL_TREE)
return NULL;
if (stmt_could_throw_p (cfun, def_stmt))
return false;
- comp_vectype = get_vectype_for_scalar_type (TREE_TYPE (rhs1));
+ comp_vectype = get_vectype_for_scalar_type (vinfo, TREE_TYPE (rhs1));
if (comp_vectype == NULL_TREE)
return false;
scalar_mode mode = SCALAR_TYPE_MODE (TREE_TYPE (rhs1));
tree itype
= build_nonstandard_integer_type (GET_MODE_BITSIZE (mode), 1);
- vecitype = get_vectype_for_scalar_type (itype);
+ vecitype = get_vectype_for_scalar_type (vinfo, itype);
if (vecitype == NULL_TREE)
return false;
}
static tree
adjust_bool_pattern_cast (tree type, tree var, stmt_vec_info stmt_info)
{
+ vec_info *vinfo = stmt_info->vinfo;
gimple *cast_stmt = gimple_build_assign (vect_recog_temp_ssa_var (type, NULL),
NOP_EXPR, var);
append_pattern_def_seq (stmt_info, cast_stmt,
- get_vectype_for_scalar_type (type));
+ get_vectype_for_scalar_type (vinfo, type));
return gimple_assign_lhs (cast_stmt);
}
adjust_bool_pattern (tree var, tree out_type,
stmt_vec_info stmt_info, hash_map <tree, tree> &defs)
{
+ vec_info *vinfo = stmt_info->vinfo;
gimple *stmt = SSA_NAME_DEF_STMT (var);
enum tree_code rhs_code, def_rhs_code;
tree itype, cond_expr, rhs1, rhs2, irhs1, irhs2;
gimple_set_location (pattern_stmt, loc);
append_pattern_def_seq (stmt_info, pattern_stmt,
- get_vectype_for_scalar_type (itype));
+ get_vectype_for_scalar_type (vinfo, itype));
defs.put (var, gimple_assign_lhs (pattern_stmt));
}
break;
}
- comp_vectype = get_vectype_for_scalar_type (TREE_TYPE (rhs1));
+ comp_vectype = get_vectype_for_scalar_type (vinfo, TREE_TYPE (rhs1));
if (comp_vectype == NULL_TREE)
{
res = NULL_TREE;
if (! INTEGRAL_TYPE_P (TREE_TYPE (lhs))
|| TYPE_PRECISION (TREE_TYPE (lhs)) == 1)
return NULL;
- vectype = get_vectype_for_scalar_type (TREE_TYPE (lhs));
+ vectype = get_vectype_for_scalar_type (vinfo, TREE_TYPE (lhs));
if (vectype == NULL_TREE)
return NULL;
if (!useless_type_conversion_p (type, TREE_TYPE (lhs)))
{
- tree new_vectype = get_vectype_for_scalar_type (type);
+ tree new_vectype = get_vectype_for_scalar_type (vinfo, type);
append_pattern_def_seq (stmt_vinfo, pattern_stmt, new_vectype);
lhs = vect_recog_temp_ssa_var (TREE_TYPE (lhs), NULL);
else if (rhs_code == COND_EXPR
&& TREE_CODE (var) == SSA_NAME)
{
- vectype = get_vectype_for_scalar_type (TREE_TYPE (lhs));
+ vectype = get_vectype_for_scalar_type (vinfo, TREE_TYPE (lhs));
if (vectype == NULL_TREE)
return NULL;
tree type
= build_nonstandard_integer_type (prec,
TYPE_UNSIGNED (TREE_TYPE (var)));
- if (get_vectype_for_scalar_type (type) == NULL_TREE)
+ if (get_vectype_for_scalar_type (vinfo, type) == NULL_TREE)
return NULL;
if (!check_bool_pattern (var, vinfo, bool_stmts))
cst0 = build_int_cst (type, 0);
cst1 = build_int_cst (type, 1);
- new_vectype = get_vectype_for_scalar_type (type);
+ new_vectype = get_vectype_for_scalar_type (vinfo, type);
rhs = vect_recog_temp_ssa_var (type, NULL);
pattern_stmt = gimple_build_assign (rhs, COND_EXPR, var, cst1, cst0);
{
int rhs_index = internal_fn_stored_value_index (ifn);
tree rhs = gimple_call_arg (last_stmt, rhs_index);
- vectype1 = get_vectype_for_scalar_type (TREE_TYPE (rhs));
+ vectype1 = get_vectype_for_scalar_type (vinfo, TREE_TYPE (rhs));
}
else
{
lhs = gimple_call_lhs (last_stmt);
- vectype1 = get_vectype_for_scalar_type (TREE_TYPE (lhs));
+ vectype1 = get_vectype_for_scalar_type (vinfo, TREE_TYPE (lhs));
}
tree mask_arg = gimple_call_arg (last_stmt, mask_argno);
/* Check for cond expression requiring mask conversion. */
if (rhs_code == COND_EXPR)
{
- vectype1 = get_vectype_for_scalar_type (TREE_TYPE (lhs));
+ vectype1 = get_vectype_for_scalar_type (vinfo, TREE_TYPE (lhs));
if (TREE_CODE (rhs1) == SSA_NAME)
{
tree wide_scalar_type = build_nonstandard_integer_type
(tree_to_uhwi (TYPE_SIZE (TREE_TYPE (vectype1))),
TYPE_UNSIGNED (rhs1_type));
- tree vectype3 = get_vectype_for_scalar_type (wide_scalar_type);
+ tree vectype3 = get_vectype_for_scalar_type (vinfo,
+ wide_scalar_type);
if (expand_vec_cond_expr_p (vectype1, vectype3, TREE_CODE (rhs1)))
return NULL;
}
if (useless_type_conversion_p (type, TREE_TYPE (value)))
return value;
+ vec_info *vinfo = stmt_info->vinfo;
tree new_value = vect_recog_temp_ssa_var (type, NULL);
gassign *conversion = gimple_build_assign (new_value, CONVERT_EXPR, value);
append_pattern_def_seq (stmt_info, conversion,
- get_vectype_for_scalar_type (type));
+ get_vectype_for_scalar_type (vinfo, type));
return new_value;
}
return NULL;
/* Convert the mask to the right form. */
- tree gs_vectype = get_vectype_for_scalar_type (gs_info.element_type);
+ tree gs_vectype = get_vectype_for_scalar_type (loop_vinfo,
+ gs_info.element_type);
if (mask)
mask = vect_convert_mask_for_vectype (mask, gs_vectype, stmt_info,
loop_vinfo);
unsigned opno, enum vect_def_type dt,
stmt_vector_for_cost *cost_vec)
{
+ vec_info *vinfo = stmt_info->vinfo;
gimple *stmt = SLP_TREE_SCALAR_STMTS (node)[0]->stmt;
tree op = gimple_op (stmt, opno);
unsigned prologue_cost = 0;
/* Without looking at the actual initializer a vector of
constants can be implemented as load from the constant pool.
When all elements are the same we can use a splat. */
- tree vectype = get_vectype_for_scalar_type (TREE_TYPE (op));
+ tree vectype = get_vectype_for_scalar_type (vinfo, TREE_TYPE (op));
unsigned group_size = SLP_TREE_SCALAR_STMTS (node).length ();
unsigned num_vects_to_check;
unsigned HOST_WIDE_INT const_nunits;
&& VECTOR_BOOLEAN_TYPE_P (stmt_vectype))
vector_type = build_same_sized_truth_vector_type (stmt_vectype);
else
- vector_type = get_vectype_for_scalar_type (TREE_TYPE (op));
+ vector_type = get_vectype_for_scalar_type (loop_vinfo, TREE_TYPE (op));
gcc_assert (vector_type);
return vect_init_vector (stmt_vinfo, op, vector_type, NULL);
gather_scatter_info *gs_info,
tree *dataref_ptr, tree *vec_offset)
{
+ vec_info *vinfo = stmt_info->vinfo;
gimple_seq stmts = NULL;
*dataref_ptr = force_gimple_operand (gs_info->base, &stmts, true, NULL_TREE);
if (stmts != NULL)
gcc_assert (!new_bb);
}
tree offset_type = TREE_TYPE (gs_info->offset);
- tree offset_vectype = get_vectype_for_scalar_type (offset_type);
+ tree offset_vectype = get_vectype_for_scalar_type (vinfo, offset_type);
*vec_offset = vect_get_vec_def_for_operand (gs_info->offset, stmt_info,
offset_vectype);
}
/* The offset given in GS_INFO can have pointer type, so use the element
type of the vector instead. */
tree offset_type = TREE_TYPE (gs_info->offset);
- tree offset_vectype = get_vectype_for_scalar_type (offset_type);
+ tree offset_vectype = get_vectype_for_scalar_type (loop_vinfo, offset_type);
offset_type = TREE_TYPE (offset_vectype);
/* Calculate X = DR_STEP / SCALE and convert it to the appropriate type. */
|| arginfo[i].dt == vect_external_def)
&& bestn->simdclone->args[i].arg_type == SIMD_CLONE_ARG_TYPE_VECTOR)
{
- arginfo[i].vectype
- = get_vectype_for_scalar_type (TREE_TYPE (gimple_call_arg (stmt,
- i)));
+ tree arg_type = TREE_TYPE (gimple_call_arg (stmt, i));
+ arginfo[i].vectype = get_vectype_for_scalar_type (vinfo, arg_type);
if (arginfo[i].vectype == NULL
|| (simd_clone_subparts (arginfo[i].vectype)
> bestn->simdclone->simdlen))
either as shift by a scalar or by a vector. */
bool
-vect_supportable_shift (vec_info *, enum tree_code code, tree scalar_type)
+vect_supportable_shift (vec_info *vinfo, enum tree_code code, tree scalar_type)
{
machine_mode vec_mode;
int icode;
tree vectype;
- vectype = get_vectype_for_scalar_type (scalar_type);
+ vectype = get_vectype_for_scalar_type (vinfo, scalar_type);
if (!vectype)
return false;
scalar_type = build_nonstandard_integer_type
(tree_to_uhwi (TYPE_SIZE (TREE_TYPE (vectype))),
TYPE_UNSIGNED (scalar_type));
- *comp_vectype = get_vectype_for_scalar_type (scalar_type);
+ *comp_vectype = get_vectype_for_scalar_type (vinfo, scalar_type);
}
return true;
/* Invariant comparison. */
if (!vectype)
{
- vectype = get_vectype_for_scalar_type (TREE_TYPE (rhs1));
+ vectype = get_vectype_for_scalar_type (vinfo, TREE_TYPE (rhs1));
if (maybe_ne (TYPE_VECTOR_SUBPARTS (vectype), nunits))
return false;
}
by the target. */
tree
-get_vectype_for_scalar_type (tree scalar_type)
+get_vectype_for_scalar_type (vec_info *, tree scalar_type)
{
tree vectype;
vectype = get_vectype_for_scalar_type_and_size (scalar_type,
of vectors of specified SCALAR_TYPE as supported by target. */
tree
-get_mask_type_for_scalar_type (vec_info *, tree scalar_type)
+get_mask_type_for_scalar_type (vec_info *vinfo, tree scalar_type)
{
- tree vectype = get_vectype_for_scalar_type (scalar_type);
+ tree vectype = get_vectype_for_scalar_type (vinfo, scalar_type);
if (!vectype)
return NULL;
tree *stmt_vectype_out,
tree *nunits_vectype_out)
{
+ vec_info *vinfo = stmt_info->vinfo;
gimple *stmt = stmt_info->stmt;
*stmt_vectype_out = NULL_TREE;
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
"get vectype for scalar type: %T\n", scalar_type);
- vectype = get_vectype_for_scalar_type (scalar_type);
+ vectype = get_vectype_for_scalar_type (vinfo, scalar_type);
if (!vectype)
return opt_result::failure_at (stmt,
"not vectorized:"
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
"get vectype for scalar type: %T\n", scalar_type);
- nunits_vectype = get_vectype_for_scalar_type (scalar_type);
+ nunits_vectype = get_vectype_for_scalar_type (vinfo, scalar_type);
}
if (!nunits_vectype)
return opt_result::failure_at (stmt,