default CFLAGS

Morgan Wesström freebsd-questions at pp.dyndns.biz
Sat Jan 24 12:13:04 PST 2009



Saifi Khan wrote:
> On Sat, Jan 24, 2009 at 5:57 PM, Pojken Purken <pp at pp.dyndns.biz> wrote:
>> RW wrote:
>>> On Sat, 24 Jan 2009 15:27:02 +0100
>>> Morgan Wesström <freebsd-questions at pp.dyndns.biz> wrote:
>>>
>>>
>>>> The section "options enabled" will list them all. I usually only add
>>>> "-march=native" to my CFLAGS to enable a few more CPU specific
>>>> optimizations.
>>> If you set CPUTYPE, -march is set to match, so setting -march=native
>>> should be redundant. OTOH a number of other make variables are defined
>>> from CPUTYPE, so if you set  -march=native, but not CPUTYPE you might
>>> miss some optimisations based on build options.
>>>
>>> I've no idea whether there are any such options, just that you're
>>> probably not going to do better than setting CPUTYPE, and leaving the
>>> rest alone.
>> I'm sorry I was unclear. I set CPUTYPE to native of course which is then
>> passed as -march=native to compiler.
>>
> 
> The entry in file /var/run/dmesg.boot shows the CPU information as
> CPU: Intel (R) Celeron (R) CPU 2.40 GHz (686-class CPU)
> 
> The entry in /usr/share/examples/etc/make.conf shows CPU types for Intel as
> core2 core nocona pentium4m pentium4 prescott pentium3m pentium3 pentium-m
> pentium2 pentiumpro pentium-mx pentium i486 i386
> 
> What would be the appropriate CPUTYPE specification in this case ?
> 
> Is there any table which sort of maps the marketing names of the Intel processor
> with the CPU information shown in dmesg ?
> 

gcc 4.2 and later will figure out the correct -march and -mtune for you
automatically if you use CPUTYPE=native. How it does it in detail can be
seen in its source code but basically it's decided by checking
manufacturer, cpu family and whether sse2 and sse3 support is present.
Your processor is most likely a prescott and you can see what gcc
selects by running the compilation example from my previous post. The
choice shows up in its output.
/Morgan


More information about the freebsd-questions mailing list