optimization/4079: unnecessary register move on simple code
mattias@virtutech.se
mattias@virtutech.se
Wed Aug 22 06:16:00 GMT 2001
>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:
More information about the Gcc-bugs
mailing list