(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
i386/
avx512dq-vreduceps-2.c
       1  /* { dg-do run } */
       2  /* { dg-options "-O2 -mavx512dq" } */
       3  /* { dg-require-effective-target avx512dq } */
       4  
       5  #define AVX512DQ
       6  #include "avx512f-helper.h"
       7  
       8  #define SIZE (AVX512F_LEN / 32)
       9  #include "avx512f-mask-type.h"
      10  
      11  #define IMM 0x23
      12  
      13  void
      14  CALC (float *s, float *r)
      15  {
      16    int i;
      17  
      18    for (i = 0; i < SIZE; i++)
      19      {
      20        float tmp = (int) (4 * s[i]) / 4.0;
      21        r[i] = s[i] - tmp;
      22      }
      23  }
      24  
      25  void
      26  TEST (void)
      27  {
      28    UNION_TYPE (AVX512F_LEN,) s, res1, res2, res3;
      29    MASK_TYPE mask = MASK_VALUE;
      30    float res_ref[SIZE];
      31    int i, sign = 1;
      32  
      33    for (i = 0; i < SIZE; i++)
      34      {
      35        s.a[i] = 123.456 * (i + 2000) * sign;
      36        res2.a[i] = DEFAULT_VALUE;
      37        sign = -sign;
      38      }
      39  
      40    res1.x = INTRINSIC (_reduce_ps) (s.x, IMM);
      41    res2.x = INTRINSIC (_mask_reduce_ps) (res2.x, mask, s.x, IMM);
      42    res3.x = INTRINSIC (_maskz_reduce_ps) (mask, s.x, IMM);
      43  
      44    CALC (s.a, res_ref);
      45  
      46    if (UNION_FP_CHECK (AVX512F_LEN,) (res1, res_ref))
      47      abort ();
      48  
      49    MASK_MERGE () (res_ref, mask, SIZE);
      50    if (UNION_FP_CHECK (AVX512F_LEN,) (res2, res_ref))
      51      abort ();
      52  
      53    MASK_ZERO () (res_ref, mask, SIZE);
      54    if (UNION_FP_CHECK (AVX512F_LEN,) (res3, res_ref))
      55      abort ();
      56  }