aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2023-11-20 15:16:44 +0100
committerRichard Biener <rguenther@suse.de>2023-11-21 08:16:57 +0100
commitc656d268c9dac8b6f710b9bbd399214cb11b3287 (patch)
tree1293e3cd79b021f13991647eedf566c37dba2392 /gcc
parent7bf1de918608e2d0b5a3ad0923040acb1819d9a5 (diff)
downloadgcc-c656d268c9dac8b6f710b9bbd399214cb11b3287.zip
gcc-c656d268c9dac8b6f710b9bbd399214cb11b3287.tar.gz
gcc-c656d268c9dac8b6f710b9bbd399214cb11b3287.tar.bz2
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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/tree-vect-stmts.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 96e4a6cf..bf8c997 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -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));