(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
i386/
pr92658-avx512vl.c
       1  /* PR target/92658 */
       2  /* { dg-do compile } */
       3  /* { dg-options "-O2 -ftree-vectorize -mavx512f -mavx512vl" } */
       4  
       5  typedef unsigned char v16qi __attribute__((vector_size (16)));
       6  typedef unsigned short v8hi __attribute__((vector_size (16)));
       7  typedef unsigned int v4si __attribute__((vector_size (16)));
       8  typedef unsigned int v8si __attribute__((vector_size (32)));
       9  typedef unsigned long long v2di __attribute__((vector_size (16)));
      10  typedef unsigned long long v4di __attribute__((vector_size (32)));
      11  
      12  void
      13  truncqd_256 (v4si * dst, v4di * __restrict src)
      14  {
      15    unsigned tem[4];
      16    tem[0] = (*src)[0];
      17    tem[1] = (*src)[1];
      18    tem[2] = (*src)[2];
      19    tem[3] = (*src)[3];
      20    dst[0] = *(v4si *) tem;
      21  }
      22  
      23  void
      24  truncqw_256 (v8hi * dst, v4di * __restrict src)
      25  {
      26    unsigned short tem[4];
      27    tem[0] = (*src)[0];
      28    tem[1] = (*src)[1];
      29    tem[2] = (*src)[2];
      30    tem[3] = (*src)[3];
      31    dst[0] = *(v8hi *) tem;
      32  }
      33  
      34  void
      35  truncqb_256 (v16qi * dst, v4di * __restrict src)
      36  {
      37    unsigned char tem[4];
      38    tem[0] = (*src)[0];
      39    tem[1] = (*src)[1];
      40    tem[2] = (*src)[2];
      41    tem[3] = (*src)[3];
      42    dst[0] = *(v16qi *) tem;
      43  }
      44  
      45  void
      46  truncqd_128 (v4si * dst, v2di * __restrict src)
      47  {
      48    unsigned tem[4];
      49    tem[0] = (*src)[0];
      50    tem[1] = (*src)[1];
      51    dst[0] = *(v4si *) tem;
      52  }
      53  
      54  void
      55  truncqw_128 (v8hi * dst, v2di * __restrict src)
      56  {
      57    unsigned short tem[4];
      58    tem[0] = (*src)[0];
      59    tem[1] = (*src)[1];
      60    dst[0] = *(v8hi *) tem;
      61  }
      62  
      63  void
      64  truncqb_128 (v16qi * dst, v2di * __restrict src)
      65  {
      66    unsigned char tem[4];
      67    tem[0] = (*src)[0];
      68    tem[1] = (*src)[1];
      69    dst[0] = *(v16qi *) tem;
      70  }
      71  
      72  void
      73  truncdw_256 (v8hi * dst, v8si * __restrict src)
      74  {
      75    unsigned short tem[8];
      76    tem[0] = (*src)[0];
      77    tem[1] = (*src)[1];
      78    tem[2] = (*src)[2];
      79    tem[3] = (*src)[3];
      80    tem[4] = (*src)[4];
      81    tem[5] = (*src)[5];
      82    tem[6] = (*src)[6];
      83    tem[7] = (*src)[7];
      84    dst[0] = *(v8hi *) tem;
      85  }
      86  
      87  void
      88  truncdb_256 (v16qi * dst, v8si * __restrict src)
      89  {
      90    unsigned char tem[8];
      91    tem[0] = (*src)[0];
      92    tem[1] = (*src)[1];
      93    tem[2] = (*src)[2];
      94    tem[3] = (*src)[3];
      95    tem[4] = (*src)[4];
      96    tem[5] = (*src)[5];
      97    tem[6] = (*src)[6];
      98    tem[7] = (*src)[7];
      99    dst[0] = *(v16qi *) tem;
     100  }
     101  
     102  void
     103  truncdw_128 (v8hi * dst, v4si * __restrict src)
     104  {
     105    unsigned short tem[8];
     106    tem[0] = (*src)[0];
     107    tem[1] = (*src)[1];
     108    tem[2] = (*src)[2];
     109    tem[3] = (*src)[3];
     110    dst[0] = *(v8hi *) tem;
     111  }
     112  
     113  void
     114  truncdb_128 (v16qi * dst, v4si * __restrict src)
     115  {
     116    unsigned char tem[8];
     117    tem[0] = (*src)[0];
     118    tem[1] = (*src)[1];
     119    tem[2] = (*src)[2];
     120    tem[3] = (*src)[3];
     121    dst[0] = *(v16qi *) tem;
     122  }
     123  
     124  /* { dg-final { scan-assembler-times "vpmovqd" 2 } } */
     125  /* { dg-final { scan-assembler-times "vpmovqw" 2 } } */
     126  /* { dg-final { scan-assembler-times "vpmovqb\[ \t]*%ymm" 1 } } */
     127  /* { dg-final { scan-assembler-times "vpmovqb\[ \t]*%xmm" 1 } } */
     128  /* { dg-final { scan-assembler-times "vpmovdw" 2 } } */
     129  /* { dg-final { scan-assembler-times "vpmovdb" 2 } } */