intel i5 - core? or core2?

Anonymous swell.k at
Sat Aug 21 16:25:45 UTC 2010

"Domagoj S." <rank1seeker at> writes:

> 8.1 RELEASE  32bit
> # gcc --version
> gcc (GCC) 4.2.1 20070719  [FreeBSD]
> As per:
> 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 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.

More information about the freebsd-hackers mailing list