Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/vandn-run.c

raw
1 /* { dg-do run } */
2 /* { dg-require-effective-target "riscv_zvbb_ok" } */
3 /* { dg-add-options "riscv_v" } */
4 /* { dg-add-options "riscv_zvbb" } */
5 /* { dg-additional-options "-std=c99 -fno-vect-cost-model" } */
6
7 #include "vandn-template.h"
8
9 #include <assert.h>
10
11 #define SZ 512
12
13 #define RUN(TYPE, VAL) \
14 TYPE a##TYPE[SZ]; \
15 TYPE b##TYPE[SZ]; \
16 for (int i = 0; i < SZ; i++) \
17 { \
18 a##TYPE[i] = 123; \
19 b##TYPE[i] = VAL; \
20 } \
21 vandn_##TYPE (a##TYPE, a##TYPE, b##TYPE, SZ); \
22 for (int i = 0; i < SZ; i++) \
23 assert (a##TYPE[i] == (TYPE) (123 & ~VAL));
24
25 #define RUN2(TYPE, VAL) \
26 TYPE as##TYPE[SZ]; \
27 for (int i = 0; i < SZ; i++) \
28 as##TYPE[i] = 123; \
29 vandns_##TYPE (as##TYPE, as##TYPE, VAL, SZ); \
30 for (int i = 0; i < SZ; i++) \
31 assert (as##TYPE[i] == (123 & ~VAL));
32
33 #define RUN_ALL() \
34 RUN (int8_t, -1) \
35 RUN (uint8_t, 2) \
36 RUN (int16_t, -1) \
37 RUN (uint16_t, 2) \
38 RUN (int32_t, -3) \
39 RUN (uint32_t, 4) \
40 RUN (int64_t, -5) \
41 RUN (uint64_t, 6) \
42 RUN2 (int8_t, -7) \
43 RUN2 (uint8_t, 8) \
44 RUN2 (int16_t, -7) \
45 RUN2 (uint16_t, 8) \
46 RUN2 (int32_t, -9) \
47 RUN2 (uint32_t, 10) \
48 RUN2 (int64_t, -11) \
49 RUN2 (uint64_t, 12)
50
51 int main ()
52 {
53 RUN_ALL()
54 }