Date: Sat, 21 Aug 2010 20:25:35 +0400 From: Anonymous <swell.k@gmail.com> To: "Domagoj S." <rank1seeker@gmail.com> Cc: freebsd-hackers@freebsd.org Subject: Re: intel i5 - core? or core2? Message-ID: <861v9sue4g.fsf@gmail.com> In-Reply-To: <AANLkTim_6DJq5d_DRzkV6Gf883oJt0UngDXhc8OkTWEc@mail.gmail.com> (Domagoj S.'s message of "Sat, 21 Aug 2010 13:41:38 %2B0200") References: <1008211213030.2000@smasher> <8639u822tx.fsf@gmail.com> <AANLkTim_6DJq5d_DRzkV6Gf883oJt0UngDXhc8OkTWEc@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
"Domagoj S." <rank1seeker@gmail.com> writes: > 8.1 RELEASE 32bit > > # gcc --version > gcc (GCC) 4.2.1 20070719 [FreeBSD] > > As per: http://gcc.gnu.org/gcc-4.2/changes.html > core2 is supported It's not! `core' and `core2' for -mtune/-march introduced since gcc43. $ echo 'int main(){}' | gcc -xc - -o/dev/null -march=core :1: error: bad value (core) for -march= switch :1: error: bad value (core) for -mtune= switch $ echo 'int main(){}' | gcc -xc - -o/dev/null -march=core2 :1: error: bad value (core2) for -march= switch :1: error: bad value (core2) for -mtune= switch Setting CPUTYPE to `core2' on amd64 will only add `sse3' to MACHINE_CPU, even when the underlying compiler/assembler actually supports more features, e.g. ssse3, sse4.1, etc., cf. conf/112997. BTW, while clang in base (on /head) supports -march=core2 it's still better to stick to -march=native, e.g. on my box CPU: Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz (3177.07-MHz K8-class CPU) `native' on clang implies `penryn', not a `core2'. While `native' on gcc45 implies `core2' + extra cflags[1]. [1] -mcx16 -msahf -msse4.1 --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=6144 > > Setting CPUTYPE(for i386) to: "nocona", "core" or "core2", will at > the end, ALWAYS set CPUTYPE to: "prescott", which again results in > set: > MACHINE_CPU = sse3 sse2 sse i686 mmx i586 i486 i386 You can populate MACHINE_CPU directly, e.g. CPUTYPE ?= native MACHINE_CPU != echo ${MACHINE_ARCH}; ${CC} -E -dM -v -march=${CPUTYPE} - </dev/null 2>&1 \ | awk '/SSE|MMX/ && !/MATH/ { FS="__"; gsub("_",".",$$2); print tolower($$2) }' MACHINE_CPU += i486 i586 i686 Note sure how well it'll work for cross-arch compilation, though. > > CPUTYPE?=native is nowhere mentioned "in FreeBSD" That cruft in bsd.cpu.mk was written in pre-gcc4 days, i.e. when it didn't support -march=native. Besides, if not maintained to accommodate for newer gcc's from ports those aliases are more harmful than useful. And not much code uses MACHINE_CPU in base anyway, only libcrypto and libz.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?861v9sue4g.fsf>