tree-optimization/111970 - fix issue with SLP of emulated gather/scatter

There's a missed index adjustment for the SLP vector number when
computing the index/data vectors for emulated gather/scatter with SLP.
The following fixes this.

	PR tree-optimization/111970
	* tree-vect-stmts.cc (vectorizable_load): Fix offset calculation
	for SLP gather load.
	(vectorizable_store): Likewise for SLP scatter store.
This commit is contained in:
Richard Biener 2023-11-20 15:16:44 +01:00
parent 7bf1de9186
commit c656d268c9

View file

@ -9188,7 +9188,8 @@ vectorizable_store (vec_info *vinfo,
unsigned HOST_WIDE_INT factor
= const_offset_nunits / const_nunits;
vec_offset = vec_offsets[(vec_num * j + i) / factor];
unsigned elt_offset = (j % factor) * const_nunits;
unsigned elt_offset
= ((vec_num * j + i) % factor) * const_nunits;
tree idx_type = TREE_TYPE (TREE_TYPE (vec_offset));
tree scale = size_int (gs_info.scale);
align = get_object_alignment (DR_REF (first_dr_info->dr));
@ -11150,7 +11151,8 @@ vectorizable_load (vec_info *vinfo,
unsigned HOST_WIDE_INT factor
= const_offset_nunits / const_nunits;
vec_offset = vec_offsets[(vec_num * j + i) / factor];
unsigned elt_offset = (j % factor) * const_nunits;
unsigned elt_offset
= ((vec_num * j + i) % factor) * const_nunits;
tree idx_type = TREE_TYPE (TREE_TYPE (vec_offset));
tree scale = size_int (gs_info.scale);
align = get_object_alignment (DR_REF (first_dr_info->dr));