You are not logged in.

#1 2010-11-28 21:49:02

mhertz
Member
From: Denmark
Registered: 2010-06-19
Posts: 681

-march=x86-64 -mtune=generic ; generic is i686!

I just wanted to add that the arch packages and makepkg.conf on arch64 uses c(xx)flags that state to use x86-64 instruction sets, but tune for i686!

i686 means e.g. half the registers and no sse/sse2 support enabled, besides the half bandwith of the registers!

I hope I understand the gcc docs right when they say that "Moreover, specifying -march=cpu-type implies -mtune=cpu-type.", as then the -mtune flag is just redundant, but i'm not entirelly sure that I understand that right, since e.g. Slackware32 and Zenwalk uses i484 and i686 tuning and VectorLinux uses i586 and i686 tuning, so maybe the gcc statement means that -march only implies -mtune, if not -mtune is added specifically in addition to the -march ?

Offline

#2 2010-11-28 23:30:14

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,393
Website

Re: -march=x86-64 -mtune=generic ; generic is i686!

I think you need to go back to the man page and read about march/mtune and what generic does.

Offline

#3 2010-11-29 00:25:09

mhertz
Member
From: Denmark
Registered: 2010-06-19
Posts: 681

Re: -march=x86-64 -mtune=generic ; generic is i686!

Thanks for your reply!

I aplogise for posting wrong info about -mtune generic using i686 instruction set(Dohh, i'm an idiot!), so please disregard that, and thanks for the correction!

However, for the rest of the post, then everything still applies, so I would appreciate some feedback on that thanks...

I.e. the -mtune option should be removed and that hopefully the option is just redundant, or at worst the parameter is actually used, which means that the code is optimized for i686 under the constraints of the X86-64 instruction set!

Under our cpu type, then it just states that -march implies -mtune, but it dosen't state if additionally adding a -mtune then overwrittes that. I mean, it could just be a statement about if e.g. using -march generic, then you don't need to also add -mtune generic... I dunno...

Many ppl do use both params together like e.g. pat from slackware and he states that they both work!

In the man under arm options, then it's stated that both params can be used together. Of course that's not our cpu type but nonetheless.

Again , sorry for my lame a** comment about the instruction sets! I'm embarassed for posting such nonsence, and should have known better...

Last edited by mhertz (2010-11-29 00:28:01)

Offline

#4 2010-11-29 00:30:51

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,393
Website

Re: -march=x86-64 -mtune=generic ; generic is i686!

Correct, sort of...   -march=x86_64 implies -mtune=x86_64.   So -march=x86_64 -mtune=x86_64 is redundant.

This is wrong:

mhertz wrote:

I.e. the -mtune option should be removed and that hopefully the option is just redundant, or at worst the parameter is actually used, which means that the code is optimized for i686 under the constraints of the X86-64 instruction set!

We want x86_64 to be our supported arch (hence -march=x86_64) but that covers many processor types.  So we use x86_64 instructions but tune them to be an "average best" across the variety of processor types that support those instructions (-mtune=generic).  That does not include i686 as it has to support x86_64 instructions.

Offline

#5 2010-11-29 00:51:15

mhertz
Member
From: Denmark
Registered: 2010-06-19
Posts: 681

Re: -march=x86-64 -mtune=generic ; generic is i686!

Thanks for your reply, mate!

Hmm, i see your point, and maybe you're right...

What I mean is that if you look under i686, then the description is "same as generic"!, and then I understood the part from the generic description about if not knowing which cpu the end user using, then generic would be the correct choise, to simply mean that most of the other options are really cpu specific and couldn't be used, but that they weren't reffering to e.g. i686 and x86-64, where you specifically know the cpu-type familly of the end users, and that the generic option just changed from time to time, and that it currently where for i686 familly cpu, which also is' the most widelly used today I would believe?...

Maybe you're right, but then I really think that the man is misleading when they write generic = i686, which is what i based this entire subject about!

Anyway, if you are 100% sure you're right, then I will take your word for it, and aplogise for my wrong assumtions and postings!

Edit: had a wrong line here before which i forgot to delete before posting!

Edit2: Hmm, i still think that ditching -mtune would be best, since that would mean -mtune x86-64, since even if you're right then generic includes e.g. i686 tunnings(i686=generic in spec)...

Last edited by mhertz (2010-11-29 01:13:47)

Offline

#6 2010-11-29 01:34:24

djgera
Developer
From: Buenos Aires - Argentina
Registered: 2008-12-24
Posts: 723
Website

Re: -march=x86-64 -mtune=generic ; generic is i686!

-march= generate instructions for a specific cpu.
-mtune= reorder/align the instructions for better cpu schedulling.

Offline

#7 2010-11-29 08:28:39

mhertz
Member
From: Denmark
Registered: 2010-06-19
Posts: 681

Re: -march=x86-64 -mtune=generic ; generic is i686!

I know! That's not the point. The point is the misleading man page of gcc which defines -mtune's generic option as both being for different popular cpus of the type x86/x86_64 and then on another place states that generic is the same as i686! ??? No matter which, i vote for removing the option, as if Allan is right, then it includes i686 tunnings among the x86-64 tunings, and which i then would prefer to only have the tunning done for x86-64!

Also, if Allan is right and generic is for multiple cpu's, then I don't think that it checks the -march for minimum cpu-type family, as that's not documented anywhere, and since the man states generic is for multiple cpu's including i686 specifically.

If im right and generic equals only i686, and that generic just changes e.g. each five years from e.g. i585 to i686 etc.then it defenetly should be removed imho!

Lastly, I agree with why Allan states that generic is for multiple cpu's, since the man states that also(but it could mean multiple cpus throughout the years? Since that's the only way the man makes sence when stating this + i686 = generic currently!), but I just don't think that we can dismis when the man also states specifically generic = i686.

