Announcement

Collapse
No announcement yet.

GCC 12 Enables Auto-Vectorization For -O2 Optimization Level

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • RealNC
    replied
    Originally posted by RealNC View Post
    I've been using "-O2 -ftree-vectorize" for many years now.
    I guess this now should be changed to "-O2 -fvect-cost-model=dynamic" instead. Otherwise you'll be using the very-cheap model.

    Leave a comment:


  • carewolf
    replied
    Originally posted by pal666 View Post
    no, you started with -fno-math-errno, which builds some other language than standard c or c++
    Sure, but you dismissed the whole comment instead of just that part. Still I would rather nudge C++ to drop old C misfeatures like global errno and global rounding settings. The latter is often broken anyway, or breaks applications and libraries if you touch it.

    And of course the features only accessible from other languages should probably be disabled with compiling c/c++, though it may require a new major version with a big changelog warning, as gcc is also used to compile libraries for other languages.

    Leave a comment:


  • pal666
    replied
    Originally posted by carewolf View Post
    Which language requires treating plus and minus 0 differently?

    As I said some of those options doesn't even affect C/C++.
    no, you started with -fno-math-errno, which builds some other language than standard c or c++

    Leave a comment:


  • alex19EP
    replied
    Originally posted by jonix View Post
    If I remember correctly arch uses -O2 by default on their packages.
    yes:
    Code:
    CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions \
    -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \
    -fstack-clash-protection -fcf-protection"
    CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"
    LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"

    Leave a comment:


  • carewolf
    replied
    Originally posted by cl333r View Post

    I was wondering what applications would see a noticeable improvement?
    Almost no benchmarks because they are already hand optimized. But tight integer loops that haven't been optimized often vectorizes nicely.

    For instance autovectorization helps Qt a lot when working on non-standard formats, working on RGB32 or ARGB32PM is hand vectorized, but if you work on RGB555 or ARGB4444PM you benefit greatly from autovectorization. But even here, this won't make a difference, since for this exact reason the graphics module in Qt is already compiled with -O3 by default.

    Leave a comment:


  • carewolf
    replied
    Originally posted by pal666 View Post
    no, we can't compile some other nonstandard language by default
    Which language requires treating plus and minus 0 differently?

    As I said some of those options doesn't even affect C/C++.

    Leave a comment:


  • pal666
    replied
    Originally posted by birdie View Post
    This option makes the binary code significantly fatter while not always making it faster. I used it many years ago, then actually tested a number of applications, found no significant improvements in most of them and disabled it for good.
    i bet you didn't test it with gcc 12 many years ago

    Leave a comment:


  • pal666
    replied
    Originally posted by carewolf View Post
    but we could atleast have
    no, we can't compile some other nonstandard language by default

    Leave a comment:


  • jonix
    replied
    Originally posted by cl333r View Post

    I was wondering what applications would see a noticeable improvement?
    If I remember correctly arch uses -O2 by default on their packages. So I'm waiting at least some small (but overall) improvement on this distro.

    Leave a comment:


  • birdie
    replied
    Originally posted by RealNC View Post
    I've been using "-O2 -ftree-vectorize" for many years now. Just use that. There's no reason to stick to the "cheap model" from what I can tell, unless you really, really care about every last millisecond in compile times.
    This option makes the binary code significantly fatter while not always making it faster. I used it many years ago, then actually tested a number of applications, found no significant improvements in most of them and disabled it for good.

    Leave a comment:

Working...
X