Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/bitmask-5.c

raw
1 /* { dg-do run { target { riscv_v } } } */
2 /* { dg-options "-mrvv-vector-bits=zvl -mrvv-max-lmul=m2 -O3" } */
3
4 #include <stdint-gcc.h>
5 #include <assert.h>
6
7 #define N 32
8
9 int
10 main ()
11 {
12 int8_t mask[N] = {0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
13 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1};
14 int8_t out[N] = {0};
15 for (int8_t i = 0; i < N; ++i)
16 if (mask[i])
17 out[i] = i;
18 for (int8_t i = 0; i < N; ++i)
19 {
20 if (mask[i])
21 assert (out[i] == i);
22 else
23 assert (out[i] == 0);
24 }
25 }