# Generic amd64 CHOST & CFLAGS?

## mansniks

Hello,

I'm interested in choosing such CHOST and CFLAGS in my make.conf, that I can run my OS copies on AMD Athlon64 X2 and on some Opterons too. What would those variables be and how much of performance can I loose? Is it even worth to choose other but most general instruction sets nowdays? How about running same OS on both AMD and intel 64 bit?

The thing is - I did optimized for prescott once, but when I had to move things to p-m, it took so much recompile... Uhhh. And I don't really know if it was work that time and work. Gentoo was once best because of optimization, but is it still?

Thanks for advice!

----------

## Sadako

-march= k8, opteron, athlon64, athlon-fx are all the exact same thing, you shouldn't have any issues running the same 64-bit binaries on any amd x86_64 cpu (unless you add -msse3 yourself, which the older cpu's don't support).

For amd and intel compatibility, yuo'll need to stick with -march=x86-64, you may be able to add some -mmmx and -msse flags (which are ommon to both), the gcc docs don't seem to list the extensions enabled by -march=x86-64...

----------

## mansniks

Ok, but how about performance decrease on, say Athlon, if I choose x86-64? Is it considerably worse?

----------

## Sadako

 *mansniks wrote:*   

> Ok, but how about performance decrease on, say Athlon, if I choose x86-64? Is it considerably worse?

 Considerably?

I seriously doubt it would be even remotely noticeable...

All your really losing is 3dnow support.

You could use -mtune, ie "-O2 -march=x86-64 -mtune=k8 -pipe", then it would be "optimized" for all the amd 64 bit cpu's, but the binaries would still run just fine on intel's chips.

----------

## mansniks

Ok, I already choose x86-64. Ridiculous discussion about avatar by the way  :Smile: 

----------

## i92guboj

 *mansniks wrote:*   

> Ok, but how about performance decrease on, say Athlon, if I choose x86-64? Is it considerably worse?

 

You won't notice any performance decrease, even if you used i686. The performance gain obtained from CFLAGS in widely overrated. And it's only *noticeable* in programs that use the extra instructions for anything important (tipical examples: mencoder and blender).

----------

