public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-1917] openmp-simd-clone: Match shift types
@ 2022-08-01 16:20 Andrew Stubbs
  0 siblings, 0 replies; only message in thread
From: Andrew Stubbs @ 2022-08-01 16:20 UTC (permalink / raw)
  To: gcc-cvs

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

commit r13-1917-gb64e937ccde286278743e8fdffea494faa46c214
Author: Andrew Stubbs <ams@codesourcery.com>
Date:   Tue Jul 19 11:16:09 2022 +0100

    openmp-simd-clone: Match shift types
    
    Ensure that both parameters to vector shifts use the same mode.  This is most
    important for amdgcn where the masks are DImode.
    
    gcc/ChangeLog:
    
            * omp-simd-clone.cc (simd_clone_adjust): Convert shift_cnt to match
            the mask type.
    
    Co-authored-by: Jakub Jelinek  <jakub@redhat.com>

Diff:
---
 gcc/omp-simd-clone.cc | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/gcc/omp-simd-clone.cc b/gcc/omp-simd-clone.cc
index 32649bc3f9a..58bd68b129b 100644
--- a/gcc/omp-simd-clone.cc
+++ b/gcc/omp-simd-clone.cc
@@ -1305,8 +1305,16 @@ simd_clone_adjust (struct cgraph_node *node)
 				       build_int_cst (TREE_TYPE (iter1), c));
 	      gsi_insert_after (&gsi, g, GSI_CONTINUE_LINKING);
 	    }
+	  tree shift_cnt_conv = shift_cnt;
+	  if (!useless_type_conversion_p (TREE_TYPE (mask),
+					  TREE_TYPE (shift_cnt)))
+	    {
+	      shift_cnt_conv = make_ssa_name (TREE_TYPE (mask));
+	      g = gimple_build_assign (shift_cnt_conv, NOP_EXPR, shift_cnt);
+	      gsi_insert_after (&gsi, g, GSI_CONTINUE_LINKING);
+	    }
 	  g = gimple_build_assign (make_ssa_name (TREE_TYPE (mask)),
-				   RSHIFT_EXPR, mask, shift_cnt);
+				   RSHIFT_EXPR, mask, shift_cnt_conv);
 	  gsi_insert_after (&gsi, g, GSI_CONTINUE_LINKING);
 	  mask = gimple_assign_lhs (g);
 	  g = gimple_build_assign (make_ssa_name (TREE_TYPE (mask)),


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

only message in thread, other threads:[~2022-08-01 16:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-01 16:20 [gcc r13-1917] openmp-simd-clone: Match shift types Andrew Stubbs

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).