Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/autovec/conversions/vsext-run.c

raw
1 /* { dg-do run { target { riscv_v } } } */
2 /* { dg-additional-options "-std=c99 -fno-vect-cost-model -mrvv-vector-bits=zvl" } */
3
4 #include "vsext-template.h"
5
6 #include <assert.h>
7
8 #define SZ 256
9
10 #define RUN(TYPE1,TYPE2) \
11 TYPE1 src##TYPE1##TYPE2[SZ]; \
12 TYPE2 dst##TYPE1##TYPE2[SZ]; \
13 for (int i = 0; i < SZ; i++) \
14 { \
15 src##TYPE1##TYPE2[i] = i - 128; \
16 dst##TYPE1##TYPE2[i] = 0; \
17 } \
18 vsext_##TYPE1##TYPE2 (dst##TYPE1##TYPE2, \
19 src##TYPE1##TYPE2, SZ); \
20 for (int i = 0; i < SZ; i++) \
21 assert (dst##TYPE1##TYPE2[i] == i - 128);
22
23
24 #define RUN_ALL() \
25 RUN(int8_t, int16_t) \
26 RUN(int8_t, int32_t) \
27 RUN(int8_t, int64_t) \
28 RUN(int16_t, int32_t) \
29 RUN(int16_t, int64_t) \
30 RUN(int32_t, int64_t) \
31
32 int main ()
33 {
34 RUN_ALL()
35 }