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 (switch to unified 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,26 +1,26 @@ @@ -1,26 +1,26 @@
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
3DISTNAME= cpuflags-1.31 3DISTNAME= cpuflags-1.32
4CATEGORIES= devel sysutils 4CATEGORIES= devel sysutils
5MASTER_SITES= # empty 5MASTER_SITES= # empty
6DISTFILES= # empty 6DISTFILES= # empty
7 7
8MAINTAINER= abs@NetBSD.org 8MAINTAINER= abs@NetBSD.org
9COMMENT= Determine compiler flags to best target current cpu 9COMMENT= Determine compiler flags to best target current cpu
10 10
11PKG_DESTDIR_SUPPORT= user-destdir 11PKG_DESTDIR_SUPPORT= user-destdir
12 12
13ONLY_FOR_PLATFORM= NetBSD-*-* Linux-*-* SunOS-*-* FreeBSD-*-* 13ONLY_FOR_PLATFORM= NetBSD-*-* Linux-*-* SunOS-*-* FreeBSD-*-*
14 14
15USE_LANGUAGES= # empty 15USE_LANGUAGES= # empty
16NO_CHECKSUM= yes 16NO_CHECKSUM= yes
17NO_CONFIGURE= yes 17NO_CONFIGURE= yes
18 18
19do-extract: 19do-extract:
20 ${MKDIR} ${WRKSRC} 20 ${MKDIR} ${WRKSRC}
21 ${CP} ${FILESDIR}/Makefile ${WRKSRC} 21 ${CP} ${FILESDIR}/Makefile ${WRKSRC}
22 ${CP} ${FILESDIR}/c* ${WRKSRC} 22 ${CP} ${FILESDIR}/c* ${WRKSRC}
23 ${CP} ${FILESDIR}/o* ${WRKSRC} 23 ${CP} ${FILESDIR}/o* ${WRKSRC}
24 ${CP} ${FILESDIR}/s* ${WRKSRC} 24 ${CP} ${FILESDIR}/s* ${WRKSRC}
25 25
26.include "../../mk/bsd.pkg.mk" 26.include "../../mk/bsd.pkg.mk"

cvs diff -r1.9 -r1.10 pkgsrc/devel/cpuflags/files/subr_NetBSD (switch to unified 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,240 +1,244 @@ @@ -1,240 +1,244 @@
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
3AWK=awk 3AWK=awk
4SED=sed 4SED=sed
5 5
6display_hw_details() 6display_hw_details()
7 { 7 {
8 cat <<END 8 cat <<END
9OS : '$(uname)' 9OS : '$(uname)'
10OS version : '$(uname -r)' 10OS version : '$(uname -r)'
11hw.model : '$hw_model' 11hw.model : '$hw_model'
12hw.machine : '$hw_machine' 12hw.machine : '$hw_machine'
13hw.machine_arch : '$hw_machine_arch' 13hw.machine_arch : '$hw_machine_arch'
14CPU : '$cpu' 14CPU : '$cpu'
15END 15END
16 extract_x86_cpu_vars 16 extract_x86_cpu_vars
17 echo "$cpu_details" 17 echo "$cpu_details"
18 } 18 }
19 19
20extract_hw_details() 20extract_hw_details()
21 { 21 {
22 hw_model=$(sysctl -n hw.model | $SED 's/^ *//') 22 hw_model=$(sysctl -n hw.model | $SED 's/^ *//')
23 hw_machine=$(sysctl -n hw.machine) 23 hw_machine=$(sysctl -n hw.machine)
24 hw_machine_arch=$(sysctl -n hw.machine_arch) 24 hw_machine_arch=$(sysctl -n hw.machine_arch)
25 if [ "$hw_machine_arch" = i386 -o "$hw_machine_arch" = x86_64 ] ; then 25 if [ "$hw_machine_arch" = i386 -o "$hw_machine_arch" = x86_64 ] ; then
26 if [ -x /usr/sbin/cpuctl ] ; then 26 if [ -x /usr/sbin/cpuctl ] ; then
27 cpu_details="$(cpuctl identify 0 | grep ^cpu0:)" 27 cpu_details="$(cpuctl identify 0 | grep ^cpu0:)"
28 else 28 else
29 cpu_details="$(grep ^cpu0: /var/run/dmesg.boot)" 29 cpu_details="$(grep ^cpu0: /var/run/dmesg.boot)"
30 fi 30 fi
31 eval $(extract_x86_cpu_vars) 31 eval $(extract_x86_cpu_vars)
32 fi 32 fi
33 33
34 # We're almost certainly crosscompiling 34 # We're almost certainly crosscompiling
35 if [ -n "$MACHINE" -a $hw_machine != "$MACHINE" ]; then 35 if [ -n "$MACHINE" -a $hw_machine != "$MACHINE" ]; then
36 echo 36 echo
37 exit 37 exit
38 fi 38 fi
39 } 39 }
40 40
41extract_x86_cpu_vars() 41extract_x86_cpu_vars()
42 { 42 {
43 # Set: cpu_feature_FOO=1 for each 'FOO' feature reported 43 # Set: cpu_feature_FOO=1 for each 'FOO' feature reported
44 # cpu_name="NAME" taken from the first cpu0: line 44 # cpu_name="NAME" taken from the first cpu0: line
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
63determine_arch() 67determine_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
72 *[\(\ ]2106[46][-A\ \)]*) ARCH="-mcpu=21064" ;; 76 *[\(\ ]2106[46][-A\ \)]*) ARCH="-mcpu=21064" ;;
73 *[\(\ ]21164[-\ \)]*) ARCH="-mcpu=21164" ;; 77 *[\(\ ]21164[-\ \)]*) ARCH="-mcpu=21164" ;;
74 *[\(\ ]21164A[-\ \)]*) ARCH="-mcpu=21164a" ;; 78 *[\(\ ]21164A[-\ \)]*) ARCH="-mcpu=21164a" ;;
75 *[\(\ ]21264[-\ \)]*) ARCH="-mcpu=21264" ;; 79 *[\(\ ]21264[-\ \)]*) ARCH="-mcpu=21264" ;;
76 *[\(\ ]21264[AB][-\ \)]*) ARCH="-mcpu=21264a" ;; 80 *[\(\ ]21264[AB][-\ \)]*) ARCH="-mcpu=21264a" ;;
77 *\ PCA56-2) ARCH="-mcpu=21164pc" ;; 81 *\ PCA56-2) ARCH="-mcpu=21164pc" ;;
78 esac 82 esac
79 ;; 83 ;;
80 84
81 arm | arm32) case $hw_model in 85 arm | arm32) case $hw_model in
82 ARM610*) ARCH="-mcpu=arm610" ;; # risc pc 86 ARM610*) ARCH="-mcpu=arm610" ;; # risc pc
83 ARM710*) ARCH="-mcpu=arm710" ;; # risc pc 87 ARM710*) ARCH="-mcpu=arm710" ;; # risc pc
84 i80321\ *) ARCH="-mcpu=xscale" ;; # iyonix 88 i80321\ *) ARCH="-mcpu=xscale" ;; # iyonix
85 SA-110*)  89 SA-110*)
86 case $hw_machine in # arm32 split post 1.5 90 case $hw_machine in # arm32 split post 1.5
87 cats|shark|hpcarm|netwinder) 91 cats|shark|hpcarm|netwinder)
88 ARCH="-mcpu=strongarm110" ;; 92 ARCH="-mcpu=strongarm110" ;;
89 acorn32) 93 acorn32)
90 ARCH="-march=armv3m -mtune=strongarm" ;; 94 ARCH="-march=armv3m -mtune=strongarm" ;;
91 *) 95 *)
92 # memorybus in strongarm risc pc machines cannot support 96 # memorybus in strongarm risc pc machines cannot support
93 # certain strongarm instructions, but in 1.5 and earlier 97 # certain strongarm instructions, but in 1.5 and earlier
94 # all strongarm machines are 'arm32', so uname and sysctl 98 # all strongarm machines are 'arm32', so uname and sysctl
95 # no use 99 # no use
96 if egrep -q 'ofbus0|footbridge0' /var/run/dmesg.boot \ 100 if egrep -q 'ofbus0|footbridge0' /var/run/dmesg.boot \
97 2>/dev/null ; then 101 2>/dev/null ; then
98 ARCH="-mcpu=strongarm110" # shark/cats 102 ARCH="-mcpu=strongarm110" # shark/cats
99 else 103 else
100 ARCH="-march=armv3m -mtune=strongarm" # risc pc 104 ARCH="-march=armv3m -mtune=strongarm" # risc pc
101 fi 105 fi
102 esac ;; 106 esac ;;
103 esac ;; 107 esac ;;
104 108
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' ;;
132 'Intel Pentium III (686-class)'*) ARCH='-march=pentium3' ;; 136 'Intel Pentium III (686-class)'*) ARCH='-march=pentium3' ;;
133 'Intel Pentium III (Katmai) (686-class)'*) ARCH='-march=pentium3' ;; 137 'Intel Pentium III (Katmai) (686-class)'*) ARCH='-march=pentium3' ;;
134 'Intel Pentium III Xeon (686-class)'*) ARCH='-march=pentium3' ;; 138 'Intel Pentium III Xeon (686-class)'*) ARCH='-march=pentium3' ;;
135 139
136 # Fallback classes 140 # Fallback classes
137 *'(586-class)'*) ARCH='-march=pentium' ;; 141 *'(586-class)'*) ARCH='-march=pentium' ;;
138 *'(486-class)'*) ARCH='-march=i486' ;; 142 *'(486-class)'*) ARCH='-march=i486' ;;
139 esac 143 esac
140 fi 144 fi
141 ;; 145 ;;
142 146
143 m68k) case $hw_model in # Examples 147 m68k) case $hw_model in # Examples
144 *\(68020*|*\ MC68020\ *) ARCH='-m68020' ;; # Untested 148 *\(68020*|*\ MC68020\ *) ARCH='-m68020' ;; # Untested
145 *\(68030*|*\ MC68030\ *) ARCH='-m68030' ;; # Mac LC III 149 *\(68030*|*\ MC68030\ *) ARCH='-m68030' ;; # Mac LC III
146 *\(68040*|*\ MC68040\ *) ARCH='-m68040' ;; # Untested 150 *\(68040*|*\ MC68040\ *) ARCH='-m68040' ;; # Untested
147 *\(68060*|*\ MC68060\ *) ARCH='-m68060' ;; # Upgraded amiga 3000 151 *\(68060*|*\ MC68060\ *) ARCH='-m68060' ;; # Upgraded amiga 3000
148 esac 152 esac
149 ;; 153 ;;
150 154
151 mipseb|mipsel) 155 mipseb|mipsel)
152 # cpu0 at mainbus0: QED R4600 Orion CPU (0x2020) Rev. 2.0 with ... 156 # cpu0 at mainbus0: QED R4600 Orion CPU (0x2020) Rev. 2.0 with ...
153 case $hw_model in 157 case $hw_model in
154 Infineon\ ADM5120) ARCH='-march=4kc' ;; 158 Infineon\ ADM5120) ARCH='-march=4kc' ;;
155 *) 159 *)
156 case "$(egrep '^cpu0 ' /var/run/dmesg.boot)" in 160 case "$(egrep '^cpu0 ' /var/run/dmesg.boot)" in
157 *\ MIPS\ R2000\ *) ARCH="-march=r2000" ;; 161 *\ MIPS\ R2000\ *) ARCH="-march=r2000" ;;
158 *\ MIPS\ R3000\ *) ARCH="-march=r3000" ;; 162 *\ MIPS\ R3000\ *) ARCH="-march=r3000" ;;
159 *\ MIPS\ R3000A\ *) ARCH="-march=r3000" ;; 163 *\ MIPS\ R3000A\ *) ARCH="-march=r3000" ;;
160 *\ Toshiba\ TX3912\ *) ARCH="-march=r3900" ;; 164 *\ Toshiba\ TX3912\ *) ARCH="-march=r3900" ;;
161 *\ Toshiba\ TX392[27]\ *) ARCH="-march=r3900" ;; 165 *\ Toshiba\ TX392[27]\ *) ARCH="-march=r3900" ;;
162 *\ MIPS\ R4000\ *) ARCH="-mtune=r4000 -mips2" ;; # mips3 166 *\ MIPS\ R4000\ *) ARCH="-mtune=r4000 -mips2" ;; # mips3
163 *\ MIPS\ R4400\ *) ARCH="-mtune=r4400 -mips2" ;; # mips3 167 *\ MIPS\ R4400\ *) ARCH="-mtune=r4400 -mips2" ;; # mips3
164 *\ NEC\ VR4100\ *) ARCH="-mtune=r4100 -mips2" ;; # mips3 168 *\ NEC\ VR4100\ *) ARCH="-mtune=r4100 -mips2" ;; # mips3
165 *\ NEC\ VR4300\ *) ARCH="-mtune=r4300 -mips2" ;; # mips3 169 *\ NEC\ VR4300\ *) ARCH="-mtune=r4300 -mips2" ;; # mips3
166 *\ QED\ R4600\ *) ARCH="-mtune=r4600 -mips2" ;; # mips3 170 *\ QED\ R4600\ *) ARCH="-mtune=r4600 -mips2" ;; # mips3
167 *\ MIPS\ R5000\ *) ARCH="-mtune=r5000 -mips2" ;; # mips4 171 *\ MIPS\ R5000\ *) ARCH="-mtune=r5000 -mips2" ;; # mips4
168 *\ QED\ RM5200\ *) ARCH="-mtune=r5000 -mips2" ;; # mips4 172 *\ QED\ RM5200\ *) ARCH="-mtune=r5000 -mips2" ;; # mips4
169 *\ MIPS\ R6000\ *) ARCH="-mtune=r6000 -mips2" ;; 173 *\ MIPS\ R6000\ *) ARCH="-mtune=r6000 -mips2" ;;
170 *\ MIPS\ R8000\ *) ARCH="-mtune=r8000 -mips2" ;; # mips4 174 *\ MIPS\ R8000\ *) ARCH="-mtune=r8000 -mips2" ;; # mips4
171 *\ MIPS\ R10000\ *) ARCH="-march=mips4 -mabi=32" ;; # mips4 175 *\ MIPS\ R10000\ *) ARCH="-march=mips4 -mabi=32" ;; # mips4
172 esac ;; 176 esac ;;
173 esac 177 esac
174 ;; 178 ;;
175 179
176 powerpc) case $hw_model in # Examples 180 powerpc) case $hw_model in # Examples
177 601\ *) ARCH='-mcpu=601' ;; # Untested 181 601\ *) ARCH='-mcpu=601' ;; # Untested
178 602\ *) ARCH='-mcpu=602' ;; # Untested 182 602\ *) ARCH='-mcpu=602' ;; # Untested
179 603\ *) ARCH='-mcpu=603' ;; # Untested 183 603\ *) ARCH='-mcpu=603' ;; # Untested
180 603e\ *|603ev\ *) ARCH='-mcpu=603e' ;; # Umax C500 / PM4400 184 603e\ *|603ev\ *) ARCH='-mcpu=603e' ;; # Umax C500 / PM4400
181 604\ *) ARCH='-mcpu=604' ;; # Mac 8500 185 604\ *) ARCH='-mcpu=604' ;; # Mac 8500
182 604e\ *) ARCH='-mcpu=604e' ;; # upgr B&W G3 186 604e\ *) ARCH='-mcpu=604e' ;; # upgr B&W G3
183 604ev\ *) ARCH='-mcpu=604e' ;; # usually 604e 187 604ev\ *) ARCH='-mcpu=604e' ;; # usually 604e
184 620\ *) ARCH='-mcpu=620' ;; # Untested 188 620\ *) ARCH='-mcpu=620' ;; # Untested
185 7400\ *) ARCH='-mcpu=7400' ;; # AGP G4/400 Mac 189 7400\ *) ARCH='-mcpu=7400' ;; # AGP G4/400 Mac
186 740\ *) ARCH='-mcpu=740' ;; # Untested 190 740\ *) ARCH='-mcpu=740' ;; # Untested
187 7410\ *) ARCH='-mcpu=7400' ;; # powerbook g4 191 7410\ *) ARCH='-mcpu=7400' ;; # powerbook g4
188 7447A\ *) ARCH='-mcpu=7450' ;; # 192 7447A\ *) ARCH='-mcpu=7450' ;; #
189 7450\ *) ARCH='-mcpu=7450' ;; # tibook 550 193 7450\ *) ARCH='-mcpu=7450' ;; # tibook 550
190 750\ *) ARCH='-mcpu=750' ;; # orig. iBook 194 750\ *) ARCH='-mcpu=750' ;; # orig. iBook
191 195
192 esac ;; 196 esac ;;
193 197
194 sparc | sparc64) case " $hw_model" in # Examples 198 sparc | sparc64) case " $hw_model" in # Examples
195 *[\ \(]MB86900/1A*) ARCH='-mcpu=cypress' ;; # ss1+ 199 *[\ \(]MB86900/1A*) ARCH='-mcpu=cypress' ;; # ss1+
196 *[\ \(]L64811*) ARCH='-mcpu=cypress' ;; # sun4/sun4c 200 *[\ \(]L64811*) ARCH='-mcpu=cypress' ;; # sun4/sun4c
197 *[\ \(]CY7C601*) ARCH='-mcpu=cypress' ;; # ss2 201 *[\ \(]CY7C601*) ARCH='-mcpu=cypress' ;; # ss2
198 *[\ \(]W8601/8701*) ARCH='-mcpu=cypress' ;; # elc 202 *[\ \(]W8601/8701*) ARCH='-mcpu=cypress' ;; # elc
199 *[\ \(]MB86904*) ARCH='-mcpu=supersparc' ;; # ss5 usparc 203 *[\ \(]MB86904*) ARCH='-mcpu=supersparc' ;; # ss5 usparc
200 *[\ \(]MB86907*) ARCH='-mcpu=supersparc' ;; # ss5 usparc 204 *[\ \(]MB86907*) ARCH='-mcpu=supersparc' ;; # ss5 usparc
201 *[\ \(]TMS390S10*) ARCH='-mcpu=supersparc' ;; # classic " 205 *[\ \(]TMS390S10*) ARCH='-mcpu=supersparc' ;; # classic "
202 *[\ \(]TMS390Z50*) ARCH='-mcpu=supersparc' ;; # ss10/ss20 206 *[\ \(]TMS390Z50*) ARCH='-mcpu=supersparc' ;; # ss10/ss20
203 *[\ \(]RT620/625*) ARCH='-mcpu=hypersparc' ;; # ss20 ross 207 *[\ \(]RT620/625*) ARCH='-mcpu=hypersparc' ;; # ss20 ross
204 *[\ \(]MB86930*) ARCH='-mcpu=sparclite' ;; # from gcc 208 *[\ \(]MB86930*) ARCH='-mcpu=sparclite' ;; # from gcc
205 *[\ \(]MB86934*) ARCH='-mcpu=sparclite' ;; # from gcc 209 *[\ \(]MB86934*) ARCH='-mcpu=sparclite' ;; # from gcc
206 # under 1.5.1 -mcpu=ultrasparc chokes egcs-2.91.66 compiling perl 210 # under 1.5.1 -mcpu=ultrasparc chokes egcs-2.91.66 compiling perl
207 *[\ \(]SUNW,UltraSPARC*) ARCH='-mcpu=v9' ;; # Ultra 211 *[\ \(]SUNW,UltraSPARC*) ARCH='-mcpu=v9' ;; # Ultra
208 esac ;; 212 esac ;;
209 213
210 vax) # No VAX specific gcc optimisations available 214 vax) # No VAX specific gcc optimisations available
211 NOARCH=1 215 NOARCH=1
212 ;; 216 ;;
213 217
214 esac 218 esac
215 echo $ARCH 219 echo $ARCH
216 } 220 }
217 221
218determine_features() 222determine_features()
219 { 223 {
220 FEATURES= 224 FEATURES=
221 225
222 case $hw_machine_arch in 226 case $hw_machine_arch in
223 i386 | x86_64) 227 i386 | x86_64)
224 if [ -n "$cpu_feature_SSE3" ] ; then 228 if [ -n "$cpu_feature_SSE3" ] ; then
225 FEATURES="-mfpmath=sse -msse3" 229 FEATURES="-mfpmath=sse -msse3"
226 elif [ -n "$cpu_feature_SSE2" ] ; then 230 elif [ -n "$cpu_feature_SSE2" ] ; then
227 FEATURES="-mfpmath=sse -msse2" 231 FEATURES="-mfpmath=sse -msse2"
228 elif [ -n "$cpu_feature_SSE" ] ; then 232 elif [ -n "$cpu_feature_SSE" ] ; then
229 FEATURES="-mfpmath=sse -msse" 233 FEATURES="-mfpmath=sse -msse"
230 fi 234 fi
231 ;; 235 ;;
232 m68k) 236 m68k)
233 case "$(egrep '^fpu0 ' /var/run/dmesg.boot)" in 237 case "$(egrep '^fpu0 ' /var/run/dmesg.boot)" in
234 *\(emulator\)*) FEATURES="-msoft-float" ;; 238 *\(emulator\)*) FEATURES="-msoft-float" ;;
235 *\(no\ math\ support\)*) FEATURES="-msoft-float" ;; 239 *\(no\ math\ support\)*) FEATURES="-msoft-float" ;;
236 esac 240 esac
237 ;; 241 ;;
238 esac 242 esac
239 echo $FEATURES 243 echo $FEATURES
240 } 244 }

