Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/autovec/binop/narrow_run-3.c

raw
1 /* { dg-do run { target { riscv_v } } } */
2 /* { dg-additional-options "-mrvv-vector-bits=scalable" } */
3
4 #include <assert.h>
5 #include "narrow-3.c"
6
7 #define RUN(TYPE1, TYPE2, SZ) \
8 TYPE1 a##TYPE1##_##TYPE2##_##SZ[SZ]; \
9 TYPE2 dst##TYPE1##_##TYPE2##_##SZ[SZ]; \
10 for (int i = 0; i < SZ; i++) \
11 { \
12 a##TYPE1##_##TYPE2##_##SZ[i] = i % 8723; \
13 } \
14 vnshift_##TYPE1##_##TYPE2 (dst##TYPE1##_##TYPE2##_##SZ, \
15 a##TYPE1##_##TYPE2##_##SZ, 9, SZ); \
16 for (int i = 0; i < SZ; i++) \
17 { \
18 assert (dst##TYPE1##_##TYPE2##_##SZ[i] \
19 == (TYPE2) (a##TYPE1##_##TYPE2##_##SZ[i] >> 9)); \
20 }
21
22 #define RUN_ALL(SZ) \
23 RUN (int16_t, int8_t, SZ) \
24 RUN (int16_t, uint8_t, SZ) \
25 RUN (uint16_t, int8_t, SZ) \
26 RUN (uint16_t, uint8_t, SZ) \
27 RUN (int32_t, int16_t, SZ) \
28 RUN (int32_t, uint16_t, SZ) \
29 RUN (uint32_t, int16_t, SZ) \
30 RUN (uint32_t, uint16_t, SZ) \
31 RUN (int64_t, int32_t, SZ) \
32 RUN (int64_t, uint32_t, SZ) \
33 RUN (uint64_t, int32_t, SZ) \
34 RUN (uint64_t, uint32_t, SZ)
35
36 int
37 main ()
38 {
39 RUN_ALL (15)
40 RUN_ALL (16)
41 RUN_ALL (17)
42 RUN_ALL (127)
43 RUN_ALL (128)
44 RUN_ALL (129)
45 RUN_ALL (512)
46 }