public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "stefansf at linux dot ibm.com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/101260] [10/11/12 Regression] Backport 27381e78925 to GCC 11
Date: Fri, 06 Aug 2021 13:59:45 +0000	[thread overview]
Message-ID: <bug-101260-4-R48cHCqwpf@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-101260-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101260

--- Comment #10 from Stefan Schulze Frielinghaus <stefansf at linux dot ibm.com> ---
In regcprop we call find_oldest_value_reg which itself calls

  maybe_mode_change (TImode, TImode, DImode, 10, 18)

where we have

  regno += subreg_regno_offset (regno, orig_mode, offset, new_mode);

The call is made where offset equals 8 which is wrong since we are interested
in the high part which is contained in r10 and not r11.  The following patch
fixes this:

diff --git a/gcc/regcprop.c b/gcc/regcprop.c
index d2a01130fe1..0e1ac12458a 100644
--- a/gcc/regcprop.c
+++ b/gcc/regcprop.c
@@ -414,9 +414,14 @@ maybe_mode_change (machine_mode orig_mode, machine_mode
copy_mode,
                            copy_nregs, &bytes_per_reg))
        return NULL_RTX;
       poly_uint64 copy_offset = bytes_per_reg * (copy_nregs - use_nregs);
-      poly_uint64 offset
-       = subreg_size_lowpart_offset (GET_MODE_SIZE (new_mode) + copy_offset,
-                                     GET_MODE_SIZE (orig_mode));
+      poly_uint64 offset =
+#if WORDS_BIG_ENDIAN
+       subreg_size_highpart_offset
+#else
+       subreg_size_lowpart_offset
+#endif
+                                   (GET_MODE_SIZE (new_mode) + copy_offset,
+                                    GET_MODE_SIZE (orig_mode));
       regno += subreg_regno_offset (regno, orig_mode, offset, new_mode);
       if (targetm.hard_regno_mode_ok (regno, new_mode))
        return gen_raw_REG (new_mode, regno);

With the patch

(insn 234 222 235 14 (set (reg:DI 10 %r10 [ a ])
        (reg:DI 18 %f4)) 1376 {*movdi_64}
     (nil))

is first modified into a noop

(insn 234 222 235 14 (set (reg:DI 10 %r10 [ a ])
        (reg:DI 10 %r10 [18])) 1376 {*movdi_64}
     (nil))

and then deleted within regcprop.

  parent reply	other threads:[~2021-08-06 13:59 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-29 15:35 [Bug tree-optimization/101260] New: " stefansf at linux dot ibm.com
2021-06-29 23:08 ` [Bug tree-optimization/101260] " jakub at gcc dot gnu.org
2021-06-30  6:33 ` rguenth at gcc dot gnu.org
2021-06-30  7:41 ` stefansf at linux dot ibm.com
2021-06-30  7:58 ` [Bug tree-optimization/101260] [10/11 Regression] " rguenth at gcc dot gnu.org
2021-06-30 14:08 ` stefansf at linux dot ibm.com
2021-06-30 17:23 ` jakub at gcc dot gnu.org
2021-06-30 19:04 ` stefansf at linux dot ibm.com
2021-07-01 16:58 ` stefansf at linux dot ibm.com
2021-07-06  6:53 ` [Bug rtl-optimization/101260] " rguenth at gcc dot gnu.org
2021-07-19 12:02 ` [Bug rtl-optimization/101260] [10/11/12 " rguenth at gcc dot gnu.org
2021-08-06 13:59 ` stefansf at linux dot ibm.com [this message]
2022-01-14 19:24 ` [Bug rtl-optimization/101260] [10/11/12 Regression] regcprop: Determine subreg offset depending on endianness pinskia at gcc dot gnu.org
2022-01-14 19:26 ` pinskia at gcc dot gnu.org
2022-01-14 19:27 ` pinskia at gcc dot gnu.org
2022-01-14 19:32 ` pinskia at gcc dot gnu.org
2022-01-14 19:33 ` pinskia at gcc dot gnu.org
2022-01-14 19:37 ` pinskia at gcc dot gnu.org
2022-02-01 12:35 ` cvs-commit at gcc dot gnu.org
2022-06-09  8:53 ` [Bug rtl-optimization/101260] [10/11 " stefansf at linux dot ibm.com
2022-06-28 10:45 ` jakub at gcc dot gnu.org
2023-07-07 10:40 ` [Bug rtl-optimization/101260] [11 " rguenth at gcc dot gnu.org

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=bug-101260-4-R48cHCqwpf@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).