1  /* { dg-do run } */
       2  /* { dg-options "-O2 -mavx512fp16 -mavx512vl -ftree-vectorize -fvect-cost-model=unlimited -fdump-tree-slp-details -mprefer-vector-width=256" } */
       3  /* { dg-require-effective-target avx512fp16 } */
       4  /* { dg-final { scan-tree-dump-times "basic block part vectorized using (?:32|64) byte vectors" 1 "slp2" } }*/
       5  /* { dg-final { scan-tree-dump-times {(?n)add new stmt:.*MEM <vector\(16\) _Float16>} 4 "slp2" } } */
       6  
       7  #include <string.h>
       8  
       9  static void do_test (void);
      10  #define DO_TEST do_test
      11  #define AVX512FP16
      12  #include "avx512-check.h"
      13  
      14  void
      15  __attribute__((noipa))
      16  foo_ph (_Complex _Float16* a, _Complex _Float16* __restrict b)
      17  {
      18    a[0] = b[8];
      19    a[1] = b[9];
      20    a[2] = b[10];
      21    a[3] = b[11];
      22    a[4] = b[12];
      23    a[5] = b[13];
      24    a[6] = b[14];
      25    a[7] = b[15];
      26    a[8] = b[0];
      27    a[9] = b[1];
      28    a[10] = b[2];
      29    a[11] = b[3];
      30    a[12] = b[4];
      31    a[13] = b[5];
      32    a[14] = b[6];
      33    a[15] = b[7];
      34  }
      35  
      36  void
      37  do_test (void)
      38  {
      39    _Complex _Float16* ph_src = (_Complex _Float16*) malloc (64);
      40    _Complex _Float16* ph_dst = (_Complex _Float16*) malloc (64);
      41    _Complex _Float16* ph_exp = (_Complex _Float16*) malloc (64);
      42    char* p = (char* ) malloc (64);
      43    char* q = (char* ) malloc (64);
      44  
      45    __builtin_memset (ph_dst, 0, 64);
      46  
      47    for (int i = 0; i != 64; i++)
      48      {
      49        p[i] = i;
      50        q[i] = (i + 32) % 64;
      51      }
      52    __builtin_memcpy (ph_src, p, 64);
      53  
      54    __builtin_memcpy (ph_exp, q, 64);
      55  
      56    foo_ph (ph_dst, ph_src);
      57  
      58    if (__builtin_memcmp (ph_dst, ph_exp, 64) != 0)
      59      __builtin_abort ();
      60  
      61    return;
      62  }