1/* { dg-do run } */ 2/* { dg-require-effective-target avx2 } */ 3/* { dg-options "-O2 -mavx2" } */ 4 5#include <string.h> 6#include "avx2-check.h" 7 8#define N 0x5 9 10static void 11compute_punpcklwd256 (short *s1, short *s2, short *r) 12{ 13 int i; 14 15 for (i = 0; i < 4; i++) 16 { 17 r[2 * i] = s1[i]; 18 r[2 * i + 1] = s2[i]; 19 20 r[2 * i + 8] = s1[i + 8]; 21 r[2 * i + 8 + 1] = s2[i + 8]; 22 } 23} 24 25void static 26avx2_test (void) 27{ 28 union256i_w s1, s2, res; 29 short res_ref[16]; 30 int i, j; 31 int fail = 0; 32 33 for (i = 0; i < 10; i++) 34 { 35 for (j = 0; j < 16; j++) 36 { 37 s1.a[j] = j * i; 38 s2.a[j] = j + 20; 39 } 40 41 res.x = _mm256_unpacklo_epi16 (s1.x, s2.x); 42 43 compute_punpcklwd256 (s1.a, s2.a, res_ref); 44 45 fail += check_union256i_w (res, res_ref); 46 } 47 48 if (fail != 0) 49 abort (); 50} 51