This is the mail system at host fx409.security-mail.net.

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

                   The mail system

<marc.poulh...@kalray.eu>: host zimbra2.kalray.eu[195.135.97.26] said: 550
    5.1.1 <marc.poulh...@kalray.eu>: Recipient address rejected: User unknown
    in virtual mailbox table (in reply to RCPT TO command)
Reporting-MTA: dns; fx409.security-mail.net
X-Postfix-Queue-ID: C607A323832
X-Postfix-Sender: rfc822; gcc-patches@gcc.gnu.org
Arrival-Date: Tue, 10 Aug 2021 12:26:10 +0200 (CEST)

Final-Recipient: rfc822; marc.poulhies@kalray.eu
Original-Recipient: rfc822;marc.poulhies@kalray.eu
Action: failed
Status: 5.1.1
Remote-MTA: dns; zimbra2.kalray.eu
Diagnostic-Code: smtp; 550 5.1.1 <marc.poulhies@kalray.eu>: Recipient address
    rejected: User unknown in virtual mailbox table
--- Begin Message ---
This adds emulated gather support for index vectors with more
elements than the data vector.  The internal function gather
vectorization code doesn't currently handle this (but the builtin
decl code does).  This allows vectorization of double data gather
with int indexes on 32bit platforms where there isn't an implicit
widening to 64bit present.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

2021-08-10  Richard Biener  <rguent...@suse.de>

        PR tree-optimization/101809
        * tree-vect-stmts.c (get_load_store_type): Allow emulated
        gathers with offset vector nunits being a constant multiple
        of the data vector nunits.
        (vect_get_gather_scatter_ops): Use the appropriate nunits
        for the offset vector defs.
        (vectorizable_store): Adjust call to
        vect_get_gather_scatter_ops.
        (vectorizable_load): Likewise.  Handle the case of less
        offset vectors than data vectors.
---
 gcc/tree-vect-stmts.c | 47 +++++++++++++++++++++++++++----------------
 1 file changed, 30 insertions(+), 17 deletions(-)

diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 5a5a4dab3f2..ab402b57fb4 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -2377,9 +2377,11 @@ get_load_store_type (vec_info  *vinfo, stmt_vec_info 
stmt_info,
              return false;
            }
          else if (!TYPE_VECTOR_SUBPARTS (vectype).is_constant ()
-                  || !known_eq (TYPE_VECTOR_SUBPARTS (vectype),
-                                TYPE_VECTOR_SUBPARTS
-                                  (gs_info->offset_vectype)))
+                  || !TYPE_VECTOR_SUBPARTS
+                        (gs_info->offset_vectype).is_constant ()
+                  || !constant_multiple_p (TYPE_VECTOR_SUBPARTS
+                                             (gs_info->offset_vectype),
+                                           TYPE_VECTOR_SUBPARTS (vectype)))
            {
              if (dump_enabled_p ())
                dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -2928,11 +2930,10 @@ vect_build_gather_load_calls (vec_info *vinfo, 
stmt_vec_info stmt_info,
    containing loop.  */
 
 static void
-vect_get_gather_scatter_ops (vec_info *vinfo,
+vect_get_gather_scatter_ops (loop_vec_info loop_vinfo,
                             class loop *loop, stmt_vec_info stmt_info,
                             gather_scatter_info *gs_info,
-                            tree *dataref_ptr, vec<tree> *vec_offset,
-                            unsigned ncopies)
+                            tree *dataref_ptr, vec<tree> *vec_offset)
 {
   gimple_seq stmts = NULL;
   *dataref_ptr = force_gimple_operand (gs_info->base, &stmts, true, NULL_TREE);
@@ -2943,8 +2944,10 @@ vect_get_gather_scatter_ops (vec_info *vinfo,
       new_bb = gsi_insert_seq_on_edge_immediate (pe, stmts);
       gcc_assert (!new_bb);
     }
-  vect_get_vec_defs_for_operand (vinfo, stmt_info, ncopies, gs_info->offset,
-                                vec_offset, gs_info->offset_vectype);
+  unsigned ncopies = vect_get_num_copies (loop_vinfo, gs_info->offset_vectype);
+  vect_get_vec_defs_for_operand (loop_vinfo, stmt_info, ncopies,
+                                gs_info->offset, vec_offset,
+                                gs_info->offset_vectype);
 }
 
 /* Prepare to implement a grouped or strided load or store using
@@ -8072,8 +8075,9 @@ vectorizable_store (vec_info *vinfo,
            }
          else if (STMT_VINFO_GATHER_SCATTER_P (stmt_info))
            {
-             vect_get_gather_scatter_ops (vinfo, loop, stmt_info, &gs_info,
-                                          &dataref_ptr, &vec_offsets, ncopies);
+             vect_get_gather_scatter_ops (loop_vinfo, loop, stmt_info,
+                                          &gs_info, &dataref_ptr,
+                                          &vec_offsets);
              vec_offset = vec_offsets[0];
            }
          else
@@ -9376,9 +9380,9 @@ vectorizable_load (vec_info *vinfo,
            }
          else if (STMT_VINFO_GATHER_SCATTER_P (stmt_info))
            {
-             vect_get_gather_scatter_ops (vinfo, loop, stmt_info, &gs_info,
-                                          &dataref_ptr, &vec_offsets, ncopies);
-             vec_offset = vec_offsets[0];
+             vect_get_gather_scatter_ops (loop_vinfo, loop, stmt_info,
+                                          &gs_info, &dataref_ptr,
+                                          &vec_offsets);
            }
          else
            dataref_ptr
@@ -9395,9 +9399,7 @@ vectorizable_load (vec_info *vinfo,
          if (dataref_offset)
            dataref_offset = int_const_binop (PLUS_EXPR, dataref_offset,
                                              bump);
-         else if (STMT_VINFO_GATHER_SCATTER_P (stmt_info))
-           vec_offset = vec_offsets[j];
-         else
+         else if (!STMT_VINFO_GATHER_SCATTER_P (stmt_info))
            dataref_ptr = bump_vector_ptr (vinfo, dataref_ptr, ptr_incr, gsi,
                                           stmt_info, bump);
          if (mask)
@@ -9490,6 +9492,7 @@ vectorizable_load (vec_info *vinfo,
                    if (memory_access_type == VMAT_GATHER_SCATTER
                        && gs_info.ifn != IFN_LAST)
                      {
+                       vec_offset = vec_offsets[j];
                        tree zero = build_zero_cst (vectype);
                        tree scale = size_int (gs_info.scale);
                        gcall *call;
@@ -9512,9 +9515,18 @@ vectorizable_load (vec_info *vinfo,
                        gcc_assert (!final_mask);
                        unsigned HOST_WIDE_INT const_nunits
                          = nunits.to_constant ();
+                       unsigned HOST_WIDE_INT const_offset_nunits
+                         = TYPE_VECTOR_SUBPARTS (gs_info.offset_vectype)
+                             .to_constant ();
                        vec<constructor_elt, va_gc> *ctor_elts;
                        vec_alloc (ctor_elts, const_nunits);
                        gimple_seq stmts = NULL;
+                       /* We support offset vectors with more elements
+                          than the data vector for now.  */
+                       unsigned HOST_WIDE_INT factor
+                         = const_offset_nunits / const_nunits;
+                       vec_offset = vec_offsets[j / factor];
+                       unsigned elt_offset = (j % factor) * const_nunits;
                        tree idx_type = TREE_TYPE (TREE_TYPE (vec_offset));
                        tree scale = size_int (gs_info.scale);
                        align
@@ -9525,7 +9537,8 @@ vectorizable_load (vec_info *vinfo,
                          {
                            tree boff = size_binop (MULT_EXPR,
                                                    TYPE_SIZE (idx_type),
-                                                   bitsize_int (k));
+                                                   bitsize_int
+                                                     (k + elt_offset));
                            tree idx = gimple_build (&stmts, BIT_FIELD_REF,
                                                     idx_type, vec_offset,
                                                     TYPE_SIZE (idx_type),
-- 
2.31.1


To declare a filtering error, please use the following link : 
https://www.security-mail.net/reporter.php?mid=7dfe.6112543e.f148.0&r=marc.poulhies%40kalray.eu&s=gcc-patches-bounces%2Bmarc.poulhies%3Dkalray.eu%40gcc.gnu.org&o=%5BPATCH%5D+tree-optimization%2F101809+-+support+emulated+gather+for+double%5Bint%5D&verdict=C&c=db07867a517b0a4ebd892d73cf5921ec9e358b2b

--- End Message ---

Reply via email to