rpm-build/rpmrc.in
Alexey Tourbin 0e8ab4e05c rpmrc.in: use -mtune=generic instead of -mtune=pentium4 for i[3456]86
We use i586 as our default generic arch for x86 processors.
But -mtune=pentium4 is preferable only for Intel processors,
and possibly disadvantageous for AMD chips.

I suggest we use -mtune=generic instead.  Here is what "man gcc" says
about -mtune=generic:

    Produce code optimized for the most common IA32/AMD64/EM64T
    processors.  If you know the CPU on which your code will run, then
    you should use the corresponding -mtune option instead of
    -mtune=generic.  But, if you do not know exactly what CPU users of
    your application will have, then you should use this option.

    As new processors are deployed in the marketplace, the behavior of
    this option will change.  Therefore, if you upgrade to a newer
    version of GCC, the code generated option will change to reflect the
    processors that were most common when that version of GCC was
    released.

Now if you're willing to take a look at gcc/gcc/config/i386/i386.c,
you can see that -mtune= option affects only "instruction costs".
For example, AMD chips take fewer cycles to execute some divide/mod
instructions than Intel processors.  Instruction costs can affect
peephole optimizer or something to make the resulting instruction
sequence take fewer cycles.  It appears that "generic32_cost" provides
reasonable compromise so that the resulting code runs quite well
on all modern CPUs.

Update.  I've been requested to provide some numbers.
I use perlbench-0.93 suite to measure libperl.so performance.

A) libperl.so compiled with -march=i586 -mtune=pentium4
B) libperl.so compiled with -march=i586 -mtune=generic

AMD Athlon 64              A       B
-------------            ---     ---
arith/mixed              100     106
arith/trig               100     100
array/copy               100     104
array/foreach            100      94
array/index              100     108
array/pop                100     109
array/shift              100     107
array/sort-num           100     103
array/sort               100     100
call/0arg                100     105
call/1arg                100      96
call/2arg                100     101
call/9arg                100     107
call/empty               100     108
call/fib                 100     103
call/method              100     106
call/wantarray           100     107
hash/copy                100      99
hash/each                100      91
hash/foreach-sort        100      96
hash/foreach             100     100
hash/get                 100     102
hash/set                 100     110
loop/for-c               100     104
loop/for-range-const     100     102
loop/for-range           100     103
loop/getline             100     106
loop/while-my            100     109
loop/while               100     113
re/const                 100     104
re/w                     100     102
startup/fewmod           100     104
startup/lotsofsub        100     107
startup/noprog           100     100
string/base64            100     102
string/htmlparser        100     102
string/index-const       100     110
string/index-var         100      74
string/ipol              100     105
string/tr                100     102
AVERAGE                  100     103

Intel Xeon                 A       B
----------               ---     ---
arith/mixed              100      98
arith/trig               100     138
array/copy               100     101
array/foreach            100     100
array/index              100      94
array/pop                100      99
array/shift              100     117
array/sort-num           100     103
array/sort               100     105
call/0arg                100     101
call/1arg                100      97
call/2arg                100      93
call/9arg                100      98
call/empty               100     100
call/fib                 100     116
call/method              100      92
call/wantarray           100     101
hash/copy                100     104
hash/each                100     102
hash/foreach-sort        100     102
hash/foreach             100      98
hash/get                 100     102
hash/set                 100      96
loop/for-c               100     128
loop/for-range-const     100     100
loop/for-range           100     103
loop/getline             100      94
loop/while-my            100     107
loop/while               100     102
re/const                 100      99
re/w                     100      92
startup/fewmod           100     101
startup/lotsofsub        100      98
startup/noprog           100     101
string/base64            100     100
string/htmlparser        100      70
string/index-const       100     103
string/index-var         100     101
string/ipol              100     105
string/tr                100      94
AVERAGE                  100     101

Look ma, I've got about 3% performance boost on Athlon64 and even some
minor improvement on Intel Xeon!  Also notice that, on Xeon, the
numbers are more diverse.  I believe that the numbers prove that,
compared to -mtune=pentium4, -mtune=generic is beneficial for Athlon64
and at least makes no harm for Xeon.

Here is how to run perlbench:

