public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r10-8874] Don't keep strict_low_part in reloads for non-registers. [PR97313]
@ 2020-10-09 14:50 Vladimir Makarov
  0 siblings, 0 replies; only message in thread
From: Vladimir Makarov @ 2020-10-09 14:50 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:70a66ff0228277b4dd89263a663c0a87eb5d782f

commit r10-8874-g70a66ff0228277b4dd89263a663c0a87eb5d782f
Author: Vladimir N. Makarov <vmakarov@redhat.com>
Date:   Fri Oct 9 10:01:13 2020 -0400

    Don't keep strict_low_part in reloads for non-registers. [PR97313]
    
    gcc/ChangeLog:
    
    2020-10-09  Vladimir Makarov  <vmakarov@redhat.com>
    
            PR rtl-optimization/97313
            * lra-constraints.c (match_reload): Don't keep strict_low_part in
            reloads for non-registers.
    
    gcc/testsuite/ChangeLog:
    
    2020-10-09  Vladimir Makarov  <vmakarov@redhat.com>
    
            PR rtl-optimization/97313
            * gcc.target/i386/pr97313.c: New.

Diff:
---
 gcc/lra-constraints.c                   |  7 ++++++-
 gcc/testsuite/gcc.target/i386/pr97313.c | 24 ++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index 421c453997b..088208b9c6e 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -1070,8 +1070,13 @@ match_reload (signed char out, signed char *ins, signed char *outs,
   narrow_reload_pseudo_class (out_rtx, goal_class);
   if (find_reg_note (curr_insn, REG_UNUSED, out_rtx) == NULL_RTX)
     {
+      reg = SUBREG_P (out_rtx) ? SUBREG_REG (out_rtx) : out_rtx;
       start_sequence ();
-      if (out >= 0 && curr_static_id->operand[out].strict_low)
+      /* If we had strict_low_part, use it also in reload to keep other
+	 parts unchanged but do it only for regs as strict_low_part
+	 has no sense for memory and probably there is no insn pattern
+	 to match the reload insn in memory case.  */
+      if (out >= 0 && curr_static_id->operand[out].strict_low && REG_P (reg))
 	out_rtx = gen_rtx_STRICT_LOW_PART (VOIDmode, out_rtx);
       lra_emit_move (out_rtx, copy_rtx (new_out_reg));
       emit_insn (*after);
diff --git a/gcc/testsuite/gcc.target/i386/pr97313.c b/gcc/testsuite/gcc.target/i386/pr97313.c
new file mode 100644
index 00000000000..ef93cf1cca8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr97313.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fPIE" } */
+
+typedef struct {
+  int unspecified : 1;
+  int secure : 1;
+} MemTxAttrs;
+
+enum { MSCAllowNonSecure } tz_msc_read_pdata;
+
+int tz_msc_read_s_0;
+int tz_msc_check();
+int address_space_ldl_le();
+
+void tz_msc_read(MemTxAttrs attrs) {
+  int as = tz_msc_read_s_0;
+  long long data;
+  switch (tz_msc_check()) {
+  case MSCAllowNonSecure:
+    attrs.secure = attrs.unspecified = 0;
+    data = address_space_ldl_le(as, attrs);
+  }
+  tz_msc_read_pdata = data;
+}


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

only message in thread, other threads:[~2020-10-09 14:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-09 14:50 [gcc r10-8874] Don't keep strict_low_part in reloads for non-registers. [PR97313] Vladimir Makarov

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