| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-additional-options "-march=rv64gcv -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 (float, __builtin_sqrtf) \ |
| 17 |
T (double, __builtin_sqrt) |
| 18 |
|
| 19 |
TEST_ALL (DEF_LOOP) |
| 20 |
|
| 21 |
/* { dg-final { scan-assembler-times {\tvfsqrt\.v\tv[0-9]+,v[0-9]+,v0\.t} 2 } } */ |
| 22 |
|
| 23 |
/* { dg-final { scan-assembler {\tvsetvli\t[a-z0-9]+,[a-z0-9]+,e[0-9]+,m[f0-9]+,t[au],mu} } } */ |
| 24 |
|
| 25 |
/* { dg-final { scan-assembler-not {\tvf?merge\.v[vxi]m\t} } } */ |