Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
gcc versions 4.8 to 4.9, changing CFLAGS
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
Massimo B.
Veteran
Veteran


Joined: 09 Feb 2005
Posts: 1771
Location: PB, Germany

PostPosted: Tue Jan 27, 2015 8:16 am    Post subject: gcc versions 4.8 to 4.9, changing CFLAGS Reply with quote

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
View user's profile Send private message
xaviermiller
Bodhisattva
Bodhisattva


Joined: 23 Jul 2004
Posts: 8708
Location: ~Brussels - Belgique

PostPosted: Tue Jan 27, 2015 8:32 am    Post subject: Reply with quote

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
View user's profile Send private message
Massimo B.
Veteran
Veteran


Joined: 09 Feb 2005
Posts: 1771
Location: PB, Germany

PostPosted: Tue Jan 27, 2015 12:28 pm    Post subject: -march and -mtune for the same arch? Reply with quote

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
View user's profile Send private message
chithanh
Developer
Developer


Joined: 05 Aug 2006
Posts: 2158
Location: Berlin, Germany

PostPosted: Tue Jan 27, 2015 3:23 pm    Post subject: Reply with quote

The compiler flags are still supported, just the man page no longer mentions them.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Tue Jan 27, 2015 3:25 pm    Post subject: Reply with quote

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
View user's profile Send private message
Massimo B.
Veteran
Veteran


Joined: 09 Feb 2005
Posts: 1771
Location: PB, Germany

PostPosted: Tue Jan 27, 2015 7:09 pm    Post subject: Reply with quote

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
View user's profile Send private message
mreff555
Apprentice
Apprentice


Joined: 10 Mar 2011
Posts: 231
Location: Philadelphia

PostPosted: Tue Jan 27, 2015 10:01 pm    Post subject: Reply with quote

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
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21642

PostPosted: Wed Jan 28, 2015 2:27 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum