| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-additional-options "-march=rv64gcv_zvfh -mabi=lp64d -mrvv-vector-bits=scalable -fno-vect-cost-model -ffast-math" } */ |
| 3 |
|
| 4 |
#include <stdint-gcc.h> |
| 5 |
|
| 6 |
#define DEF_LOOP(TYPE, OP) \ |
| 7 |
void __attribute__ ((noipa)) \ |
| 8 |
test_##TYPE##_##OP (TYPE *__restrict r, TYPE *__restrict a, \ |
| 9 |
TYPE *__restrict b, TYPE *__restrict pred, int n) \ |
| 10 |
{ \ |
| 11 |
for (int i = 0; i < n; ++i) \ |
| 12 |
r[i] = pred[i] ? OP (a[i]) : b[i]; \ |
| 13 |
} |
| 14 |
|
| 15 |
#define TEST_ALL(T) \ |
| 16 |
T (_Float16, __builtin_sqrtf16) \ |
| 17 |
|
| 18 |
TEST_ALL (DEF_LOOP) |
| 19 |
|
| 20 |
/* { dg-final { scan-assembler-times {\tvfsqrt\.v\tv[0-9]+,v[0-9]+,v0\.t} 1 } } */ |
| 21 |
|
| 22 |
/* { dg-final { scan-assembler {\tvsetvli\t[a-z0-9]+,[a-z0-9]+,e[0-9]+,m[f0-9]+,t[au],mu} } } */ |