public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Andreas Krebbel <krebbel@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r11-9025] IBM Z: Fix PR102222
Date: Wed, 22 Sep 2021 10:21:20 +0000 (GMT)	[thread overview]
Message-ID: <20210922102120.40B043858D39@sourceware.org> (raw)

https://gcc.gnu.org/g:22b25535b8b2f9961e4772b1cc7cce5dc2f60719

commit r11-9025-g22b25535b8b2f9961e4772b1cc7cce5dc2f60719
Author: Andreas Krebbel <krebbel@linux.ibm.com>
Date:   Wed Sep 22 09:32:21 2021 +0200

    IBM Z: Fix PR102222
    
    Avoid emitting a strict low part move if the insv target actually
    affects the whole target reg.
    
    gcc/ChangeLog:
    
            PR target/102222
            * config/s390/s390.c (s390_expand_insv): Emit a normal move if it
            is actually a full copy of the source operand into the target.
            Don't emit a strict low part move if source and target mode match.
    
    gcc/testsuite/ChangeLog:
    
            * gcc.target/s390/pr102222.c: New test.
    
    (cherry picked from commit a9b3c451be58f0fe660154323ace7ba72a4211ec)

Diff:
---
 gcc/config/s390/s390.c                   | 10 ++++++++++
 gcc/testsuite/gcc.target/s390/pr102222.c | 16 ++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 6bbeb640e1f..c5d4c439bcc 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -6411,6 +6411,15 @@ s390_expand_insv (rtx dest, rtx op1, rtx op2, rtx src)
   if (bitsize + bitpos > GET_MODE_BITSIZE (mode))
     return false;
 
+  /* Just a move.  */
+  if (bitpos == 0
+      && bitsize == GET_MODE_BITSIZE (GET_MODE (src))
+      && mode == GET_MODE (src))
+    {
+      emit_move_insn (dest, src);
+      return true;
+    }
+
   /* Generate INSERT IMMEDIATE (IILL et al).  */
   /* (set (ze (reg)) (const_int)).  */
   if (TARGET_ZARCH
@@ -6507,6 +6516,7 @@ s390_expand_insv (rtx dest, rtx op1, rtx op2, rtx src)
       && (bitpos & 32) == ((bitpos + bitsize - 1) & 32)
       && MEM_P (src)
       && (mode == DImode || mode == SImode)
+      && mode != smode
       && register_operand (dest, mode))
     {
       /* Emit a strict_low_part pattern if possible.  */
diff --git a/gcc/testsuite/gcc.target/s390/pr102222.c b/gcc/testsuite/gcc.target/s390/pr102222.c
new file mode 100644
index 00000000000..47d075e47fc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/pr102222.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -m31 -mesa" } */
+
+struct squashfs_reg_inode_header_1 read_inode_inode;
+
+int read_inode_val;
+
+struct squashfs_reg_inode_header_1
+{
+  int file_size:32;
+} __attribute__((packed)) read_inode ();
+
+void foo (void)
+{
+  read_inode_inode.file_size = read_inode_val;
+}


                 reply	other threads:[~2021-09-22 10:21 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=20210922102120.40B043858D39@sourceware.org \
    --to=krebbel@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).