1  /* { dg-do compile } */
       2  /* { dg-options "-O2 -ftree-vectorize" } */
       3  
       4  #include <math.h>
       5  
       6  #define NUM_ELEMS(TYPE) (320 / sizeof (TYPE))
       7  
       8  #define DEF_MAXMIN(TYPE, FUN)					\
       9  void __attribute__ ((noinline, noclone))			\
      10  test_##FUN##_##TYPE (TYPE *restrict r, TYPE *restrict a,	\
      11  		     TYPE *restrict b)				\
      12  {								\
      13    for (int i = 0; i < NUM_ELEMS (TYPE); i++)			\
      14      r[i] = FUN (a[i], b[i]);					\
      15  }
      16  
      17  #define TEST_ALL(T)				\
      18    T (float, fmaxf)				\
      19    T (double, fmax)				\
      20  						\
      21    T (float, fminf)				\
      22    T (double, fmin)
      23  
      24  TEST_ALL (DEF_MAXMIN)
      25  
      26  /* { dg-final { scan-assembler-times {\tfmaxnm\tz[0-9]+\.s, p[0-7]/m, z[0-9]+\.s, z[0-9]+\.s\n} 1 } } */
      27  /* { dg-final { scan-assembler-times {\tfmaxnm\tz[0-9]+\.d, p[0-7]/m, z[0-9]+\.d, z[0-9]+\.d\n} 1 } } */
      28  
      29  /* { dg-final { scan-assembler-times {\tfminnm\tz[0-9]+\.s, p[0-7]/m, z[0-9]+\.s, z[0-9]+\.s\n} 1 } } */
      30  /* { dg-final { scan-assembler-times {\tfminnm\tz[0-9]+\.d, p[0-7]/m, z[0-9]+\.d, z[0-9]+\.d\n} 1 } } */