public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "xry111 at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/110701] [14 Regression] Wrong code at -O1/2/3/s on x86_64-linux-gnu
Date: Mon, 17 Jul 2023 12:43:01 +0000	[thread overview]
Message-ID: <bug-110701-4-Giz2CZmitV@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110701-4@http.gcc.gnu.org/bugzilla/>

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

Xi Ruoyao <xry111 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |rtl-optimization

--- Comment #1 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
Combine pass seems guilty.  Before combine:

(insn 21 20 23 2 (parallel [
            (set (subreg:HI (reg:DI 92) 0)
                (and:HI (subreg:HI (reg:DI 92) 0)
                    (const_int 340 [0x154])))
            (clobber (reg:CC 17 flags))
        ]) "/app/example.c":5:39 596 {*andhi_1}
     (expr_list:REG_UNUSED (reg:CC 17 flags)
        (nil)))
(insn 23 21 24 2 (parallel [
            (set (reg:HI 94) 
                (xor:HI (subreg:HI (reg:DI 92) 0)
                    (const_int 3 [0x3])))
            (clobber (reg:CC 17 flags))
        ]) "/app/example.c":7:23 discrim 1 634 {*xorhi_1}
     (expr_list:REG_DEAD (reg:DI 92) 
        (expr_list:REG_UNUSED (reg:CC 17 flags)
            (nil))))
(insn 24 23 25 2 (set (reg:SI 95) 
        (sign_extend:SI (reg:HI 94))) "/app/example.c":7:23 discrim 1 179
{extendhisi2}
     (expr_list:REG_DEAD (reg:HI 94) 
        (nil)))
(insn 25 24 26 2 (set (mem:SI (reg/f:DI 85 [ c.3_6 ]) [3 *c.3_6+0 S4 A32])
        (reg:SI 95)) "/app/example.c":7:23 discrim 1 91 {*movsi_internal}
     (expr_list:REG_DEAD (reg:SI 95) 
        (expr_list:REG_DEAD (reg/f:DI 85 [ c.3_6 ])
            (nil))))

This is perfectly legal.  After combine:

(insn 21 20 23 2 (parallel [
            (set (subreg:HI (reg:DI 92) 0)
                (and:HI (subreg:HI (reg:DI 92) 0)
                    (const_int 340 [0x154])))
            (clobber (reg:CC 17 flags))
        ]) "/app/example.c":5:39 596 {*andhi_1}
     (expr_list:REG_UNUSED (reg:CC 17 flags)
        (nil)))
(note 23 21 24 2 NOTE_INSN_DELETED)
(insn 24 23 25 2 (parallel [
            (set (reg:SI 95)
                (ior:SI (subreg:SI (reg:DI 92) 0)
                    (const_int 3 [0x3])))
            (clobber (reg:CC 17 flags))
        ]) "/app/example.c":7:23 discrim 1 635 {*iorsi_1}
     (expr_list:REG_UNUSED (reg:CC 17 flags)
        (expr_list:REG_DEAD (reg:DI 92)
            (nil))))
(insn 25 24 26 2 (set (mem:SI (reg/f:DI 85 [ c.3_6 ]) [3 *c.3_6+0 S4 A32])
        (reg:SI 95)) "/app/example.c":7:23 discrim 1 91 {*movsi_internal}
     (expr_list:REG_DEAD (reg:SI 95)
        (expr_list:REG_DEAD (reg/f:DI 85 [ c.3_6 ])
            (nil))))

The removal of sign_extend seems wrong.

  reply	other threads:[~2023-07-17 12:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-17 10:21 [Bug c/110701] New: " shaohua.li at inf dot ethz.ch
2023-07-17 12:43 ` xry111 at gcc dot gnu.org [this message]
2023-07-17 17:51 ` [Bug rtl-optimization/110701] [14 Regression] " pinskia at gcc dot gnu.org
2023-07-17 17:55 ` pinskia at gcc dot gnu.org
2023-07-17 17:58 ` pinskia at gcc dot gnu.org
2023-07-18 15:38 ` roger at nextmovesoftware dot com
2023-07-18 17:17 ` roger at nextmovesoftware dot com
2023-07-27 18:23 ` roger at nextmovesoftware dot com
2023-10-04 16:12 ` cvs-commit at gcc dot gnu.org
2023-10-11  7:59 ` roger at nextmovesoftware dot com

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-110701-4-Giz2CZmitV@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).