From 1f109a66003ddced299c5eb18708cc7c5e77a442 Mon Sep 17 00:00:00 2001 From: jkim Date: Tue, 4 Dec 2012 00:37:17 +0000 Subject: [PATCH] Tidy up bsd.cpu.mk for X86 CPUs: - Do not limit recent processors to "prescott" class for i386 target. There is no reason for this hack because clang is default now. On top of that, it will only grow indefinitely over time. - Add more CPUTYPEs, i.e., "athlon-fx", "core-avx2", "atom", "penryn", and "yonah". Note "penryn" and "yonah" are intentionally undocumented because they are not supported by gcc and marked deprecated by clang. - Add more CPUTYPE aliases, i.e., "barcelona" (-> amdfam10), "westmere" and "nehalem" (-> corei7). Note these are intentionally undocumented because they are not supported by (base) gcc and/or clang. However, LLVM (backend) seems to "know" the differences. Most likely, they were deprecated with other vendor code names and clang did not bother implementing them at all. - Add i686 to MACHINE_CPU for "c3-2" (VIA Nehemiah). Both gcc & clang treat it like an i686-class processor. - Add IDT "winchip2" and "winchip-c6" for completeness (undocumented). - Order processors per make.conf example, i.e., CPU vendors and models. - Tidy up make.conf example, i.e., remove "by gcc" (because we have aliases) and remove "prescott" from AMD64 architecture (because it is not correct). --- share/examples/etc/make.conf | 11 +++--- share/mk/bsd.cpu.mk | 74 +++++++++++++++++++++--------------- 2 files changed, 49 insertions(+), 36 deletions(-) diff --git a/share/examples/etc/make.conf b/share/examples/etc/make.conf index 6ba5a4ee5c7d..df5e225bd244 100644 --- a/share/examples/etc/make.conf +++ b/share/examples/etc/make.conf @@ -28,24 +28,25 @@ # of CFLAGS to contain the appropriate optimization directive to cc. # The automatic setting of CFLAGS may be overridden using the # NO_CPU_CFLAGS variable below. -# Currently the following CPU types are recognized by gcc: +# Currently the following CPU types are recognized: # Intel x86 architecture: # (AMD CPUs) opteron-sse3, athlon64-sse3, k8-sse3, opteron, -# athlon64, k8, athlon-mp, athlon-xp, athlon-4, -# athlon-tbird, athlon, k7, geode, k6-3, k6-2, k6, k5 +# athlon64, athlon-fx, k8, athlon-mp, athlon-xp, +# athlon-4, athlon-tbird, athlon, k7, geode, k6-3, +# k6-2, k6 # (Intel CPUs) core2, core, nocona, pentium4m, pentium4, prescott, # pentium3m, pentium3, pentium-m, pentium2, # pentiumpro, pentium-mmx, pentium, i486 # (VIA CPUs) c7, c3-2, c3 # AMD64 architecture: opteron-sse3, athlon64-sse3, k8-sse3, opteron, -# athlon64, k8, core2, nocona, prescott +# athlon64, k8, core2, nocona # Intel ia64 architecture: itanium2, itanium # SPARC-V9 architecture: v9 (generic 64-bit V9), ultrasparc (default # if omitted), ultrasparc3 # Additionally the following CPU types are recognized by clang: # Intel x86 architecture (for both amd64 and i386): # (AMD CPUs) bdver2, bdver1, btver1, amdfam10 -# (Intel CPUs) core-avx-i, corei7-avx, corei7 +# (Intel CPUs) core-avx2, core-avx-i, corei7-avx, corei7, atom # # (?= allows to buildworld for a different CPUTYPE.) # diff --git a/share/mk/bsd.cpu.mk b/share/mk/bsd.cpu.mk index af395613b82f..2b5d4521ad21 100644 --- a/share/mk/bsd.cpu.mk +++ b/share/mk/bsd.cpu.mk @@ -27,9 +27,13 @@ MACHINE_CPU = mips # between e.g. i586 and pentium) . if ${MACHINE_CPUARCH} == "i386" -. if ${CPUTYPE} == "nocona" || ${CPUTYPE} == "core" || \ - ${CPUTYPE} == "core2" || ${CPUTYPE} == "corei7" || \ - ${CPUTYPE} == "corei7-avx" || ${CPUTYPE} == "core-avx-i" +. if ${CPUTYPE} == "barcelona" +CPUTYPE = amdfam10 +. elif ${CPUTYPE} == "k7" +CPUTYPE = athlon +. elif ${CPUTYPE} == "westmere" || ${CPUTYPE} == "nehalem" +CPUTYPE = corei7 +. elif ${CPUTYPE} == "core" CPUTYPE = prescott . elif ${CPUTYPE} == "p4" CPUTYPE = pentium4 @@ -49,18 +53,13 @@ CPUTYPE = pentiumpro CPUTYPE = pentium-mmx . elif ${CPUTYPE} == "i586" CPUTYPE = pentium -. elif ${CPUTYPE} == "opteron-sse3" || ${CPUTYPE} == "athlon64-sse3" || \ - ${CPUTYPE} == "k8-sse3" || ${CPUTYPE} == "amdfam10" || \ - ${CPUTYPE} == "btver1" || ${CPUTYPE} == "bdver1" || ${CPUTYPE} == "bdver2" -CPUTYPE = prescott -. elif ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" || \ - ${CPUTYPE} == "k8" -CPUTYPE = athlon-mp -. elif ${CPUTYPE} == "k7" -CPUTYPE = athlon . endif . elif ${MACHINE_CPUARCH} == "amd64" -. if ${CPUTYPE} == "prescott" +. if ${CPUTYPE} == "barcelona" +CPUTYPE = amdfam10 +. elif ${CPUTYPE} == "westmere" || ${CPUTYPE} == "nehalem" +CPUTYPE = corei7 +. elif ${CPUTYPE} == "prescott" CPUTYPE = nocona . endif . elif ${MACHINE_ARCH} == "sparc64" @@ -87,11 +86,11 @@ CPUTYPE = ultrasparc3 _CPUCFLAGS = -march=i686 -falign-functions=0 -falign-jumps=0 -falign-loops=0 . elif ${CPUTYPE} == "k5" _CPUCFLAGS = -march=pentium -. elif ${CPUTYPE} == "core2" -_CPUCFLAGS = -march=prescott +. elif ${CPUTYPE} == "c7" +_CPUCFLAGS = -march=c3-2 . else _CPUCFLAGS = -march=${CPUTYPE} -. endif # GCC on 'i386' +. endif . elif ${MACHINE_CPUARCH} == "amd64" _CPUCFLAGS = -march=${CPUTYPE} . elif ${MACHINE_CPUARCH} == "arm" @@ -143,7 +142,7 @@ _CPUCFLAGS = -mcpu=ultrasparc3 # presence of a CPU feature. . if ${MACHINE_CPUARCH} == "i386" -. if ${CPUTYPE} == "bdver1" || ${CPUTYPE} == "bdver2" +. if ${CPUTYPE} == "bdver2" || ${CPUTYPE} == "bdver1" MACHINE_CPU = xop avx sse42 sse41 ssse3 sse4a sse3 sse2 sse mmx k6 k5 i586 . elif ${CPUTYPE} == "btver1" MACHINE_CPU = ssse3 sse4a sse3 sse2 sse mmx k6 k5 i586 @@ -151,7 +150,8 @@ MACHINE_CPU = ssse3 sse4a sse3 sse2 sse mmx k6 k5 i586 MACHINE_CPU = athlon-xp athlon k7 3dnow sse4a sse3 sse2 sse mmx k6 k5 i586 . elif ${CPUTYPE} == "opteron-sse3" || ${CPUTYPE} == "athlon64-sse3" MACHINE_CPU = athlon-xp athlon k7 3dnow sse3 sse2 sse mmx k6 k5 i586 -. elif ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" +. elif ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" || \ + ${CPUTYPE} == "athlon-fx" MACHINE_CPU = athlon-xp athlon k7 3dnow sse2 sse mmx k6 k5 i586 . elif ${CPUTYPE} == "athlon-mp" || ${CPUTYPE} == "athlon-xp" || \ ${CPUTYPE} == "athlon-4" @@ -164,19 +164,17 @@ MACHINE_CPU = 3dnow mmx k6 k5 i586 MACHINE_CPU = mmx k6 k5 i586 . elif ${CPUTYPE} == "k5" MACHINE_CPU = k5 i586 -. elif ${CPUTYPE} == "c3" -MACHINE_CPU = 3dnow mmx i586 -. elif ${CPUTYPE} == "c3-2" -MACHINE_CPU = sse mmx i586 -. elif ${CPUTYPE} == "c7" -MACHINE_CPU = sse3 sse2 sse i686 mmx i586 -. elif ${CPUTYPE} == "corei7-avx" || ${CPUTYPE} == "core-avx-i" +. elif ${CPUTYPE} == "corei-avx2" +MACHINE_CPU = avx2 avx sse42 sse41 ssse3 sse3 sse2 sse i686 mmx i586 +. elif ${CPUTYPE} == "core-avx-i" || ${CPUTYPE} == "corei7-avx" MACHINE_CPU = avx sse42 sse41 ssse3 sse3 sse2 sse i686 mmx i586 . elif ${CPUTYPE} == "corei7" MACHINE_CPU = sse42 sse41 ssse3 sse3 sse2 sse i686 mmx i586 -. elif ${CPUTYPE} == "core2" +. elif ${CPUTYPE} == "penryn" +MACHINE_CPU = sse41 ssse3 sse3 sse2 sse i686 mmx i586 +. elif ${CPUTYPE} == "atom" || ${CPUTYPE} == "core2" MACHINE_CPU = ssse3 sse3 sse2 sse i686 mmx i586 -. elif ${CPUTYPE} == "prescott" +. elif ${CPUTYPE} == "yonah" || ${CPUTYPE} == "prescott" MACHINE_CPU = sse3 sse2 sse i686 mmx i586 . elif ${CPUTYPE} == "pentium4" || ${CPUTYPE} == "pentium4m" || \ ${CPUTYPE} == "pentium-m" @@ -191,10 +189,20 @@ MACHINE_CPU = i686 i586 MACHINE_CPU = mmx i586 . elif ${CPUTYPE} == "pentium" MACHINE_CPU = i586 +. elif ${CPUTYPE} == "c7" +MACHINE_CPU = sse3 sse2 sse i686 mmx i586 +. elif ${CPUTYPE} == "c3-2" +MACHINE_CPU = sse i686 mmx i586 +. elif ${CPUTYPE} == "c3" +MACHINE_CPU = 3dnow mmx i586 +. elif ${CPUTYPE} == "winchip2" +MACHINE_CPU = 3dnow mmx +. elif ${CPUTYPE} == "winchip-c6" +MACHINE_CPU = mmx . endif MACHINE_CPU += i486 . elif ${MACHINE_CPUARCH} == "amd64" -. if ${CPUTYPE} == "bdver1" || ${CPUTYPE} == "bdver2" +. if ${CPUTYPE} == "bdver2" || ${CPUTYPE} == "bdver1" MACHINE_CPU = xop avx sse42 sse41 ssse3 sse4a sse3 . elif ${CPUTYPE} == "btver1" MACHINE_CPU = ssse3 sse4a sse3 @@ -204,13 +212,17 @@ MACHINE_CPU = k8 3dnow sse4a sse3 ${CPUTYPE} == "k8-sse3" MACHINE_CPU = k8 3dnow sse3 . elif ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" || \ - ${CPUTYPE} == "k8" + ${CPUTYPE} == "athlon-fx" || ${CPUTYPE} == "k8" MACHINE_CPU = k8 3dnow -. elif ${CPUTYPE} == "corei7-avx" || ${CPUTYPE} == "core-avx-i" +. elif ${CPUTYPE} == "corei-avx2" +MACHINE_CPU = avx2 avx sse42 sse41 ssse3 sse3 +. elif ${CPUTYPE} == "core-avx-i" || ${CPUTYPE} == "corei7-avx" MACHINE_CPU = avx sse42 sse41 ssse3 sse3 . elif ${CPUTYPE} == "corei7" MACHINE_CPU = sse42 sse41 ssse3 sse3 -. elif ${CPUTYPE} == "core2" +. elif ${CPUTYPE} == "penryn" +MACHINE_CPU = sse41 ssse3 sse3 +. elif ${CPUTYPE} == "atom" || ${CPUTYPE} == "core2" MACHINE_CPU = ssse3 sse3 . elif ${CPUTYPE} == "nocona" MACHINE_CPU = sse3