[Bug target/80381] AVX512: -O3, _mm512_srai_epi32, the last argument must be an 8-bit immediate

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Apr 10 12:33:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80381

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |jakub at gcc dot gnu.org
         Resolution|---                         |INVALID

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This is another user error.
_mm512_srai_epi32 second argument must be a constant integer literal, n is not
a constant integer literal, nor is there any chance that even with
optimizations you get one, you pass a function argument to that.

So, if you want to pass sometimes a variable, sometimes a constant, use
_mm512_sra_epi32(a.v, _mm_set_epi64x(0, n))
instead of
_mm512_srai_epi32(a.v, n);
or perhaps
__builtin_constant_p (n) ? _mm512_srai_epi32(a.v, n) : _mm512_sra_epi32(a.v,
_mm_set_epi64x(0, n));
The optimizer will optimize the first line exactly as the second one if n is a
constant after optimizations, but it will not error out otherwise.


More information about the Gcc-bugs mailing list