On Linux/Intel64, --- typedef int S; typedef int V __attribute__((vector_size(16))); typedef int IV __attribute__((vector_size(16))); typedef union { S s[4]; V v; } U;
static U i[2], b, c; extern int memcmp (const void *, const void *, __SIZE_TYPE__); extern void abort (); int main() { i[0].s[0] = 0; i[0].s[1] = 1; i[0].s[2] = 2; i[0].s[3] = 3; i[0].s[4] = 4; i[0].s[5] = 5; i[0].s[6] = 6; i[0].s[7] = 7; b.v = __builtin_ia32_vec_perm_v4si (i[0].v, i[1].v, (IV){4, 1, 2, 3}); c.s[0] = i[0].s[4]; c.s[1] = i[0].s[1]; c.s[2] = i[0].s[2]; c.s[3] = i[0].s[3]; __asm__("" : : : "memory"); if (memcmp (&b, &c, sizeof(c)) != 0) abort (); return 0; } -- aborted with -mavx. You can get Intel AVX SDE from http://software.intel.com/en-us/avx/ to run it: [...@gnu-6 gcc]$ ./xgcc -B./ -O -mavx /tmp/perm.c [...@gnu-6 gcc]$ ./sde -- ./a.out Aborted [...@gnu-6 gcc]$ ./xgcc -B./ -O -mssse3 /tmp/perm.c [...@gnu-6 gcc]$ ./a.out [...@gnu-6 gcc]$ -- Summary: __builtin_ia32_vec_perm_v4si doesn't work with AVX Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: hjl dot tools at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43175