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]

optimization/4079: unnecessary register move on simple code



>Number:         4079
>Category:       optimization
>Synopsis:       unnecessary register move on simple code
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          pessimizes-code
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 22 06:16:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     mattias@virtutech.se
>Release:        gcc-3.0.1 for powerpc-unknown-linux-gnu
>Organization:
>Environment:
powerpc-unknown-linux-gnu (YDL 1.2.1)
>Description:
This code:

unsigned mulh(unsigned a, unsigned b)
{
        return ((unsigned long long)a * (unsigned long long)b) >> 32;
}

produces this:

   0:   7d 23 20 16     mulhwu  r9,r3,r4
   4:   7d 2a 4b 78     mr      r10,r9
   8:   7d 43 53 78     mr      r3,r10
   c:   4e 80 00 20     blr

when compiled with -O2.
I would have expected mulhwu r3,r3,r4; blr
>How-To-Repeat:
gcc -O2 -c mulh.c
with gcc-3.0.1 for ppc (-mcpu=<target> changes nothing)
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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