Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/autovec/vls-vlmax/perm.h

raw
1 #include <stdint-gcc.h>
2
3 typedef int8_t vnx2qi __attribute__ ((vector_size (2)));
4 typedef int8_t vnx4qi __attribute__ ((vector_size (4)));
5 typedef int8_t vnx8qi __attribute__ ((vector_size (8)));
6 typedef int8_t vnx16qi __attribute__ ((vector_size (16)));
7 typedef int8_t vnx32qi __attribute__ ((vector_size (32)));
8 typedef int8_t vnx64qi __attribute__ ((vector_size (64)));
9 typedef int8_t vnx128qi __attribute__ ((vector_size (128)));
10
11 typedef int16_t vnx2hi __attribute__ ((vector_size (4)));
12 typedef int16_t vnx4hi __attribute__ ((vector_size (8)));
13 typedef int16_t vnx8hi __attribute__ ((vector_size (16)));
14 typedef int16_t vnx16hi __attribute__ ((vector_size (32)));
15 typedef int16_t vnx32hi __attribute__ ((vector_size (64)));
16 typedef int16_t vnx64hi __attribute__ ((vector_size (128)));
17
18 typedef int32_t vnx2si __attribute__ ((vector_size (8)));
19 typedef int32_t vnx4si __attribute__ ((vector_size (16)));
20 typedef int32_t vnx8si __attribute__ ((vector_size (32)));
21 typedef int32_t vnx16si __attribute__ ((vector_size (64)));
22 typedef int32_t vnx32si __attribute__ ((vector_size (128)));
23
24 typedef int64_t vnx2di __attribute__ ((vector_size (16)));
25 typedef int64_t vnx4di __attribute__ ((vector_size (32)));
26 typedef int64_t vnx8di __attribute__ ((vector_size (64)));
27 typedef int64_t vnx16di __attribute__ ((vector_size (128)));
28
29 typedef float vnx2sf __attribute__ ((vector_size (8)));
30 typedef float vnx4sf __attribute__ ((vector_size (16)));
31 typedef float vnx8sf __attribute__ ((vector_size (32)));
32 typedef float vnx16sf __attribute__ ((vector_size (64)));
33 typedef float vnx32sf __attribute__ ((vector_size (128)));
34
35 typedef double vnx2df __attribute__ ((vector_size (16)));
36 typedef double vnx4df __attribute__ ((vector_size (32)));
37 typedef double vnx8df __attribute__ ((vector_size (64)));
38 typedef double vnx16df __attribute__ ((vector_size (128)));
39
40 #define INIT_PERMUTE(NUNITS, NUM1, NUM2, TYPE) \
41 TYPE v_##TYPE##_in1; \
42 TYPE v_##TYPE##_in2; \
43 TYPE v_##TYPE##_out = {0}; \
44 for (int i = 0; i < NUNITS; i++) \
45 { \
46 v_##TYPE##_in1[i] = i * NUM1 + NUM2; \
47 v_##TYPE##_in2[i] = i * NUM1 - NUM2; \
48 }
49
50 #define CHECK_PERMUTE_SINGLE(NUNITS, VALUE, TYPE) \
51 for (int i = 0; i < NUNITS; i++) \
52 if (v_##TYPE##_out[i] != VALUE) \
53 __builtin_abort ();
54
55 #define CHECK_PERMUTE_REVERSE(NUNITS, TYPE) \
56 for (int i = 0; i < NUNITS; i++) \
57 if (v_##TYPE##_out[i] != v_##TYPE##_in1[NUNITS - 1 - i]) \
58 __builtin_abort ();
59
60 #define CHECK_PERMUTE_DOUBLE(NUNITS, TYPE) \
61 for (int i = 0; i < NUNITS; i++) \
62 { \
63 int new_index = i * 2; \
64 if (new_index < NUNITS \
65 && v_##TYPE##_out[i] != v_##TYPE##_in1[new_index]) \
66 __builtin_abort (); \
67 if (new_index >= NUNITS \
68 && v_##TYPE##_out[i] != v_##TYPE##_in2[new_index % NUNITS]) \
69 __builtin_abort (); \
70 }