}
/* Return true if a non-affine read or write in STMT_INFO is suitable for a
- gather load or scatter store. Describe the operation in *INFO if so.
- If it is suitable and ELSVALS is nonzero store the supported else values
- in the vector it points to. */
+ gather load or scatter store with VECTYPE. Describe the operation in *INFO
+ if so. If it is suitable and ELSVALS is nonzero store the supported else
+ values in the vector it points to. */
bool
-vect_check_gather_scatter (stmt_vec_info stmt_info, loop_vec_info loop_vinfo,
+vect_check_gather_scatter (stmt_vec_info stmt_info, tree vectype,
+ loop_vec_info loop_vinfo,
gather_scatter_info *info, vec<int> *elsvals)
{
HOST_WIDE_INT scale = 1;
struct data_reference *dr = STMT_VINFO_DATA_REF (stmt_info);
tree offtype = NULL_TREE;
tree decl = NULL_TREE, base, off;
- tree vectype = STMT_VINFO_VECTYPE (stmt_info);
tree memory_type = TREE_TYPE (DR_REF (dr));
machine_mode pmode;
int punsignedp, reversep, pvolatilep = 0;
if (gatherscatter != SG_NONE)
{
gather_scatter_info gs_info;
- if (!vect_check_gather_scatter (stmt_info,
+ if (!vect_check_gather_scatter (stmt_info, vectype,
as_a <loop_vec_info> (vinfo),
&gs_info)
|| !get_vectype_for_scalar_type (vinfo,
This is null if the operation is unconditional. */
tree mask = vect_get_load_store_mask (stmt_info);
+ /* DR analysis nailed down the vector type for the access. */
+ tree gs_vectype = STMT_VINFO_VECTYPE (stmt_info);
+
/* Make sure that the target supports an appropriate internal
function for the gather/scatter operation. */
gather_scatter_info gs_info;
- if (!vect_check_gather_scatter (stmt_info, loop_vinfo, &gs_info)
+ if (!vect_check_gather_scatter (stmt_info, gs_vectype, loop_vinfo, &gs_info)
|| gs_info.ifn == IFN_LAST)
return NULL;
/* Convert the mask to the right form. */
- 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);
stmt_vec_info pattern_stmt_info = loop_vinfo->add_stmt (pattern_stmt);
loop_vinfo->move_dr (pattern_stmt_info, stmt_info);
- tree vectype = STMT_VINFO_VECTYPE (stmt_info);
- *type_out = vectype;
+ *type_out = gs_vectype;
vect_pattern_detected ("gather/scatter pattern", stmt_info->stmt);
return pattern_stmt;
swapping operands of father node of this one, return 1; if everything is
ok return 0. */
static int
-vect_get_and_check_slp_defs (vec_info *vinfo, unsigned char swap,
+vect_get_and_check_slp_defs (vec_info *vinfo, tree vectype, unsigned char swap,
bool *skip_args,
vec<stmt_vec_info> stmts, unsigned stmt_num,
vec<slp_oprnd_info> *oprnds_info)
{
gcc_assert (STMT_VINFO_GATHER_SCATTER_P (stmt_info));
if (!is_a <loop_vec_info> (vinfo)
- || !vect_check_gather_scatter (stmt_info,
+ || !vect_check_gather_scatter (stmt_info, vectype,
as_a <loop_vec_info> (vinfo),
first ? &oprnd_info->first_gs_info
: &gs_info))
slp_oprnd_info oprnd_info;
FOR_EACH_VEC_ELT (stmts, i, stmt_info)
{
- int res = vect_get_and_check_slp_defs (vinfo, swap[i], skip_args,
+ int res = vect_get_and_check_slp_defs (vinfo, vectype,
+ swap[i], skip_args,
stmts, i, &oprnds_info);
if (res != 0)
matches[(res == -1) ? 0 : i] = false;
if (STMT_VINFO_GATHER_SCATTER_P (stmt_vinfo))
{
gather_scatter_info gs_info;
- if (!vect_check_gather_scatter (stmt_vinfo, loop_vinfo, &gs_info))
+ if (!vect_check_gather_scatter (stmt_vinfo,
+ STMT_VINFO_VECTYPE (stmt_vinfo),
+ loop_vinfo, &gs_info))
gcc_unreachable ();
opt_result res
= process_use (stmt_vinfo, gs_info.offset, loop_vinfo, relevant,
unsigned int group_size,
bool single_element_p)
{
- if (!vect_check_gather_scatter (stmt_info, loop_vinfo, gs_info, elsvals)
+ if (!vect_check_gather_scatter (stmt_info, vectype,
+ loop_vinfo, gs_info, elsvals)
|| gs_info->ifn == IFN_LAST)
{
if (!vect_truncate_gather_scatter_offset (stmt_info, vectype, loop_vinfo,
extern bool vect_gather_scatter_fn_p (vec_info *, bool, bool, tree, tree,
tree, int, internal_fn *, tree *,
vec<int> * = nullptr);
-extern bool vect_check_gather_scatter (stmt_vec_info, loop_vec_info,
- gather_scatter_info *,
+extern bool vect_check_gather_scatter (stmt_vec_info, tree,
+ loop_vec_info, gather_scatter_info *,
vec<int> * = nullptr);
extern void vect_describe_gather_scatter_call (stmt_vec_info,
gather_scatter_info *);