| 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, & ~ , vbic) |
| 26 |
FUNC(u, uint, 32, 2, & ~ , vbic) |
| 27 |
FUNC(s, int, 16, 4, & ~ , vbic) |
| 28 |
FUNC(u, uint, 16, 4, & ~ , vbic) |
| 29 |
FUNC(s, int, 8, 8, & ~ , vbic) |
| 30 |
FUNC(u, uint, 8, 8, & ~ , vbic) |
| 31 |
|
| 32 |
/* 128-bit vectors. */ |
| 33 |
FUNC(s, int, 32, 4, & ~ , vbic) |
| 34 |
FUNC(u, uint, 32, 4, & ~ , vbic) |
| 35 |
FUNC(s, int, 16, 8, & ~ , vbic) |
| 36 |
FUNC(u, uint, 16, 8, & ~ , vbic) |
| 37 |
FUNC(s, int, 8, 16, & ~ , vbic) |
| 38 |
FUNC(u, uint, 8, 16, & ~ , vbic) |
| 39 |
|
| 40 |
/* 64-bit vectors. */ |
| 41 |
FUNC_IMM(s, int, 32, 2, & ~, vbicimm) |
| 42 |
FUNC_IMM(u, uint, 32, 2, & ~, vbicimm) |
| 43 |
FUNC_IMM(s, int, 16, 4, & ~, vbicimm) |
| 44 |
FUNC_IMM(u, uint, 16, 4, & ~, vbicimm) |
| 45 |
FUNC_IMM(s, int, 8, 8, & ~, vbicimm) |
| 46 |
FUNC_IMM(u, uint, 8, 8, & ~, vbicimm) |
| 47 |
|
| 48 |
/* 128-bit vectors. */ |
| 49 |
FUNC_IMM(s, int, 32, 4, & ~, vbicimm) |
| 50 |
FUNC_IMM(u, uint, 32, 4, & ~, vbicimm) |
| 51 |
FUNC_IMM(s, int, 16, 8, & ~, vbicimm) |
| 52 |
FUNC_IMM(u, uint, 16, 8, & ~, vbicimm) |
| 53 |
FUNC_IMM(s, int, 8, 16, & ~, vbicimm) |
| 54 |
FUNC_IMM(u, uint, 8, 16, & ~, vbicimm) |
| 55 |
|
| 56 |
/* MVE has only 128-bit vectors, so we can vectorize only half of the |
| 57 |
functions above. */ |
| 58 |
/* We emit vand.i[16|32] qX, #XX for the first four versions of the |
| 59 |
128-bit vector vbicimm tests. */ |
| 60 |
/* For some reason, we do not generate the immediate version for |
| 61 |
int8x16 and uint8x16, we still use vldr to load the vector of |
| 62 |
immediates. */ |
| 63 |
/* { dg-final { scan-assembler-times {vbic\tq[0-9]+, q[0-9]+, q[0-9]+} 6 } } */ |
| 64 |
/* { dg-final { scan-assembler-times {vand.i[0-9]+\tq[0-9]+} 4 } } */ |
| 65 |
/* { dg-final { scan-assembler-times {vand\tq[0-9]+, q[0-9]+, q[0-9]+} 2 } } */ |