(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
arm/
simd/
mve-vcmp.c
       1  /* { dg-do assemble } */
       2  /* { dg-require-effective-target arm_v8_1m_mve_ok } */
       3  /* { dg-add-options arm_v8_1m_mve } */
       4  /* { dg-additional-options "-O3" } */
       5  
       6  #include <stdint.h>
       7  
       8  #define FUNC(SIGN, TYPE, BITS, NB, OP, NAME)				\
       9    void test_ ## NAME ##_ ## SIGN ## BITS ## x ## NB (TYPE##BITS##_t * __restrict__ dest, TYPE##BITS##_t *a, TYPE##BITS##_t *b) { \
      10      int i;								\
      11      for (i=0; i<NB; i++) {						\
      12        dest[i] = a[i] OP b[i];						\
      13      }									\
      14  }
      15  
      16  #define ALL_FUNCS(OP, NAME) \
      17    FUNC(s, int, 32, 2, OP, NAME)			\
      18    FUNC(u, uint, 32, 2, OP, NAME)		\
      19    FUNC(s, int, 16, 4, OP, NAME)			\
      20    FUNC(u, uint, 16, 4, OP, NAME)		\
      21    FUNC(s, int, 8, 8, OP, NAME)			\
      22    FUNC(u, uint, 8, 8, OP, NAME)			\
      23    FUNC(s, int, 32, 4, OP, NAME)			\
      24    FUNC(u, uint, 32, 4, OP, NAME)		\
      25    FUNC(s, int, 16, 8, OP, NAME)			\
      26    FUNC(u, uint, 16, 8, OP, NAME)		\
      27    FUNC(s, int, 8, 16, OP, NAME)			\
      28    FUNC(u, uint, 8, 16, OP, NAME)
      29  
      30  ALL_FUNCS(==, vcmpeq)
      31  ALL_FUNCS(!=, vcmpne)
      32  ALL_FUNCS(<, vcmplt)
      33  ALL_FUNCS(<=, vcmple)
      34  ALL_FUNCS(>, vcmpgt)
      35  ALL_FUNCS(>=, vcmpge)
      36  
      37  /* MVE has only 128-bit vectors, so we can vectorize only half of the
      38     functions above.  */
      39  /* { dg-final { scan-assembler-times {\tvcmp.i[0-9]+\teq, q[0-9]+, q[0-9]+\n} 6 } } */
      40  /* { dg-final { scan-assembler-times {\tvcmp.i[0-9]+\tne, q[0-9]+, q[0-9]+\n} 6 } } */
      41  
      42  /* lt, le, gt, ge apply to signed types, cs and hi to unsigned types.  */
      43  /* lt and le with unsigned types are replaced with the opposite condition, hence
      44     the double number of matches for cs and hi.  */
      45  /* { dg-final { scan-assembler-times {\tvcmp.s[0-9]+\tlt, q[0-9]+, q[0-9]+\n} 3 } } */
      46  /* { dg-final { scan-assembler-times {\tvcmp.s[0-9]+\tle, q[0-9]+, q[0-9]+\n} 3 } } */
      47  /* { dg-final { scan-assembler-times {\tvcmp.s[0-9]+\tgt, q[0-9]+, q[0-9]+\n} 3 } } */
      48  /* { dg-final { scan-assembler-times {\tvcmp.s[0-9]+\tge, q[0-9]+, q[0-9]+\n} 3 } } */
      49  /* { dg-final { scan-assembler-times {\tvcmp.u[0-9]+\tcs, q[0-9]+, q[0-9]+\n} 6 } } */
      50  /* { dg-final { scan-assembler-times {\tvcmp.u[0-9]+\thi, q[0-9]+, q[0-9]+\n} 6 } } */