this_fn_optabs->supports_vec_gather_load_cached = true;
this_fn_optabs->supports_vec_gather_load
- = supports_vec_convert_optab_p (gather_load_optab);
+ = (supports_vec_convert_optab_p (gather_load_optab)
+ || supports_vec_convert_optab_p (mask_gather_load_optab));
return this_fn_optabs->supports_vec_gather_load;
}
this_fn_optabs->supports_vec_scatter_store_cached = true;
this_fn_optabs->supports_vec_scatter_store
- = supports_vec_convert_optab_p (scatter_store_optab);
+ = (supports_vec_convert_optab_p (scatter_store_optab)
+ || supports_vec_convert_optab_p (mask_scatter_store_optab));
return this_fn_optabs->supports_vec_scatter_store;
}
return false;
/* Work out which function we need. */
- internal_fn ifn;
+ internal_fn ifn, alt_ifn;
if (read_p)
- ifn = masked_p ? IFN_MASK_GATHER_LOAD : IFN_GATHER_LOAD;
+ {
+ ifn = masked_p ? IFN_MASK_GATHER_LOAD : IFN_GATHER_LOAD;
+ alt_ifn = IFN_MASK_GATHER_LOAD;
+ }
else
- ifn = masked_p ? IFN_MASK_SCATTER_STORE : IFN_SCATTER_STORE;
+ {
+ ifn = masked_p ? IFN_MASK_SCATTER_STORE : IFN_SCATTER_STORE;
+ alt_ifn = IFN_MASK_SCATTER_STORE;
+ }
for (;;)
{
*offset_vectype_out = offset_vectype;
return true;
}
+ else if (!masked_p
+ && internal_gather_scatter_fn_supported_p (alt_ifn, vectype,
+ memory_type,
+ offset_vectype,
+ scale))
+ {
+ *ifn_out = alt_ifn;
+ *offset_vectype_out = offset_vectype;
+ return true;
+ }
if (TYPE_PRECISION (offset_type) >= POINTER_SIZE
&& TYPE_PRECISION (offset_type) >= element_bits)
if (mask)
mask = vect_convert_mask_for_vectype (mask, gs_vectype, stmt_info,
loop_vinfo);
+ else if (gs_info.ifn == IFN_MASK_SCATTER_STORE
+ || gs_info.ifn == IFN_MASK_GATHER_LOAD)
+ mask = build_int_cst (TREE_TYPE (truth_type_for (gs_vectype)), -1);
/* Get the invariant base and non-invariant offset, converting the
latter to the same width as the vector elements. */
{
tree rhs = vect_get_store_rhs (stmt_info);
if (mask != NULL)
- pattern_stmt = gimple_build_call_internal (IFN_MASK_SCATTER_STORE, 5,
+ pattern_stmt = gimple_build_call_internal (gs_info.ifn, 5,
base, offset, scale, rhs,
mask);
else
- pattern_stmt = gimple_build_call_internal (IFN_SCATTER_STORE, 4,
+ pattern_stmt = gimple_build_call_internal (gs_info.ifn, 4,
base, offset, scale, rhs);
}
gimple_call_set_nothrow (pattern_stmt, true);
return false;
}
- if (TREE_CODE (*mask) != SSA_NAME)
- {
- if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "mask argument is not an SSA name.\n");
- return false;
- }
-
/* If the caller is not prepared for adjusting an external/constant
SLP mask vector type fail. */
if (slp_node