| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d -mrvv-vector-bits=scalable -fno-vect-cost-model" } */ |
| 3 |
|
| 4 |
#include <stdint-gcc.h> |
| 5 |
|
| 6 |
#define DEF_LOOP(TYPE, NAME, OP) \ |
| 7 |
void __attribute__ ((noipa)) \ |
| 8 |
test_##TYPE##_##NAME (TYPE *__restrict r, TYPE *__restrict a, \ |
| 9 |
TYPE *__restrict b, TYPE *__restrict c, int n) \ |
| 10 |
{ \ |
| 11 |
for (int i = 0; i < n; ++i) \ |
| 12 |
r[i] = a[i] > 20 ? b[i] OP c[i] : 91; \ |
| 13 |
} |
| 14 |
|
| 15 |
#define TEST_TYPE(T, TYPE) \ |
| 16 |
T (TYPE, shl, <<) \ |
| 17 |
T (TYPE, shr, >>) |
| 18 |
|
| 19 |
#define TEST_ALL(T) \ |
| 20 |
TEST_TYPE (T, int32_t) \ |
| 21 |
TEST_TYPE (T, uint32_t) \ |
| 22 |
TEST_TYPE (T, int64_t) \ |
| 23 |
TEST_TYPE (T, uint64_t) |
| 24 |
|
| 25 |
TEST_ALL (DEF_LOOP) |
| 26 |
|
| 27 |
/* { dg-final { scan-assembler-times {vsll\.vv\s+v[0-9]+,v[0-9]+,v[0-9]+,v0.t} 4 } } */ |
| 28 |
/* { dg-final { scan-assembler-times {vsra\.vv\s+v[0-9]+,v[0-9]+,v[0-9]+,v0.t} 2 } } */ |
| 29 |
/* { dg-final { scan-assembler-times {vsrl\.vv\s+v[0-9]+,v[0-9]+,v[0-9]+,v0.t} 2 } } */ |
| 30 |
/* { dg-final { scan-assembler-not {\tvf?merge\.v[vxi]m\t} } } */ |