Bug 5143

Summary: Default optflags for some x86 machines could be better
Product: [Retired] Red Hat Linux Reporter: andrewem
Component: rpmAssignee: Jeff Johnson <jbj>
Severity: low Docs Contact:
Priority: low    
Version: 6.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-02-08 19:08:15 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description andrewem 1999-09-15 01:43:55 UTC
Default optflags for some x86 machines could be better.

I would suggest the alignment be reduced for processors
>i486.  The default of 16 bytes is best for an i486 cache
(one cache line), and wasteful on newer processors where 4
bytes will do just as well.  This reduces executable size
and improves performance slightly.
  optflags: i586 -O2 -m486 -malign-loops=2 -malign-jumps=2
  optflags: i686 -O2 -m486 -malign-loops=2 -malign-jumps=2
Note the amount is specified in powers of 2 (2^2 = 4).

The -fno-strength-reduce option probably isn't needed
anymore; it was a kludge for a rare optimizer bug that I've
only ever seen realized in the kernel, but people seem to
have gotten used to using it.

Adding the -pipe option speeds up compiles a bit, especially
on SMP systems.  The tradeoff is more memory used and less
temporary disk space used, as the compiler output is piped
directly to the assembler when this option is used.

Comment 1 andrewem 2000-02-08 19:08:59 UTC
Just noticed this...

echo "int main(void){return 0;}" > test.c
gcc -O2 -c -S -fverbose-asm test.c

At the top of test.s you will find lists ("options passed:" and "options
enabled:") of all the optimization options passed and enabled.  This will be
helpful for choosing which options in addition to -O2 to add (ie. avoid
repeating options).

Comment 2 Jeff Johnson 2001-02-21 19:34:42 UTC
Yes, there will always be better optflags.

FWIW, rpm can now do a better job of using different optflags for different
if necessary, using per-platform macro configurations. Feel free to send me a
with your favorite optflags instantiated in
if you want rpm to carry your per-platform (i.e. per-vendor) optflags, see
in rpm sources for where to do your dirty.