Updated devel/cpuflags to 1.32

Intel appear to have re-used cpu branding strings between Northwood
and Prescott pentium4s. Thats just... special.

Handle this by explicitly testing for SSE3 support to distinguish between
'-march=prescott' and '-march=pentium4'
This commit is contained in:
abs 2009-01-09 12:54:15 +00:00
parent cb1ac20e13
commit 9f246fab8b
3 changed files with 29 additions and 13 deletions

View file

@ -1,6 +1,6 @@
# $NetBSD: Makefile,v 1.137 2009/01/02 19:30:31 abs Exp $
# $NetBSD: Makefile,v 1.138 2009/01/09 12:54:15 abs Exp $
DISTNAME= cpuflags-1.31
DISTNAME= cpuflags-1.32
CATEGORIES= devel sysutils
MASTER_SITES= # empty
DISTFILES= # empty

View file

@ -1,4 +1,4 @@
# $NetBSD: subr_NetBSD,v 1.9 2009/01/02 19:30:31 abs Exp $
# $NetBSD: subr_NetBSD,v 1.10 2009/01/09 12:54:15 abs Exp $
AWK=awk
SED=sed
@ -55,7 +55,11 @@ extract_x86_cpu_vars()
print "cpu_feature_"features[f]"=1";
}
/cpu0: family/ {
for (i = 2; i < NF; i = i + 2) { print "cpu_"$i"="($(i+1) + 0) }
for (i = 2; i < NF; i = i + 2) {
f=$(i+1);
sub(/^0/, "", f);
print "cpu_"$i"="f
}
}
'
}
@ -115,7 +119,7 @@ determine_arch()
i386 | x86_64)
include subr_x86 # this provides map_x86_brand_string()
ARCH=$(map_x86_brand_string "$cpu_brand")
ARCH=$(map_x86_brand_string)
if [ -z "$ARCH" ] ; then
case "$cpu_name" in
'AMD Athlon 64 X2 (686-class)'*) ARCH='-march=athlon64' ;;

View file

@ -1,8 +1,10 @@
# $NetBSD: subr_x86,v 1.8 2008/12/31 14:49:54 abs Exp $
# $NetBSD: subr_x86,v 1.9 2009/01/09 12:54:15 abs Exp $
# Apparently the only way to reliably determine the architecture of a recent
# Intel CPU is to use the cpu brand string - as they reused family and
# extended family bitflags... annoying
# Even better, they appear to have reused brand strings between Northwood
# and Prescott pentium4s. Thats just... special.
# AMD, in contrast decided to keep things simple:
# (thanks to Christoph Egger for this list)
@ -13,8 +15,17 @@
map_x86_brand_string()
{
case "$1" in
"AMD-K6(tm)-III Processor"*) echo '-march=k6-3' ;;
case "$cpu_brand" in
"AMD*")
case "$cpu_family-$cpu_model" in
5-6 | 5-7 ) echo '-march=k6' ;;
5-8 ) echo '-march=k6-2' ;;
5-9 ) echo '-march=k6-3' ;;
6-1 | 6-2 | 6-3 ) echo '-march=athlon' ;;
6-4 | 6-6 | 6-7 | 6-8 | 6-a ) echo '-march=athlon-4' ;;
esac
;;
"VIA Nehemiah"*) echo '-march=c3' ;;
"Genuine Intel(R) CPU T2400"*) echo '-march=core2' ;;
@ -26,11 +37,12 @@ map_x86_brand_string()
"Intel(R) Core(TM)2 CPU "*) echo '-march=core2' ;;
"Intel(R) Core(TM)2 Duo CPU "*) echo '-march=core2' ;;
"Intel(R) Core(TM)2 Quad CPU"*) echo '-march=core2' ;;
"Intel(R) Pentium(R) 4 CPU 2.00GHz") echo '-march=pentium4' ;;
"Intel(R) Pentium(R) 4 CPU 2.80GHz") echo '-march=pentium4' ;;
"Intel(R) Pentium(R) 4 CPU 3.00GHz") echo '-march=prescott' ;;
"Intel(R) Pentium(R) 4 CPU 3.20GHz") echo '-march=prescott' ;;
"Intel(R) Pentium(R) D CPU "*) echo '-march=prescott' ;;
"Intel(R) Pentium(R) 4 CPU"*)
if [ -n "$cpu_feature_SSE3" ] ; then
echo '-march=prescott'
else
echo '-march=pentium4'
fi ;;
"Intel(R) Pentium(R) M processor "*) echo '-march=pentium-m' ;;
"Intel(R) Xeon(R) CPU 3040"*) echo '-march=core2' ;;
"Intel(R) Xeon(R) CPU 3050"*) echo '-march=core2' ;;