make.conf configurations and cpu types

Hello,

I am looking to optimizing my source compilations. I note the setting CPUTYPE?=

with the following options for INTEL CPUs:

Code:
core2 core nocona pentium4m pentium4 prescott pentium3m pentium3 pentium-m pentium2

I am using an Intel Xeon X3440 processor. How do I determine what to use? I could not find a resource on the web linking the connection between processor type and these options. I get the vague sense from reading online that I may want to use "nocona" but I am not sure about it. As always, any guidance or hints are appreciated.

I am particularly interested in this as a follow up on building my kernel as well as future optimizations applied to compiled ports.
 
Also, one quick follow up. I see some people add the '?' to "CPUTYPE" and others don't.

Is it CPUTYPE=foobar

or

Is it CPUTYPE?=foobar

maybe these questions seem silly but I could not a reference that elaborated on this.
 
from

/usr/share/examples/etc/make.conf

Code:
# The CPUTYPE variable controls which processor should be targeted for
# generated code.  This controls processor-specific optimizations in
# certain code (currently only OpenSSL) as well as modifying the value
# of CFLAGS to contain the appropriate optimization directive to gcc.
# The automatic setting of CFLAGS may be overridden using the
# NO_CPU_CFLAGS variable below.
# Currently the following CPU types are recognized:
#   Intel x86 architecture:
#       (AMD CPUs)      opteron athlon64 athlon-mp athlon-xp athlon-4
#                       athlon-tbird athlon k8 k6-3 k6-2 k6 k5
#       (Intel CPUs)    core2 core nocona pentium4m pentium4 prescott
#                       pentium3m pentium3 pentium-m pentium2
#                       pentiumpro pentium-mmx pentium i486 i386
#       (Via CPUs)      c3 c3-2
#   Alpha/AXP architecture: ev67 ev6 pca56 ev56 ev5 ev45 ev4
#   AMD64 architecture: opteron, athlon64, nocona, prescott, core2
#   Intel ia64 architecture: itanium2, itanium
#
[B]# (?= allows to buildworld for a different CPUTYPE.)[/B]
#
#CPUTYPE?=pentium3
#NO_CPU_CFLAGS=         # Don't add -march=<cpu> to CFLAGS automatically
#NO_CPU_COPTFLAGS=      # Don't add -march=<cpu> to COPTFLAGS automatically
 
I see, so from my understanding, I can have BOTH cputype=foobar and cputype?=foobar in the same make.conf file and the one without the '?' is used for all compiles except the kernel and the one with '?' used just for the kernel.

Now if only I could figure out how to determine the right cputype for my cpu processor (Intel X3440). A Google search brings up this post to this forum!

Thanks for any suggestions
 
badaei said:
I see, so from my understanding, I can have BOTH cputype=foobar and cputype?=foobar in the same make.conf file and the one without the '?' is used for all compiles except the kernel and the one with '?' used just for the kernel.

Err, no.

% man make | less '+/\?='

Now if only I could figure out how to determine the right cputype for my cpu processor (Intel X3440).

Code:
CPUTYPE?=native

There's a script to detect specific cputype: http://www.pixelbeat.org/scripts/gcccpuopt
It says my core2 system should use CPUTYPE?=pentium-m. I guess I could benchmark it and see if that's faster than core2, which translates to prescott with the current system gcc.
 
The output of gcccpuopt was:

Code:
Warning: Your compiler supports the -march=native option which you may prefer
Warning: The optimum *32 bit* architecture is reported
Warning: Newer versions of GCC better support your CPU with -march=core2
-m32 -march=pentium-m -mfpmath=sse

This is a 64-bit machine so that won't work. I did a Google search looking to understand more about the cputype?=native setting. I came across this link, telling people *not* to use native.

http://lists.freebsd.org/pipermail/freebsd-bugs/2007-May/024348.html

Not sure if this is relevant but my kernel configuration file has this setting in it

Code:
cpu HAMMER

for reference, I have an Intel Xeon x3440 cpu.

Thanks for sharing knowledge thus far.
 
I wonder if just using

Code:
COPTFLAGS= -O -pipe

is the best option. What "cputype" is set if you set nothing anyway? What is the default action?
 
Executing

Code:
gcc -v -x c -E -mtune=native /dev/null -o /dev/null 2>&1 | grep mtune | sed -e 's/.*mtune=//'

Returns "generic" on my x3440 machine. Out of curiosity I ran this on my MacBook Air and it return "native -m64".

It seems safe to say that I should leave cputype alone and commented it out of my make.conf for the Intel x3440, unless someone out there knows better. Thanks everyone for your input.
 
badaei said:
Executing

Code:
gcc -v -x c -E -mtune=native /dev/null -o /dev/null 2>&1 | grep mtune | sed -e 's/.*mtune=//'

Returns "generic" on my x3440 machine. Out of curiosity I ran this on my MacBook Air and it return "native -m64".

It seems safe to say that I should leave cputype alone and commented it out of my make.conf for the Intel x3440, unless someone out there knows better. Thanks everyone for your input.

For myself i used

Code:
CPUTYPE?=core2

with two Intel(R) Xeon(R) CPU E5620, and dont recognized any problems so far.

So my opinion is, it is safe to use. But leave compiler flags untouched, like SirDice said.
 
Does the current base gcc optimize anything sufficiently different to warrant playing with CPUTYPE? Especially on amd64 systems?
 
danbi said:
Does the current base gcc optimize anything sufficiently different to warrant playing with CPUTYPE? Especially on amd64 systems?

mine is set to core2

it still compiles with nocona. There is a switch somewhere as we are still on an older version of gcc. This will change in the future just use core2 as it's what it should be set to anyways.
 
Back
Top