$ echo ${PWD##*/}
perlbench-0.93
$ cat perl1 perl2
LD_LIBRARY_PATH=$PWD/lib1 exec /usr/bin/perl "$@"
LD_LIBRARY_PATH=$PWD/lib2 exec /usr/bin/perl "$@"
$ ls -l lib?/libperl*
-rw-r--r-- 1 at at 1173944 Jan  9 03:42 lib1/libperl.so.5.8
-rw-r--r-- 1 at at 1204984 Jan  9 03:46 lib2/libperl.so.5.8
$ ./perlbench-run ./perl1 ./perl2
...
2007-01-09 04:54:07 +03:00

413 lines
12 KiB
Plaintext

#/*! \page config_rpmrc Default configuration: /usr/lib/rpm/rpmrc
# \verbatim
#
#
# This is a global RPM configuration file. All changes made here will
# be lost when the rpm package is upgraded. Any per-system configuration
# should be added to /etc/rpmrc, while per-user configuration should
# be added to ~/.rpmrc.
#
#############################################################
# Values for RPM_OPT_FLAGS for various platforms
optflags: i386 %optflags_default -march=i386 -mtune=generic
optflags: i486 %optflags_default -march=i486 -mtune=generic
optflags: i586 %optflags_default -march=i586 -mtune=generic
optflags: i686 %optflags_default -march=i686 -mtune=generic
optflags: pentium2 %optflags_default -march=pentium2 -mtune=pentium4
optflags: pentium3 %optflags_default -march=pentium3 -mtune=pentium4
optflags: pentium4 %optflags_default -march=pentium4
optflags: k6 %optflags_default -march=k6 -mtune=athlon-xp
optflags: athlon %optflags_default -march=athlon -mtune=athlon-xp
optflags: athlon_xp %optflags_default -march=athlon-xp
optflags: amd64 %optflags_default
optflags: ia64 %optflags_default
optflags: ia32e %optflags_default
optflags: x86_64 %optflags_default
optflags: noarch %optflags_default
# The official RPM starting with 3.0.5 uses -mieee on Alpha by default.
# We don't as to not kill floating-point performance, but packages which
# care might want to add that flag themselves.
optflags: alpha %optflags_default -march=ev4
optflags: alphaev5 %optflags_default -march=ev5
optflags: alphaev56 %optflags_default -march=ev56
optflags: alphapca56 %optflags_default -march=pca56
optflags: alphaev6 %optflags_default -march=ev6
optflags: alphaev67 %optflags_default -march=ev67
optflags: sparc %optflags_default -m32 -mcpu=v8 -mtune=ultrasparc
optflags: sparcv8 %optflags_default -m32 -mcpu=v8 -mtune=ultrasparc
optflags: sparcv9 %optflags_default -m32 -mcpu=ultrasparc
optflags: sparc64 %optflags_default -m64 -mcpu=ultrasparc
optflags: m68k %optflags_default -fomit-frame-pointer
optflags: ppc %optflags_default -fsigned-char
optflags: ppciseries %optflags_default -fsigned-char
optflags: ppcpseries %optflags_default -fsigned-char
optflags: ppc64 %optflags_default -fsigned-char
optflags: parisc %optflags_default -mpa-risc-1-0
optflags: hppa1.0 %optflags_default -mpa-risc-1-0
optflags: hppa1.1 %optflags_default -mpa-risc-1-0
optflags: hppa1.2 %optflags_default -mpa-risc-1-0
optflags: hppa2.0 %optflags_default -mpa-risc-1-0
optflags: mips %optflags_default
optflags: mipsel %optflags_default
optflags: armv3l %optflags_default -fsigned-char -fomit-frame-pointer -march=armv3
optflags: armv4b %optflags_default -fsigned-char -fomit-frame-pointer -march=armv4
optflags: armv4l %optflags_default -fsigned-char -fomit-frame-pointer -march=armv4
optflags: armv5b %optflags_default -fsigned-char -mcpu=xscale -mtune=xscale
optflags: armv5l %optflags_default -fsigned-char -mcpu=xscale -mtune=xscale
optflags: atarist %optflags_default -fomit-frame-pointer
optflags: atariste %optflags_default -fomit-frame-pointer
optflags: ataritt %optflags_default -fomit-frame-pointer
optflags: falcon %optflags_default -fomit-frame-pointer
optflags: atariclone %optflags_default -fomit-frame-pointer
optflags: milan %optflags_default -fomit-frame-pointer
optflags: hades %optflags_default -fomit-frame-pointer
optflags: s390 %optflags_default
optflags: s390x %optflags_default
#############################################################
# Canonical arch names and numbers
arch_canon: pentium4: pentium4 1
arch_canon: pentium3: pentium3 1
arch_canon: pentium2: pentium2 1
arch_canon: athlon_xp: athlon_xp 1
arch_canon: athlon: athlon 1
arch_canon: i686: i686 1
arch_canon: k6: k6 1
arch_canon: i586: i586 1
arch_canon: i486: i486 1
arch_canon: i386: i386 1
arch_canon: amd64: amd64 1
arch_canon: ia32e: ia32e 1
arch_canon: x86_64: x86_64 1
arch_canon: alpha: alpha 2
arch_canon: alphaev5: alphaev5 2
arch_canon: alphaev56: alphaev56 2
arch_canon: alphapca56:alphapca56 2
arch_canon: alphaev6: alphaev6 2
arch_canon: alphaev67: alphaev67 2
arch_canon: sparc: sparc 3
arch_canon: sun4: sparc 3
arch_canon: sun4m: sparc 3
arch_canon: sun4c: sparc 3
arch_canon: sun4d: sparc 3
arch_canon: sparcv8: sparcv8 3
arch_canon: sparcv9: sparcv9 3
# This is really a place holder for MIPS.
arch_canon: mips: mips 4
arch_canon: ppc: ppc 5
arch_canon: ppciseries: ppciseries 5
arch_canon: ppcpseries: ppcpseries 5
arch_canon: m68k: m68k 6
arch_canon: IP: sgi 7
arch_canon: rs6000: rs6000 8
arch_canon: ia64: ia64 9
arch_canon: sparc64:sparc64 10
arch_canon: sun4u: sparc64 10
arch_canon: mipsel: mipsel 11
arch_canon: armv3l: armv3l 12
arch_canon: armv4b: armv4b 12
arch_canon: armv4l: armv4l 12
arch_canon: armv5b: armv5b 12
arch_canon: armv5l: armv5l 12
arch_canon: m68kmint: m68kmint 13
arch_canon: atarist: m68kmint 13
arch_canon: atariste: m68kmint 13
arch_canon: ataritt: m68kmint 13
arch_canon: falcon: m68kmint 13
arch_canon: atariclone: m68kmint 13
arch_canon: milan: m68kmint 13
arch_canon: hades: m68kmint 13
arch_canon: s390: s390 14
arch_canon: i370: i370 14
arch_canon: s390x: s390x 15
arch_canon: ppc64: ppc64 16
arch_canon: sh: sh 17
arch_canon: xtensa: xtensa 18
#############################################################
# Canonical OS names and numbers
os_canon: Linux: Linux 1
os_canon: IRIX: Irix 2
# This is wrong
os_canon: SunOS5: solaris 3
os_canon: SunOS4: SunOS 4
os_canon: AmigaOS: AmigaOS 5
os_canon: AIX: AIX 5
os_canon: HP-UX: hpux10 6
os_canon: OSF1: osf1 7
os_canon: osf4.0: osf1 7
os_canon: osf3.2: osf1 7
os_canon: FreeBSD: FreeBSD 8
os_canon: SCO_SV: SCO_SV3.2v5.0.2 9
os_canon: IRIX64: Irix64 10
os_canon: NEXTSTEP: NextStep 11
os_canon: BSD_OS: bsdi 12
os_canon: machten: machten 13
os_canon: CYGWIN32_NT: cygwin32 14
os_canon: CYGWIN32_95: cygwin32 15
os_canon: UNIX_SV: MP_RAS: 16
os_canon: MiNT: FreeMiNT 17
os_canon: OS/390: OS/390 18
os_canon: VM/ESA: VM/ESA 19
os_canon: Linux/390: OS/390 20
os_canon: Linux/ESA: VM/ESA 20
os_canon: Darwin: darwin 21
os_canon: MacOSX: macosx 21
#############################################################
# For a given uname().machine, the default build arch
buildarchtranslate: osfmach3_i686: i386
buildarchtranslate: osfmach3_i586: i386
buildarchtranslate: osfmach3_i486: i386
buildarchtranslate: osfmach3_i386: i386
buildarchtranslate: ia64: ia64
buildarchtranslate: x86_64: x86_64
buildarchtranslate: amd64: x86_64
buildarchtranslate: ia32e: x86_64
buildarchtranslate: pentium4: pentium4
buildarchtranslate: pentium3: pentium3
buildarchtranslate: pentium2: pentium2
buildarchtranslate: athlon_xp: athlon_xp
buildarchtranslate: athlon: athlon
buildarchtranslate: i686: i686
buildarchtranslate: k6: k6
buildarchtranslate: i586: i586
buildarchtranslate: i486: i486
buildarchtranslate: i386: i386
buildarchtranslate: alphaev5: alpha
buildarchtranslate: alphaev56: alpha
buildarchtranslate: alphapca56: alpha
buildarchtranslate: alphaev6: alpha
buildarchtranslate: alphaev67: alpha
buildarchtranslate: sun4c: sparc
buildarchtranslate: sun4d: sparc
buildarchtranslate: sun4m: sparc
buildarchtranslate: sparcv8: sparc
buildarchtranslate: sparcv9: sparc
buildarchtranslate: sun4u: sparc64
buildarchtranslate: osfmach3_ppc: ppc
buildarchtranslate: powerpc: ppc
buildarchtranslate: powerppc: ppc
buildarchtranslate: ppciseries: ppc
buildarchtranslate: ppcpseries: ppc
buildarchtranslate: atarist: m68kmint
buildarchtranslate: atariste: m68kmint
buildarchtranslate: ataritt: m68kmint
buildarchtranslate: falcon: m68kmint
buildarchtranslate: atariclone: m68kmint
buildarchtranslate: milan: m68kmint
buildarchtranslate: hades: m68kmint
buildarchtranslate: s390: s390
buildarchtranslate: s390x: s390x
#############################################################
# Architecture compatibility
arch_compat: alphaev67: alphaev6
arch_compat: alphaev6: alphapca56
arch_compat: alphapca56: alphaev56
arch_compat: alphaev56: alphaev5
arch_compat: alphaev5: alpha
arch_compat: alpha: axp noarch
arch_compat: pentium4: pentium3
arch_compat: athlon_xp: athlon pentium3
arch_compat: pentium3: pentium2
arch_compat: athlon: k6 pentium2
arch_compat: pentium2: i686
arch_compat: i686: i586
arch_compat: k6: i586
arch_compat: i586: i486
arch_compat: i486: i386
arch_compat: i386: noarch
arch_compat: osfmach3_i686: i686 osfmach3_i586
arch_compat: osfmach3_i586: i586 osfmach3_i486
arch_compat: osfmach3_i486: i486 osfmach3_i386
arch_compat: osfmach3_i386: i486
arch_compat: osfmach3_ppc: ppc
arch_compat: powerpc: ppc
arch_compat: powerppc: ppc
arch_compat: ppciseries: ppc
arch_compat: ppcpseries: ppc
arch_compat: ppc64: ppc
arch_compat: ppc: rs6000
arch_compat: rs6000: noarch
arch_compat: sun4c: sparc
arch_compat: sun4d: sparc
arch_compat: sun4m: sparc
arch_compat: sun4u: sparc64
arch_compat: sparc64: sparcv9
arch_compat: sparcv9: sparc
arch_compat: sparcv8: sparc
arch_compat: sparc: noarch
arch_compat: mips: noarch
arch_compat: mipsel: noarch
arch_compat: hppa2.0: hppa1.2
arch_compat: hppa1.2: hppa1.1
arch_compat: hppa1.1: hppa1.0
arch_compat: hppa1.0: parisc
arch_compat: parisc: noarch
arch_compat: armv5b: noarch
arch_compat: armv5l: noarch
arch_compat: armv4b: noarch
arch_compat: armv4l: armv3l
arch_compat: armv3l: noarch
arch_compat: atarist: m68kmint noarch
arch_compat: atariste: m68kmint noarch
arch_compat: ataritt: m68kmint noarch
arch_compat: falcon: m68kmint noarch
arch_compat: atariclone: m68kmint noarch
arch_compat: milan: m68kmint noarch
arch_compat: hades: m68kmint noarch
arch_compat: i370: noarch
arch_compat: s390: noarch
arch_compat: s390x: s390 noarch
arch_compat: ia64: noarch
arch_compat: amd64: x86_64
arch_compat: ia32e: x86_64
arch_compat: x86_64: athlon_xp pentium4
os_compat: IRIX64: IRIX
os_compat: solaris2.7: solaris2.3 solaris2.4 solaris2.5 solaris2.6
os_compat: solaris2.6: solaris2.3 solaris2.4 solaris2.5
os_compat: solaris2.5: solaris2.3 solaris2.4
os_compat: solaris2.4: solaris2.3
os_compat: hpux11.00: hpux10.30
os_compat: hpux10.30: hpux10.20
os_compat: hpux10.20: hpux10.10
os_compat: hpux10.10: hpux10.01
os_compat: hpux10.01: hpux10.00
os_compat: hpux10.00: hpux9.07
os_compat: hpux9.07: hpux9.05
os_compat: hpux9.05: hpux9.04
os_compat: osf4.0: osf3.2 osf1
os_compat: ncr-sysv4.3: ncr-sysv4.2
os_compat: FreeMiNT: mint MiNT TOS
os_compat: MiNT: FreeMiNT mint TOS
os_compat: mint: FreeMiNT MiNT TOS
os_compat: TOS: FreeMiNT MiNT mint
os_compat: BSD_OS: bsdi
os_compat: bsdi4.0: bsdi
os_compat: Darwin: MacOSX
buildarch_compat: ia64: noarch
buildarch_compat: x86_64: noarch
buildarch_compat: amd64: x86_64
buildarch_compat: ia32e: x86_64
buildarch_compat: pentium4: pentium3
buildarch_compat: athlon_xp: athlon pentium3
buildarch_compat: pentium3: pentium2
buildarch_compat: athlon: k6 pentium2
buildarch_compat: pentium2: i686
buildarch_compat: i686: i586
buildarch_compat: k6: i586
buildarch_compat: i586: i486
buildarch_compat: i486: i386
buildarch_compat: i386: noarch
buildarch_compat: sun4c: noarch
buildarch_compat: sun4d: noarch
buildarch_compat: sun4m: noarch
buildarch_compat: sun4u: noarch
buildarch_compat: sparc64: noarch
buildarch_compat: sparcv9: sparc
buildarch_compat: sparc: noarch
buildarch_compat: alphaev67: alphaev6
buildarch_compat: alphaev6: alphapca56
buildarch_compat: alphapca56: alphaev56
buildarch_compat: alphaev56: alphaev5
buildarch_compat: alphaev5: alpha
buildarch_compat: alpha: noarch
buildarch_compat: m68k: noarch
buildarch_compat: ppciseries: noarch
buildarch_compat: ppcpseries: noarch
buildarch_compat: ppc: noarch
buildarch_compat: ppc64: noarch
buildarch_compat: mips: noarch
buildarch_compat: mipsel: noarch
buildarch_compat: armv3l: noarch
buildarch_compat: armv4b: noarch
buildarch_compat: armv4l: noarch
buildarch_compat: armv5b: noarch
buildarch_compat: armv5l: noarch
buildarch_compat: hppa2.0: hppa1.2
buildarch_compat: hppa1.2: hppa1.1
buildarch_compat: hppa1.1: hppa1.0
buildarch_compat: hppa1.0: parisc
buildarch_compat: parisc: noarch
buildarch_compat: atarist: m68kmint noarch
buildarch_compat: atariste: m68kmint noarch
buildarch_compat: ataritt: m68kmint noarch
buildarch_compat: falcon: m68kmint noarch
buildarch_compat: atariclone: m68kmint noarch
buildarch_compat: milan: m68kmint noarch
buildarch_compat: hades: m68kmint noarch
buildarch_compat: ia64: noarch
buildarch_compat: s390: noarch
buildarch_compat: s390x: noarch
macrofiles: @RPMCONFIGDIR@/macros:@RPMCONFIGDIR@/%{_target}/macros:@SYSCONFIGDIR@/macros.specspo:@SYSCONFIGDIR@/macros.db1:@SYSCONFIGDIR@/macros.cdb:@SYSCONFIGDIR@/macros:@SYSCONFIGDIR@/%{_target}/macros:@SYSCONFIGDIR@/macros.d/*:~/.rpmmacros
# \endverbatim
#*/