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 FUNC_IMM(SIGN, TYPE, BITS, NB, OP, NAME)				\
      17    void test_ ## NAME ##_ ## SIGN ## BITS ## x ## NB (TYPE##BITS##_t * __restrict__ dest, TYPE##BITS##_t *a) { \
      18      int i;								\
      19      for (i=0; i<NB; i++) {						\
      20        dest[i] = a[i] OP 1;						\
      21      }									\
      22  }
      23  
      24  /* 64-bit vectors.  */
      25  FUNC(s, int, 32, 2, |, vorr)
      26  FUNC(u, uint, 32, 2, |, vorr)
      27  FUNC(s, int, 16, 4, |, vorr)
      28  FUNC(u, uint, 16, 4, |, vorr)
      29  FUNC(s, int, 8, 8, |, vorr)
      30  FUNC(u, uint, 8, 8, |, vorr)
      31  
      32  /* 128-bit vectors.  */
      33  FUNC(s, int, 32, 4, |, vorr)
      34  FUNC(u, uint, 32, 4, |, vorr)
      35  FUNC(s, int, 16, 8, |, vorr)
      36  FUNC(u, uint, 16, 8, |, vorr)
      37  FUNC(s, int, 8, 16, |, vorr)
      38  FUNC(u, uint, 8, 16, |, vorr)
      39  
      40  /* 64-bit vectors.  */
      41  FUNC_IMM(s, int, 32, 2, |, vorrimm)
      42  FUNC_IMM(u, uint, 32, 2, |, vorrimm)
      43  FUNC_IMM(s, int, 16, 4, |, vorrimm)
      44  FUNC_IMM(u, uint, 16, 4, |, vorrimm)
      45  FUNC_IMM(s, int, 8, 8, |, vorrimm)
      46  FUNC_IMM(u, uint, 8, 8, |, vorrimm)
      47  
      48  /* 128-bit vectors.  */
      49  FUNC_IMM(s, int, 32, 4, |, vorrimm)
      50  FUNC_IMM(u, uint, 32, 4, |, vorrimm)
      51  FUNC_IMM(s, int, 16, 8, |, vorrimm)
      52  FUNC_IMM(u, uint, 16, 8, |, vorrimm)
      53  FUNC_IMM(s, int, 8, 16, |, vorrimm)
      54  FUNC_IMM(u, uint, 8, 16, |, vorrimm)
      55  
      56  /* MVE has only 128-bit vectors, so we can vectorize only half of the
      57     functions above.  */
      58  /* Although float16 and float32 types are supported at assembly level,
      59     we cannot test them with the '|' operator, so we check only the
      60     integer variants.  */
      61  /* We emit vorr.i[16|32] qX, #1 for the first four versions of the
      62     128-bit vector vorrimm tests.  */
      63  /* { dg-final { scan-assembler-times {vorr\tq[0-9]+, q[0-9]+, q[0-9]+} 8 } } */
      64  /* { dg-final { scan-assembler-times {vorr.i[0-9]+\tq[0-9]+} 4 } } */