(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
i386/
avx512fp16-pr101846.c
       1  /* { dg-do compile } */
       2  /* { dg-options "-mavx512fp16 -mavx512vl -O2" } */
       3  /* { dg-additional-options "-fno-PIE" { target ia32 } } */
       4  /* { dg-final { scan-assembler-times "vpmovzxwd" "3" } } */
       5  /* { dg-final { scan-assembler-times "vpmovdw" "3" } } */
       6  
       7  typedef _Float16 v32hf __attribute__((vector_size (64)));
       8  typedef _Float16 v16hf __attribute__((vector_size (32)));
       9  typedef _Float16 v8hf __attribute__((vector_size (16)));
      10  typedef _Float16 v4hf __attribute__((vector_size (8)));
      11  typedef short v4hi __attribute__((vector_size (8)));
      12  typedef short v8hi __attribute__((vector_size (16)));
      13  
      14  #define PERM_CONST_INTERLEAVE_v32hi \
      15  0, 16, 1, 17, 2, 18, 3, 19, \
      16  4, 20, 5, 21, 6, 22, 7, 23, \
      17  8, 24, 9, 25, 10, 26, 11, 27, \
      18  12, 28, 13, 29, 14, 30, 15, 31
      19  
      20  #define PERM_CONST_INTERLEAVE_v16hi \
      21  0, 8, 1, 9, 2, 10, 3, 11, \
      22  4, 12, 5, 13, 6, 14, 7, 15
      23  
      24  #define PERM_CONST_INTERLEAVE_v8hi \
      25  0, 4, 1, 5, 2, 6, 3, 7
      26  
      27  #define PERM_CONST_TRUNCATE_v32hi \
      28  0, 2, 4, 6, 8, 10, 12, 14, \
      29  16, 18, 20, 22, 24, 26, 28, 30
      30  
      31  #define PERM_CONST_TRUNCATE_v16hi \
      32  0, 2, 4, 6, 8, 10, 12, 14
      33  
      34  #define PERM_CONST_TRUNCATE_v8hi \
      35  0, 2, 4, 6
      36  
      37  #define PERM_CONST_INTERLEAVE(size) \
      38    PERM_CONST_INTERLEAVE_v##size##hi
      39  
      40  #define PERM_CONST_TRUNCATE(size) \
      41    PERM_CONST_TRUNCATE_v##size##hi
      42  
      43  #define SHUFFLE_CONST_INTERLEAVE(type, rtype, size) \
      44  rtype foo_##type##shufflevector_const_interleave (type a) \
      45  { \
      46    return __builtin_shufflevector (a, (type) {}, \
      47  				  PERM_CONST_INTERLEAVE (size)); \
      48  } \
      49  type foo_##type##shufflevector_const_trunc (rtype a) \
      50  { \
      51    return __builtin_shufflevector (a, a, \
      52  				  PERM_CONST_TRUNCATE (size)); \
      53  }
      54  
      55  SHUFFLE_CONST_INTERLEAVE (v16hf, v32hf, 32)
      56  SHUFFLE_CONST_INTERLEAVE (v8hf, v16hf, 16)
      57  SHUFFLE_CONST_INTERLEAVE (v4hf, v8hf, 8)