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, ^, veor)
26 FUNC(u, uint, 32, 2, ^, veor)
27 FUNC(s, int, 16, 4, ^, veor)
28 FUNC(u, uint, 16, 4, ^, veor)
29 FUNC(s, int, 8, 8, ^, veor)
30 FUNC(u, uint, 8, 8, ^, veor)
31 
32 /* 128-bit vectors.  */
33 FUNC(s, int, 32, 4, ^, veor)
34 FUNC(u, uint, 32, 4, ^, veor)
35 FUNC(s, int, 16, 8, ^, veor)
36 FUNC(u, uint, 16, 8, ^, veor)
37 FUNC(s, int, 8, 16, ^, veor)
38 FUNC(u, uint, 8, 16, ^, veor)
39 
40 /* 64-bit vectors.  */
41 FUNC_IMM(s, int, 32, 2, ^, veorimm)
42 FUNC_IMM(u, uint, 32, 2, ^, veorimm)
43 FUNC_IMM(s, int, 16, 4, ^, veorimm)
44 FUNC_IMM(u, uint, 16, 4, ^, veorimm)
45 FUNC_IMM(s, int, 8, 8, ^, veorimm)
46 FUNC_IMM(u, uint, 8, 8, ^, veorimm)
47 
48 /* 128-bit vectors.  */
49 FUNC_IMM(s, int, 32, 4, ^, veorimm)
50 FUNC_IMM(u, uint, 32, 4, ^, veorimm)
51 FUNC_IMM(s, int, 16, 8, ^, veorimm)
52 FUNC_IMM(u, uint, 16, 8, ^, veorimm)
53 FUNC_IMM(s, int, 8, 16, ^, veorimm)
54 FUNC_IMM(u, uint, 8, 16, ^, veorimm)
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 /* { dg-final { scan-assembler-times {veor\tq[0-9]+, q[0-9]+, q[0-9]+} 12 } } */
62