1219019Sgabor/* { dg-do run } */ 2219019Sgabor/* { dg-require-effective-target ssse3 } */ 3219019Sgabor/* { dg-options "-O -mssse3" } */ 4219019Sgabor 5219019Sgabor#include "isa-check.h" 6219019Sgabor 7219019Sgabortypedef float S; 8219019Sgabortypedef float V __attribute__((vector_size(16))); 9219019Sgabortypedef int IV __attribute__((vector_size(16))); 10219019Sgabortypedef union { S s[4]; V v; } U; 11219019Sgabor 12219019Sgaborstatic U i[2], b, c; 13219019Sgabor 14219019Sgaborextern int memcmp (const void *, const void *, __SIZE_TYPE__); 15219019Sgabor#define assert(T) ((T) || (__builtin_trap (), 0)) 16219019Sgabor 17219019Sgabor#define TEST(E0, E1, E2, E3) \ 18219019Sgabor b.v = __builtin_ia32_vec_perm_v4sf (i[0].v, i[1].v, (IV){E0, E1, E2, E3}); \ 19219019Sgabor c.s[0] = i[0].s[E0]; \ 20219019Sgabor c.s[1] = i[0].s[E1]; \ 21219019Sgabor c.s[2] = i[0].s[E2]; \ 22219019Sgabor c.s[3] = i[0].s[E3]; \ 23219019Sgabor __asm__("" : : : "memory"); \ 24219019Sgabor assert (memcmp (&b, &c, sizeof(c)) == 0); 25219019Sgabor 26219019Sgabor#include "vperm-4-2.inc" 27219019Sgabor 28219019Sgaborint main() 29219019Sgabor{ 30219019Sgabor i[0].s[0] = 0; 31219019Sgabor i[0].s[1] = 1; 32219019Sgabor i[0].s[2] = 2; 33219019Sgabor i[0].s[3] = 3; 34219019Sgabor i[0].s[4] = 4; 35219019Sgabor i[0].s[5] = 5; 36219019Sgabor i[0].s[6] = 6; 37219019Sgabor i[0].s[7] = 7; 38219019Sgabor 39219019Sgabor check(); 40219019Sgabor return 0; 41219019Sgabor} 42219019Sgabor