(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
i386/
avx512f-ceil-vec-1.c
       1  /* { dg-do run } */
       2  /* { dg-options "-O2 -ffast-math -ftree-vectorize -mavx512f" } */
       3  /* { dg-require-effective-target avx512f } */
       4  
       5  #define __NO_MATH_INLINES
       6  #include "math_m_pi.h"
       7  #include "avx512f-check.h"
       8  
       9  #define NUM 64
      10  
      11  static void
      12  __attribute__((__target__("fpmath=sse")))
      13  init_src (double *src)
      14  {
      15    int i, sign = 1;
      16    double f = rand ();
      17  
      18    for (i = 0; i < NUM; i++)
      19      {
      20        src[i] = (i + 1) * f * M_PI * sign;
      21        if (i < (NUM / 2))
      22  	{
      23            if ((i % 6) == 0)
      24  	    f = f * src[i];
      25          }
      26        else if (i == (NUM / 2))
      27  	f = rand ();
      28        else if ((i % 6) == 0)
      29  	f = 1 / (f * (i + 1) * src[i] * M_PI * sign);
      30        sign = -sign;
      31      }
      32  }
      33  
      34  static void
      35  __attribute__((__target__("fpmath=387")))
      36  avx512f_test (void)
      37  {
      38    double a[NUM];
      39    double r[NUM];
      40    int i;
      41  
      42    init_src (a);
      43  
      44    for (i = 0; i < NUM; i++)
      45      r[i] = ceil (a[i]);
      46  
      47    /* check results:  */
      48    for (i = 0; i < NUM; i++)
      49      if (r[i] != ceil (a[i]))
      50        abort();
      51  }