WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Compiler flags and semi-portable extensions for "newer" pcs?  (Read 4244 times)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11618
Re: Compiler flags and semi-portable extensions for "newer" pcs?
« Reply #15 on: April 14, 2012, 11:34:11 AM »
Hi qopit
I don't think there are hard and fast rules for what the best settings are. In general, I would say to set  -march  to the
lowest version of processor you intend to run on. The  -mtune  flag I won't comment on. That still leaves the  -O  flags
which select the level of optimization. As you start with  s  and work your way through  1, 2, 3,  the compiler starts
trading off size in favor of speed. Depending on the program, you may find  -O3  does not produce faster code
than  -Os  or even  -O2. You should measure the results of those settings to determine which is best. There are
some other compiler settings which can also influence execution speed, but if not used carefully look like they
can cause other problems so I don't use them.