public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "law at redhat dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/94567] [10 Regression] wrong code at -O2 and -O3 on x86_64-linux-gnu Date: Tue, 14 Apr 2020 11:28:45 +0000 [thread overview] Message-ID: <bug-94567-4-cDvu2CrISc@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-94567-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94567 --- Comment #2 from Jeffrey A. Law <law at redhat dot com> --- THanks Martin. I'm already well into this one :-) I'm pretty sure the problem is testqi_ext_3 and the code we generate when splitting it. Consider (from my own slightly reduced testcase, but I'm sure yours will have something similar): (insn 25 22 26 3 (set (reg:CCNO 17 flags) (compare:CCNO (zero_extract:SI (reg:HI 104 [ e ]) (const_int 13 [0xd]) (const_int 3 [0x3])) (const_int 0 [0]))) "j.c":15:17 449 {*testqi_ext_3} (expr_list:REG_DEAD (reg:HI 104 [ e ]) (nil))) Which gets "split" into: (insn 124 22 26 3 (set (reg:CCNO 17 flags) (compare:CCNO (and:HI (reg:HI 104 [ e ]) (const_int -8 [0xfffffffffffffff8])) (const_int 0 [0]))) "j.c":15:17 444 {*testhi_1} (expr_list:REG_DEAD (reg:HI 104 [ e ]) (nil))) But consider the affect on the flags, particularly if the HImode sign bit is on in (reg 104). In the pre-split we extract a 13 bit field starting at bit 3 and zero extend it to SImode, then compare it against zero. No matter what the value in (reg 104) the sign flag bit will be off. In the post-split version we do a HImode AND and thus the sign flag bit will be on if bit 16 in (reg 104) is on. The pr90275 changes indirectly enabled generation of testqi_ext_3, but after a day of looking at the dumps, I'm confident the 90275 changes are correct/safe and that we're really dealing with a latent issue in testqi_ext_3.
next prev parent reply other threads:[~2020-04-14 11:28 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-04-12 2:49 [Bug tree-optimization/94567] New: " qrzhang at gatech dot edu 2020-04-14 6:41 ` [Bug rtl-optimization/94567] [10 Regression] " marxin at gcc dot gnu.org 2020-04-14 11:28 ` law at redhat dot com [this message] 2020-04-14 11:45 ` [Bug target/94567] " rguenth at gcc dot gnu.org 2020-04-14 11:48 ` rguenth at gcc dot gnu.org 2020-04-14 11:59 ` law at redhat dot com 2020-04-14 12:45 ` rguenth at gcc dot gnu.org 2020-04-14 13:20 ` law at redhat dot com 2020-04-15 9:57 ` rguenth at gcc dot gnu.org 2020-04-15 16:57 ` jakub at gcc dot gnu.org 2020-04-15 17:10 ` jakub at gcc dot gnu.org 2020-04-15 17:14 ` law at redhat dot com 2020-04-15 17:48 ` jakub at gcc dot gnu.org 2020-04-15 23:12 ` law at redhat dot com 2020-04-16 12:30 ` jakub at gcc dot gnu.org 2020-04-16 22:45 ` law at redhat dot com 2020-04-17 14:58 ` cvs-commit at gcc dot gnu.org 2020-04-17 15:11 ` jakub 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-94567-4-cDvu2CrISc@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: linkBe 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).