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

            Bug ID: 70584
           Summary: constexpr variables cannot be used as intrinsic
                    arguments where an immediate is expected
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: daniel.gutson at tallertechnologies dot com
  Target Milestone: ---

Created attachment 38216
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38216&action=edit
test case

The following code causes gcc to complain that the last argument should be an
8-bit immediate value:

#include <wmmintrin.h>
int main()
{
    __m128i r;

    constexpr auto index = 1;
    r = _mm_aeskeygenassist_si128(r, index);
}

This fails with -O0 but not with -O3.
The arguments to reproduce the issue are:
    g++ -std=c++14 -msse -msse2 -maes -O0 tst.cpp -o tst

I attached the code anyway.

FWIW, this works in clang both for -O0 and for -O3. I think that constexpr
variables should be valid immediate arguments.

This bug affects the development of template metaprograms.

If there is agreement that this should be fixed, feel free to assign this to
andres.tirabos...@tallertechnologies.com .

Reply via email to