Updated devel/cpuflags to 1.22

- Updates for NetBSD:
    - Report OS version in verbose mode
    - Cleanup the parsing of "cpuctl identify 0" / "grep ^cpu0: dmesg"
    - Add cases for:
      - 'AMD Athlon 64 X2 (686-class)' - thanks Ryo HAYASAKA
      - 'Intel Pentium M (Yonah) (686-class)' - thanks Juho Juopperi
      - 'Intel Pentium III (Katmai) (686-class)'
    - Adjust '-march=core2' facllback to pentium-m - thanks Thomas E. Spanjaard
    - Pickup -'msse3'
  - Updates for gcc:
    - Add some more x86 -march cases from gcc 4.3
This commit is contained in:
abs 2008-12-08 17:40:14 +00:00
parent 813d2f9f4f
commit ca6f0b311a
3 changed files with 60 additions and 41 deletions

View file

@ -1,6 +1,6 @@
# $NetBSD: Makefile,v 1.127 2008/12/05 00:41:31 abs Exp $ # $NetBSD: Makefile,v 1.128 2008/12/08 17:40:14 abs Exp $
DISTNAME= cpuflags-1.21 DISTNAME= cpuflags-1.22
CATEGORIES= devel sysutils CATEGORIES= devel sysutils
MASTER_SITES= # empty MASTER_SITES= # empty
DISTFILES= # empty DISTFILES= # empty

View file

