Re: intel i5 - core? or core2?

2010-08-23 Thread Domagoj S.
On Sat, Aug 21, 2010 at 6:25 PM, Anonymous swel...@gmail.com wrote:
 Domagoj S. rank1see...@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.

Ups!
I've been confusing FreeBSD's 'CPUTYPE' with gcc's '-march='


 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


I see..., so I should always go against FBSD devs and ensure that
gcc's arg '-march=' is always populated by value 'native'?
That is, gcc should alone determine CPU? Not a human user and then
setting discovered CPU type in CPUTYPE?


 You can populate MACHINE_CPU directly, e.g.

  CPUTYPE ?= native
  MACHINE_CPU != echo ${MACHINE_ARCH}; ${CC} -E -dM -v -march=${CPUTYPE} - 
 /dev/null 21 \
        | 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.

Setting CPUTYPE will populate MACHINE_CPU.
Then I can ensure gcc's arg '-march=native' by setting:
CFLAGS=-O2 -pipe -march=native

But CPUTYPE will also append it's own '-march=', so to stop it:
NO_CPU_CFLAGS=yes

I've also saw recommendation to add:
COPTFLAGS=-O2 -pipe -march=native
NO_CPU_COPTFLAGS=yes

But I didn't see that CPUTYPE, has ever set COPTFLAGS?


So now I am totally confused with all this options?
What is the right way?


 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.


So if I decide to use a latest compiler from ports, I MUST avoid usage
of CPUTYPE?

Finally, should I use latest gcc compiler from ports, to build world 
kernel, with:
CFLAGS=-O2 -pipe -march=native
COPTFLAGS=-O2 -pipe -march=native
MACHINE_CPU=???


And a, regarding speed, please in percentage and taking regular binary
install from .iso, as a speed of value 100%, to be compared against.
What kind of gain, is compared to compilation from source:
a) Without any variables set in /etc/make.conf or passed on CMD
b) Only CPUTYPE var set, as officially recommended
c) Appending CFLAGS, NO_CPU_CFLAGS ... to b)
d) Using latest gcc from ports
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: intel i5 - core? or core2?

2010-08-21 Thread Domagoj S.
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

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

CPUTYPE?=native is nowhere mentioned in FreeBSD
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: intel i5 - core? or core2?

2010-08-21 Thread Olivier Smedts
2010/8/21 Garrett Cooper gcoo...@freebsd.org:
 On Fri, Aug 20, 2010 at 5:19 PM, Atom Smasher a...@smasher.org wrote:
 hardware:
  MACH:  x86_64 (LENOVO, 4313CTO, ThinkPad T510)
  CPU:   x86_64 (Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz)

 FreeBSD 8.1-RELEASE #0 (amd64)

 in /etc/make.conf i tried setting CPUTYPE=core but as soon as i start
 building things, lang/perl5.10 fails, complaining about core not being
 right.

 when i change the setting to CPUTYPE=core2 it builds fine.

 is something wrong? i thought the i5 was core, not core2...?

    I thought our base gcc didn't support core/core2 (IIRC gcc 4.4+
 supports core/core2). Maybe this is a documentation bug with
 .../share/examples/etc/make.conf ?

CPYTYPE is make.conf and -march in gcc are different things.
After a lot of reading (/usr/share/examples/etc/make.conf and man gcc)
and testing, here is what I use for my core2 :
CPUTYPE=core2
CFLAGS=-O2 -pipe -march=native
NO_CPU_CFLAGS=yes
COPTFLAGS=-O2 -pipe -march=native
NO_CPU_COPTFLAGS=yes

I think you can use the same for your i5.

 Thanks,
 -Garrett
 ___
 freebsd-hackers@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
 To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org




-- 
Olivier Smedts                                                 _
                                        ASCII ribbon campaign ( )
e-mail: oliv...@gid0.org        - against HTML email  vCards  X
www: http://www.gid0.org    - against proprietary attachments / \

  Il y a seulement 10 sortes de gens dans le monde :
  ceux qui comprennent le binaire,
  et ceux qui ne le comprennent pas.
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: intel i5 - core? or core2?

2010-08-21 Thread Anonymous
Domagoj S. rank1see...@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 21 \
| 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.
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: intel i5 - core? or core2?

2010-08-20 Thread Garrett Cooper
On Fri, Aug 20, 2010 at 5:19 PM, Atom Smasher a...@smasher.org wrote:
 hardware:
  MACH:  x86_64 (LENOVO, 4313CTO, ThinkPad T510)
  CPU:   x86_64 (Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz)

 FreeBSD 8.1-RELEASE #0 (amd64)

 in /etc/make.conf i tried setting CPUTYPE=core but as soon as i start
 building things, lang/perl5.10 fails, complaining about core not being
 right.

 when i change the setting to CPUTYPE=core2 it builds fine.

 is something wrong? i thought the i5 was core, not core2...?

I thought our base gcc didn't support core/core2 (IIRC gcc 4.4+
supports core/core2). Maybe this is a documentation bug with
.../share/examples/etc/make.conf ?
Thanks,
-Garrett
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: intel i5 - core? or core2?

2010-08-20 Thread Anonymous
Atom Smasher a...@smasher.org writes:

 hardware:
   MACH:  x86_64 (LENOVO, 4313CTO, ThinkPad T510)
   CPU:   x86_64 (Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz)

 FreeBSD 8.1-RELEASE #0 (amd64)

 in /etc/make.conf i tried setting CPUTYPE=core but as soon as i
 start building things, lang/perl5.10 fails, complaining about core
 not being right.

 when i change the setting to CPUTYPE=core2 it builds fine.

I'd suggest using CPUTYPE?=native and let the compiler decide what's best.
Our pretty old gcc in base supports neither `core' nor `core2'.

The `core2' is just an alias for `nocona'/`prescott' for amd64/i386.
And `core' alias is available only for i386, cf. bsd.cpu.mk.


 is something wrong? i thought the i5 was core, not core2...?
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org