public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Vladimir Makarov <vmakarov@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r11-8180] [PR100066] Check paradoxical subreg when splitting hard reg live range
Date: Wed, 14 Apr 2021 17:23:10 +0000 (GMT)	[thread overview]
Message-ID: <20210414172310.78936394D8AB@sourceware.org> (raw)

https://gcc.gnu.org/g:f99f64f69db49ce6343d79a39eab28dcc6b91865

commit r11-8180-gf99f64f69db49ce6343d79a39eab28dcc6b91865
Author: Vladimir N. Makarov <vmakarov@redhat.com>
Date:   Wed Apr 14 13:21:40 2021 -0400

    [PR100066] Check paradoxical subreg when splitting hard reg live range
    
    When splitting live range of a hard reg, LRA actually split multi-register
    containing the hard reg.  So we need to check the biggest used mode of the hard reg on
    paradoxical subregister when the natural and the biggest
    mode are ordered.
    
    gcc/ChangeLog:
    
            PR rtl-optimization/100066
            * lra-constraints.c (split_reg): Check paradoxical_subreg_p for
            ordered modes when choosing splitting mode for hard reg.
    
    gcc/testsuite/ChangeLog:
    
            PR rtl-optimization/100066
            * gcc.target/i386/pr100066.c: New.

Diff:
---
 gcc/lra-constraints.c                    | 12 ++++++++----
 gcc/testsuite/gcc.target/i386/pr100066.c | 13 +++++++++++++
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index 62bcfc31772..9425f2d7e73 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -5797,10 +5797,14 @@ split_reg (bool before_p, int original_regno, rtx_insn *insn,
       mode = lra_reg_info[hard_regno].biggest_mode;
       machine_mode reg_rtx_mode = GET_MODE (regno_reg_rtx[hard_regno]);
       /* A reg can have a biggest_mode of VOIDmode if it was only ever seen as
-	 part of a multi-word register.  In that case, just use the reg_rtx.
-	 Otherwise, limit the size to that of the biggest access in the
-	 function.  */
-      if (mode == VOIDmode)
+	 part of a multi-word register.  In that case, just use the reg_rtx
+	 mode.  Do the same also if the biggest mode was larger than a register
+	 or we can not compare the modes.  Otherwise, limit the size to that of
+	 the biggest access in the function.  */
+      if (mode == VOIDmode
+	  || !ordered_p (GET_MODE_PRECISION (mode),
+			 GET_MODE_PRECISION (reg_rtx_mode))
+	  || paradoxical_subreg_p (mode, reg_rtx_mode))
 	{
 	  original_reg = regno_reg_rtx[hard_regno];
 	  mode = reg_rtx_mode;
diff --git a/gcc/testsuite/gcc.target/i386/pr100066.c b/gcc/testsuite/gcc.target/i386/pr100066.c
new file mode 100644
index 00000000000..a795864e172
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100066.c
@@ -0,0 +1,13 @@
+/* { dg-do compile { target { int128 } } } */
+/* { dg-options "-O1 -w" } */
+int pm;
+
+void
+w3 (int, int, int);
+
+void
+e6 (__int128 rt, long int mo)
+{
+  mo += rt / 0;
+  w3 (pm / mo, pm, 0);
+}


                 reply	other threads:[~2021-04-14 17:23 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=20210414172310.78936394D8AB@sourceware.org \
    --to=vmakarov@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).