public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/45218]  New: Mathematical simplification missed at tree-level
@ 2010-08-06 22:39 bernds at gcc dot gnu dot org
  2010-08-06 22:51 ` [Bug tree-optimization/45218] " steven 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 22:39 UTC (permalink / raw)
  To: gcc-bugs

Consider
  a = (x / 39) * 32 + (x % 39)

If we have no instruction to produce both the quotient and the remaineder, this
can be computed as
  y = x / 39
  z = x - y * 39
  a = y * 32 + z

The last line can be simplified by substituting:
  a = y * 32 + x - y * 39
  a = y * (32 - 39) + x
  a = x - y * 7

Testcase:

int i_size;

extern void foo (void);
int udf_check_anchor_block(int block)
{
 i_size = ( ( ( (block) / 39 ) << 5 ) + ( block % 39 ));
 return 1;
}

The tree optimization phase misses this, and this PR should stay open until
that is resolved.  The combiner can handle it if it is able to look at 4
instructions.


-- 
           Summary: Mathematical simplification missed at tree-level
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: enhancement
          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=45218


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

* [Bug tree-optimization/45218] Mathematical simplification missed at tree-level
  2010-08-06 22:39 [Bug tree-optimization/45218] New: Mathematical simplification missed at tree-level bernds at gcc dot gnu dot org
@ 2010-08-06 22:51 ` steven at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: steven at gcc dot gnu dot org @ 2010-08-06 22:51 UTC (permalink / raw)
  To: gcc-bugs



-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-08-06 22:51:00
               date|                            |


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


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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-06 22:39 [Bug tree-optimization/45218] New: Mathematical simplification missed at tree-level bernds at gcc dot gnu dot org
2010-08-06 22:51 ` [Bug tree-optimization/45218] " steven 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).