| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -ftree-vectorize" } */ |
| 3 |
|
| 4 |
#include <stdint.h> |
| 5 |
|
| 6 |
#define N 1024 |
| 7 |
|
| 8 |
#define TYPE(N) int##N##_t |
| 9 |
|
| 10 |
#define TEMPLATE(SIZE) \ |
| 11 |
void __attribute__ ((noinline, noclone)) \ |
| 12 |
f_##SIZE##_##OP \ |
| 13 |
(TYPE(SIZE) *restrict a, TYPE(SIZE) *restrict b, \ |
| 14 |
TYPE(SIZE) *restrict c) \ |
| 15 |
{ \ |
| 16 |
for (int i = 0; i < N; i++) \ |
| 17 |
a[i] = b[i] * c[i]; \ |
| 18 |
} |
| 19 |
|
| 20 |
TEMPLATE (8); |
| 21 |
TEMPLATE (16); |
| 22 |
TEMPLATE (32); |
| 23 |
TEMPLATE (64); |
| 24 |
|
| 25 |
/* { dg-final { scan-assembler-times {\tmul\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d} 1 } } */ |
| 26 |
/* { dg-final { scan-assembler-times {\tmul\tz[0-9]+\.s, z[0-9]+\.s, z[0-9]+\.s} 1 } } */ |
| 27 |
/* { dg-final { scan-assembler-times {\tmul\tz[0-9]+\.h, z[0-9]+\.h, z[0-9]+\.h} 1 } } */ |
| 28 |
/* { dg-final { scan-assembler-times {\tmul\tz[0-9]+\.b, z[0-9]+\.b, z[0-9]+\.b} 1 } } */ |
| 29 |
|