public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "segher at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/78103] Failure to optimize with __builtin_clzl Date: Mon, 26 Jul 2021 21:26:26 +0000 [thread overview] Message-ID: <bug-78103-4-eFcltaFlkR@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-78103-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78103 --- Comment #15 from Segher Boessenkool <segher at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #14) > (In reply to Segher Boessenkool from comment #13) > > (In reply to Jakub Jelinek from comment #10) > > > Unfortunately, it doesn't work for the #c0 testcase, after the combiner > > > splitter kicks in, the combiner doesn't even try that 4 insn combination. > > > > It does for me? > > But only in the unpatched gcc, no? Yes, of course. > For #c0 findLastSet I actually need to combine 5 original instructions, [...] That is not something we want to ever implement: 4 insns already is too expensive unless we try only the simplest, and/or only very specific combinations. > and > what I was hoping for is to first combine first 3 instructions into 2, > 9, 10 -> 12 to get rid of the useless sign-extension, You should be able to combine only 10 and 12 even, to a SImode xor followed by the sign extension (may not work out wrt costs, but it isn't even tried). Or, why is r86 DImode anyway? > the value is known to > be 0..63, so zero extension is fine, into 10 (bsr) and 12 (xor with zero > extend), which is what the #c9 patch does. > And then I was hoping 10, 12, 13 -> 14 would be attempted to be combined > because 13 is mov of a constant. But that doesn't happen because the 9, 10 > -> 12 combination with the #c9 patch throws away the 12 -> 10 LOG_LINKS and > doesn't add a new one, even when 10 is a setter of a fresh new pseudo and 12 > is the only use of that pseudo. This is only safe if it *is* a new pseudo, and even then, you need to prevent getting stuck somehow. insn 10 is the most problematic things here btw, having the same pseudo as input and as output (it is not the unique setter either). This happens in expand already, probably a machine pattern that forgets to create new registers where it should?
next prev parent reply other threads:[~2021-07-26 21:26 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-78103-4@http.gcc.gnu.org/bugzilla/> 2021-07-24 6:20 ` pinskia at gcc dot gnu.org 2021-07-24 12:28 ` jakub at gcc dot gnu.org 2021-07-26 10:57 ` jakub at gcc dot gnu.org 2021-07-26 11:14 ` jakub at gcc dot gnu.org 2021-07-26 11:22 ` jakub at gcc dot gnu.org 2021-07-26 12:11 ` jakub at gcc dot gnu.org 2021-07-26 21:01 ` segher at gcc dot gnu.org 2021-07-26 21:08 ` jakub at gcc dot gnu.org 2021-07-26 21:26 ` segher at gcc dot gnu.org [this message] 2021-07-27 8:52 ` jakub at gcc dot gnu.org 2021-07-27 12:35 ` segher at gcc dot gnu.org 2021-07-27 12:41 ` jakub at gcc dot gnu.org 2021-07-27 13:53 ` jakub at gcc dot gnu.org 2021-07-27 15:25 ` segher at gcc dot gnu.org 2021-07-27 15:37 ` segher at gcc dot gnu.org 2021-07-31 7:21 ` cvs-commit at gcc dot gnu.org 2021-07-31 8:24 ` jakub at gcc dot gnu.org 2021-08-01 20:33 ` 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-78103-4-eFcltaFlkR@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).