Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/autovec/slp-mask-run-1.c

raw
1 /* { dg-do run { target { riscv_v } } } */
2 /* { dg-additional-options "-std=gnu99 -O3 -mrvv-vector-bits=scalable" } */
3
4 #include <malloc.h>
5 #include <stdio.h>
6
7 #include "slp-mask-1.c"
8
9 #define SZ 8
10
11 __attribute__ ((optimize ("1")))
12 int main ()
13 {
14 int *a = malloc (SZ * sizeof (*a));
15 short *b = malloc (SZ * sizeof (*b));
16 int *res = malloc (SZ * sizeof (*res));
17 int *ref = malloc (SZ * sizeof (*ref));
18
19 for (int i = 0; i < SZ; i++)
20 {
21 a[i] = i & 1;
22 b[i] = 2;
23 ref[i] = a[i] == 1 & b[i] == 2;
24 }
25
26 f (a, b, res);
27
28 for (int i = 0; i < SZ; i++)
29 if (res[i] != ref[i])
30 __builtin_abort ();
31 }