This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/26026] New: power of 2 mod missing optimisation
- From: "anton at samba dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Jan 2006 07:02:57 -0000
- Subject: [Bug tree-optimization/26026] New: power of 2 mod missing optimisation
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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