From 3c26b189ed0e3ef58ee07c8448514ab378081b52 Mon Sep 17 00:00:00 2001 From: abs Date: Thu, 1 Apr 2004 19:37:59 +0000 Subject: Update cpuflags to 0.64: - Do nothing on x86_64 (for now). Thanks to Wolfgang S. Rupprecht - Digital AlphaPC 164SX. Thanks to HATANO Hiromichi. - Intel Pentium/MMX & Unrecognised Athlon XP. Thanks to Kimmo Suominen - Mips update for gcc 3.1 and later. Thanks to Andreas Yankopolus - Handle converting flags for old gcc versions recursively. Most excessive case would be using cpuflags on a k6-3 win gcc 2.89 which would map -march=k6-3 -> -march=k6 -> -march=pentium -> -march=i486 --- devel/cpuflags/Makefile | 4 +- devel/cpuflags/files/cpuflags.NetBSD | 86 +++++++++++++++++++++++++----------- 2 files changed, 63 insertions(+), 27 deletions(-) (limited to 'devel') diff --git a/devel/cpuflags/Makefile b/devel/cpuflags/Makefile index f0351f80ac3..e33761549cc 100644 --- a/devel/cpuflags/Makefile +++ b/devel/cpuflags/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.67 2004/03/17 00:26:55 abs Exp $ +# $NetBSD: Makefile,v 1.68 2004/04/01 19:37:59 abs Exp $ # -DISTNAME= cpuflags-0.63 +DISTNAME= cpuflags-0.64 CATEGORIES= sysutils MASTER_SITES= # empty DISTFILES= # empty diff --git a/devel/cpuflags/files/cpuflags.NetBSD b/devel/cpuflags/files/cpuflags.NetBSD index a3aca43bd2f..0852bb06c73 100755 --- a/devel/cpuflags/files/cpuflags.NetBSD +++ b/devel/cpuflags/files/cpuflags.NetBSD @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: cpuflags.NetBSD,v 1.45 2004/02/20 00:37:46 dan Exp $ +# $NetBSD: cpuflags.NetBSD,v 1.46 2004/04/01 19:37:59 abs Exp $ if [ -x /sbin/sysctl ] ;then SYSCTL=/sbin/sysctl @@ -23,6 +23,7 @@ else CC=gcc fi +# When adding $hw_model tests use maximum context (such as trailing space) case $hw_machine_arch in alpha) @@ -33,6 +34,7 @@ case $hw_machine_arch in *[\(\ ]21164A[-\ \)]*) FLAGS="-mcpu=21164a" ;; *[\(\ ]21264[-\ \)]*) FLAGS="-mcpu=21264" ;; *[\(\ ]21264[AB][-\ \)]*) FLAGS="-mcpu=21264a" ;; + *\ PCA56-2) FLAGS="-mcpu=21164pc" ;; esac ;; @@ -60,6 +62,7 @@ case $hw_machine_arch in esac ;; i386) case $hw_model in + *Intel\ Pentium/MMX\ *) FLAGS='-march=pentium-mmx' ;; *Intel\ Pentium\ II\ *) FLAGS='-march=pentium2' ;; *Intel\ Pentium\ III\ *) FLAGS='-march=pentium3' ;; *Intel\ Mobile\ Pentium\ III\ *) FLAGS='-march=pentium3' ;; @@ -72,7 +75,8 @@ case $hw_machine_arch in *AMD\ Duron*) FLAGS='-march=athlon' ;; *AMD\ Athlon\ 4*) FLAGS='-march=athlon-4' ;; *AMD\ Athlon\ MP*) FLAGS='-march=athlon-mp' ;; - *AMD\ Athlon\ XP*) FLAGS='-march=athlon-xp' ;; + *AMD\ K7\ \(Athlon\)\ XP\ *) FLAGS='-march=athlon-xp' ;; + *AMD\ Athlon\ XP\ *) FLAGS='-march=athlon-xp' ;; *AMD\ K7*|*AMD\ Athlon*) FLAGS='-march=athlon' ;; *386-class*) FLAGS='-march=i386' ;; *486-class*) FLAGS='-march=i486' ;; @@ -95,20 +99,20 @@ case $hw_machine_arch in mipseb|mipsel) # cpu0 at mainbus0: QED R4600 Orion CPU (0x2020) Rev. 2.0 with ... case "`egrep '^cpu0 ' /var/run/dmesg.boot`" in - *\ MIPS\ R2000\ *) FLAGS="-mcpu=r2000" ;; - *\ MIPS\ R3000\ *) FLAGS="-mcpu=r3000" ;; - *\ MIPS\ R3000A\ *) FLAGS="-mcpu=r3000" ;; - *\ Toshiba\ TX3912\ *) FLAGS="-mcpu=r3900" ;; - *\ Toshiba\ TX392[27]\ *) FLAGS="-mcpu=r3900" ;; - *\ MIPS\ R4000\ *) FLAGS="-mcpu=r4000 -mips2" ;; # really mips3 - *\ MIPS\ R4400\ *) FLAGS="-mcpu=r4400 -mips2" ;; # really mips3 - *\ NEC\ VR4100\ *) FLAGS="-mcpu=r4100 -mips2" ;; # really mips3 - *\ NEC\ VR4300\ *) FLAGS="-mcpu=r4300 -mips2" ;; # really mips3 - *\ QED\ R4600\ *) FLAGS="-mcpu=r4600 -mips2" ;; # really mips3 - *\ MIPS\ R5000\ *) FLAGS="-mcpu=r5000 -mips2" ;; # really mips4 - *\ QED\ RM5200\ *) FLAGS="-mcpu=r5000 -mips2" ;; # really mips4 - *\ MIPS\ R6000\ *) FLAGS="-mcpu=r6000 -mips2" ;; - *\ MIPS\ R8000\ *) FLAGS="-mcpu=r8000 -mips2" ;; # really mips4 + *\ MIPS\ R2000\ *) FLAGS="-march=r2000" ;; + *\ MIPS\ R3000\ *) FLAGS="-march=r3000" ;; + *\ MIPS\ R3000A\ *) FLAGS="-march=r3000" ;; + *\ Toshiba\ TX3912\ *) FLAGS="-march=r3900" ;; + *\ Toshiba\ TX392[27]\ *) FLAGS="-march=r3900" ;; + *\ MIPS\ R4000\ *) FLAGS="-mtune=r4000 -mips2" ;; # really mips3 + *\ MIPS\ R4400\ *) FLAGS="-mtune=r4400 -mips2" ;; # really mips3 + *\ NEC\ VR4100\ *) FLAGS="-mtune=r4100 -mips2" ;; # really mips3 + *\ NEC\ VR4300\ *) FLAGS="-mtune=r4300 -mips2" ;; # really mips3 + *\ QED\ R4600\ *) FLAGS="-mtune=r4600 -mips2" ;; # really mips3 + *\ MIPS\ R5000\ *) FLAGS="-mtune=r5000 -mips2" ;; # really mips4 + *\ QED\ RM5200\ *) FLAGS="-mtune=r5000 -mips2" ;; # really mips4 + *\ MIPS\ R6000\ *) FLAGS="-mtune=r6000 -mips2" ;; + *\ MIPS\ R8000\ *) FLAGS="-mtune=r8000 -mips2" ;; # really mips4 esac ;; @@ -141,6 +145,10 @@ case $hw_machine_arch in *[\ \(]SUNW,UltraSPARC*) FLAGS='-mcpu=v9' ;; # Ultra esac ;; + x86_64) # No x86_64 specific gcc optimisations yet + NONE=1 + ;; + vax) # No VAX specific gcc optimisations available NONE=1 ;; @@ -156,31 +164,59 @@ if [ -z "$FLAGS" -a -z "$NONE" ] ; then egrep '^cpu' /var/run/dmesg.boot >&2 fi -# Fixup flags for old gcc +# 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 + if [ -n "$FLAGS" ]; then gcc_ver=`${CC} -v 2>&1 | awk '/gcc version/ {sub("egcs-","");print $3}'` FLAGS=`awk -v "flags=$FLAGS" -v "gcc_ver=$gcc_ver" ' - {if (gcc_ver < $1){map[$2] = ""$3}} - END{if (flags in map) {print map[flags]}else {print flags}} + { if (gcc_ver < $1){map[$2] = ""$3} } + END { while (flags in map) {flags = map[flags]} print flags } ' <