# $NetBSD: subr_x86,v 1.13 2009/03/30 21:02:25 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) # Family 0x6: AMD K7 # Family 0xf: AMD K8 # Family 0x10: AMD Barcelona/Phenom # Family 0x11: AMD Turion Ultra map_x86_brand_string() { 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' ;; "Genuine Intel(R) CPU T2500"*) echo '-march=core2' ;; "Intel(R) Atom(TM) CPU "*) echo '-march=core2 -mtune=pentium' ;;#So far "Intel(R) Celeron(R) CPU E1400"*) echo '-march=core2' ;; "Intel(R) Celeron(R) CPU 2.40GHz") echo '-march=pentium4' ;; "Intel(R) Celeron(R) M processor "*) echo '-march=pentium-m' ;; "Intel(R) Celeron(TM) CPU 1400MHz") echo '-march=pentium3' ;; "Intel(R) Core 2 "*) echo '-march=core2' ;; "Intel(R) Core(TM)2 "*) echo '-march=core2' ;; "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' ;; "Intel(R) Xeon(R) CPU E5310"*) echo '-march=core2' ;; "Intel(r) Xeon(r) CPU E5430"*) echo '-march=core2' ;; "Pentium(R) Dual-Core CPU E5200"*) echo '-march=core2' ;; esac } flags_fixup_x86arch() { arch=$1 features=$2 # Fixup ARCH for x86 # # The format of table is # feature:lowend_arch:fix_arch # $AWK -v "arch=${arch#-march=}" -v "features=$features" ' BEGIN { split(features,ar); FS=":" } { for (af in ar) { if ((ar[af] == $1) && (arch == $3)) { print $2; exit;} } } ' <