This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug other/17103] New: Opportunity to replace multiply with shift/add sequence
- From: "gcc-bugzilla at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Aug 2004 14:59:17 -0000
- Subject: [Bug other/17103] New: Opportunity to replace multiply with shift/add sequence
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Description:
A non-optimal code sequence is illustraded. Duplicate using gcc 3.5 and
command line:
gcc -O3 -m32 -c test.c
Testcase:
long foo(long x)
{
return (x * 258);
}
Assembly:
Currently, gcc 3.5 generates the following:
foo:
mulli 3,3,258
blr
It would be more efficient to use a shift/add sequence:
foo:
or 0,3,3
rlwinm 3,3,8
add 0,0,0
add 3,3,0
blr
--
Summary: Opportunity to replace multiply with shift/add sequence
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P1
Component: other
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: steinmtz at us dot ibm dot com
CC: gcc-bugs at gcc dot gnu dot org,steinmtz at us dot ibm
dot com
GCC build triplet: powerpc64-linux
GCC host triplet: powerpc64-linux
GCC target triplet: powerpc64-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17103