public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Andrew Stubbs <ams@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/omp/gcc-12] openmp-simd-clone: Match shift types
Date: Wed,  3 Aug 2022 09:30:51 +0000 (GMT)	[thread overview]
Message-ID: <20220803093051.C0AAD3857418@sourceware.org> (raw)

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


                 reply	other threads:[~2022-08-03  9:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220803093051.C0AAD3857418@sourceware.org \
    --to=ams@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).