Debian Codegraph @

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

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