| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -ftree-vectorize -march=armv8-a+sve --param aarch64-vect-compare-costs=0" } */ |
| 3 |
|
| 4 |
#include <stdint.h> |
| 5 |
|
| 6 |
#define DEF_LOOP(TYPE) \ |
| 7 |
void __attribute__ ((noinline, noclone)) \ |
| 8 |
test_##TYPE (int *restrict a, TYPE *restrict b, int a1, int a2, \ |
| 9 |
int a3, int a4, int n) \ |
| 10 |
{ \ |
| 11 |
for (int i = 0; i < n; i += 2) \ |
| 12 |
{ \ |
| 13 |
a[i] = a[i] >= 1 & b[i] != 3 ? a1 : a2; \ |
| 14 |
a[i + 1] = a[i + 1] >= 1 & b[i + 1] != 3 ? a3 : a4; \ |
| 15 |
} \ |
| 16 |
} |
| 17 |
|
| 18 |
#define FOR_EACH_TYPE(T) \ |
| 19 |
T (int8_t) \ |
| 20 |
T (uint8_t) \ |
| 21 |
T (int16_t) \ |
| 22 |
T (uint16_t) \ |
| 23 |
T (int64_t) \ |
| 24 |
T (uint64_t) \ |
| 25 |
T (double) |
| 26 |
|
| 27 |
FOR_EACH_TYPE (DEF_LOOP) |
| 28 |
|
| 29 |
/* { dg-final { scan-assembler-times {\tld1b\t} 2 } } */ |
| 30 |
/* { dg-final { scan-assembler-times {\tld1h\t} 2 } } */ |
| 31 |
/* 4 for each 8-bit function, 2 for each 16-bit function, 1 for |
| 32 |
each 64-bit function. */ |
| 33 |
/* { dg-final { scan-assembler-times {\tld1w\t} 15 } } */ |
| 34 |
/* 3 64-bit functions * 2 64-bit vectors per 32-bit vector. */ |
| 35 |
/* { dg-final { scan-assembler-times {\tld1d\t} 6 } } */ |
| 36 |
/* { dg-final { scan-assembler-times {\tsel\tz[0-9]} 15 } } */ |