| 1 |
/* { dg-do assemble { target aarch64_asm_sve_ok } } */ |
| 2 |
/* { dg-options "-O2 -ftree-vectorize --save-temps" } */ |
| 3 |
|
| 4 |
#include <stdint.h> |
| 5 |
|
| 6 |
#define TEST_LOOP(DATA_TYPE) \ |
| 7 |
void __attribute__ ((noinline, noclone)) \ |
| 8 |
f_##DATA_TYPE (DATA_TYPE *restrict *dest, DATA_TYPE *restrict src, \ |
| 9 |
int n) \ |
| 10 |
{ \ |
| 11 |
for (int i = 0; i < n; ++i) \ |
| 12 |
*dest[i] = src[i] + 1; \ |
| 13 |
} |
| 14 |
|
| 15 |
#define TEST_ALL(T) \ |
| 16 |
T (int8_t) \ |
| 17 |
T (uint8_t) \ |
| 18 |
T (int16_t) \ |
| 19 |
T (uint16_t) \ |
| 20 |
T (int32_t) \ |
| 21 |
T (uint32_t) \ |
| 22 |
T (int64_t) \ |
| 23 |
T (uint64_t) \ |
| 24 |
T (double) |
| 25 |
|
| 26 |
TEST_ALL (TEST_LOOP) |
| 27 |
|
| 28 |
/* We assume this isn't profitable for bytes. */ |
| 29 |
/* { dg-final { scan-assembler-times {\tst1h\tz[0-9]+\.d, p[0-7], \[z[0-9]+.d\]\n} 2 } } */ |
| 30 |
/* { dg-final { scan-assembler-times {\tst1w\tz[0-9]+\.d, p[0-7], \[z[0-9]+.d\]\n} 2 } } */ |
| 31 |
/* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d, p[0-7], \[z[0-9]+.d\]\n} 3 } } */ |