[LLVMbugs] [Bug 9665] New: __builtin_shufflevector requires a constant integer

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Apr 9 13:11:09 PDT 2011


           Summary: __builtin_shufflevector requires a constant integer
           Product: clang
           Version: 2.9
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: giulio.eulisse at cern.ch
                CC: llvmbugs at cs.uiuc.edu

The following bit of code:

  #include <xmmintrin.h>

  int main()
    int n = 1;
    __m128 a, b;
    _mm_shuffle_ps(a, b, _MM_SHUFFLE(n, n, n, n));  

compiles fine under gcc 4.5.1 but fails with clang 2.9 with:

  foo.cc:7:3: error: index for __builtin_shufflevector must be a constant
  _mm_shuffle_ps(a, b, _MM_SHUFFLE(n, n, n, n));  
  In file included from foo.cc:1:
  note: instantiated from:
          (__builtin_shufflevector((__v4sf)(a), (__v4sf)(b),                \

Notice that if I use `const int n = 1` it is then accepted. What puzzles me is
that if I do:

   #include <xmmintrin.h>

   int main()
     int m = 1;                                                                 
     const int n = m;
     __m128 a, b;
     _mm_shuffle_ps(a, b, _MM_SHUFFLE(n, n, n, n));

it still gives the error reported above.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list