optimization/7067: -Os with -mcpu=powerpc optimizes for speed (?) instead of space
fshvaige@cisco.com
fshvaige@cisco.com
Tue Jun 18 09:22:00 GMT 2002
>Number: 7067
>Category: optimization
>Synopsis: -Os with -mcpu=powerpc optimizes for speed (?) instead of space
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: pessimizes-code
>Submitter-Id: net
>Arrival-Date: Tue Jun 18 08:06:13 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: fshvaige@cisco.com
>Release: 3.1 20020510 (prerelease)
>Organization:
>Environment:
../gcc-3.1/configure --with-gcc-version-trigger=/home/install/gcc-3.1/gcc/version.c --host=i686-pc-linux-gnu --with-newlib --enable-target-optspace --target=ppc-eabi --prefix=/home/crossGCC/ppc-eabi --with-local-prefix=/home/crossGCC/ppc-eabi --program-prefix=ppc-eabi- --enable-languages=c,c++ -v --norecursion
>Description:
File test4.c:
unsigned f (unsigned v) {
return v * 10;
}
Command line:
ppc-eabi-gcc -S -Os test4.c
Produced code (right, space optimized):
f:
mulli 3,3,10
blr
Command line:
ppc-eabi-gcc -S -Os -mcpu=powerpc test4.c
Produced code (wrong, probably speed optimized ?):
f:
mr 0,3
slwi 3,3,2
add 3,3,0
slwi 3,3,1
blr
Note: instruction "mulli" present in powerpc and even used by the same compiler and same command line for the very alike function, so problem is somewhere in optimization.
File test4a.c:
unsigned f (unsigned v) {
return v * 11;
}
Command line:
ppc-eabi-gcc -S -Os -mcpu=powerpc test4a.c
Produced code (right):
f:
mulli 3,3,11
blr
>How-To-Repeat:
ppc-eabi-gcc -S -Os test4.c
ppc-eabi-gcc -S -Os -mcpu=powerpc test4.c
ppc-eabi-gcc -S -Os -mcpu=powerpc test4a.c
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list