cvs diff -r1.8 -r1.9 pkgsrc/devel/cpuflags/files/subr_x86 (switch to unified 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,117 +1,129 @@ @@ -1,117 +1,129 @@
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
14map_x86_brand_string() 16map_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
42flags_fixup_x86arch() 54flags_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
47 # 59 #
48 # The format of table is 60 # The format of table is
49 # feature:lowend_arch:fix_arch 61 # feature:lowend_arch:fix_arch
50 # 62 #
51 $AWK -v "arch=${arch#-march=}" -v "features=$features" ' 63 $AWK -v "arch=${arch#-march=}" -v "features=$features" '
52 BEGIN { split(features,ar); FS=":" } 64 BEGIN { split(features,ar); FS=":" }
53 { for (af in ar) 65 { for (af in ar)
54 { if ((ar[af] == $1) && (arch == $3)) { print $2; exit;} } 66 { if ((ar[af] == $1) && (arch == $3)) { print $2; exit;} }
55 } 67 }
56 ' <<EOD 68 ' <<EOD
57-msse:pentium3:i386 69-msse:pentium3:i386
58-msse:pentium3:i486 70-msse:pentium3:i486
59-msse:pentium3:i586 71-msse:pentium3:i586
60-msse:pentium3:i686 72-msse:pentium3:i686
61-msse:pentium3:pentium 73-msse:pentium3:pentium
62-msse:pentium3:pentium-mmx 74-msse:pentium3:pentium-mmx
63-msse:pentium3:pentiumpro 75-msse:pentium3:pentiumpro
64-msse:pentium3:pentium2 76-msse:pentium3:pentium2
65-msse:athlon:k6 77-msse:athlon:k6
66-msse:athlon:k6-2 78-msse:athlon:k6-2
67-msse:athlon:k6-3 79-msse:athlon:k6-3
68-msse2:pentium4:i386 80-msse2:pentium4:i386
69-msse2:pentium4:i386 81-msse2:pentium4:i386
70-msse2:pentium4:i486 82-msse2:pentium4:i486
71-msse2:pentium4:i586 83-msse2:pentium4:i586
72-msse2:pentium4:i686 84-msse2:pentium4:i686
73-msse2:pentium4:pentium 85-msse2:pentium4:pentium
74-msse2:pentium4:pentium-mmx 86-msse2:pentium4:pentium-mmx
75-msse2:pentium4:pentiumpro 87-msse2:pentium4:pentiumpro
76-msse2:pentium4:pentium2 88-msse2:pentium4:pentium2
77-msse2:pentium4:pentium3 89-msse2:pentium4:pentium3
78-msse2:pentium4:pentium3m 90-msse2:pentium4:pentium3m
79-msse2:k8:k6 91-msse2:k8:k6
80-msse2:k8:k6-2 92-msse2:k8:k6-2
81-msse2:k8:k6-3 93-msse2:k8:k6-3
82-msse2:k8:athlon 94-msse2:k8:athlon
83-msse2:k8:athlon-tbird 95-msse2:k8:athlon-tbird
84-msse2:k8:athlon-4 96-msse2:k8:athlon-4
85-msse2:k8:athlon-xp 97-msse2:k8:athlon-xp
86-msse2:k8:athlon-mp 98-msse2:k8:athlon-mp
87-msse3:prescott:i386 99-msse3:prescott:i386
88-msse3:prescott:i386 100-msse3:prescott:i386
89-msse3:prescott:i486 101-msse3:prescott:i486
90-msse3:prescott:i586 102-msse3:prescott:i586
91-msse3:prescott:i686 103-msse3:prescott:i686
92-msse3:prescott:pentium 104-msse3:prescott:pentium
93-msse3:prescott:pentium-mmx 105-msse3:prescott:pentium-mmx
94-msse3:prescott:pentiumpro 106-msse3:prescott:pentiumpro
95-msse3:prescott:pentium2 107-msse3:prescott:pentium2
96-msse3:prescott:pentium3 108-msse3:prescott:pentium3
97-msse3:prescott:pentium3m 109-msse3:prescott:pentium3m
98-msse3:prescott:pentium-m 110-msse3:prescott:pentium-m
99-msse3:prescott:pentium4 111-msse3:prescott:pentium4
100-msse3:prescott:pentium4m 112-msse3:prescott:pentium4m
101-msse3:k8:k6 113-msse3:k8:k6
102-msse3:k8:k6-2 114-msse3:k8:k6-2
103-msse3:k8:k6-3 115-msse3:k8:k6-3
104-msse3:k8:athlon 116-msse3:k8:athlon
105-msse3:k8:athlon-tbird 117-msse3:k8:athlon-tbird
106-msse3:k8:athlon-4 118-msse3:k8:athlon-4
107-msse3:k8:athlon-xp 119-msse3:k8:athlon-xp
108-msse3:k8:athlon-mp 120-msse3:k8:athlon-mp
109-m3dnow:athlon:k6 121-m3dnow:athlon:k6
110-m3dnow:athlon:k6-2 122-m3dnow:athlon:k6-2
111-m3dnow:athlon:k6-3 123-m3dnow:athlon:k6-3
112EOD 124EOD
113 125
114## in future 126## in future
115#-mssse3:nocona:prescott ... 127#-mssse3:nocona:prescott ...
116#-msse4:nehalem:nocona ... 128#-msse4:nehalem:nocona ...
117 } 129 }