public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/31261] Missed tree optimizations: (8 - (x & 7)) & 7
       [not found] <bug-31261-4@http.gcc.gnu.org/bugzilla/>
@ 2010-09-30 21:23 ` jakub at gcc dot gnu.org
  0 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-09-30 21:23 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31261

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-09-30 19:21:44 UTC ---
Author: jakub
Date: Thu Sep 30 19:21:34 2010
New Revision: 164761

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164761
Log:
    PR tree-optimization/31261
    * fold-const.c (fold_binary): Optimize ((A & N) + B) & M
    for constants M and N, M == (1LL << cst) - 1 && (N & M) == M.

    * gcc.dg/tree-ssa/pr31261.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/pr31261.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/31261] Missed tree optimizations: (8 - (x & 7)) & 7
  2007-03-19 11:05 [Bug tree-optimization/31261] New: " jakub at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-03-21 15:06 ` jakub at gcc dot gnu dot org
@ 2007-03-21 18:28 ` trt at acm dot org
  3 siblings, 0 replies; 5+ messages in thread
From: trt at acm dot org @ 2007-03-21 18:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from trt at acm dot org  2007-03-21 18:28 -------
I think this could be generalized to more operators, e.g. 

     (y | (x & 7)) & 7
        ^ (bitwise or, xor, multiply, ...)

This optimization could be for "e & M" where e contains a subexpression of the
form "t & N" which can (sometimes) be simplified to "t".  I suppose that would
require walking the tree.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31261


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/31261] Missed tree optimizations: (8 - (x & 7)) & 7
  2007-03-19 11:05 [Bug tree-optimization/31261] New: " jakub at gcc dot gnu dot org
  2007-03-19 11:17 ` [Bug tree-optimization/31261] " rguenth at gcc dot gnu dot org
  2007-03-19 11:19 ` rguenth at gcc dot gnu dot org
@ 2007-03-21 15:06 ` jakub at gcc dot gnu dot org
  2007-03-21 18:28 ` trt at acm dot org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-03-21 15:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2007-03-21 15:05 -------
Created an attachment (id=13244)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13244&action=view)
gcc43-pr31261.patch

Patch I'm testing ATM.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31261


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/31261] Missed tree optimizations: (8 - (x & 7)) & 7
  2007-03-19 11:05 [Bug tree-optimization/31261] New: " jakub at gcc dot gnu dot org
  2007-03-19 11:17 ` [Bug tree-optimization/31261] " rguenth at gcc dot gnu dot org
@ 2007-03-19 11:19 ` rguenth at gcc dot gnu dot org
  2007-03-21 15:06 ` jakub at gcc dot gnu dot org
  2007-03-21 18:28 ` trt at acm dot org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-03-19 11:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2007-03-19 11:19 -------
You would need to enhance associate_trees () or the reassoc pass to fix this.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |missed-optimization, TREE
   Last reconfirmed|0000-00-00 00:00:00         |2007-03-19 11:19:48
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31261


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/31261] Missed tree optimizations: (8 - (x & 7)) & 7
  2007-03-19 11:05 [Bug tree-optimization/31261] New: " jakub at gcc dot gnu dot org
@ 2007-03-19 11:17 ` rguenth at gcc dot gnu dot org
  2007-03-19 11:19 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-03-19 11:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2007-03-19 11:17 -------
(x & 7) + 8 & 7 is actually ((x & 7) + 8) & 7


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31261


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-09-30 19:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-31261-4@http.gcc.gnu.org/bugzilla/>
2010-09-30 21:23 ` [Bug tree-optimization/31261] Missed tree optimizations: (8 - (x & 7)) & 7 jakub at gcc dot gnu.org
2007-03-19 11:05 [Bug tree-optimization/31261] New: " jakub at gcc dot gnu dot org
2007-03-19 11:17 ` [Bug tree-optimization/31261] " rguenth at gcc dot gnu dot org
2007-03-19 11:19 ` rguenth at gcc dot gnu dot org
2007-03-21 15:06 ` jakub at gcc dot gnu dot org
2007-03-21 18:28 ` trt at acm dot org

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).