From owner-freebsd-hackers@FreeBSD.ORG Sat Aug 21 16:25:45 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B82B81065670 for ; Sat, 21 Aug 2010 16:25:45 +0000 (UTC) (envelope-from swell.k@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 4B80C8FC14 for ; Sat, 21 Aug 2010 16:25:44 +0000 (UTC) Received: by wwi18 with SMTP id 18so1564985wwi.31 for ; Sat, 21 Aug 2010 09:25:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:references :date:in-reply-to:message-id:user-agent:mime-version:content-type; bh=rZ/yqyenJrkdG6QPQUVOS26mqRktJSDcDZglAhJcwWw=; b=jbpIrwU9NnTxhYiNftVtM3EZl1rTRShI4ckgMI4GhStp20aGP2q9oyAgw56gxPXA4R CeE6faBvMdEw8RErseizcaacB/3MQCY1j6va16750be1GrTuevUHDAa4AVRAB6TpGjWF IgS1BtrjXZ/0WDxtAP++N1DkJK1TyaZygSHfw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; b=EzA+KaTLJPNfsbyMLrTQhIEADCQ8YKZHODruRp4G4w7RXma1r/O7C6Kgvh9nOT5HPL P78vRBNyoxcx9Rjb0wRuAUgR0Je3WLUxmeNIC0gSlU59ge0O1XQNfbwdkng7/MReQ7rR Qo2LJQswBZtglApr0S4pIfiyM/VPoJnR7tcuA= Received: by 10.227.143.12 with SMTP id s12mr2653474wbu.125.1282407944083; Sat, 21 Aug 2010 09:25:44 -0700 (PDT) Received: from localhost (server51262.uk2net.com [83.170.92.9]) by mx.google.com with ESMTPS id e31sm3607633wbe.5.2010.08.21.09.25.41 (version=SSLv3 cipher=RC4-MD5); Sat, 21 Aug 2010 09:25:42 -0700 (PDT) From: Anonymous To: "Domagoj S." References: <1008211213030.2000@smasher> <8639u822tx.fsf@gmail.com> Date: Sat, 21 Aug 2010 20:25:35 +0400 In-Reply-To: (Domagoj S.'s message of "Sat, 21 Aug 2010 13:41:38 +0200") Message-ID: <861v9sue4g.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: freebsd-hackers@freebsd.org Subject: Re: intel i5 - core? or core2? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Aug 2010 16:25:45 -0000 "Domagoj S." 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} - &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.