public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/29789] Missed invariant out of the loop with conditionals and shifts Date: Fri, 20 Apr 2007 14:34:00 -0000 [thread overview] Message-ID: <20070420143358.9647.qmail@sourceware.org> (raw) In-Reply-To: <bug-29789-10053@http.gcc.gnu.org/bugzilla/> ------- Comment #5 from rguenth at gcc dot gnu dot org 2007-04-20 15:33 ------- Note that this does fix the loop invariant motion only in the case of two ifs can be merged (because that re-instantiates the A & (1 << B) form). The following parts are still not resolved: void quantum_cnot(int control, int target, unsigned long *state, int size) { int i; for(i=0; i<size; i++) { if (state[i] & ((unsigned long) 1 << control)) state[i] ^= ((unsigned long) 1 << target); } } (and more similar loops in libquantum). It would be nice if rtl loop-invariant motion could detect this form: (insn 23 22 24 4 (parallel [ (set (reg:DI 67) (lshiftrt:DI (reg:DI 62 [ D.1992 ]) (subreg:QI (reg/v:SI 63 [ control ]) 0))) (clobber (reg:CC 17 flags)) ]) 470 {*lshrdi3_1_rex64} (nil) (nil)) (insn 24 23 25 4 (parallel [ (set (reg:SI 68) (and:SI (subreg:SI (reg:DI 67) 0) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) 301 {*andsi_1} (nil) (nil)) and move the invariant (1 << control). It does move the (1 << target) which looks like (insn 30 28 31 5 (set (reg:DI 70) (const_int 1 [0x1])) 82 {*movdi_1_rex64} (nil) (nil)) (insn 31 30 32 5 (parallel [ (set (reg:DI 69) (ashift:DI (reg:DI 70) (subreg:QI (reg/v:SI 64 [ target ]) 0))) (clobber (reg:CC 17 flags)) ]) 411 {*ashldi3_1_rex64} (nil) (expr_list:REG_EQUAL (ashift:DI (const_int 1 [0x1]) (subreg:QI (reg/v:SI 64 [ target ]) 0)) (nil))) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29789
next prev parent reply other threads:[~2007-04-20 14:34 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2006-11-09 21:54 [Bug tree-optimization/29789] New: Missed optimization in libquantum rguenth at gcc dot gnu dot org 2006-11-09 22:07 ` [Bug tree-optimization/29789] " rguenth at gcc dot gnu dot org 2006-11-10 1:56 ` pinskia at gcc dot gnu dot org 2006-11-10 9:21 ` rguenth at gcc dot gnu dot org 2007-04-20 12:52 ` [Bug tree-optimization/29789] Missed invariant out of the loop with conditionals and shifts rguenth at gcc dot gnu dot org 2007-04-20 14:34 ` rguenth at gcc dot gnu dot org [this message] 2007-04-20 15:09 ` rakdver at atrey dot karlin dot mff dot cuni dot cz 2007-04-20 16:00 ` rguenth at gcc dot gnu dot org 2007-04-22 11:27 ` rguenth at gcc dot gnu dot org 2007-04-22 11:35 ` rguenth 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=20070420143358.9647.qmail@sourceware.org \ --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).