This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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

            Bug ID: 80381
           Summary: AVX512: -O3, _mm512_srai_epi32, the last argument must
                    be an 8-bit immediate
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mail@sven-woop.de
  Target Milestone: ---

I again reduced the issue we ran into, this time I have a reproducer that fails
when compiling with -O3.

Code:
---------

#include <immintrin.h>

#define __forceinline inline __attribute__((always_inline))

struct vint16
{
  __forceinline vint16(const int i) 
    : v(_mm512_set1_epi32(i)) {}

  __forceinline vint16(const __m512i& t) 
    : v(t) {}

  friend __forceinline const vint16 operator >>( const vint16& a, const int n )
{ 
    return _mm512_srai_epi32(a.v, n); 
  }

  __m512i v; 
};

vint16 test16(int shift)
{
  const vint16 blocks_add = shift;
  return blocks_add >> shift;
}

Command line:
--------------

g++ -mavx512f -mavx512dq -mavx512cd -mavx512bw -mavx512vl -mf16c -mavx2 -mfma
-mlzcnt -mbmi -mbmi2 -O3 test.cpp -c -o test.o

Output:
-------

/home/swoop/projects/gcc/latest/usr/local/lib/gcc/x86_64-pc-linux-gnu/7.0.1/include/avx512fintrin.h:
In function \u2018vint16 test16(int)\u2019:
/home/swoop/projects/gcc/latest/usr/local/lib/gcc/x86_64-pc-linux-gnu/7.0.1/include/avx512fintrin.h:1318:50:
error: the last argument must be an 8-bit immediate
   return (__m512i) __builtin_ia32_psradi512_mask ((__v16si) __A, __B,
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
         (__v16si)
         ~~~~~~~~~                                 
         _mm512_undefined_epi32 (),
         ~~~~~~~~~~~~~~~~~~~~~~~~~~                
         (__mmask16) -1);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]