Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/autovec/cond/cond_arith_run-1.c

raw
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_arith-1.c"
5
6 #define N 99
7
8 #undef TEST
9 #define TEST(TYPE, NAME, OP) \
10 { \
11 TYPE x[N], y[N], z[N], pred[N]; \
12 for (int i = 0; i < N; ++i) \
13 { \
14 y[i] = i * i; \
15 z[i] = ((i + 2) % 3) * (i + 1); \
16 pred[i] = i % 3; \
17 } \
18 test_##TYPE##_##NAME (x, y, z, pred, N); \
19 for (int i = 0; i < N; ++i) \
20 { \
21 TYPE expected = i % 3 != 1 ? y[i] OP z[i] : y[i]; \
22 if (x[i] != expected) \
23 __builtin_abort (); \
24 asm volatile ("" ::: "memory"); \
25 } \
26 }
27
28 int
29 main (void)
30 {
31 TEST_ALL
32 return 0;
33 }