public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "admin at levyhsu dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/97417] RISC-V Unnecessary andi instruction when loading volatile bool
Date: Wed, 18 Nov 2020 06:09:49 +0000	[thread overview]
Message-ID: <bug-97417-4-CvgNmtfRbd@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-97417-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #39 from Levy <admin at levyhsu dot com> ---
Checked all pass from 250r.shorten_memrefs to 270r.ce2

In 269r.combine I saw the following combination merged the replaced address:
-------------------------------------------------------
modifying insn i3    27: r92:DI=r96:DI+0x300
      REG_DEAD r96:DI
deferring rescan insn with uid = 27.
(!)allowing combination of insns 27 and 6
original costs 4 + 16 = 20
replacement costs 4 + 16 = 20
modifying insn i2    27: r92:DI=r96:DI+0x300
deferring rescan insn with uid = 27.
modifying insn i3     6: r82:DI=sign_extend([r96:DI+0x320])
      REG_DEAD r96:DI
deferring rescan insn with uid = 6.
(!)allowing combination of insns 27 and 8
original costs 4 + 16 = 20
replacement costs 4 + 16 = 20
modifying insn i2    27: r92:DI=r96:DI+0x300
deferring rescan insn with uid = 27.
modifying insn i3     8: r84:DI=sign_extend([r96:DI+0x324])
      REG_DEAD r96:DI
deferring rescan insn with uid = 8.
(!)allowing combination of insns 27 and 12
original costs 4 + 16 = 20
replacement costs 4 + 16 = 20
modifying insn i2    27: r92:DI=r96:DI+0x300
deferring rescan insn with uid = 27.
modifying insn i3    12: r87:DI=sign_extend([r96:DI+0x328])
      REG_DEAD r96:DI
deferring rescan insn with uid = 12.
(!)allowing combination of insns 27 and 16
original costs 4 + 16 = 20
replacement cost 16
deferring deletion of insn with uid = 27.
modifying insn i3    16: r90:DI=sign_extend([r96:DI+0x32c])
      REG_DEAD r96:DI
deferring rescan insn with uid = 16.
allowing combination of insns 18 and 19
-------------------------------------------------------
Where in 268r.ud_dce both insns 27 are same (except for memory address):

(insn 27 26 28 2 (set (reg:DI 10 a0)
        (lo_sum:DI (reg/f:DI 85)
            (symbol_ref/f:DI ("*.LC0") [flags 0x82]  <var_decl 0x7f3546fe91b0
*.LC0>))) "array_test.c":21:5 133 {*lowdi}
     (expr_list:REG_DEAD (reg/f:DI 85)
        (expr_list:REG_EQUAL (symbol_ref/f:DI ("*.LC0") [flags 0x82]  <var_decl
0x7f3546fe91b0 *.LC0>)
            (nil))))
-------------------------------------------------------
In 270r.combine (patched):

(note 27 3 6 2 NOTE_INSN_DELETED)

and following insns 768 + 32/36/40/44 were put back as:

(insn 6 27 8 2 (set (reg:DI 82 [ MEM[(int *)array_5(D) + 800B] ])
        (sign_extend:DI (mem:SI (plus:DI (reg:DI 96)
                    (const_int 800 [0x320])) [1 MEM[(int *)array_5(D) + 800B]+0
S4 A32]))) "array_test.c":7:5 90 {extendsidi2}


(insn 8 6 10 2 (set (reg:DI 84 [ MEM[(int *)array_5(D) + 804B] ])
        (sign_extend:DI (mem:SI (plus:DI (reg:DI 96)
                    (const_int 804 [0x324])) [1 MEM[(int *)array_5(D) + 804B]+0
S4 A32]))) "array_test.c":7:5 90 {extendsidi2}


(insn 12 10 14 2 (set (reg:DI 87 [ MEM[(int *)array_5(D) + 808B] ])
        (sign_extend:DI (mem:SI (plus:DI (reg:DI 96)
                    (const_int 808 [0x328])) [1 MEM[(int *)array_5(D) + 808B]+0
S4 A32]))) "array_test.c":8:5 90 {extendsidi2}

(insn 16 14 18 2 (set (reg:DI 90 [ MEM[(int *)array_5(D) + 812B] ])
        (sign_extend:DI (mem:SI (plus:DI (reg:DI 96)
                    (const_int 812 [0x32c])) [1 MEM[(int *)array_5(D) + 812B]+0
S4 A32]))) "array_test.c":9:5 90 {extendsidi2}
     (expr_list:REG_DEAD (reg:DI 96)
        (nil)))

Maybe combine.c needs some modification?

  parent reply	other threads:[~2020-11-18  6:09 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-14 11:56 [Bug other/97417] New: " kjetilos at gmail dot com
2020-10-15 20:34 ` [Bug other/97417] " wilson at gcc dot gnu.org
2020-10-21  3:36 ` jiawei at iscas dot ac.cn
2020-10-21  5:58 ` wilson at gcc dot gnu.org
2020-10-27 11:18 ` jiawei at iscas dot ac.cn
2020-10-27 15:25 ` wilson at gcc dot gnu.org
2020-10-29  5:27 ` admin at levyhsu dot com
2020-10-29 22:49 ` wilson at gcc dot gnu.org
2020-10-30  8:35 ` admin at levyhsu dot com
2020-10-30 12:46 ` admin at levyhsu dot com
2020-11-04  6:10 ` admin at levyhsu dot com
2020-11-04  6:35 ` kito at gcc dot gnu.org
2020-11-04  7:03 ` admin at levyhsu dot com
2020-11-05 22:57 ` wilson at gcc dot gnu.org
2020-11-06  1:20 ` wilson at gcc dot gnu.org
2020-11-06  2:40 ` wilson at gcc dot gnu.org
2020-11-06  2:44 ` kito at gcc dot gnu.org
2020-11-06  3:35 ` wilson at gcc dot gnu.org
2020-11-06  9:46 ` admin at levyhsu dot com
2020-11-06 11:38 ` admin at levyhsu dot com
2020-11-06 20:44 ` wilson at gcc dot gnu.org
2020-11-06 21:08 ` wilson at gcc dot gnu.org
2020-11-09  8:35 ` admin at levyhsu dot com
2020-11-09  9:22 ` admin at levyhsu dot com
2020-11-10  5:20 ` admin at levyhsu dot com
2020-11-10  5:29 ` kito at gcc dot gnu.org
2020-11-10  5:34 ` admin at levyhsu dot com
2020-11-10  5:36 ` admin at levyhsu dot com
2020-11-10  6:01 ` admin at levyhsu dot com
2020-11-10 10:47 ` admin at levyhsu dot com
2020-11-11  1:21 ` wilson at gcc dot gnu.org
2020-11-11  5:43 ` admin at levyhsu dot com
2020-11-11  6:43 ` admin at levyhsu dot com
2020-11-11 19:35 ` wilson at gcc dot gnu.org
2020-11-12  1:26 ` admin at levyhsu dot com
2020-11-13  0:00 ` wilson at gcc dot gnu.org
2020-11-16  1:17 ` admin at levyhsu dot com
2020-11-16  3:24 ` kito at gcc dot gnu.org
2020-11-17 10:19 ` admin at levyhsu dot com
2020-11-18  6:09 ` admin at levyhsu dot com [this message]
2020-11-18 18:31 ` [Bug target/97417] " wilson at gcc dot gnu.org
2020-11-20  2:41 ` admin at levyhsu dot com
2020-11-20  3:32 ` wilson at gcc dot gnu.org
2020-11-23  6:17 ` admin at levyhsu dot com
2020-11-23  6:38 ` admin at levyhsu dot com
2020-11-23  7:43 ` admin at levyhsu dot com
2020-12-01  3:03 ` admin at levyhsu dot com
2020-12-08  9:22 ` admin at levyhsu dot com
2020-12-14 10:43 ` admin at levyhsu dot com
2020-12-15  9:55 ` admin at levyhsu dot com
2020-12-16  2:40 ` wilson at gcc dot gnu.org
2020-12-16  2:42 ` wilson at gcc dot gnu.org
2020-12-17 18:13 ` wilson at gcc dot gnu.org
2020-12-17 18:26 ` jiawei at iscas dot ac.cn
2020-12-21 15:08 ` jiawei at iscas dot ac.cn
2020-12-21 15:38 ` kito at gcc dot gnu.org
2020-12-21 16:09 ` jiawei at iscas dot ac.cn
2020-12-22  6:35 ` admin at levyhsu dot com
2020-12-25  3:31 ` kito at gcc dot gnu.org
2020-12-25  9:09 ` jiawei at iscas dot ac.cn
2021-02-13 20:24 ` cvs-commit at gcc dot gnu.org
2021-02-13 20:37 ` cvs-commit at gcc dot gnu.org
2021-02-13 20:48 ` wilson 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-97417-4-CvgNmtfRbd@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).