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