This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
How to force gcc to vectorize the loop with particular vectorization width
- From: Denis Bakhvalov <dendibakh at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Thu, 19 Oct 2017 09:22:49 +0200
- Subject: How to force gcc to vectorize the loop with particular vectorization width
- Authentication-results: sourceware.org; auth=none
Hello!
I have a hot inner loop which was vectorized by gcc, but I also want
compiler to unroll this loop by some factor.
It can be controled in clang with this pragma:
#pragma clang loop vectorize(enable) vectorize_width(8)
Please see example here:
https://godbolt.org/g/UJoUJn
So I want to tell gcc something like this:
"I want you to vectorize the loop. After that I want you to unroll
this vectorized loop by some defined factor."
I was playing with #pragma omp simd with the safelen clause, and
#pragma GCC optimize("unroll-loops") with no success. Compiler option
-fmax-unroll-times is not suitable for me, because it will affect
other parts of the code.
Is it possible to achieve this somehow?
--
Best regards,
Denis.