This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug other/17103] New: Opportunity to replace multiply with shift/add sequence


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]