(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
i386/
avx-ne-convert-vcvtneps2bf16-2.c
       1  /* { dg-do run } */
       2  /* { dg-options "-mavxneconvert -O2" } */
       3  /* { dg-require-effective-target avxneconvert } */
       4  #define AVXNECONVERT
       5  #include <stdint.h>
       6  
       7  #ifndef CHECK
       8  #define CHECK "avx-check.h"
       9  #endif
      10  
      11  #ifndef TEST
      12  #define TEST avx_test
      13  #endif
      14  
      15  #include CHECK
      16  
      17  typedef union
      18  {
      19    uint32_t int32;
      20    float flt;
      21  } float_int_t;
      22  
      23  typedef union
      24  {
      25    __m128bh  x;
      26    unsigned short a[8];
      27  } union128bf16;
      28  
      29  void TEST (void)
      30  {
      31    union128 src_128;
      32    union256 src_256;
      33    union128bf16 dst_128, dst_256;
      34    uint16_t res_ref_128[8] = {0}, res_ref_256[8];
      35    float_int_t fp32;
      36    for (int i = 0; i < 4; i++)
      37    {
      38      fp32.flt = (float) 2 * i + 7 + i * 0.25;
      39      src_128.a[i] = fp32.flt;
      40      res_ref_128[i] = fp32.int32 >> 16;
      41      dst_128.a[i] = 117;
      42    }
      43  
      44    for (int i = 0; i < 8; i++)
      45    {
      46      fp32.flt = (float) 2 * i + 7 + i * 0.25;
      47      src_256.a[i] = fp32.flt;
      48      res_ref_256[i] = fp32.int32 >> 16;
      49      dst_256.a[i] = 117;
      50    }
      51    dst_128.x = _mm_cvtneps_avx_pbh (src_128.x);
      52    dst_256.x = _mm256_cvtneps_avx_pbh (src_256.x);
      53  
      54    if (checkVus (dst_128.a, res_ref_128, 8))
      55      abort();
      56    if (checkVus (dst_128.a, res_ref_128, 8))
      57      abort();
      58  }