public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/45215]  New: Tree-optimization misses a trick with bit tests
@ 2010-08-06 21:29 bernds at gcc dot gnu dot org
  2010-08-06 21:49 ` [Bug tree-optimization/45215] " rguenth at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: bernds at gcc dot gnu dot org @ 2010-08-06 21:29 UTC (permalink / raw)
  To: gcc-bugs

The following testcase

int x (int t)
{
  if (t & 256)
    return -26;
  return 0;
}

can be implemented as a sequence of two shifts and one and operation:
        movl    4(%esp), %eax
        sall    $23, %eax
        sarl    $31, %eax
        andl    $-26, %eax
        ret

Initial RTL generation produces a more complicated sequence which is not
optimized unless the combiner is extended to handle four insns.  The tree
optimizers could be enhanced to handle this pattern and related ones, although
it would have to take costs into account, as on some targets other sequences
may be better.


-- 
           Summary: Tree-optimization misses a trick with bit tests
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bernds at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug tree-optimization/45215] Tree-optimization misses a trick with bit tests
  2010-08-06 21:29 [Bug tree-optimization/45215] New: Tree-optimization misses a trick with bit tests bernds at gcc dot gnu dot org
@ 2010-08-06 21:49 ` rguenth at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-08-06 21:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2010-08-06 21:49 -------
Confirmed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|richard dot guenther at     |rguenth at gcc dot gnu dot
                   |gmail dot com               |org
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |missed-optimization
   Last reconfirmed|0000-00-00 00:00:00         |2010-08-06 21:49:25
               date|                            |


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


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

end of thread, other threads:[~2010-08-06 21:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-06 21:29 [Bug tree-optimization/45215] New: Tree-optimization misses a trick with bit tests bernds at gcc dot gnu dot org
2010-08-06 21:49 ` [Bug tree-optimization/45215] " rguenth at gcc dot gnu 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).