GCC 12 Enables Auto-Vectorization For -O2 Optimization Level

Written by Michael Larabel in GNU on 8 October 2021 at 10:06 AM EDT. 19 Comments
GNU
A month ago was talk of GCC developers enabling the vectorizer at the common "-O2" optimization level and now that change has landed into the GCC 12 development code-base.

The change merged today is enabling the auto-vectorizer at the -O2 optimization level rather than only at -O3 and above. The auto-vectorizer is enabled by default with -O2 and using its "very cheap" cost model. The very cheap model enables vectorization if the scalar iteration count is a multiple of four, it is the "cheapest" of these cost models. Meanwhile the default cost model for vectorization at -O3 is "dynamic" for having more checks to try to determine if a vectorized code path will be faster.

This commit from Intel changes that default behavior for -O2 as of today's GNU Compiler Collection 12 development code. GCC 12 in turn will debut as stable around early Q2'22. This change should help with the performance at the common -O2 optimization level for some code-bases, GCC 11 vs. GCC 12 compiler benchmarks will begin in due course. GCC 12 will be moving to its stage three phase of development in November as feature work winds down.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week