| 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(SIGN, TYPE, BITS, NB, OP, NAME) \ |
| 9 |
void test_ ## NAME ##_ ## SIGN ## BITS ## x ## NB (TYPE##BITS##_t * __restrict__ dest, \ |
| 10 |
TYPE##BITS##_t *a, TYPE##BITS##_t *b) { \ |
| 11 |
int i; \ |
| 12 |
for (i=0; i<NB; i++) { \ |
| 13 |
dest[i] = a[i] OP b[i]; \ |
| 14 |
} \ |
| 15 |
} |
| 16 |
|
| 17 |
/* 128-bit vectors. */ |
| 18 |
FUNC(s, int, 32, 4, +, vadd) |
| 19 |
FUNC(u, uint, 32, 4, +, vadd) |
| 20 |
FUNC(s, int, 16, 8, +, vadd) |
| 21 |
FUNC(u, uint, 16, 8, +, vadd) |
| 22 |
FUNC(s, int, 8, 16, +, vadd) |
| 23 |
FUNC(u, uint, 8, 16, +, vadd) |
| 24 |
|
| 25 |
/* { dg-final { scan-assembler-times {vadd\.i32\tq[0-9]+, q[0-9]+, q[0-9]+} 2 } } */ |
| 26 |
/* { dg-final { scan-assembler-times {vadd\.i16\tq[0-9]+, q[0-9]+, q[0-9]+} 2 } } */ |
| 27 |
/* { dg-final { scan-assembler-times {vadd\.i8\tq[0-9]+, q[0-9]+, q[0-9]+} 2 } } */ |
| 28 |
|
| 29 |
void test_vadd_f32 (float * dest, float * a, float * b) { |
| 30 |
int i; |
| 31 |
for (i=0; i<4; i++) { |
| 32 |
dest[i] = a[i] + b[i]; |
| 33 |
} |
| 34 |
} |
| 35 |
/* { dg-final { scan-assembler-times {vadd\.f32\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */ |
| 36 |
|
| 37 |
void test_vadd_f16 (__fp16 * dest, __fp16 * a, __fp16 * b) { |
| 38 |
int i; |
| 39 |
for (i=0; i<8; i++) { |
| 40 |
dest[i] = a[i] + b[i]; |
| 41 |
} |
| 42 |
} |
| 43 |
/* { dg-final { scan-assembler-times {vadd\.f16\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */ |