public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/26026]  New: power of 2 mod missing optimisation
@ 2006-01-30  7:03 anton at samba dot org
  2006-01-30 10:20 ` [Bug tree-optimization/26026] " rguenth at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: anton at samba dot org @ 2006-01-30  7:03 UTC (permalink / raw)
  To: gcc-bugs

gcc is using a divide and multiply where it could be using shift/ands:

unsigned long f1(unsigned long x, unsigned long n)
{
        return x % (1UL << n);
}

produces:

f1:
        li 9,1
        slw 9,9,4
        divwu 0,3,9
        mullw 0,0,9
        subf 3,0,3
        blr


-- 
           Summary: power of 2 mod missing optimisation
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anton at samba dot org
GCC target triplet: powerpc64-linux


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


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

end of thread, other threads:[~2007-06-22 17:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-30  7:03 [Bug tree-optimization/26026] New: power of 2 mod missing optimisation anton at samba dot org
2006-01-30 10:20 ` [Bug tree-optimization/26026] " rguenth at gcc dot gnu dot org
2006-01-31  2:45 ` amodra at bigpond dot net dot au
2006-02-03 12:37 ` amodra at bigpond dot net dot au
2006-03-24  3:38 ` [Bug rtl-optimization/26026] " patchapp at dberlin dot org
2006-04-18 23:45 ` amodra at gcc dot gnu dot org
2006-04-18 23:46 ` amodra at bigpond dot net dot au
2006-04-19 14:57 ` pinskia at gcc dot gnu dot org
2006-04-21 12:10 ` dave dot korn at artimi dot com
2006-10-19  4:06 ` bergner at gcc dot gnu dot org
2007-06-22 17:56 ` bergner 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).