eal: simplify meson build of common directory
[dpdk.git] / lib / librte_eal / common / include / generic / rte_vect.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2016 6WIND S.A.
3  */
4
5 #ifndef _RTE_VECT_H_
6 #define _RTE_VECT_H_
7
8 /**
9  * @file
10  * SIMD vector types
11  *
12  * This file defines types to use vector instructions with generic C code.
13  */
14
15 #include <stdint.h>
16
17 /* Unsigned vector types */
18
19 /**
20  * 64 bits vector size to use with unsigned 8 bits elements.
21  *
22  * a = (rte_v64u8_t){ a0, a1, a2, a3, a4, a5, a6, a7 }
23  */
24 typedef uint8_t rte_v64u8_t __attribute__((vector_size(8), aligned(8)));
25
26 /**
27  * 64 bits vector size to use with unsigned 16 bits elements.
28  *
29  * a = (rte_v64u16_t){ a0, a1, a2, a3 }
30  */
31 typedef uint16_t rte_v64u16_t __attribute__((vector_size(8), aligned(8)));
32
33 /**
34  * 64 bits vector size to use with unsigned 32 bits elements.
35  *
36  * a = (rte_v64u32_t){ a0, a1 }
37  */
38 typedef uint32_t rte_v64u32_t __attribute__((vector_size(8), aligned(8)));
39
40 /**
41  * 128 bits vector size to use with unsigned 8 bits elements.
42  *
43  * a = (rte_v128u8_t){ a00, a01, a02, a03, a04, a05, a06, a07,
44  *                     a08, a09, a10, a11, a12, a13, a14, a15 }
45  */
46 typedef uint8_t rte_v128u8_t __attribute__((vector_size(16), aligned(16)));
47
48 /**
49  * 128 bits vector size to use with unsigned 16 bits elements.
50  *
51  * a = (rte_v128u16_t){ a0, a1, a2, a3, a4, a5, a6, a7 }
52  */
53 typedef uint16_t rte_v128u16_t __attribute__((vector_size(16), aligned(16)));
54
55 /**
56  * 128 bits vector size to use with unsigned 32 bits elements.
57  *
58  * a = (rte_v128u32_t){ a0, a1, a2, a3 }
59  */
60 typedef uint32_t rte_v128u32_t __attribute__((vector_size(16), aligned(16)));
61
62 /**
63  * 128 bits vector size to use with unsigned 64 bits elements.
64  *
65  * a = (rte_v128u64_t){ a0, a1 }
66  */
67 typedef uint64_t rte_v128u64_t __attribute__((vector_size(16), aligned(16)));
68
69 /**
70  * 256 bits vector size to use with unsigned 8 bits elements.
71  *
72  * a = (rte_v256u8_t){ a00, a01, a02, a03, a04, a05, a06, a07,
73  *                     a08, a09, a10, a11, a12, a13, a14, a15,
74  *                     a16, a17, a18, a19, a20, a21, a22, a23,
75  *                     a24, a25, a26, a27, a28, a29, a30, a31 }
76  */
77 typedef uint8_t rte_v256u8_t __attribute__((vector_size(32), aligned(32)));
78
79 /**
80  * 256 bits vector size to use with unsigned 16 bits elements.
81  *
82  * a = (rte_v256u16_t){ a00, a01, a02, a03, a04, a05, a06, a07,
83  *                      a08, a09, a10, a11, a12, a13, a14, a15 }
84  */
85 typedef uint16_t rte_v256u16_t __attribute__((vector_size(32), aligned(32)));
86
87 /**
88  * 256 bits vector size to use with unsigned 32 bits elements.
89  *
90  * a = (rte_v256u32_t){ a0, a1, a2, a3, a4, a5, a6, a7 }
91  */
92 typedef uint32_t rte_v256u32_t __attribute__((vector_size(32), aligned(32)));
93
94 /**
95  * 256 bits vector size to use with unsigned 64 bits elements.
96  *
97  * a = (rte_v256u64_t){ a0, a1, a2, a3 }
98  */
99 typedef uint64_t rte_v256u64_t __attribute__((vector_size(32), aligned(32)));
100
101
102 /* Signed vector types */
103
104 /**
105  * 64 bits vector size to use with 8 bits elements.
106  *
107  * a = (rte_v64s8_t){ a0, a1, a2, a3, a4, a5, a6, a7 }
108  */
109 typedef int8_t rte_v64s8_t __attribute__((vector_size(8), aligned(8)));
110
111 /**
112  * 64 bits vector size to use with 16 bits elements.
113  *
114  * a = (rte_v64s16_t){ a0, a1, a2, a3 }
115  */
116 typedef int16_t rte_v64s16_t __attribute__((vector_size(8), aligned(8)));
117
118 /**
119  * 64 bits vector size to use with 32 bits elements.
120  *
121  * a = (rte_v64s32_t){ a0, a1 }
122  */
123 typedef int32_t rte_v64s32_t __attribute__((vector_size(8), aligned(8)));
124
125 /**
126  * 128 bits vector size to use with 8 bits elements.
127  *
128  * a = (rte_v128s8_t){ a00, a01, a02, a03, a04, a05, a06, a07,
129  *                     a08, a09, a10, a11, a12, a13, a14, a15 }
130  */
131 typedef int8_t rte_v128s8_t __attribute__((vector_size(16), aligned(16)));
132
133 /**
134  * 128 bits vector size to use with 16 bits elements.
135  *
136  * a = (rte_v128s16_t){ a0, a1, a2, a3, a4, a5, a6, a7 }
137  */
138 typedef int16_t rte_v128s16_t __attribute__((vector_size(16), aligned(16)));
139
140 /**
141  * 128 bits vector size to use with 32 bits elements.
142  *
143  * a = (rte_v128s32_t){ a0, a1, a2, a3 }
144  */
145 typedef int32_t rte_v128s32_t __attribute__((vector_size(16), aligned(16)));
146
147 /**
148  * 128 bits vector size to use with 64 bits elements.
149  *
150  * a = (rte_v128s64_t){ a1, a2 }
151  */
152 typedef int64_t rte_v128s64_t __attribute__((vector_size(16), aligned(16)));
153
154 /**
155  * 256 bits vector size to use with 8 bits elements.
156  *
157  * a = (rte_v256s8_t){ a00, a01, a02, a03, a04, a05, a06, a07,
158  *                     a08, a09, a10, a11, a12, a13, a14, a15,
159  *                     a16, a17, a18, a19, a20, a21, a22, a23,
160  *                     a24, a25, a26, a27, a28, a29, a30, a31 }
161  */
162 typedef int8_t rte_v256s8_t __attribute__((vector_size(32), aligned(32)));
163
164 /**
165  * 256 bits vector size to use with 16 bits elements.
166  *
167  * a = (rte_v256s16_t){ a00, a01, a02, a03, a04, a05, a06, a07,
168  *                      a08, a09, a10, a11, a12, a13, a14, a15 }
169  */
170 typedef int16_t rte_v256s16_t __attribute__((vector_size(32), aligned(32)));
171
172 /**
173  * 256 bits vector size to use with 32 bits elements.
174  *
175  * a = (rte_v256s32_t){ a0, a1, a2, a3, a4, a5, a6, a7 }
176  */
177 typedef int32_t rte_v256s32_t __attribute__((vector_size(32), aligned(32)));
178
179 /**
180  * 256 bits vector size to use with 64 bits elements.
181  *
182  * a = (rte_v256s64_t){ a0, a1, a2, a3 }
183  */
184 typedef int64_t rte_v256s64_t __attribute__((vector_size(32), aligned(32)));
185
186 #endif /* _RTE_VECT_H_ */