(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
gcn/
smin_1.c
       1  /* { dg-do compile } */
       2  /* { dg-options "-O2 -ftree-vectorize -dp" } */
       3  
       4  #include <stdint.h>
       5  
       6  #define DO_REGREG_OPS(TYPE)                                                    \
       7    void __attribute__ ((noclone))                                               \
       8    varith_##TYPE##_reg (TYPE *__restrict x, TYPE *__restrict y, int count)      \
       9    {                                                                            \
      10      for (int i = 0; i < count; ++i)                                            \
      11        x[i] = x[i] < y[i] ? x[i] : y[i];                                        \
      12    }
      13  
      14  #define DO_IMMEDIATE_OPS(VALUE, TYPE, NAME)                                    \
      15    void __attribute__ ((noclone))                                               \
      16    varithimm_##NAME##_##TYPE (TYPE *__restrict x, int count)                    \
      17    {                                                                            \
      18      for (int i = 0; i < count; ++i)                                            \
      19        x[i] = x[i] < (TYPE) VALUE ? x[i] : (TYPE) VALUE;                        \
      20    }
      21  
      22  #define DO_ARITH_OPS(REG, IMM, TYPE)                                           \
      23    REG (TYPE);                                                                  \
      24    IMM (0, TYPE, 0);                                                            \
      25    IMM (86, TYPE, 86);                                                          \
      26    IMM (109, TYPE, 109);                                                        \
      27    IMM (141, TYPE, 141);                                                        \
      28    IMM (92137445376, TYPE, 92137445376);                                        \
      29    IMM (-1, TYPE, minus1);                                                      \
      30    IMM (-110, TYPE, minus110);                                                  \
      31    IMM (-141, TYPE, minus141);                                                  \
      32    IMM (-92137445376, TYPE, minus92137445376);
      33  
      34  #define TEST_ALL(REG, IMM)                                                     \
      35    DO_ARITH_OPS (REG, IMM, int8_t)                                              \
      36    DO_ARITH_OPS (REG, IMM, int16_t)                                             \
      37    DO_ARITH_OPS (REG, IMM, int32_t)                                             \
      38    DO_ARITH_OPS (REG, IMM, int64_t)
      39  
      40  TEST_ALL (DO_REGREG_OPS, DO_IMMEDIATE_OPS)
      41  
      42  /* One per 64-bit test case: */
      43  /* { dg-final { scan-assembler-times {vec_cmpv64didi} 10 } } */
      44  /* { dg-final { scan-assembler-times {\tv_cmp_lt_i64\tvcc, v[[0-9]+:[0-9]+], v[[0-9]+:[0-9]+]} 10 } } */
      45  
      46  /* Two per test case:*/
      47  /* { dg-final { scan-assembler-times {\tv_cmpx_gt_i32\tvcc, s[0-9]+, v[0-9]+} 80 } } */