Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Is `-ftree-slp-vectorize` not enabled by `-O2` in GCC?

From https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html

It says "-ftree-slp-vectorize: Perform basic block vectorization on trees. This flag is enabled by default at -O2 and by -ftree-vectorize, -fprofile-use, and -fauto-profile."

However it seems I have to pass a flag explicitly to turn on SIMD. Did I mis undertand something here? It is enabled at -O3 though.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

https://www.godbolt.org/z/1ffzdqMoT

>Solution :

Is -ftree-slp-vectorize not enabled by -O2 in GCC?

Yes and no. It depends on the version of the compiler.

From https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html

You have linked to the latest version of documentation. It applies to the version that is currently under development, which at the moment is version 12.

However it seems I have to pass a flag explicitly to turn on SIMD.

https://www.godbolt.org/z/1ffzdqMoT

Your example uses GCC version 11.

Did I mis undertand something here?

You read the wrong version of documentation, or used wrong version of compiler and hence your assumption didn’t hold.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading