Fri Jan 9 12:54:15 2009 UTC ()
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'


(abs)
diff -r1.137 -r1.138 pkgsrc/devel/cpuflags/Makefile
diff -r1.9 -r1.10 pkgsrc/devel/cpuflags/files/subr_NetBSD
diff -r1.8 -r1.9 pkgsrc/devel/cpuflags/files/subr_x86

cvs diff -r1.137 -r1.138 pkgsrc/devel/cpuflags/Makefile (expand / switch to context diff)
--- pkgsrc/devel/cpuflags/Makefile 2009/01/02 19:30:31 1.137
+++ pkgsrc/devel/cpuflags/Makefile 2009/01/09 12:54:15 1.138
@@ -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

cvs diff -r1.9 -r1.10 pkgsrc/devel/cpuflags/files/subr_NetBSD (expand / switch to context diff)
--- pkgsrc/devel/cpuflags/files/subr_NetBSD 2009/01/02 19:30:31 1.9
+++ pkgsrc/devel/cpuflags/files/subr_NetBSD 2009/01/09 12:54:15 1.10
@@ -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 @@
 	    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 @@
 
     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' ;;

cvs diff -r1.8 -r1.9 pkgsrc/devel/cpuflags/files/subr_x86 (expand / switch to context diff)
--- pkgsrc/devel/cpuflags/files/subr_x86 2008/12/31 14:49:54 1.8
+++ pkgsrc/devel/cpuflags/files/subr_x86 2009/01/09 12:54:15 1.9
@@ -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 @@
 	"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' ;;