| 1 |
/* { dg-do assemble { target aarch64_asm_sve_ok } } */ |
| 2 |
/* { dg-options "-O2 -ftree-vectorize --save-temps" } */ |
| 3 |
|
| 4 |
#include <stdint.h> |
| 5 |
|
| 6 |
#ifndef INDEX32 |
| 7 |
#define INDEX32 int32_t |
| 8 |
#define INDEX64 int64_t |
| 9 |
#endif |
| 10 |
|
| 11 |
#define TEST_LOOP(DATA_TYPE, BITS) \ |
| 12 |
void __attribute__ ((noinline, noclone)) \ |
| 13 |
f_##DATA_TYPE (DATA_TYPE *restrict dest, DATA_TYPE *restrict src, \ |
| 14 |
INDEX##BITS *indices, int n) \ |
| 15 |
{ \ |
| 16 |
for (int i = 0; i < n; ++i) \ |
| 17 |
dest[indices[i]] = src[i] + 1; \ |
| 18 |
} |
| 19 |
|
| 20 |
#define TEST_ALL(T) \ |
| 21 |
T (int8_t, 32) \ |
| 22 |
T (uint8_t, 32) \ |
| 23 |
T (int16_t, 32) \ |
| 24 |
T (uint16_t, 32) \ |
| 25 |
T (int32_t, 32) \ |
| 26 |
T (uint32_t, 32) \ |
| 27 |
T (float, 32) \ |
| 28 |
T (int64_t, 64) \ |
| 29 |
T (uint64_t, 64) \ |
| 30 |
T (double, 64) |
| 31 |
|
| 32 |
TEST_ALL (TEST_LOOP) |
| 33 |
|
| 34 |
/* { dg-final { scan-assembler-times {\tst1b\tz[0-9]+\.s, p[0-7], \[x[0-9]+, z[0-9]+.s, sxtw\]\n} 2 } } */ |
| 35 |
/* { dg-final { scan-assembler-times {\tst1h\tz[0-9]+\.s, p[0-7], \[x[0-9]+, z[0-9]+.s, sxtw 1\]\n} 2 } } */ |
| 36 |
/* { dg-final { scan-assembler-times {\tst1w\tz[0-9]+\.s, p[0-7], \[x[0-9]+, z[0-9]+.s, sxtw 2\]\n} 3 } } */ |
| 37 |
/* { dg-final { scan-assembler-times {\tst1d\tz[0-9]+\.d, p[0-7], \[x[0-9]+, z[0-9]+.d, lsl 3\]\n} 3 } } */ |