1  /* { dg-do compile } */
       2  /* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
       3  /* { dg-add-options arm_v8_1m_mve_fp } */
       4  /* { dg-additional-options "-O3" } */
       5  
       6  #include <stdint.h>
       7  
       8  #define FUNC_IMM(SIGN, TYPE, BITS, NB, OP, NAME)			\
       9    void test_ ## NAME ##_ ## SIGN ## BITS ## x ## NB (TYPE##BITS##_t * __restrict__ dest, \
      10  						     TYPE##BITS##_t *a) { \
      11      int i;								\
      12      for (i=0; i<NB; i++) {						\
      13        dest[i] = a[i] OP 5;						\
      14      }									\
      15  }
      16  
      17  /* 128-bit vectors.  */
      18  FUNC_IMM(s, int, 32, 4, *, vmulimm)
      19  FUNC_IMM(u, uint, 32, 4, *, vmulimm)
      20  FUNC_IMM(s, int, 16, 8, *, vmulimm)
      21  FUNC_IMM(u, uint, 16, 8, *, vmulimm)
      22  FUNC_IMM(s, int, 8, 16, *, vmulimm)
      23  FUNC_IMM(u, uint, 8, 16, *, vmulimm)
      24  
      25  /* For the moment we do not select the T2 vmul variant operating on a scalar
      26     final argument.  */
      27  /* { dg-final { scan-assembler-times {vmul\.i32\tq[0-9]+, q[0-9]+, r[0-9]+} 2 { xfail *-*-* } } } */
      28  /* { dg-final { scan-assembler-times {vmul\.i16\tq[0-9]+, q[0-9]+, r[0-9]+} 2 { xfail *-*-* } } } */
      29  /* { dg-final { scan-assembler-times {vmul\.i8\tq[0-9]+, q[0-9]+, r[0-9]+} 2 { xfail *-*-* } } } */
      30  
      31  void test_vmul_f32 (float * dest, float * a, float * b) {
      32    int i;
      33    for (i=0; i<4; i++) {
      34      dest[i] = a[i] * b[1];
      35    }
      36  }
      37  void test_vmulimm_f32 (float * dest, float * a) {
      38    int i;
      39    for (i=0; i<4; i++) {
      40      dest[i] = a[i] * 5.0;
      41    }
      42  }
      43  /* { dg-final { scan-assembler-times {vmul\.f32\tq[0-9]+, q[0-9]+, r[0-9]+} 2 { xfail *-*-* } } } */
      44  
      45  void test_vmul_f16 (__fp16 * dest, __fp16 * a, __fp16 * b) {
      46    int i;
      47    for (i=0; i<8; i++) {
      48      dest[i] = a[i] * b[i];
      49    }
      50  }
      51  
      52  /* Note that dest[i] = a[i] * 5.0f16 is not vectorized.  */
      53  void test_vmulimm_f16 (__fp16 * dest, __fp16 * a) {
      54    int i;
      55    __fp16 b = 5.0f16;
      56    for (i=0; i<8; i++) {
      57      dest[i] = a[i] * b;
      58    }
      59  }
      60  /* { dg-final { scan-assembler-times {vmul\.f16\tq[0-9]+, q[0-9]+, r[0-9]+} 2 { xfail *-*-* } } } */