1  /* { dg-do run } */
       2  /* { dg-options "-O2 -mavx512bw" } */
       3  /* { dg-require-effective-target avx512bw } */
       4  
       5  #define AVX512BW
       6  #include "avx512f-helper.h"
       7  
       8  #define SIZE (AVX512F_LEN / 16)
       9  #include "avx512f-mask-type.h"
      10  
      11  void
      12  CALC (short *s, unsigned char imm, short *r)
      13  {
      14    int i;
      15  
      16    for (i = 0; i < SIZE / 8; i++)
      17      {
      18        r[8 * i] = s[8 * i + (imm >> 0 & 3)];
      19        r[8 * i + 1] = s[8 * i + (imm >> 2 & 3)];
      20        r[8 * i + 2] = s[8 * i + (imm >> 4 & 3)];
      21        r[8 * i + 3] = s[8 * i + (imm >> 6 & 3)];
      22        r[8 * i + 4] = s[8 * i + 4];
      23        r[8 * i + 5] = s[8 * i + 5];
      24        r[8 * i + 6] = s[8 * i + 6];
      25        r[8 * i + 7] = s[8 * i + 7];
      26      }
      27  }
      28  
      29  void
      30  TEST (void)
      31  {
      32    UNION_TYPE (AVX512F_LEN, i_w) s1, res1, res2, res3;
      33    short res_ref[SIZE];
      34    int i, sign = 1;
      35    MASK_TYPE mask = MASK_VALUE;
      36  
      37    for (i = 0; i < SIZE; i++)
      38      {
      39        s1.a[i] = i * i * sign;
      40        res1.a[i] = DEFAULT_VALUE;
      41        res2.a[i] = DEFAULT_VALUE;
      42        res3.a[i] = DEFAULT_VALUE;
      43        sign = -sign;
      44      }
      45  
      46    res1.x = INTRINSIC (_shufflelo_epi16) (s1.x, 0xec);
      47    res2.x =
      48      INTRINSIC (_mask_shufflelo_epi16) (res2.x, mask, s1.x, 0xec);
      49    res3.x = INTRINSIC (_maskz_shufflelo_epi16) (mask, s1.x, 0xec);
      50  
      51    CALC (s1.a, 0xec, res_ref);
      52  
      53    if (UNION_CHECK (AVX512F_LEN, i_w) (res1, res_ref))
      54      abort ();
      55  
      56    MASK_MERGE (i_w) (res_ref, mask, SIZE);
      57    if (UNION_CHECK (AVX512F_LEN, i_w) (res2, res_ref))
      58      abort ();
      59  
      60    MASK_ZERO (i_w) (res_ref, mask, SIZE);
      61    if (UNION_CHECK (AVX512F_LEN, i_w) (res3, res_ref))
      62      abort ();
      63  }