You are not logged in.

#1 2007-06-05 00:43:21

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

mtune generic and native

I've had "-mtune=generic" in my makepkg.conf file since I upgraded GCC a few weeks ago. Why? Because I read it is a good idea. I really don't understand the scope of it. Now today with my newest Pacman upgrade, it mentions adding "-mtune=native". So here's my question:

What do these things do and should they be run together?

------------------------------------------------------------------------------------------

Hmmm. I guess my question answered itself. Generic is for if you plan to share your builds, and native is for your own local builds. Correct?

Last edited by skottish (2007-06-05 01:21:53)

Offline

#2 2007-06-05 05:02:57

AndyRTR
Developer
From: Magdeburg/Germany
Registered: 2005-10-07
Posts: 1,641

Re: mtune generic and native

http://gcc.gnu.org/gcc-4.2/changes.html

New Targets and Target Specific Improvements
IA-32/x86-64

    * -mtune=generic can now be used to generate code running well on common x86 chips. This includes AMD Athlon, AMD Opteron, Intel Pentium-M, Intel Pentium 4 and Intel Core 2.
    * -mtune=native and -march=native will produce code optimized for the host architecture as detected using the cpuid instruction.

Offline

#3 2007-06-05 07:06:25

Bola
Member
From: Italia
Registered: 2007-02-16
Posts: 118

Re: mtune generic and native

Is it possible to recompile the installed packages with -mtune=native? hmm

Offline

#4 2007-06-05 09:39:43

AndyRTR
Developer
From: Magdeburg/Germany
Registered: 2005-10-07
Posts: 1,641

Re: mtune generic and native

man makeworld wink

Offline

#5 2007-06-05 12:32:41

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: mtune generic and native

Does this have any effect to "-march=x86_64"?

Offline

#6 2007-06-05 13:04:15

AndyRTR
Developer
From: Magdeburg/Germany
Registered: 2005-10-07
Posts: 1,641

Re: mtune generic and native

mtune will not affect the used cpu instructions, only further optimisations (e.g. pipeline reordering). but -march=native of course would touch the cpu instructions and replace the -march=x86_64.

Offline

#7 2007-06-05 18:40:08

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: mtune generic and native

Would you recommend this for my homegrown packages?

-----------------------------

I went ahead and tried it, and I must say that it's pretty cool. GCC passed -march=k8 and -mtune=k8 automagically. This is good stuff.

Last edited by skottish (2007-06-06 00:43:10)

Offline

#8 2007-06-10 00:50:48

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: mtune generic and native

Bump for more info...

As I posted before, when using -march and -mtune=native I end up with 'k8' as the compiler option. On this site:

http://gentoo-wiki.com/Safe_Cflags

it suggest that for my processor (AMD X2 5200+) to use 'athlon64'.  Is there any fundamental difference between the two?

One more compiler question: Does SSE3 contain SSE2, or is it a independent extention?

Last edited by skottish (2007-06-10 00:51:12)

Offline

#9 2007-06-10 07:10:46

mouse256
Member
From: Antwerpen, Belgium
Registered: 2005-08-24
Posts: 247

Re: mtune generic and native

According to this page, athlon64 and k8 are the same. So I suppose using -mtune=native will result in exactly the same as -march=athlon64.

As for the SSE question, I think they are independent, but I'm not sure about this...

Offline

#10 2007-06-10 12:25:11

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: mtune generic and native

If your CPU supports SSE3, that means it supports older SSE versions too... It seems the higher the number, the more gets added.

If you compile 'natively' for the K8, SSE2 is already included.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#11 2007-06-11 00:45:12

somedrew
Member
From: Canada
Registered: 2007-05-14
Posts: 140

Re: mtune generic and native

FWIW:

-mtune=native was causing problems for me on an Intel Core Duo.
-march=prescott -mtune=generic seem to the proper CFLAGS for the processor.

CFLAGS="-march=prescott -mtune=generic -O2 -pipe -fomit-frame-pointer"

http://article.gmane.org/gmane.comp.gcc.devel/83870
http://gcc.gnu.org/ml/gcc-patches/2006-12/msg00052.html
http://gentoo-wiki.com/Safe_Cflags)

Last edited by somedrew (2007-06-13 08:06:12)

Offline

#12 2007-06-23 03:00:57

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: mtune generic and native

One more bump...

I'm a little unclear on what all is implied by using 'native'. My processor (AMD 5200+) is SSE3 capable. Would that be implied, or do I still need the '-msse3' flag? I guess what I'm asking is, is there anything deemed "safe" that isn't implied?

Offline

#13 2007-06-23 07:29:51

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: mtune generic and native

Why don't you read GCC docs?


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#14 2007-06-23 16:19:49

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: mtune generic and native

B wrote:

Why don't you read GCC docs?

I just want some confirmation from someone with practical understanding. I mean, as far as I can tell, the two lines AndyRTR posted above are the GCC docs on this subject. And while it seems to point to "yes" as the answer to my question, it hasn't brought the clarification that I'd like.

Offline

#15 2007-06-23 21:03:05

mouse256
Member
From: Antwerpen, Belgium
Registered: 2005-08-24
Posts: 247

Re: mtune generic and native

Yeah, the GCC docs are a bit unclear about this part in my opinion. I've been doing some research about this too, and I've found some reactions from people who are certain this is added automatically as well as people telling you still have to add it your own. So I can't really help you on this. The only thing I can say is I add the -msse and -m3dnow (I have an athlon XP)  flag because I'm not sure the -mtune=native flag is adding it by default and either way it's not bad to add it yourself.
But if someone could give a clear explanation it would be nice, I do understand skottish's questions about it being somewhat unclear smile

Offline

Board footer

Powered by FluxBB