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.