Offline

#8 2010-11-29 09:13:23

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,393
Website

Re: -march=x86-64 -mtune=generic ; generic is i686!

Firstly, if I was right, everything you wrote after "if Allan is right" would be entirely wrong...  because it is the opposite of what I said.  yikes

If you use -march=generic then that is (sort of) the same as -march=i686.  That says nothing about the combination of setting -march to a specific value and -mtune to generic.

We are specifying the minimum architecture we want to support (with -march=x86_64) and then telling gcc to tune the instructions to be optimised based on what the common processors are that support that architecture specified in -march.   That is how -mtune=generic works after specifying -march.

Offline

#9 2010-11-29 09:41:23

mhertz
Member
From: Denmark
Registered: 2010-06-19
Posts: 681

Re: -march=x86-64 -mtune=generic ; generic is i686!

Sorry for wrong "wording"!

Your assumption about -mtune generic uses -march as minimum supported cpu type isn't documented anywhere imho. It's two different things; -march is the instruction set used and -mtune is the tuning used without regard to instruction sets whatsoever.

-mtune generic is listed as i686 and other place i686 + newer cpu's, period.

I don't want you to get tired of me, so l will just end this dicussion as lets agree to disagree!

(and in case you're right, which you maybe are, then I will say that the man is wildelly misleading!)

CU, Martin smile

Last edited by mhertz (2010-11-29 09:43:10)

Offline

#10 2010-11-29 15:56:56

GogglesGuy
Member
From: Rocket City
Registered: 2005-03-29
Posts: 610
Website

Re: -march=x86-64 -mtune=generic ; generic is i686!

For what its worth. -mtune=x86-64 is deprecated anyways. Use -mtune=k8 or -mtune=generic instead as appropriate.

Offline

#11 2010-11-30 08:53:28

mhertz
Member
From: Denmark
Registered: 2010-06-19
Posts: 681

Re: -march=x86-64 -mtune=generic ; generic is i686!

OK, Thanks!

...

Sorry, but if I can just come with one final closing argument; I know it's the same as i've said before, but I will just cut it out in cardboard now, or so to speak...

Under the -mtune option there's listed a bunch of cpu-types and cpu-families,but they are all called cpu-type in the man, no matter if they are a cpu-family: "The choices for cpu-type are"...

Now under generic it's stated that if you don't know what cpu end users are using, then this should be used, but keep in mind that all the available choises that can be entered after -mtune are called cpu-type in the man, including e.g. i585, i686 and X86-64, even though they are cpu-families and hence imho generic isn't right for our choise where we do know the cpu-familly!

In short, they are saying that if you don't can use ANY of the available -mtune cpu-type/familly valyes, then generic is the way to go!

Now if we still use it, then it's stated to be for common i686 and x86-64 cpu's + under i686 it's stated to be the same as generic.

This means that if using -mtune generic without an -march, then the code will be using i386 instruction set, but tuned for best schedulling on common i686/x86-64 cpu's.

But, if additionally adding an -march in addition to the -mtune, then you override the i386 instruction set code with another value, like e.g. i686 or whatever, but nowhere does it state that you imposses or losses the restriction on the -mtune value, which is for scheduling and not instruction set and abi!...

-mtune are for processor scedulling without taking instruction sets into equation, whereas -march are specifically for instruction sets and abi, and i cannot find any place where it's stated that -mtune uses the -march value as minimum cpu schedulling-type. Instead there says that -march equals -mtune, but we then override that with adding another specific -mtune value!

I would like that we ditch -mtune, since that equals the same -mtune as our -march!.

Now if i thought that generic in our case would equal different x86-64 cpu's and no i686 cpu's,  i would also think that it would be fine, but i just don't think that based on the spec(man).

Sorry for blabbing on, but i just wanted to explain myself so as to ppl dosen't just think that i'm an idiot, but that i've actually given it some thought also...

I'll shut up now, as i haven't got any new arguments... smile

Last edited by mhertz (2010-11-30 09:22:35)

Offline

#12 2010-12-01 11:45:15

mhertz
Member
From: Denmark
Registered: 2010-06-19
Posts: 681

Re: -march=x86-64 -mtune=generic ; generic is i686!

@Allan (and others reading my previous posts...)

I sincerly apologise for posting wrong information, and I hope that you will not hold it against me in the feature...

I was going to write to the gcc devs and ask about this, but just before I did that, then i searched again one final time about the generic option, and then I found the answer(your answer!)..

I found an old gcc mailing list message, where the author of the generic patch announced it to the others.

Here's a snippet from the propossed original man in that first patch:

+ @item generic
+ Produce code working well on most common x86 and x86-64 CPUs.  The set of CPUs
+ the option tune to differs in 32-bit and 64-bit compilation and is supposed to
+ envolve in future versions of GCC as new CPU models are introduced and other
+ become obsolette.  At present this option in 32bit mode generate code tuned for
+ Athlon, Dothan, Nocona, Northwood, Opteron, PentiumPro, Pentium2, Pentium3,
+ Prescott and Yonah.  In 64bit mode code is tuned for Opteron and Nocona.  This
+ "virtual CPU" can not be used as @option{-march} operand. In 64-bit mode
+ @option{x86-64} shall be used instead. In 32-bit mode the @option{i686} is
+ available for i686 familly chips (instruction set of PentiumPro and tunning
+ defaults to @code{generic}).

Full message with much more detailed info: http://gcc.gnu.org/ml/gcc-patches/2006-01/msg01045.html

Again, I apologise...

CU, Martin.

Edit: typo's...

Last edited by mhertz (2010-12-01 11:52:27)

Offline

#13 2010-12-01 12:14:44

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,393
Website

Re: -march=x86-64 -mtune=generic ; generic is i686!

No problem...   good to know I was not making it all up!  tongue

Offline

#14 2010-12-01 12:17:10

mhertz
Member
From: Denmark
Registered: 2010-06-19
Posts: 681

Re: -march=x86-64 -mtune=generic ; generic is i686!

Thanks, mate! smile

CU, Martin.

Offline

Board footer

Powered by FluxBB