960b801f9b
For gcc pre 4.2 -march=core2 should fall back to -march=nocona rather than -march=pentium-m
120 lines
3.1 KiB
Text
120 lines
3.1 KiB
Text
# $NetBSD: subr_gcc,v 1.6 2009/01/12 22:11:58 abs Exp $
|
|
|
|
# Return gcc version string
|
|
gcc_ver()
|
|
{
|
|
gcc=$1
|
|
${gcc} -dumpversion | $SED -e 's/^[^0-9\.]\{1,\}//' -e 's/[^0-9\.]\{1,\}$//'
|
|
}
|
|
|
|
gcc_ser()
|
|
{
|
|
gcc=$1
|
|
gcc_ver $gcc | $AWK -F. '{ print ($1*1000+$2)}'
|
|
}
|
|
|
|
gcc_fixup_arch_flags()
|
|
{
|
|
gcc=$1
|
|
shift
|
|
gcc_arch_flags="$*"
|
|
|
|
# Fixup options for older gccs.
|
|
# Entries can be recursive - eg:
|
|
# -march=k6-3 -> -march=k6 -> -march=pentium -> -march=i486
|
|
#
|
|
# The format of table is
|
|
# gcc_version_in_which_option_was_introduced : new_option : old_option
|
|
|
|
$AWK -F: -v "flags=$gcc_arch_flags" -v "gcc_ver=$(gcc_ver $gcc)" '
|
|
{ if (gcc_ver < $1) { map[$2] = ""$3 } }
|
|
END {
|
|
FS=" "; split(flags, flaglist);
|
|
for (af in flaglist) {
|
|
flag = flaglist[af];
|
|
while (flag in map) {
|
|
flag = map[flag]
|
|
}
|
|
print flag
|
|
}
|
|
}
|
|
' <<EOD
|
|
2.90:-march=i386:-mno-486
|
|
2.90:-march=i486:-m486
|
|
2.90:-march=pentium:-m486
|
|
2.90:-march=pentiumpro:-m486
|
|
2.90:-mcpu=21164a:
|
|
2.90:-mcpu=arm610:-m6
|
|
2.90:-mcpu=arm710:-m6
|
|
2.90:-mcpu=cypress:-mcypress
|
|
2.90:-mcpu=sparclite:-msparclite
|
|
2.90:-mcpu=strongarm110:-m6
|
|
2.90:-mcpu=supersparc:-msupersparc
|
|
2.90:-mcpu=v9:-mv8
|
|
2.95:-march=k6:-march=pentium
|
|
3.0:-march=athlon:-march=pentiumpro
|
|
3.1:-march=athlon-4:-march=athlon
|
|
3.1:-march=athlon-mp:-march=athlon
|
|
3.1:-march=athlon-tbird:-march=athlon
|
|
3.1:-march=athlon-xp:-march=athlon
|
|
3.1:-march=k6-2:-march=k6
|
|
3.1:-march=k6-3:-march=k6
|
|
3.1:-march=pentium-mmx:-march=pentium
|
|
3.1:-march=pentium2:-march=pentiumpro
|
|
3.1:-march=pentium3 -mno-sse:-march=pentiumpro
|
|
3.1:-march=pentium3:-march=pentiumpro
|
|
3.1:-march=pentium4:-march=pentiumpro
|
|
3.1:-march=r2000:-cpu=r2000
|
|
3.1:-march=r3000:-cpu=r3000
|
|
3.1:-march=r3900:-cpu=r3900
|
|
3.1:-march=r4000:-cpu=r4000
|
|
3.1:-march=r4100:-cpu=r4100
|
|
3.1:-march=r4300:-cpu=r4300
|
|
3.1:-march=r4400:-cpu=r4400
|
|
3.1:-march=r4600:-cpu=r4600
|
|
3.1:-march=r5000:-cpu=r5000
|
|
3.1:-march=r6000:-cpu=r6000
|
|
3.1:-march=r8000:-cpu=r8000
|
|
3.1:-mcpu=21264a:-mcpu=21264
|
|
3.1:-mcpu=7400:-mcpu=750
|
|
3.1:-mcpu=7450:-mcpu=750
|
|
3.1:-mfpmath=sse:
|
|
3.1:-mmmx:
|
|
3.1:-msse2:
|
|
3.1:-msse:
|
|
3.1:-mtune=r2000:-cpu=r2000
|
|
3.1:-mtune=r3000:-cpu=r3000
|
|
3.1:-mtune=r3900:-cpu=r3900
|
|
3.1:-mtune=r4000:-cpu=r4000
|
|
3.1:-mtune=r4100:-cpu=r4100
|
|
3.1:-mtune=r4300:-cpu=r4300
|
|
3.1:-mtune=r4400:-cpu=r4400
|
|
3.1:-mtune=r4600:-cpu=r4600
|
|
3.1:-mtune=r5000:-cpu=r5000
|
|
3.1:-mtune=r6000:-cpu=r6000
|
|
3.1:-mtune=r8000:-cpu=r8000
|
|
3.3:-march=c3:-march=i586
|
|
3.3:-march=winchip-c6:-march=i586
|
|
3.3:-march=winchip2:-march=i586
|
|
3.4:-march=athlon-fx:-march=athlon-xp
|
|
3.4:-march=athlon64:-march=athlon-xp
|
|
3.4:-march=c3-2:-march=c3
|
|
3.4:-march=k8:-march=athlon-xp
|
|
3.4:-march=nocona:-march=pentium4
|
|
3.4:-march=opteron:-march=athlon-xp
|
|
3.4:-march=pentium-m:-march=pentium3
|
|
3.4:-march=pentium3m:-march=pentium3
|
|
3.4:-march=pentium4m:-march=pentium4
|
|
3.4:-march=prescott:-march=pentium4
|
|
3.4:-msse3:
|
|
4.2:-m3dnow:
|
|
4.2:-march=native:
|
|
4.3:-march=amdfam10:-march=athlon64
|
|
4.3:-march=athlon64-sse3:-march=athlon64
|
|
4.3:-march=barcelona:-march=athlon64
|
|
4.3:-march=core2:-march=nocona
|
|
4.3:-march=geode:-march=k6-3
|
|
4.3:-march=k8-sse3:-march=k8
|
|
4.3:-march=opteron-sse3:-march=opteron
|
|
EOD
|
|
}
|