View previous topic :: View next topic |
Author |
Message |
Massimo B. Veteran
Joined: 09 Feb 2005 Posts: 1771 Location: PB, Germany
|
Posted: Tue Jan 27, 2015 8:16 am Post subject: gcc versions 4.8 to 4.9, changing CFLAGS |
|
|
Hi,
while comparing the different -march keywords on different gcc versions here...
...I found some major differences:
Lot of marchs are dropped from 4.8 to 4.9. Currently using 4.8.4 and facing the next 4.9.2 upgrade, I wonder why all "core*" marchs have been dropped for these new items:
- ‘core2’
- ‘nehalem’
- ‘westmere’
- ‘sandybridge’
- ‘ivybridge’
- ‘haswell’
- ‘broadwell’
Are there still aliases? Beside the "native" item, do I need to adapt fixed -march CFLAGS? _________________ HP ZBook Power 15.6" G8 i7-11800H|HP EliteDesk 800G1 i7-4790|HP Compaq Pro 6300 i7-3770 |
|
Back to top |
|
|
xaviermiller Bodhisattva
Joined: 23 Jul 2004 Posts: 8708 Location: ~Brussels - Belgique
|
Posted: Tue Jan 27, 2015 8:32 am Post subject: |
|
|
I you don't use distcc, using native for -march and -mtune works for all GCC versions and architectures, from your microwave to your local server
If you don't like native, find the new native flags with Code: | #cc -O2 -pipe -fomit-frame-pointer -march=native -mtune=native -E -v - </dev/null 2>&1 | grep cc1 | (adapt "-O2 -pipe" & co with your CFLAGS) _________________ Kind regards,
Xavier Miller |
|
Back to top |
|
|
Massimo B. Veteran
Joined: 09 Feb 2005 Posts: 1771 Location: PB, Germany
|
Posted: Tue Jan 27, 2015 12:28 pm Post subject: -march and -mtune for the same arch? |
|
|
For some VMware ESX virtual machine I just need to stay compatible with different archs in order to move the VM from server to local archs. There I set the compatible -march together with -mtune=native. Usually these machine are building themselves with the option to be moved temporarily to a different VMware Workstation without rebuilding all.
btw. for the -march=native machines, what does it mean to set -march and -mtune to the same arch? Isn't -mtune redundant or even worse? If architecture features are natively built in why to add some more runtime checks the the same optimizations? _________________ HP ZBook Power 15.6" G8 i7-11800H|HP EliteDesk 800G1 i7-4790|HP Compaq Pro 6300 i7-3770 |
|
Back to top |
|
|
chithanh Developer
Joined: 05 Aug 2006 Posts: 2158 Location: Berlin, Germany
|
Posted: Tue Jan 27, 2015 3:23 pm Post subject: |
|
|
The compiler flags are still supported, just the man page no longer mentions them. |
|
Back to top |
|
|
krinn Watchman
Joined: 02 May 2003 Posts: 7470
|
Posted: Tue Jan 27, 2015 3:25 pm Post subject: |
|
|
march is the familly opitmize, mtune is the cpu
if you don't set one or the other, the missing one met the other (so redundant in this case), but mtune can let you tune more your cpu optimization than its familly.
a coreX familly may say : a coreX must have sse, but some coreX may not have sse2
so if you have a coreX-33 cpu: setting only familly (-march=coreX) will not enable sse2 because not all cpu of the familly have sse2
and setting -mtune=coreX-33 will enable coreX set + the set only coreX-33 cpu could handle (in the example, sse2) |
|
Back to top |
|
|
Massimo B. Veteran
Joined: 09 Feb 2005 Posts: 1771 Location: PB, Germany
|
Posted: Tue Jan 27, 2015 7:09 pm Post subject: |
|
|
So as final conclusion on native platforms not being portable, setting both -march=native and -mtune=native is the optimum? _________________ HP ZBook Power 15.6" G8 i7-11800H|HP EliteDesk 800G1 i7-4790|HP Compaq Pro 6300 i7-3770 |
|
Back to top |
|
|
mreff555 Apprentice
Joined: 10 Mar 2011 Posts: 231 Location: Philadelphia
|
Posted: Tue Jan 27, 2015 10:01 pm Post subject: |
|
|
krinn wrote: | march is the familly opitmize, mtune is the cpu
if you don't set one or the other, the missing one met the other (so redundant in this case), but mtune can let you tune more your cpu optimization than its familly.
a coreX familly may say : a coreX must have sse, but some coreX may not have sse2
so if you have a coreX-33 cpu: setting only familly (-march=coreX) will not enable sse2 because not all cpu of the familly have sse2
and setting -mtune=coreX-33 will enable coreX set + the set only coreX-33 cpu could handle (in the example, sse2) |
Bottom line, and this is from the gcc docs, -march will strictly build based on that platform and may compile software that isn't very portable. -mtune is more likely to be portable at the cost of less tuning.
In my opinion. if you are certain about your architecture, use -march. This should be much less ambiguous with the flag changes in gcc 4.9.1+. |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21642
|
Posted: Wed Jan 28, 2015 2:27 am Post subject: |
|
|
Massimo B. wrote: | So as final conclusion on native platforms not being portable, setting both -march=native and -mtune=native is the optimum? | You do not need to set -mtune if you have set -march. Only use -mtune when you are building with a portable -march, but want code optimized to run best on a particular platform that is newer than your minimum supported hardware. |
|
Back to top |
|
|
|