http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54219

             Bug #: 54219
           Summary: __builtin_shuffle mask reversed
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: gli...@gcc.gnu.org


Hello,

#include <x86intrin.h>

__m128d f(__m128d x){
  __m128i m={5,0};
  return __builtin_shuffle(x,x,m);
}

$ gcc u.c -O2 -S -Wall

produces a simple rep; ret. However, if I replace 5 with 1, it does produce the
expected shufpd.

fold-const.c contains this loop:
              for (i = 0; i < nelts; i++)
                tsel[i] = build_int_cst (eltype, sel[nelts - i - 1]);

which reverses the order of the elements in the mask. I don't know if there is
any reason to do that...

Reply via email to