(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
aarch64/
sve/
fmaxnm_1.c
       1  /* { dg-do compile } */
       2  /* { dg-options "-O2 -ftree-vectorize" } */
       3  
       4  #include <stdint.h>
       5  
       6  #ifndef FN
       7  #define FN(X) __builtin_fmax##X
       8  #endif
       9  
      10  #define DEF_LOOP(FN, TYPE, NAME, CONST)			\
      11    void __attribute__ ((noipa))				\
      12    test_##TYPE##_##NAME (TYPE *__restrict x,		\
      13  			TYPE *__restrict y, int n)	\
      14    {							\
      15      for (int i = 0; i < n; ++i)				\
      16        x[i] = FN (y[i], CONST);				\
      17    }
      18  
      19  #define TEST_TYPE(T, FN, TYPE) \
      20    T (FN, TYPE, zero, 0) \
      21    T (FN, TYPE, one, 1) \
      22    T (FN, TYPE, two, 2)
      23  
      24  #define TEST_ALL(T) \
      25    TEST_TYPE (T, FN (f16), _Float16) \
      26    TEST_TYPE (T, FN (f32), float) \
      27    TEST_TYPE (T, FN (f64), double)
      28  
      29  TEST_ALL (DEF_LOOP)
      30  
      31  /* { dg-final { scan-assembler-times {\tfmaxnm\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, #0\.0\n} 1 } } */
      32  /* { dg-final { scan-assembler-times {\tfmaxnm\tz[0-9]+\.s, p[0-7]/m, z[0-9]+\.s, #0\.0\n} 1 } } */
      33  /* { dg-final { scan-assembler-times {\tfmaxnm\tz[0-9]+\.d, p[0-7]/m, z[0-9]+\.d, #0\.0\n} 1 } } */
      34  
      35  /* { dg-final { scan-assembler-times {\tfmaxnm\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, #1\.0\n} 1 } } */
      36  /* { dg-final { scan-assembler-times {\tfmaxnm\tz[0-9]+\.s, p[0-7]/m, z[0-9]+\.s, #1\.0\n} 1 } } */
      37  /* { dg-final { scan-assembler-times {\tfmaxnm\tz[0-9]+\.d, p[0-7]/m, z[0-9]+\.d, #1\.0\n} 1 } } */
      38  
      39  /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.h, #2\.0} 1 } } */
      40  /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.s, #2\.0} 1 } } */
      41  /* { dg-final { scan-assembler-times {\tfmov\tz[0-9]+\.d, #2\.0} 1 } } */
      42  
      43  /* { dg-final { scan-assembler-times {\tfmaxnm\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 1 } } */
      44  /* { dg-final { scan-assembler-times {\tfmaxnm\tz[0-9]+\.s, p[0-7]/m, z[0-9]+\.s, z[0-9]+\.s\n} 1 } } */
      45  /* { dg-final { scan-assembler-times {\tfmaxnm\tz[0-9]+\.d, p[0-7]/m, z[0-9]+\.d, z[0-9]+\.d\n} 1 } } */