# Atom and -mtune/-march switch



## sysman (May 21, 2010)

Hi. "make.conf", what are best options for atom processor? My lines related to make.conf are:

```
CPUTYPE?=prescott
CFLAGS= -mtune=prescott -march=prescott -O2 -pipe -funroll-loops -fomit-frame-pointer
```
Any other suggests? I know that in Gentoo linux, -march opt could accept switch name "atom", but not being sure I preferred use "prescott" instead, somewhere I got this suggestion but I'd want ask you for other better suggestions.

Thanks
SYS


----------



## fronclynne (May 21, 2010)

Those are based on your version of gcc(1), which by default on FreeBSD 8.0 is 4.2.1.  If you poke your head into /usr/share/mk/bsd.cpu.mk you'll see all the aliases that the base make system passes to gcc.  Note that you can install version of gcc from ports that allows you to use other flags.  It looks like prescott/nocona is as good as it gets for 4.2.1, though, & most of your CFLAGS are redundant.

I don't recall (or care to look up) if the atom chips support sse4, which is about all that'll matter to you (I hear tell that [red]-O666[/red] causes wet newspapers to rain on you for eternity).  If they don't you're no worse off either way.

In any case, Gentoo probably runs a slightly "better" version of gcc, & further, "atom" is probably aliased to "prescott" (& you could always edit your local copy of /usr/share/mk/bsd.cpu.mk if it makes you happy).


----------



## dennylin93 (May 21, 2010)

As a general rule, don't even touch CFLAGS. It's not necessary and breaks stuff. Optimization is already added when using Ports.

Setting CPUTYPE should be enough. Sometimes the benefits aren't even noticeable though.


----------



## SirDice (May 21, 2010)

sysman said:
			
		

> Hi. "make.conf", what are best options for atom processor? My lines related to make.conf are:
> CPUTYPE?=prescott
> CFLAGS= -mtune=prescott -march=prescott -O2 -pipe -funroll-loops -fomit-frame-pointer


None, nothing, remove them, all of them.

Playing around with CFLAGS will mean your kernel and base can produce strange errors. As soon as you run into problems people will suggest to remove them and recompile everything. The 'improved' performance will be marginal at best anyway.


----------



## fronclynne (May 21, 2010)

Indeed.  if you set CPUTYPE, then -mtune is already set correctly automatically. & -march is redundant most of the time (but might be set, I don't know).  -O2 & -fomit-frame-pointer are set by default everywhere that it is known to be safe, & -funroll-loops doesn't help very much if you're not a computer scientist discovering computers on the moon.


----------



## sysman (May 21, 2010)

fronclynne said:
			
		

> Indeed.  if you set CPUTYPE, then -mtune is already set correctly automatically. & -march is redundant most of the time (but might be set, I don't know).  -O2 & -fomit-frame-pointer are set by default everywhere that it is known to be safe, & -funroll-loops doesn't help very much if you're not a computer scientist discovering computers on the moon.



Hey, I'm typing from international mars orbital station, could be enough? :e :e :e

SYS


----------



## sysman (May 21, 2010)

Ok many thanks to you all. 
@SirDice/@dennylin93 . I'll get rid off CFLAGS statement and keep CPUTYPE instead. Thanks.
@fronclynne. Thanks for the tips!

SYS


----------



## SirDice (May 21, 2010)

If you want to know more about getting the most out of your system read the tuning(7) man page.


----------



## sysman (May 21, 2010)

what about using a benchmark/perf tool suite?


----------

