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

https://gcc.gnu.org/g:2c710128b780ba92b8d63e43a5888f947277de60

commit 2c710128b780ba92b8d63e43a5888f947277de60
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>
    (cherry picked from commit b64e937ccde286278743e8fdffea494faa46c214)

Diff:
---
 gcc/ChangeLog.omp     |  6 ++++++
 gcc/omp-simd-clone.cc | 10 +++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp
index a8ba3b5e78b..08ab26da8ca 100644
--- a/gcc/ChangeLog.omp
+++ b/gcc/ChangeLog.omp
@@ -1,3 +1,9 @@
+2022-08-02  Andrew Stubbs  <ams@codesourcery.com>
+
+	Backport from mainline:
+	* omp-simd-clone.cc (simd_clone_adjust): Convert shift_cnt to match
+	the mask type.
+
 2022-08-02  Andrew Stubbs  <ams@codesourcery.com>
 
 	Backport from mainline:
diff --git a/gcc/omp-simd-clone.cc b/gcc/omp-simd-clone.cc
index 04fe03cde5f..6a9351c2102 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-03  9:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-03  9:30 [gcc/devel/omp/gcc-12] 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).