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'diff -r1.137 -r1.138 pkgsrc/devel/cpuflags/Makefile
(abs)
@@ -1,16 +1,16 @@ | @@ -1,16 +1,16 @@ | |||
1 | # $NetBSD: Makefile,v 1.137 2009/01/02 19:30:31 abs Exp $ | 1 | # $NetBSD: Makefile,v 1.138 2009/01/09 12:54:15 abs Exp $ | |
2 | 2 | |||
3 | DISTNAME= cpuflags-1.31 | 3 | DISTNAME= cpuflags-1.32 | |
4 | CATEGORIES= devel sysutils | 4 | CATEGORIES= devel sysutils | |
5 | MASTER_SITES= # empty | 5 | MASTER_SITES= # empty | |
6 | DISTFILES= # empty | 6 | DISTFILES= # empty | |
7 | 7 | |||
8 | MAINTAINER= abs@NetBSD.org | 8 | MAINTAINER= abs@NetBSD.org | |
9 | COMMENT= Determine compiler flags to best target current cpu | 9 | COMMENT= Determine compiler flags to best target current cpu | |
10 | 10 | |||
11 | PKG_DESTDIR_SUPPORT= user-destdir | 11 | PKG_DESTDIR_SUPPORT= user-destdir | |
12 | 12 | |||
13 | ONLY_FOR_PLATFORM= NetBSD-*-* Linux-*-* SunOS-*-* FreeBSD-*-* | 13 | ONLY_FOR_PLATFORM= NetBSD-*-* Linux-*-* SunOS-*-* FreeBSD-*-* | |
14 | 14 | |||
15 | USE_LANGUAGES= # empty | 15 | USE_LANGUAGES= # empty | |
16 | NO_CHECKSUM= yes | 16 | NO_CHECKSUM= yes |
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | # $NetBSD: subr_NetBSD,v 1.9 2009/01/02 19:30:31 abs Exp $ | 1 | # $NetBSD: subr_NetBSD,v 1.10 2009/01/09 12:54:15 abs Exp $ | |
2 | 2 | |||
3 | AWK=awk | 3 | AWK=awk | |
4 | SED=sed | 4 | SED=sed | |
5 | 5 | |||
6 | display_hw_details() | 6 | display_hw_details() | |
7 | { | 7 | { | |
8 | cat <<END | 8 | cat <<END | |
9 | OS : '$(uname)' | 9 | OS : '$(uname)' | |
10 | OS version : '$(uname -r)' | 10 | OS version : '$(uname -r)' | |
11 | hw.model : '$hw_model' | 11 | hw.model : '$hw_model' | |
12 | hw.machine : '$hw_machine' | 12 | hw.machine : '$hw_machine' | |
13 | hw.machine_arch : '$hw_machine_arch' | 13 | hw.machine_arch : '$hw_machine_arch' | |
14 | CPU : '$cpu' | 14 | CPU : '$cpu' | |
@@ -45,27 +45,31 @@ extract_x86_cpu_vars() | @@ -45,27 +45,31 @@ extract_x86_cpu_vars() | |||
45 | # cpu_brand="BRAND" the CPU branding string | 45 | # cpu_brand="BRAND" the CPU branding string | |
46 | echo "$cpu_details" | $AWK ' | 46 | echo "$cpu_details" | $AWK ' | |
47 | { if (/cpu0:/ && !n) { sub("cpu0: ",""); n=1; print "cpu_name=\""$0"\"" } } | 47 | { if (/cpu0:/ && !n) { sub("cpu0: ",""); n=1; print "cpu_name=\""$0"\"" } } | |
48 | /cpu0: ".*"/ { sub("[^\"]*", ""); print "cpu_brand="$0 } | 48 | /cpu0: ".*"/ { sub("[^\"]*", ""); print "cpu_brand="$0 } | |
49 | /cpu0: features/ { | 49 | /cpu0: features/ { | |
50 | sub(".*<",""); | 50 | sub(".*<",""); | |
51 | sub(">.*",""); | 51 | sub(">.*",""); | |
52 | gsub("[^,A-Z0-9]","_"); | 52 | gsub("[^,A-Z0-9]","_"); | |
53 | split($0, features, /,/) | 53 | split($0, features, /,/) | |
54 | for (f in features) | 54 | for (f in features) | |
55 | print "cpu_feature_"features[f]"=1"; | 55 | print "cpu_feature_"features[f]"=1"; | |
56 | } | 56 | } | |
57 | /cpu0: family/ { | 57 | /cpu0: family/ { | |
58 | for (i = 2; i < NF; i = i + 2) { print "cpu_"$i"="($(i+1) + 0) } | 58 | for (i = 2; i < NF; i = i + 2) { | |
59 | f=$(i+1); | |||
60 | sub(/^0/, "", f); | |||
61 | print "cpu_"$i"="f | |||
62 | } | |||
59 | } | 63 | } | |
60 | ' | 64 | ' | |
61 | } | 65 | } | |
62 | 66 | |||
63 | determine_arch() | 67 | determine_arch() | |
64 | { | 68 | { | |
65 | ARCH= | 69 | ARCH= | |
66 | # When adding $hw_model tests use maximum context (such as trailing space) | 70 | # When adding $hw_model tests use maximum context (such as trailing space) | |
67 | case $hw_machine_arch in | 71 | case $hw_machine_arch in | |
68 | 72 | |||
69 | alpha) | 73 | alpha) | |
70 | # cpu0 at mainbus0: ID 0 (primary), 21164A-0 (unknown ... | 74 | # cpu0 at mainbus0: ID 0 (primary), 21164A-0 (unknown ... | |
71 | case "$(egrep '^cpu0 ' /var/run/dmesg.boot)" in | 75 | case "$(egrep '^cpu0 ' /var/run/dmesg.boot)" in | |
@@ -105,27 +109,27 @@ determine_arch() | @@ -105,27 +109,27 @@ determine_arch() | |||
105 | hppa) | 109 | hppa) | |
106 | case "$(egrep '^cpu0 ' /var/run/dmesg.boot)" in | 110 | case "$(egrep '^cpu0 ' /var/run/dmesg.boot)" in | |
107 | *\ PA7100\ *) ARCH="-march=1.1 -mschedule=7100" ;; # untested | 111 | *\ PA7100\ *) ARCH="-march=1.1 -mschedule=7100" ;; # untested | |
108 | *\ PA7150\ *) ARCH="-march=1.1 -mschedule=7100" ;; # untested | 112 | *\ PA7150\ *) ARCH="-march=1.1 -mschedule=7100" ;; # untested | |
109 | *\ PA7100LC\ *) ARCH="-march=1.1 -mschedule=7100LC" ;; # untested | 113 | *\ PA7100LC\ *) ARCH="-march=1.1 -mschedule=7100LC" ;; # untested | |
110 | *\ PA7200\ *) ARCH="-march=1.1 -mschedule=7200" ;; # untested | 114 | *\ PA7200\ *) ARCH="-march=1.1 -mschedule=7200" ;; # untested | |
111 | *\ PA7300LC\ *) ARCH="-march=1.1 -mschedule=7300" ;; # B180L | 115 | *\ PA7300LC\ *) ARCH="-march=1.1 -mschedule=7300" ;; # B180L | |
112 | *\ PA8*) ARCH="-march=2.0 -mschedule=8000" ;; # untested | 116 | *\ PA8*) ARCH="-march=2.0 -mschedule=8000" ;; # untested | |
113 | esac | 117 | esac | |
114 | ;; | 118 | ;; | |
115 | 119 | |||
116 | i386 | x86_64) | 120 | i386 | x86_64) | |
117 | include subr_x86 # this provides map_x86_brand_string() | 121 | include subr_x86 # this provides map_x86_brand_string() | |
118 | ARCH=$(map_x86_brand_string "$cpu_brand") | 122 | ARCH=$(map_x86_brand_string) | |
119 | if [ -z "$ARCH" ] ; then | 123 | if [ -z "$ARCH" ] ; then | |
120 | case "$cpu_name" in | 124 | case "$cpu_name" in | |
121 | 'AMD Athlon 64 X2 (686-class)'*) ARCH='-march=athlon64' ;; | 125 | 'AMD Athlon 64 X2 (686-class)'*) ARCH='-march=athlon64' ;; | |
122 | 'AMD Athlon 64 or Athlon 64 FX or Opteron '*) ARCH='-march=opteron' ;; | 126 | 'AMD Athlon 64 or Athlon 64 FX or Opteron '*) ARCH='-march=opteron' ;; | |
123 | 'AMD Athlon 64 or Sempron (686-class)'*) ARCH='-march=athlon64' ;; | 127 | 'AMD Athlon 64 or Sempron (686-class)'*) ARCH='-march=athlon64' ;; | |
124 | 'AMD Athlon Model 4 (Thunderbird) '*) ARCH='-march=athlon-tbird' ;; | 128 | 'AMD Athlon Model 4 (Thunderbird) '*) ARCH='-march=athlon-tbird' ;; | |
125 | 'AMD Dual-Core Opteron or Athlon 64 X2 '*) ARCH='-march=opteron' ;; | 129 | 'AMD Dual-Core Opteron or Athlon 64 X2 '*) ARCH='-march=opteron' ;; | |
126 | 'AMD Family 10h (686-class)'*) ARCH='-march=amdfam10' ;; | 130 | 'AMD Family 10h (686-class)'*) ARCH='-march=amdfam10' ;; | |
127 | 'AMD K6-2 (586-class)'*) ARCH="-march=k6-2" ;; | 131 | 'AMD K6-2 (586-class)'*) ARCH="-march=k6-2" ;; | |
128 | 132 | |||
129 | # Intel PIII & earlier - later Intel handled by map_x86_brand_string | 133 | # Intel PIII & earlier - later Intel handled by map_x86_brand_string | |
130 | 'Intel (686-class)'*) ARCH='-march=pentiumpro' ;; | 134 | 'Intel (686-class)'*) ARCH='-march=pentiumpro' ;; | |
131 | 'Intel Pentium II (686-class)'*) ARCH='-march=pentium2' ;; | 135 | 'Intel Pentium II (686-class)'*) ARCH='-march=pentium2' ;; |
@@ -1,46 +1,58 @@ | @@ -1,46 +1,58 @@ | |||
1 | # $NetBSD: subr_x86,v 1.8 2008/12/31 14:49:54 abs Exp $ | 1 | # $NetBSD: subr_x86,v 1.9 2009/01/09 12:54:15 abs Exp $ | |
2 | 2 | |||
3 | # Apparently the only way to reliably determine the architecture of a recent | 3 | # Apparently the only way to reliably determine the architecture of a recent | |
4 | # Intel CPU is to use the cpu brand string - as they reused family and | 4 | # Intel CPU is to use the cpu brand string - as they reused family and | |
5 | # extended family bitflags... annoying | 5 | # extended family bitflags... annoying | |
6 | # Even better, they appear to have reused brand strings between Northwood | |||
7 | # and Prescott pentium4s. Thats just... special. | |||
6 | 8 | |||
7 | # AMD, in contrast decided to keep things simple: | 9 | # AMD, in contrast decided to keep things simple: | |
8 | # (thanks to Christoph Egger for this list) | 10 | # (thanks to Christoph Egger for this list) | |
9 | # Family 0x6: AMD K7 | 11 | # Family 0x6: AMD K7 | |
10 | # Family 0xf: AMD K8 | 12 | # Family 0xf: AMD K8 | |
11 | # Family 0x10: AMD Barcelona/Phenom | 13 | # Family 0x10: AMD Barcelona/Phenom | |
12 | # Family 0x11: AMD Turion Ultra | 14 | # Family 0x11: AMD Turion Ultra | |
13 | 15 | |||
14 | map_x86_brand_string() | 16 | map_x86_brand_string() | |
15 | { | 17 | { | |
16 | case "$1" in | 18 | case "$cpu_brand" in | |
17 | "AMD-K6(tm)-III Processor"*) echo '-march=k6-3' ;; | 19 | "AMD*") | |
20 | case "$cpu_family-$cpu_model" in | |||
21 | 5-6 | 5-7 ) echo '-march=k6' ;; | |||
22 | 5-8 ) echo '-march=k6-2' ;; | |||
23 | 5-9 ) echo '-march=k6-3' ;; | |||
24 | 6-1 | 6-2 | 6-3 ) echo '-march=athlon' ;; | |||
25 | 6-4 | 6-6 | 6-7 | 6-8 | 6-a ) echo '-march=athlon-4' ;; | |||
26 | esac | |||
27 | ;; | |||
28 | ||||
18 | "VIA Nehemiah"*) echo '-march=c3' ;; | 29 | "VIA Nehemiah"*) echo '-march=c3' ;; | |
19 | 30 | |||
20 | "Genuine Intel(R) CPU T2400"*) echo '-march=core2' ;; | 31 | "Genuine Intel(R) CPU T2400"*) echo '-march=core2' ;; | |
21 | "Intel(R) Atom(TM) CPU N270 "*) echo '-march=prescott' ;;#So far | 32 | "Intel(R) Atom(TM) CPU N270 "*) echo '-march=prescott' ;;#So far | |
22 | "Intel(R) Celeron(R) CPU E1400"*) echo '-march=core2' ;; | 33 | "Intel(R) Celeron(R) CPU E1400"*) echo '-march=core2' ;; | |
23 | "Intel(R) Celeron(R) CPU 2.40GHz") echo '-march=pentium4' ;; | 34 | "Intel(R) Celeron(R) CPU 2.40GHz") echo '-march=pentium4' ;; | |
24 | "Intel(R) Celeron(R) M processor "*) echo '-march=pentium-m' ;; | 35 | "Intel(R) Celeron(R) M processor "*) echo '-march=pentium-m' ;; | |
25 | "Intel(R) Celeron(TM) CPU 1400MHz") echo '-march=pentium3' ;; | 36 | "Intel(R) Celeron(TM) CPU 1400MHz") echo '-march=pentium3' ;; | |
26 | "Intel(R) Core(TM)2 CPU "*) echo '-march=core2' ;; | 37 | "Intel(R) Core(TM)2 CPU "*) echo '-march=core2' ;; | |
27 | "Intel(R) Core(TM)2 Duo CPU "*) echo '-march=core2' ;; | 38 | "Intel(R) Core(TM)2 Duo CPU "*) echo '-march=core2' ;; | |
28 | "Intel(R) Core(TM)2 Quad CPU"*) echo '-march=core2' ;; | 39 | "Intel(R) Core(TM)2 Quad CPU"*) echo '-march=core2' ;; | |
29 | "Intel(R) Pentium(R) 4 CPU 2.00GHz") echo '-march=pentium4' ;; | 40 | "Intel(R) Pentium(R) 4 CPU"*) | |
30 | "Intel(R) Pentium(R) 4 CPU 2.80GHz") echo '-march=pentium4' ;; | 41 | if [ -n "$cpu_feature_SSE3" ] ; then | |
31 | "Intel(R) Pentium(R) 4 CPU 3.00GHz") echo '-march=prescott' ;; | 42 | echo '-march=prescott' | |
32 | "Intel(R) Pentium(R) 4 CPU 3.20GHz") echo '-march=prescott' ;; | 43 | else | |
33 | "Intel(R) Pentium(R) D CPU "*) echo '-march=prescott' ;; | 44 | echo '-march=pentium4' | |
45 | fi ;; | |||
34 | "Intel(R) Pentium(R) M processor "*) echo '-march=pentium-m' ;; | 46 | "Intel(R) Pentium(R) M processor "*) echo '-march=pentium-m' ;; | |
35 | "Intel(R) Xeon(R) CPU 3040"*) echo '-march=core2' ;; | 47 | "Intel(R) Xeon(R) CPU 3040"*) echo '-march=core2' ;; | |
36 | "Intel(R) Xeon(R) CPU 3050"*) echo '-march=core2' ;; | 48 | "Intel(R) Xeon(R) CPU 3050"*) echo '-march=core2' ;; | |
37 | "Pentium(R) Dual-Core CPU E5200"*) echo '-march=core2' ;; | 49 | "Pentium(R) Dual-Core CPU E5200"*) echo '-march=core2' ;; | |
38 | 50 | |||
39 | esac | 51 | esac | |
40 | } | 52 | } | |
41 | 53 | |||
42 | flags_fixup_x86arch() | 54 | flags_fixup_x86arch() | |
43 | { | 55 | { | |
44 | arch=$1 | 56 | arch=$1 | |
45 | features=$2 | 57 | features=$2 | |
46 | # Fixup ARCH for x86 | 58 | # Fixup ARCH for x86 |