| 1 |
/* { dg-options "-O2 -mcpu=neoverse-v2 --param aarch64-autovec-preference=asimd-only" } */ |
| 2 |
|
| 3 |
#include <stdint.h> |
| 4 |
|
| 5 |
#define OPNBSL(x,y,z) (~(((x) & (z)) | ((y) & ~(z)))) |
| 6 |
#define OPBSL1N(x,y,z) ((~(x) & (z)) | ((y) & ~(z))) |
| 7 |
#define OPBSL2N(x,y,z) (((x) & (z)) | (~(y) & ~(z))) |
| 8 |
|
| 9 |
#define N 1024 |
| 10 |
|
| 11 |
#define TYPE(N) int##N##_t |
| 12 |
|
| 13 |
#define TEST(SIZE, OP, SUFFIX) \ |
| 14 |
void __attribute__ ((noinline, noclone)) \ |
| 15 |
f_##SIZE##_##SUFFIX \ |
| 16 |
(TYPE(SIZE) *restrict a, TYPE(SIZE) *restrict b, \ |
| 17 |
TYPE(SIZE) *restrict c, TYPE(SIZE) *restrict d) \ |
| 18 |
{ \ |
| 19 |
for (int i = 0; i < N; i++) \ |
| 20 |
a[i] = OP (b[i], c[i], d[i]); \ |
| 21 |
} |
| 22 |
|
| 23 |
#define TEST_ALL(SIZE) \ |
| 24 |
TEST(SIZE, OPNBSL, nbsl) \ |
| 25 |
TEST(SIZE, OPBSL1N, bsl1n) \ |
| 26 |
TEST(SIZE, OPBSL2N, bsl2n) |
| 27 |
|
| 28 |
TEST_ALL(8); |
| 29 |
TEST_ALL(16); |
| 30 |
TEST_ALL(32); |
| 31 |
TEST_ALL(64); |
| 32 |
|
| 33 |
/* { dg-final { scan-assembler-times {\tnbsl\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 4 } } */ |
| 34 |
/* { dg-final { scan-assembler-times {\tbsl1n\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 4 } } */ |
| 35 |
/* { dg-final { scan-assembler-times {\tbsl2n\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 4 } } */ |