public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-9025] IBM Z: Fix PR102222
@ 2021-09-22 10:21 Andreas Krebbel
0 siblings, 0 replies; only message in thread
From: Andreas Krebbel @ 2021-09-22 10:21 UTC (permalink / raw)
To: gcc-cvs
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;
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-09-22 10:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-22 10:21 [gcc r11-9025] IBM Z: Fix PR102222 Andreas Krebbel
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).