public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/rguenth/heads/vect-force-slp)] Fix SLP reduction initial value for pointer reductions
@ 2024-02-23 12:00 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2024-02-23 12:00 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:598e22d683e4c92eaa784238d9ef733b612b75fa

commit 598e22d683e4c92eaa784238d9ef733b612b75fa
Author: Richard Biener <rguenther@suse.de>
Date:   Fri Feb 23 11:21:20 2024 +0100

    Fix SLP reduction initial value for pointer reductions
    
    For pointer reductions we need to convert the initial value to
    the vector component integer type.
    
            * tree-vect-loop.cc (get_initial_defs_for_reduction): Convert
            initial value to the vector component type.

Diff:
---
 gcc/tree-vect-loop.cc | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 405c7fb16180..51ed64a85c16 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -5619,7 +5619,14 @@ get_initial_defs_for_reduction (loop_vec_info loop_vinfo,
       if (i >= initial_values.length () || (j > i && neutral_op))
 	op = neutral_op;
       else
-	op = initial_values[i];
+	{
+	  if (!useless_type_conversion_p (TREE_TYPE (vector_type),
+					  TREE_TYPE (initial_values[i])))
+	    initial_values[i] = gimple_convert (&ctor_seq,
+						TREE_TYPE (vector_type),
+						initial_values[i]);
+	  op = initial_values[i];
+	}
 
       /* Create 'vect_ = {op0,op1,...,opn}'.  */
       number_of_places_left_in_vector--;

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

only message in thread, other threads:[~2024-02-23 12:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-23 12:00 [gcc(refs/users/rguenth/heads/vect-force-slp)] Fix SLP reduction initial value for pointer reductions 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).