public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-5635] tree-optimization/111970 - fix issue with SLP of emulated gather/scatter
@ 2023-11-21  7:20 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2023-11-21  7:20 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:c656d268c9dac8b6f710b9bbd399214cb11b3287

commit r14-5635-gc656d268c9dac8b6f710b9bbd399214cb11b3287
Author: Richard Biener <rguenther@suse.de>
Date:   Mon Nov 20 15:16:44 2023 +0100

    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.

Diff:
---
 gcc/tree-vect-stmts.cc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 96e4a6cffad..bf8c99779ae 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));

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-11-21  7:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-21  7:20 [gcc r14-5635] tree-optimization/111970 - fix issue with SLP of emulated gather/scatter Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).