public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/114902] [14/15 Regression] wrong code at -O3 with "-fno-tree-vrp -fno-expensive-optimizations -fno-tree-dominator-opts" on x86_64-linux-gnu Date: Wed, 01 May 2024 02:22:16 +0000 [thread overview] Message-ID: <bug-114902-4-HSm6rkkQv4@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-114902-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114902 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|target |rtl-optimization --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Looks like the issue is during combine. After combine we have: ``` 12: r113:SI=[`b'] 13: r112:SI=~r113:SI REG_DEAD r113:SI REG_EQUAL ~[`b'] 14: NOTE_INSN_DELETED 15: {r109:SI=sign_extract(r112:SI,0x1,0);clobber flags:CC;} REG_UNUSED flags:CC 18: NOTE_INSN_DELETED 19: NOTE_INSN_DELETED 22: r117:SI=0x1 21: flags:CCZ=cmp(zero_extract(r112:SI,0x1,0),0) REG_DEAD r112:SI 23: r106:SI={(flags:CCZ==0)?r109:SI:r117:SI} REG_DEAD r117:SI REG_DEAD r109:SI REG_DEAD flags:CCZ REG_EQUAL {(flags:CCZ==0)?r109:SI:0x1} ``` insn 21 is wrong. ``` Trying 15 -> 18: 15: {r109:SI=sign_extract(r112:SI,0x1,0);clobber flags:CC;} REG_DEAD r112:SI REG_UNUSED flags:CC 18: flags:CCGC=cmp(r109:SI,0xffffffffffffffff) Failed to match this instruction: (parallel [ (set (reg:CCZ 17 flags) (compare:CCZ (zero_extract:SI (reg:SI 112 [ _2 ]) (const_int 1 [0x1]) (const_int 0 [0])) (const_int 0 [0]))) (set (reg/v:SI 109 [ eD.2798 ]) (sign_extract:SI (reg:SI 112 [ _2 ]) (const_int 1 [0x1]) (const_int 0 [0]))) ]) Failed to match this instruction: (parallel [ (set (reg:CCZ 17 flags) (compare:CCZ (zero_extract:SI (reg:SI 112 [ _2 ]) (const_int 1 [0x1]) (const_int 0 [0])) (const_int 0 [0]))) (set (reg/v:SI 109 [ eD.2798 ]) (sign_extract:SI (reg:SI 112 [ _2 ]) (const_int 1 [0x1]) (const_int 0 [0]))) ]) Failed to match this instruction: (parallel [ (set (reg:CCZ 17 flags) (compare:CCZ (and:SI (reg:SI 112 [ _2 ]) (const_int 1 [0x1])) (const_int 0 [0]))) (set (reg/v:SI 109 [ eD.2798 ]) (sign_extract:SI (reg:SI 112 [ _2 ]) (const_int 1 [0x1]) (const_int 0 [0]))) ]) Failed to match this instruction: (parallel [ (set (reg:CCZ 17 flags) (compare:CCZ (and:SI (reg:SI 112 [ _2 ]) (const_int 1 [0x1])) (const_int 0 [0]))) (set (reg/v:SI 109 [ eD.2798 ]) (sign_extract:SI (reg:SI 112 [ _2 ]) (const_int 1 [0x1]) (const_int 0 [0]))) ]) Successfully matched this instruction: (set (reg/v:SI 109 [ eD.2798 ]) (sign_extract:SI (reg:SI 112 [ _2 ]) (const_int 1 [0x1]) (const_int 0 [0]))) Successfully matched this instruction: (set (reg:CCZ 17 flags) (compare:CCZ (zero_extract:SI (reg:SI 112 [ _2 ]) (const_int 1 [0x1]) (const_int 0 [0])) (const_int 0 [0]))) Successfully matched this instruction: (set (reg:QI 115 [ _10 ]) (ne:QI (reg:CCZ 17 flags) (const_int 0 [0]))) allowing combination of insns 15 and 18 original costs 4 + 4 = 12 replacement costs 4 + 4 = 12 modifying other_insn 19: r115:QI=flags:CCZ!=0 REG_DEAD flags:CCGC deferring rescan insn with uid = 19. modifying insn i2 15: {r109:SI=sign_extract(r112:SI,0x1,0);clobber flags:CC;} REG_UNUSED flags:CC deferring rescan insn with uid = 15. modifying insn i3 18: flags:CCZ=cmp(zero_extract(r112:SI,0x1,0),0) REG_DEAD r112:SI deferring rescan insn with uid = 18. ``` We go from CCGC with a sign_extend to a zero_extend with CCZ. that can't be right.
next prev parent reply other threads:[~2024-05-01 2:22 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-04-30 22:13 [Bug tree-optimization/114902] New: " zhendong.su at inf dot ethz.ch 2024-05-01 2:06 ` [Bug target/114902] [14/15 Regression] " pinskia at gcc dot gnu.org 2024-05-01 2:22 ` pinskia at gcc dot gnu.org [this message] 2024-05-01 2:34 ` [Bug rtl-optimization/114902] " pinskia at gcc dot gnu.org 2024-05-01 5:12 ` pinskia at gcc dot gnu.org 2024-05-01 5:29 ` pinskia at gcc dot gnu.org 2024-05-03 8:14 ` segher at gcc dot gnu.org 2024-05-03 8:38 ` pinskia at gcc dot gnu.org 2024-05-07 7:45 ` rguenth at gcc dot gnu.org 2024-05-09 9:48 ` segher at gcc dot gnu.org 2024-05-09 9:49 ` segher at gcc dot gnu.org 2024-05-14 20:09 ` segher at gcc dot gnu.org 2024-05-14 22:04 ` pinskia at gcc dot gnu.org 2024-05-15 16:44 ` cvs-commit at gcc dot gnu.org 2024-05-15 16:54 ` [Bug rtl-optimization/114902] [14 " jakub at gcc dot gnu.org 2024-06-04 14:26 ` cvs-commit at gcc dot gnu.org 2024-06-04 14:28 ` jakub at gcc dot gnu.org 2024-06-11 6:17 ` cvs-commit at gcc dot gnu.org 2024-06-11 10:38 ` cvs-commit at gcc dot gnu.org 2024-06-20 13:23 ` cvs-commit 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-114902-4-HSm6rkkQv4@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).