@ -1,4 +1,4 @@
# $NetBSD: subr_NetBSD,v 1.5 2008/12/05 00:41:31 abs Exp $ # $NetBSD: subr_NetBSD,v 1.6 2008/12/08 17:40:14 abs Exp $
AWK=awk AWK=awk
SED=sed SED=sed
@ -7,16 +7,13 @@ display_hw_details()
{ {
cat <<END cat <<END
OS : '$(uname)' OS : '$(uname)'
OS version : '$(uname -r)'
hw.model : '$hw_model' hw.model : '$hw_model'
hw.machine : '$hw_machine' hw.machine : '$hw_machine'
hw.machine_arch : '$hw_machine_arch' hw.machine_arch : '$hw_machine_arch'
cpu details : '$cpu' CPU : '$cpu'
$cpu_details
END END
sed -n -e 's/^/ /' -e '/^ cpu/p' /var/run/dmesg.boot
if [ -x /usr/sbin/cpuctl ]; then
cpuctl identify 0
fi
} }
extract_hw_details() extract_hw_details()
@ -26,10 +23,11 @@ extract_hw_details()
hw_machine_arch=$(sysctl -n hw.machine_arch) hw_machine_arch=$(sysctl -n hw.machine_arch)
if [ "$hw_machine_arch" = i386 -o "$hw_machine_arch" = x86_64 ] ; then if [ "$hw_machine_arch" = i386 -o "$hw_machine_arch" = x86_64 ] ; then
if [ -x /usr/sbin/cpuctl ] ; then if [ -x /usr/sbin/cpuctl ] ; then
cpu=$(cpuctl identify 0|awk '/cpu0:/{sub("cpu0: ","");print;exit}') cpu_details="$(cpuctl identify 0 | grep ^cpu0:)"
else else
cpu=$(awk '/cpu0:/{sub("cpu0: ","");print;exit}'</var/run/dmesg.boot) cpu_details="$(grep ^cpu0: /var/run/dmesg.boot)"
fi fi
cpu=$(echo "$cpu_details"|awk '/cpu0:/{sub("cpu0: ","");print;exit}')
fi fi
# We're almost certainly crosscompiling # We're almost certainly crosscompiling
@ -94,29 +92,33 @@ determine_arch()
i386 | x86_64) i386 | x86_64)
case "$cpu" in case "$cpu" in
'AMD Athlon 64 or Athlon 64 FX or Opteron '*) ARCH='-march=opteron' ;; 'AMD Athlon 64 X2 (686-class)'*) ARCH='-march=athlon64' ;;
'AMD Athlon 64 or Sempron (686-class)'*) ARCH='-march=athlon64' ;; 'AMD Athlon 64 or Athlon 64 FX or Opteron '*) ARCH='-march=opteron' ;;
'AMD Dual-Core Opteron or Athlon 64 X2 '*) ARCH='-march=opteron' ;; 'AMD Athlon 64 or Sempron (686-class)'*) ARCH='-march=athlon64' ;;
'AMD Athlon Model 4 (Thunderbird) '*) ARCH='-march=athlon-tbird' ;; 'AMD Athlon Model 4 (Thunderbird) '*) ARCH='-march=athlon-tbird' ;;
'Intel (686-class)'*) ARCH='-march=pentiumpro' ;; 'AMD Dual-Core Opteron or Athlon 64 X2 '*) ARCH='-march=opteron' ;;
'Intel Celeron (686-class)'*) ARCH='-march=pentiumpro' ;; 'Intel (686-class)'*) ARCH='-march=pentiumpro' ;;
'Intel Core 2 (Merom) (686-class)'*) ARCH='-march=core2' ;; 'Intel Celeron (686-class)'*) ARCH='-march=pentiumpro' ;;
'Intel Pentium 4 (686-class)'*) ARCH='-march=pentium4' ;; 'Intel Core 2 (Merom) (686-class)'*) ARCH='-march=core2' ;;
'Intel Pentium II (686-class)'*) ARCH='-march=pentium2' ;; 'Intel Pentium 4 (686-class)'*) ARCH='-march=pentium4' ;;
'Intel Pentium III (686-class)'*) ARCH='-march=pentium3' ;; 'Intel Pentium II (686-class)'*) ARCH='-march=pentium2' ;;
'Intel Pentium III Xeon (686-class)'*) ARCH='-march=pentium3' ;; 'Intel Pentium III (686-class)'*) ARCH='-march=pentium3' ;;
'Intel Pentium M (Dothan) (686-class)'*) ARCH='-march=pentium-m' ;; 'Intel Pentium III (Katmai) (686-class)'*) ARCH='-march=pentium3' ;;
# Fallback classes 'Intel Pentium III Xeon (686-class)'*) ARCH='-march=pentium3' ;;
*'(586-class)'*) ARCH='-march=pentium' ;; 'Intel Pentium M (Dothan) (686-class)'*) ARCH='-march=pentium-m' ;;
*'(486-class)'*) ARCH='-march=i486' ;; 'Intel Pentium M (Yonah) (686-class)'*) ARCH='-march=pentium-m' ;;
# Fallback classes
*'(586-class)'*) ARCH='-march=pentium' ;;
*'(486-class)'*) ARCH='-march=i486' ;;
esac esac
;; ;;
m68k) case $hw_model in # Examples m68k) case $hw_model in # Examples
*\(68020*|*\ MC68020\ *) ARCH='-m68020' ;; # Untested *\(68020*|*\ MC68020\ *) ARCH='-m68020' ;; # Untested
*\(68030*|*\ MC68030\ *) ARCH='-m68030' ;; # Mac LC III *\(68030*|*\ MC68030\ *) ARCH='-m68030' ;; # Mac LC III
*\(68040*|*\ MC68040\ *) ARCH='-m68040' ;; # Untested *\(68040*|*\ MC68040\ *) ARCH='-m68040' ;; # Untested
*\(68060*|*\ MC68060\ *) ARCH='-m68060' ;; # Upgraded amiga 3000 *\(68060*|*\ MC68060\ *) ARCH='-m68060' ;; # Upgraded amiga 3000
esac esac
;; ;;
@ -159,7 +161,7 @@ determine_arch()
7410\ *) ARCH='-mcpu=7400' ;; # powerbook g4 7410\ *) ARCH='-mcpu=7400' ;; # powerbook g4
7447A\ *) ARCH='-mcpu=7450' ;; # 7447A\ *) ARCH='-mcpu=7450' ;; #
7450\ *) ARCH='-mcpu=7450' ;; # tibook 550 7450\ *) ARCH='-mcpu=7450' ;; # tibook 550
750\ *) ARCH='-mcpu=750' ;; # orig. iBook 750\ *) ARCH='-mcpu=750' ;; # orig. iBook
esac ;; esac ;;
@ -168,11 +170,11 @@ determine_arch()
*[\ \(]L64811*) ARCH='-mcpu=cypress' ;; # sun4/sun4c *[\ \(]L64811*) ARCH='-mcpu=cypress' ;; # sun4/sun4c
*[\ \(]CY7C601*) ARCH='-mcpu=cypress' ;; # ss2 *[\ \(]CY7C601*) ARCH='-mcpu=cypress' ;; # ss2
*[\ \(]W8601/8701*) ARCH='-mcpu=cypress' ;; # elc *[\ \(]W8601/8701*) ARCH='-mcpu=cypress' ;; # elc
*[\ \(]MB86904*) ARCH='-mcpu=supersparc' ;; # ss5 usparc *[\ \(]MB86904*) ARCH='-mcpu=supersparc' ;; # ss5 usparc
*[\ \(]MB86907*) ARCH='-mcpu=supersparc' ;; # ss5 usparc *[\ \(]MB86907*) ARCH='-mcpu=supersparc' ;; # ss5 usparc
*[\ \(]TMS390S10*) ARCH='-mcpu=supersparc' ;; # classic " *[\ \(]TMS390S10*) ARCH='-mcpu=supersparc' ;; # classic "
*[\ \(]TMS390Z50*) ARCH='-mcpu=supersparc' ;; # ss10/ss20 *[\ \(]TMS390Z50*) ARCH='-mcpu=supersparc' ;; # ss10/ss20
*[\ \(]RT620/625*) ARCH='-mcpu=hypersparc' ;; # ss20 ross *[\ \(]RT620/625*) ARCH='-mcpu=hypersparc' ;; # ss20 ross
*[\ \(]MB86930*) ARCH='-mcpu=sparclite' ;; # from gcc *[\ \(]MB86930*) ARCH='-mcpu=sparclite' ;; # from gcc
*[\ \(]MB86934*) ARCH='-mcpu=sparclite' ;; # from gcc *[\ \(]MB86934*) ARCH='-mcpu=sparclite' ;; # from gcc
# under 1.5.1 -mcpu=ultrasparc chokes egcs-2.91.66 compiling perl # under 1.5.1 -mcpu=ultrasparc chokes egcs-2.91.66 compiling perl
@ -190,11 +192,22 @@ determine_arch()
determine_features() determine_features()
{ {
FEATURES= FEATURES=
case $hw_machine_arch in case $hw_machine_arch in
i386) i386 | x86_64)
if [ "$(sysctl -n machdep.sse2)" = 1 ] ; then # Set cpu_feature_FOO=1 for each 'FOO' feature reported
eval $(echo "$cpu_details" | awk -F , '
/cpu0: features/ {
sub(".*<","");
sub(">.*","");
gsub("[^,A-Z0-9]","_");
for (i = 1; i < NR; i++) { print "cpu_feature_"$i"=1" } }
')
if [ -n "$cpu_feature_SSE3" ] ; then
FEATURES="-mfpmath=sse -msse3"
elif [ -n "$cpu_feature_SSE2" ] ; then
FEATURES="-mfpmath=sse -msse2" FEATURES="-mfpmath=sse -msse2"
elif [ "$(sysctl -n machdep.sse)" = 1 ] ; then elif [ -n "$cpu_feature_SSE" ] ; then
FEATURES="-mfpmath=sse -msse" FEATURES="-mfpmath=sse -msse"
fi fi
;; ;;

View file

@ -1,4 +1,4 @@
# $NetBSD: subr_gcc,v 1.4 2008/12/04 11:45:35 abs Exp $ # $NetBSD: subr_gcc,v 1.5 2008/12/08 17:40:14 abs Exp $
# Return gcc version string # Return gcc version string
gcc_ver() gcc_ver()
@ -109,6 +109,12 @@ gcc_fixup_arch_flags()
3.4:-msse3: 3.4:-msse3:
4.2:-m3dnow: 4.2:-m3dnow:
4.2:-march=native: 4.2:-march=native:
4.3:-march=core2:-march=pentium3 4.3:-march=amdfam10:-march=athlon64
4.3:-march=athlon64-sse3:-march=athlon64
4.3:-march=barcelona:-march=athlon64
4.3:-march=core2:-march=pentium-m
4.3:-march=geode:-march=k6-3
4.3:-march=k8-sse3:-march=k8
4.3:-march=opteron-sse3:-march=opteron
EOD EOD
} }