The following fixes an error in the SLP of emulated gathers,
discovered by x86 specific tests when enabling single-lane SLP.

Bootstrap and regtest running on x86_64-unknown-linux-gnu.

        * tree-vect-stmts.cc (vectorizable_load): Adjust offset
        vector gathering for SLP of emulated gathers.
---
 gcc/tree-vect-stmts.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 61e23b29516..913a4fb08ed 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -11163,7 +11163,7 @@ vectorizable_load (vec_info *vinfo,
                     than the data vector for now.  */
                  unsigned HOST_WIDE_INT factor
                    = const_offset_nunits / const_nunits;
-                 vec_offset = vec_offsets[j / factor];
+                 vec_offset = vec_offsets[(vec_num * j + i) / factor];
                  unsigned elt_offset = (j % factor) * const_nunits;
                  tree idx_type = TREE_TYPE (TREE_TYPE (vec_offset));
                  tree scale = size_int (gs_info.scale);
-- 
2.35.3

Reply via email to