public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "wilson at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/26190] combine misses some distributivity Date: Fri, 24 Apr 2015 21:13:00 -0000 [thread overview] Message-ID: <bug-26190-4-YskYJe7FFm@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-26190-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26190 --- Comment #3 from Jim Wilson <wilson at gcc dot gnu.org> --- This ior/shift/xor optimization be done during combine with a simplify-rtx.c patch. I wrote a prototype and tested it. Combine canonicalizes shift/logical as logical/shift, so we actually have to look for ior/xor/shift. I see that the optimization does not happen on arm and aarch64 because the 0x4002 value does not fit into the immediate range for logical ops, gets loaded into a register, pulled out of the loop, and hence is not available to combine. We would have to perform the optimization earlier for it to work for arm/aarch64. I tried MIPS, and see that because MIPS promotes HImode to SImode we don't have enough info to prove that the opt is safe. We need type info to make this work. This prototype does work for the x86 target which has both 16-bit immediates and HImode instructions. Next I wrote a prototype for match-and-simplify. This one works for all 4 targets. We have to handle ior/shift/xor as match-and-simplify does not canonicalize logical/shift. I noticed that if I change the xor to an ior, then it gets optimized in combine because of the canonicalization for mips and x86, but not for arm/aarch64 again because the constant was pulled out of the loop. So it seems that match-and-simplify should canonicalize shift/logical to logical/shift too. That would also reduce the number of patterns we need to match when performing this ior/shift/xor optimization. These are prototype patches that need a bit more work to handle more cases, and to prove that they test all conditions necessary to make them safe. This is my first attempt to use the wi:: functions, so there might be a better way to do this.
next prev parent reply other threads:[~2015-04-24 21:13 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-26190-4@http.gcc.gnu.org/bugzilla/> 2015-04-24 21:12 ` wilson at gcc dot gnu.org 2015-04-24 21:13 ` wilson at gcc dot gnu.org [this message] 2023-10-12 3:33 ` pinskia at gcc dot gnu.org 2006-02-09 9:06 [Bug rtl-optimization/26190] New: " bonzini at gnu dot org 2006-02-09 9:07 ` [Bug rtl-optimization/26190] " bonzini at gnu dot org 2006-02-09 13:31 ` pinskia at gcc dot gnu dot org 2006-02-25 19:49 ` pinskia at gcc dot gnu dot 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-26190-4-YskYJe7FFm@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).