tag:blogger.com,1999:blog-15319370.post7523280130324184576..comments2024-03-05T11:16:00.846+01:00Comments on Roland Bouman's blog: GCC: -march and -mtunerpboumanhttp://www.blogger.com/profile/13365137747952711328noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-15319370.post-26632229054262436002009-11-04T21:47:53.092+01:002009-11-04T21:47:53.092+01:00This is why I hate blogs / wiki answers. People p...This is why I hate blogs / wiki answers. People post answers when they don't really know all the facts, even *after* the issue has been correctly addressed by a previous comment! I'm concluding that these type of people just like to here themselves type. :|<br /><br />-march={cpu} : Generate a binary *only* for the specific cpu type (and later, compatible models [most later cpu's support earlier optimizations, or gracefully bypass them]). This flag should generate the faster code on x86 architectures. Fall back to the most recent (mainstream) model in your vendors line if yours is not yet available.<br /><br />-mtune={cpu} : Tunes the binary for given cpu on x86 architecture. This means that the binary will still execute on a 386 (if it did in the first place), while also including optimization for the cpu supplied to the '-mtune=' switch.<br /><br />-mcpu={cpu} : Deprecated (phased out) for the x86 architecture.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-15319370.post-24389832363720125932007-09-03T15:21:00.000+02:002007-09-03T15:21:00.000+02:00Here is a script that finds theoptimum gcc cpu set...<A HREF="http://www.pixelbeat.org/scripts/gcccpuopt" REL="nofollow">Here</A> is a script that finds the<BR/>optimum gcc cpu settings for your<BR/>cpu in conjuntion with your currently<BR/>installed gcc.Pádraig Bradyhttps://www.blogger.com/profile/09859979434686189342noreply@blogger.comtag:blogger.com,1999:blog-15319370.post-6068618433481583322007-07-14T02:13:00.000+02:002007-07-14T02:13:00.000+02:00-mtune is used predominantly for instruction sched...-mtune is used predominantly for instruction scheduling, gcc uses it when it's reordering instructions to favour a specific micro-architecture over others. Code which is tuned for one microarchitecture will run on another chip of the same architecture, but the reordering may hurt performance on these chips.<BR/><BR/>-mcpu tells it to generate code SPECIFICALLY for a certain chip, which obviously includes instruction reordering (thus why -mcpu implies -mtune), but will also cause the compiler to emit instructions specific to the target processor. This does not guarantee binary compatibility with other chips based on a different microarchitecture.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-15319370.post-60461697778911588542007-02-25T21:28:00.000+01:002007-02-25T21:28:00.000+01:00The manual (info gcc) is your friend:-mtune (not -...The manual (info gcc) is your friend:<BR/><BR/>-mtune (not --mtune): Tune to CPU-TYPE everything applicable about the generated code, except for the ABI and the set of available instructions.<BR/><BR/>-march: Generate instructions for the machine type CPU-TYPE. Specifying -march=CPU-TYPE implies -mtune=CPU-TYPE.<BR/><BR/>-mcpu: A deprecated synonym for -mtune.<BR/><BR/>Unfortunately the manual for GCC 4.1 will not tell you what CPU-TYPE to use for core2. Dunno about 4.2, though.<BR/><BR/>//Carl TAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-15319370.post-73358940605361751362007-02-11T10:54:00.000+01:002007-02-11T10:54:00.000+01:00I'm not 100% sure, but I think -mcpu doesn't break...I'm not 100% sure, but I think -mcpu doesn't break compatability with other CPUs but -march (-mtune) does...Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-15319370.post-92124167691902841472007-01-30T17:02:00.000+01:002007-01-30T17:02:00.000+01:00gcc 4.3 adds "core2" as arch. I've resisted the te...gcc 4.3 adds "core2" as arch. I've resisted the temptation to add that quite yet as pretty much nobody has 4.3 yet.<br />-- AzundrisAnonymousnoreply@blogger.com