Bug 5143 - Default optflags for some x86 machines could be better
Summary: Default optflags for some x86 machines could be better
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: rpm
Version: 6.0
Hardware: i386
OS: Linux
low
low
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 1999-09-15 01:43 UTC by andrewem
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2000-02-08 19:08:15 UTC
Embargoed:


Attachments (Terms of Use)

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
-malign-functions=2
  optflags: i686 -O2 -m486 -malign-loops=2 -malign-jumps=2
-malign-functions=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
platforms,
if necessary, using per-platform macro configurations. Feel free to send me a
patch
with your favorite optflags instantiated in
/usr/lib/rpm/<arch>-<vendor>-<os>/macros
if you want rpm to carry your per-platform (i.e. per-vendor) optflags, see
installplatform
in rpm sources for where to do your dirty.


Note You need to log in before you can comment on or make changes to this bug.