111
|
1 /* GNU compiler vector extension intrinsics
|
131
|
2 Copyright (C) 2015-2018 Free Software Foundation, Inc.
|
111
|
3 Contributed by Andreas Krebbel (Andreas.Krebbel@de.ibm.com)
|
|
4
|
|
5 This file is part of GCC.
|
|
6
|
|
7 GCC is free software; you can redistribute it and/or modify it under
|
|
8 the terms of the GNU General Public License as published by the Free
|
|
9 Software Foundation; either version 3, or (at your option) any later
|
|
10 version.
|
|
11
|
|
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
15 for more details.
|
|
16
|
|
17 You should have received a copy of the GNU General Public License
|
|
18 along with GCC; see the file COPYING3. If not see
|
|
19 <http://www.gnu.org/licenses/>. */
|
|
20
|
|
21 #ifndef _VECINTRIN_H
|
|
22 #define _VECINTRIN_H
|
|
23
|
|
24 #define __VEC_CLASS_FP_ZERO_P (1<<11)
|
|
25 #define __VEC_CLASS_FP_ZERO_N (1<<10)
|
|
26 #define __VEC_CLASS_FP_ZERO (__VEC_CLASS_FP_ZERO_P \
|
|
27 | __VEC_CLASS_FP_ZERO_N)
|
|
28
|
|
29 #define __VEC_CLASS_FP_NORMAL_P (1<<9)
|
|
30 #define __VEC_CLASS_FP_NORMAL_N (1<<8)
|
|
31 #define __VEC_CLASS_FP_NORMAL (__VEC_CLASS_FP_NORMAL_P \
|
|
32 | __VEC_CLASS_FP_NORMAL_N)
|
|
33
|
|
34 #define __VEC_CLASS_FP_SUBNORMAL_P (1<<7)
|
|
35 #define __VEC_CLASS_FP_SUBNORMAL_N (1<<6)
|
|
36 #define __VEC_CLASS_FP_SUBNORMAL (__VEC_CLASS_FP_SUBNORMAL_P \
|
|
37 | __VEC_CLASS_FP_SUBNORMAL_N)
|
|
38
|
|
39 #define __VEC_CLASS_FP_INFINITY_P (1<<5)
|
|
40 #define __VEC_CLASS_FP_INFINITY_N (1<<4)
|
|
41 #define __VEC_CLASS_FP_INFINITY (__VEC_CLASS_FP_INFINITY_P \
|
|
42 | __VEC_CLASS_FP_INFINITY_N)
|
|
43
|
|
44 #define __VEC_CLASS_FP_QNAN_P (1<<3)
|
|
45 #define __VEC_CLASS_FP_QNAN_N (1<<2)
|
|
46 #define __VEC_CLASS_FP_QNAN (__VEC_CLASS_FP_QNAN_P \
|
|
47 | __VEC_CLASS_FP_QNAN_N)
|
|
48
|
|
49 #define __VEC_CLASS_FP_SNAN_P (1<<1)
|
|
50 #define __VEC_CLASS_FP_SNAN_N (1<<0)
|
|
51 #define __VEC_CLASS_FP_SNAN (__VEC_CLASS_FP_SNAN_P \
|
|
52 | __VEC_CLASS_FP_SNAN_N)
|
|
53
|
|
54 #define __VEC_CLASS_FP_NAN (__VEC_CLASS_FP_QNAN \
|
|
55 | __VEC_CLASS_FP_SNAN)
|
|
56 #define __VEC_CLASS_FP_NOT_NORMAL (__VEC_CLASS_FP_NAN \
|
|
57 | __VEC_CLASS_FP_SUBNORMAL \
|
|
58 |__VEC_CLASS_FP_ZERO \
|
|
59 | __VEC_CLASS_FP_INFINITY)
|
|
60
|
|
61 /* This also accepts a type for its parameter, so it is not enough
|
|
62 to #define vec_step to __builtin_vec_step. */
|
|
63 #define vec_step(x) __builtin_vec_step (* (__typeof__ (x) *) 0)
|
|
64
|
|
65 static inline int
|
|
66 __lcbb(const void *ptr, int bndry)
|
|
67 {
|
|
68 int code;
|
|
69 switch (bndry)
|
|
70 {
|
|
71 case 64: code = 0; break;
|
|
72 case 128: code = 1; break;
|
|
73 case 256: code = 2; break;
|
|
74 case 512: code = 3; break;
|
|
75 case 1024: code = 4; break;
|
|
76 case 2048: code = 5; break;
|
|
77 case 4096: code = 6; break;
|
|
78 default: return 0;
|
|
79 }
|
|
80 return __builtin_s390_lcbb (ptr, code);
|
|
81 }
|
|
82
|
|
83 #define vec_all_nle(X, Y) vec_all_nge ((Y), (X))
|
|
84 #define vec_all_nlt(X, Y) vec_all_ngt ((Y), (X))
|
|
85 #define vec_any_nle(X, Y) vec_any_nge ((Y), (X))
|
|
86 #define vec_any_nlt(X, Y) vec_any_ngt ((Y), (X))
|
|
87 #define vec_genmask __builtin_s390_vgbm
|
|
88 #define vec_genmasks_8 __builtin_s390_vgmb
|
|
89 #define vec_genmasks_16 __builtin_s390_vgmh
|
|
90 #define vec_genmasks_32 __builtin_s390_vgmf
|
|
91 #define vec_genmasks_64 __builtin_s390_vgmg
|
|
92 #define vec_splat_u8 __builtin_s390_vec_splat_u8
|
|
93 #define vec_splat_s8 __builtin_s390_vec_splat_s8
|
|
94 #define vec_splat_u16 __builtin_s390_vec_splat_u16
|
|
95 #define vec_splat_s16 __builtin_s390_vec_splat_s16
|
|
96 #define vec_splat_u32 __builtin_s390_vec_splat_u32
|
|
97 #define vec_splat_s32 __builtin_s390_vec_splat_s32
|
|
98 #define vec_splat_u64 __builtin_s390_vec_splat_u64
|
|
99 #define vec_splat_s64 __builtin_s390_vec_splat_s64
|
|
100 #define vec_checksum __builtin_s390_vcksm
|
|
101 #define vec_gfmsum_128 __builtin_s390_vgfmg
|
|
102 #define vec_gfmsum_accum_128 __builtin_s390_vgfmag
|
|
103 #define vec_ceil(X) __builtin_s390_vfi((X), 4, 6)
|
|
104 #define vec_roundp(X) __builtin_s390_vfi((X), 4, 6)
|
|
105 #define vec_floor(X) __builtin_s390_vfi((X), 4, 7)
|
|
106 #define vec_roundm(X) __builtin_s390_vfi((X), 4, 7)
|
|
107 #define vec_trunc(X) __builtin_s390_vfi((X), 4, 5)
|
|
108 #define vec_roundz(X) __builtin_s390_vfi((X), 4, 5)
|
|
109 #define vec_rint(X) __builtin_s390_vfi((X), 0, 0)
|
|
110 #define vec_roundc(X) __builtin_s390_vfi((X), 4, 0)
|
|
111 #define vec_round(X) __builtin_s390_vfi((X), 4, 4)
|
|
112 #define vec_signed(X) __builtin_s390_vcgdb((X), 0, 0)
|
|
113 #define vec_unsigned(X) __builtin_s390_vclgdb((X), 0, 0)
|
|
114 #define vec_doublee(X) __builtin_s390_vfll((X))
|
|
115 #define vec_floate(X) __builtin_s390_vflr((X), 0, 0)
|
|
116 #define vec_load_len_r(X,Y) __builtin_s390_vlrl((Y),(X))
|
|
117 #define vec_store_len_r(X,Y) __builtin_s390_vstrl((Y),(X))
|
|
118
|
|
119 #define vec_all_nan(a) \
|
|
120 __extension__ ({ \
|
|
121 int __cc; \
|
|
122 __builtin_s390_vec_fp_test_data_class (a, \
|
|
123 __VEC_CLASS_FP_QNAN \
|
|
124 | __VEC_CLASS_FP_QNAN_N \
|
|
125 | __VEC_CLASS_FP_SNAN \
|
|
126 | __VEC_CLASS_FP_SNAN_N, &__cc); \
|
|
127 __cc == 0 ? 1 : 0; \
|
|
128 })
|
|
129
|
|
130 #define vec_all_numeric(a) \
|
|
131 __extension__ ({ \
|
|
132 int __cc; \
|
|
133 __builtin_s390_vec_fp_test_data_class (a, \
|
|
134 __VEC_CLASS_FP_NORMAL \
|
|
135 | __VEC_CLASS_FP_NORMAL_N \
|
|
136 | __VEC_CLASS_FP_SUBNORMAL \
|
|
137 | __VEC_CLASS_FP_SUBNORMAL_N, &__cc); \
|
|
138 __cc == 0 ? 1 : 0; \
|
|
139 })
|
|
140
|
|
141 #define vec_any_nan(a) \
|
|
142 __extension__ ({ \
|
|
143 int __cc; \
|
|
144 __builtin_s390_vec_fp_test_data_class (a, \
|
|
145 __VEC_CLASS_FP_QNAN \
|
|
146 | __VEC_CLASS_FP_QNAN_N \
|
|
147 | __VEC_CLASS_FP_SNAN \
|
|
148 | __VEC_CLASS_FP_SNAN_N, &cc); \
|
|
149 cc != 3 ? 1 : 0; \
|
|
150 })
|
|
151
|
|
152 #define vec_any_numeric(a) \
|
|
153 __extension__ ({ \
|
|
154 int __cc; \
|
|
155 __builtin_s390_vec_fp_test_data_class (a, \
|
|
156 __VEC_CLASS_FP_NORMAL \
|
|
157 | __VEC_CLASS_FP_NORMAL_N \
|
|
158 | __VEC_CLASS_FP_SUBNORMAL \
|
|
159 | __VEC_CLASS_FP_SUBNORMAL_N, &cc); \
|
|
160 cc != 3 ? 1 : 0; \
|
|
161 })
|
|
162 #define vec_gather_element __builtin_s390_vec_gather_element
|
|
163 #define vec_xl __builtin_s390_vec_xl
|
|
164 #define vec_xld2 __builtin_s390_vec_xld2
|
|
165 #define vec_xlw4 __builtin_s390_vec_xlw4
|
|
166 #define vec_splats __builtin_s390_vec_splats
|
|
167 #define vec_insert __builtin_s390_vec_insert
|
|
168 #define vec_promote __builtin_s390_vec_promote
|
|
169 #define vec_extract __builtin_s390_vec_extract
|
|
170 #define vec_insert_and_zero __builtin_s390_vec_insert_and_zero
|
|
171 #define vec_load_bndry __builtin_s390_vec_load_bndry
|
|
172 #define vec_load_pair __builtin_s390_vec_load_pair
|
|
173 #define vec_load_len __builtin_s390_vec_load_len
|
|
174 #define vec_mergeh __builtin_s390_vec_mergeh
|
|
175 #define vec_mergel __builtin_s390_vec_mergel
|
|
176 #define vec_pack __builtin_s390_vec_pack
|
|
177 #define vec_packs __builtin_s390_vec_packs
|
|
178 #define vec_packs_cc __builtin_s390_vec_packs_cc
|
|
179 #define vec_packsu __builtin_s390_vec_packsu
|
|
180 #define vec_packsu_cc __builtin_s390_vec_packsu_cc
|
|
181 #define vec_perm __builtin_s390_vec_perm
|
|
182 #define vec_permi __builtin_s390_vec_permi
|
|
183 #define vec_splat __builtin_s390_vec_splat
|
|
184 #define vec_scatter_element __builtin_s390_vec_scatter_element
|
|
185 #define vec_sel __builtin_s390_vec_sel
|
|
186 #define vec_extend_s64 __builtin_s390_vec_extend_s64
|
|
187 #define vec_xst __builtin_s390_vec_xst
|
|
188 #define vec_xstd2 __builtin_s390_vec_xstd2
|
|
189 #define vec_xstw4 __builtin_s390_vec_xstw4
|
|
190 #define vec_store_len __builtin_s390_vec_store_len
|
|
191 #define vec_bperm_u128 __builtin_s390_vec_bperm_u128
|
|
192 #define vec_unpackh __builtin_s390_vec_unpackh
|
|
193 #define vec_unpackl __builtin_s390_vec_unpackl
|
|
194 #define vec_addc __builtin_s390_vec_addc
|
|
195 #define vec_add_u128 __builtin_s390_vec_add_u128
|
|
196 #define vec_addc_u128 __builtin_s390_vec_addc_u128
|
|
197 #define vec_adde_u128 __builtin_s390_vec_adde_u128
|
|
198 #define vec_addec_u128 __builtin_s390_vec_addec_u128
|
|
199 #define vec_and __builtin_s390_vec_and
|
|
200 #define vec_andc __builtin_s390_vec_andc
|
|
201 #define vec_avg __builtin_s390_vec_avg
|
|
202 #define vec_all_eq __builtin_s390_vec_all_eq
|
|
203 #define vec_all_ne __builtin_s390_vec_all_ne
|
|
204 #define vec_all_ge __builtin_s390_vec_all_ge
|
|
205 #define vec_all_gt __builtin_s390_vec_all_gt
|
|
206 #define vec_all_le __builtin_s390_vec_all_le
|
|
207 #define vec_all_lt __builtin_s390_vec_all_lt
|
|
208 #define vec_any_eq __builtin_s390_vec_any_eq
|
|
209 #define vec_any_ne __builtin_s390_vec_any_ne
|
|
210 #define vec_any_ge __builtin_s390_vec_any_ge
|
|
211 #define vec_any_gt __builtin_s390_vec_any_gt
|
|
212 #define vec_any_le __builtin_s390_vec_any_le
|
|
213 #define vec_any_lt __builtin_s390_vec_any_lt
|
|
214 #define vec_cmpeq __builtin_s390_vec_cmpeq
|
|
215 #define vec_cmpge __builtin_s390_vec_cmpge
|
|
216 #define vec_cmpgt __builtin_s390_vec_cmpgt
|
|
217 #define vec_cmple __builtin_s390_vec_cmple
|
|
218 #define vec_cmplt __builtin_s390_vec_cmplt
|
|
219 #define vec_cntlz __builtin_s390_vec_cntlz
|
|
220 #define vec_cnttz __builtin_s390_vec_cnttz
|
|
221 #define vec_xor __builtin_s390_vec_xor
|
|
222 #define vec_gfmsum __builtin_s390_vec_gfmsum
|
|
223 #define vec_gfmsum_accum __builtin_s390_vec_gfmsum_accum
|
|
224 #define vec_abs __builtin_s390_vec_abs
|
|
225 #define vec_max __builtin_s390_vec_max
|
|
226 #define vec_min __builtin_s390_vec_min
|
|
227 #define vec_mladd __builtin_s390_vec_mladd
|
|
228 #define vec_mhadd __builtin_s390_vec_mhadd
|
|
229 #define vec_meadd __builtin_s390_vec_meadd
|
|
230 #define vec_moadd __builtin_s390_vec_moadd
|
|
231 #define vec_mulh __builtin_s390_vec_mulh
|
|
232 #define vec_mule __builtin_s390_vec_mule
|
|
233 #define vec_mulo __builtin_s390_vec_mulo
|
|
234 #define vec_nor __builtin_s390_vec_nor
|
|
235 #define vec_or __builtin_s390_vec_or
|
|
236 #define vec_popcnt __builtin_s390_vec_popcnt
|
|
237 #define vec_rl __builtin_s390_vec_rl
|
|
238 #define vec_rli __builtin_s390_vec_rli
|
|
239 #define vec_rl_mask __builtin_s390_vec_rl_mask
|
|
240 #define vec_sll __builtin_s390_vec_sll
|
|
241 #define vec_slb __builtin_s390_vec_slb
|
|
242 #define vec_sld __builtin_s390_vec_sld
|
|
243 #define vec_sldw __builtin_s390_vec_sldw
|
|
244 #define vec_sral __builtin_s390_vec_sral
|
|
245 #define vec_srab __builtin_s390_vec_srab
|
|
246 #define vec_srl __builtin_s390_vec_srl
|
|
247 #define vec_srb __builtin_s390_vec_srb
|
|
248 #define vec_subc __builtin_s390_vec_subc
|
|
249 #define vec_sub_u128 __builtin_s390_vec_sub_u128
|
|
250 #define vec_subc_u128 __builtin_s390_vec_subc_u128
|
|
251 #define vec_sube_u128 __builtin_s390_vec_sube_u128
|
|
252 #define vec_subec_u128 __builtin_s390_vec_subec_u128
|
|
253 #define vec_sum2 __builtin_s390_vec_sum2
|
|
254 #define vec_sum_u128 __builtin_s390_vec_sum_u128
|
|
255 #define vec_sum4 __builtin_s390_vec_sum4
|
|
256 #define vec_test_mask __builtin_s390_vec_test_mask
|
|
257 #define vec_msum_u128 __builtin_s390_vec_msum_u128
|
|
258 #define vec_eqv __builtin_s390_vec_eqv
|
|
259 #define vec_nand __builtin_s390_vec_nand
|
|
260 #define vec_orc __builtin_s390_vec_orc
|
|
261 #define vec_find_any_eq_idx __builtin_s390_vec_find_any_eq_idx
|
|
262 #define vec_find_any_ne_idx __builtin_s390_vec_find_any_ne_idx
|
|
263 #define vec_find_any_eq_or_0_idx __builtin_s390_vec_find_any_eq_or_0_idx
|
|
264 #define vec_find_any_ne_or_0_idx __builtin_s390_vec_find_any_ne_or_0_idx
|
|
265 #define vec_find_any_eq __builtin_s390_vec_find_any_eq
|
|
266 #define vec_find_any_ne __builtin_s390_vec_find_any_ne
|
|
267 #define vec_find_any_eq_idx_cc __builtin_s390_vec_find_any_eq_idx_cc
|
|
268 #define vec_find_any_ne_idx_cc __builtin_s390_vec_find_any_ne_idx_cc
|
|
269 #define vec_find_any_eq_or_0_idx_cc __builtin_s390_vec_find_any_eq_or_0_idx_cc
|
|
270 #define vec_find_any_ne_or_0_idx_cc __builtin_s390_vec_find_any_ne_or_0_idx_cc
|
|
271 #define vec_find_any_eq_cc __builtin_s390_vec_find_any_eq_cc
|
|
272 #define vec_find_any_ne_cc __builtin_s390_vec_find_any_ne_cc
|
|
273 #define vec_cmpeq_idx __builtin_s390_vec_cmpeq_idx
|
|
274 #define vec_cmpeq_or_0_idx __builtin_s390_vec_cmpeq_or_0_idx
|
|
275 #define vec_cmpeq_idx_cc __builtin_s390_vec_cmpeq_idx_cc
|
|
276 #define vec_cmpeq_or_0_idx_cc __builtin_s390_vec_cmpeq_or_0_idx_cc
|
|
277 #define vec_cmpne_idx __builtin_s390_vec_cmpne_idx
|
|
278 #define vec_cmpne_or_0_idx __builtin_s390_vec_cmpne_or_0_idx
|
|
279 #define vec_cmpne_idx_cc __builtin_s390_vec_cmpne_idx_cc
|
|
280 #define vec_cmpne_or_0_idx_cc __builtin_s390_vec_cmpne_or_0_idx_cc
|
|
281 #define vec_cp_until_zero __builtin_s390_vec_cp_until_zero
|
|
282 #define vec_cp_until_zero_cc __builtin_s390_vec_cp_until_zero_cc
|
|
283 #define vec_cmprg_idx __builtin_s390_vec_cmprg_idx
|
|
284 #define vec_cmpnrg_idx __builtin_s390_vec_cmpnrg_idx
|
|
285 #define vec_cmprg_or_0_idx __builtin_s390_vec_cmprg_or_0_idx
|
|
286 #define vec_cmpnrg_or_0_idx __builtin_s390_vec_cmpnrg_or_0_idx
|
|
287 #define vec_cmprg __builtin_s390_vec_cmprg
|
|
288 #define vec_cmpnrg __builtin_s390_vec_cmpnrg
|
|
289 #define vec_cmprg_idx_cc __builtin_s390_vec_cmprg_idx_cc
|
|
290 #define vec_cmpnrg_idx_cc __builtin_s390_vec_cmpnrg_idx_cc
|
|
291 #define vec_cmprg_or_0_idx_cc __builtin_s390_vec_cmprg_or_0_idx_cc
|
|
292 #define vec_cmpnrg_or_0_idx_cc __builtin_s390_vec_cmpnrg_or_0_idx_cc
|
|
293 #define vec_cmprg_cc __builtin_s390_vec_cmprg_cc
|
|
294 #define vec_cmpnrg_cc __builtin_s390_vec_cmpnrg_cc
|
|
295 #define vec_all_nge __builtin_s390_vec_all_nge
|
|
296 #define vec_all_ngt __builtin_s390_vec_all_ngt
|
|
297 #define vec_any_nge __builtin_s390_vec_any_nge
|
|
298 #define vec_any_ngt __builtin_s390_vec_any_ngt
|
|
299 #define vec_ctd __builtin_s390_vec_ctd
|
|
300 #define vec_ctd_s64 __builtin_s390_vec_ctd_s64
|
|
301 #define vec_ctd_u64 __builtin_s390_vec_ctd_u64
|
|
302 #define vec_ctsl __builtin_s390_vec_ctsl
|
|
303 #define vec_ctul __builtin_s390_vec_ctul
|
|
304 #define vec_ld2f __builtin_s390_vec_ld2f
|
|
305 #define vec_st2f __builtin_s390_vec_st2f
|
|
306 #define vec_double __builtin_s390_vec_double
|
|
307 #define vec_madd __builtin_s390_vec_madd
|
|
308 #define vec_msub __builtin_s390_vec_msub
|
|
309 #define vec_nmadd __builtin_s390_vec_nmadd
|
|
310 #define vec_nmsub __builtin_s390_vec_nmsub
|
|
311 #define vec_nabs __builtin_s390_vec_nabs
|
|
312 #define vec_sqrt __builtin_s390_vec_sqrt
|
|
313 #define vec_fp_test_data_class __builtin_s390_vec_fp_test_data_class
|
|
314 #endif /* _VECINTRIN_H */
|