Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 May 2010 11:20:22 GMT
From:      Anonymous <swell.k@gmail.com>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: conf/112997: [patch] Add note about the 'native' mtune option to share/examples/etc/make.conf
Message-ID:  <201005031120.o43BKMPt045780@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR conf/112997; it has been noted by GNATS.

From: Anonymous <swell.k@gmail.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: conf/112997: [patch] Add note about the 'native' mtune option to share/examples/etc/make.conf
Date: Mon, 03 May 2010 15:18:33 +0400

 I disagree, native and ${YOUR_CPU} aren't equivalent. Here is what I get
 on gcc45 + core2@amd64 system:
 
   $ cc -E -v -march=core2 - </dev/null |& fgrep cc1
   .../cc1 -E -quiet -v - -march=core2
 
   $ cc -E -v -mtune=core2 - </dev/null |& fgrep cc1
   .../cc1 -E -quiet -v - -mtune=core2 -march=x86-64
 
   $ cc -E -v -march=native - </dev/null |& fgrep cc1
   .../cc1 -E -quiet -v - -march=core2 -mcx16 -msahf -msse4.1 --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=6144 -mtune=core2
 
   $ cc -E -v -mtune=native - </dev/null |& fgrep cc1
   .../cc1 -E -quiet -v - --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=6144 -mtune=core2 -march=x86-64
 
 And bsd.cpu.mk is oblivious about gcc43+. It will degrade native to
 nocona even though core2 is supported. Good example that overriding
 CPUTYPE is bad idea.
 
 Better leave CPUTYPE as is and populate MACHINE_CPU directly, smth like
 
   $ cat a.mk
   CPUTYPE = ${MACHINE_ARCH}
   MACHINE_CPU != echo ${MACHINE_ARCH}; ${CC} -E -dM -v -march=${CPUTYPE:S/amd64/x86-64/:S/i386/i486/} - </dev/null 2>&1 \
           | awk '/SSE|MMX/ && !/MATH/ { FS="__"; gsub("_",".",$$2); print tolower($$2) }'
 
   $ make -f a.mk -V MACHINE_CPU
   amd64 mmx sse2 sse
   $ make -f a.mk -V MACHINE_CPU CPUTYPE=native
   amd64 sse4.1 mmx sse2 ssse3 sse sse3
   $ make -f a.mk -V MACHINE_CPU CPUTYPE=native CC=/usr/bin/cc
   amd64 mmx sse sse2 sse3



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201005031120.o43BKMPt045780>