| 1 |
/* { dg-do run { target { riscv_v } } } */ |
| 2 |
/* { dg-additional-options "-mrvv-vector-bits=scalable -fno-vect-cost-model -ffast-math" } */ |
| 3 |
|
| 4 |
#include "cond_fms_fnms-4.c" |
| 5 |
|
| 6 |
#define FACTOR 17 |
| 7 |
#define N 99 |
| 8 |
|
| 9 |
#define TEST_LOOP(TYPE, NAME, OP) \ |
| 10 |
{ \ |
| 11 |
TYPE r[N], a[N], b[N], pred[N]; \ |
| 12 |
for (int i = 0; i < N; ++i) \ |
| 13 |
{ \ |
| 14 |
a[i] = (i & 1 ? i : 3 * i); \ |
| 15 |
b[i] = (i >> 4) << (i & 15); \ |
| 16 |
pred[i] = i % 3; \ |
| 17 |
asm volatile ("" ::: "memory"); \ |
| 18 |
} \ |
| 19 |
test_##TYPE##_##NAME (r, a, b, FACTOR, pred, N); \ |
| 20 |
for (int i = 0; i < N; ++i) \ |
| 21 |
{ \ |
| 22 |
TYPE expected = (pred[i] == 1 \ |
| 23 |
? -a[i] OP b[i] * (TYPE) FACTOR \ |
| 24 |
: pred[i]); \ |
| 25 |
if (r[i] != expected) \ |
| 26 |
__builtin_abort (); \ |
| 27 |
asm volatile ("" ::: "memory"); \ |
| 28 |
} \ |
| 29 |
} |
| 30 |
|
| 31 |
int |
| 32 |
main (void) |
| 33 |
{ |
| 34 |
TEST_ALL (TEST_LOOP) |
| 35 |
return 0; |
| 36 |
} |