Skip various cmp-mem-const tests on lp64 hppa*-*-*
[official-gcc.git] / gcc / config / s390 / vecintrin.h
blob9abbd761067842a01b16bca5a2d3ae2f86bf7add
1 /* GNU compiler vector extension intrinsics
2 Copyright (C) 2015-2024 Free Software Foundation, Inc.
3 Contributed by Andreas Krebbel (Andreas.Krebbel@de.ibm.com)
5 This file is part of GCC.
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.
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.
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/>. */
21 #ifndef _VECINTRIN_H
22 #define _VECINTRIN_H
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)
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)
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)
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)
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)
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)
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)
61 /* This also accepts a type for its parameter, so it is not enough
62 to #define vec_step to __builtin_s390_vec_step. */
63 #define vec_step(x) __builtin_s390_vec_step (* (__typeof__ (x) *) 0)
65 static inline int
66 __lcbb(const void *ptr, int bndry)
68 int code;
69 switch (bndry)
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;
80 return __builtin_s390_lcbb (ptr, code);
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_doublee(X) __builtin_s390_vflls((X))
113 #define vec_floate(X) __builtin_s390_vflrd((X), 0, 0)
114 #define vec_load_len_r(X,L) \
115 (__vector unsigned char)__builtin_s390_vlrlr((L),(X))
116 #define vec_store_len_r(X,Y,L) \
117 __builtin_s390_vstrlr((__vector signed char)(X),(L),(Y))
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; \
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; \
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; \
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; \
163 #define vec_vstbrh vec_vlbrh
164 #define vec_vstbrf vec_vlbrf
165 #define vec_vstbrg vec_vlbrg
166 #define vec_vstbrq vec_vlbrq
167 #define vec_vstbrf_flt vec_vlbrf_flt
168 #define vec_vstbrg_dbl vec_vlbrg_dbl
170 #define vec_vsterb vec_vlerb
171 #define vec_vsterh vec_vlerh
172 #define vec_vsterf vec_vlerh
173 #define vec_vsterg vec_vlerh
174 #define vec_vsterf_flt vec_vlerf_flt
175 #define vec_vsterg_dbl vec_vlerg_dbl
177 #define vec_extend_to_fp32_hi __builtin_s390_vclfnhs
178 #define vec_extend_to_fp32_lo __builtin_s390_vclfnls
179 #define vec_round_from_fp32 __builtin_s390_vcrnfs
180 #define vec_convert_to_fp16 __builtin_s390_vcfn
181 #define vec_convert_from_fp16 __builtin_s390_vcnf
182 #define vec_gather_element __builtin_s390_vec_gather_element
183 #define vec_xl __builtin_s390_vec_xl
184 #define vec_xld2 __builtin_s390_vec_xld2
185 #define vec_xlw4 __builtin_s390_vec_xlw4
186 #define vec_splats __builtin_s390_vec_splats
187 #define vec_insert __builtin_s390_vec_insert
188 #define vec_promote __builtin_s390_vec_promote
189 #define vec_extract __builtin_s390_vec_extract
190 #define vec_insert_and_zero __builtin_s390_vec_insert_and_zero
191 #define vec_load_bndry __builtin_s390_vec_load_bndry
192 #define vec_load_pair __builtin_s390_vec_load_pair
193 #define vec_load_len __builtin_s390_vec_load_len
194 #define vec_mergeh __builtin_s390_vec_mergeh
195 #define vec_mergel __builtin_s390_vec_mergel
196 #define vec_pack __builtin_s390_vec_pack
197 #define vec_packs __builtin_s390_vec_packs
198 #define vec_packs_cc __builtin_s390_vec_packs_cc
199 #define vec_packsu __builtin_s390_vec_packsu
200 #define vec_packsu_cc __builtin_s390_vec_packsu_cc
201 #define vec_perm __builtin_s390_vec_perm
202 #define vec_permi __builtin_s390_vec_permi
203 #define vec_splat __builtin_s390_vec_splat
204 #define vec_scatter_element __builtin_s390_vec_scatter_element
205 #define vec_sel __builtin_s390_vec_sel
206 #define vec_extend_s64 __builtin_s390_vec_extend_s64
207 #define vec_xst __builtin_s390_vec_xst
208 #define vec_xstd2 __builtin_s390_vec_xstd2
209 #define vec_xstw4 __builtin_s390_vec_xstw4
210 #define vec_store_len __builtin_s390_vec_store_len
211 #define vec_bperm_u128 __builtin_s390_vec_bperm_u128
212 #define vec_unpackh __builtin_s390_vec_unpackh
213 #define vec_unpackl __builtin_s390_vec_unpackl
214 #define vec_addc __builtin_s390_vec_addc
215 #define vec_add_u128 __builtin_s390_vec_add_u128
216 #define vec_addc_u128 __builtin_s390_vec_addc_u128
217 #define vec_adde_u128 __builtin_s390_vec_adde_u128
218 #define vec_addec_u128 __builtin_s390_vec_addec_u128
219 #define vec_and __builtin_s390_vec_and
220 #define vec_andc __builtin_s390_vec_andc
221 #define vec_avg __builtin_s390_vec_avg
222 #define vec_all_eq __builtin_s390_vec_all_eq
223 #define vec_all_ne __builtin_s390_vec_all_ne
224 #define vec_all_ge __builtin_s390_vec_all_ge
225 #define vec_all_gt __builtin_s390_vec_all_gt
226 #define vec_all_le __builtin_s390_vec_all_le
227 #define vec_all_lt __builtin_s390_vec_all_lt
228 #define vec_any_eq __builtin_s390_vec_any_eq
229 #define vec_any_ne __builtin_s390_vec_any_ne
230 #define vec_any_ge __builtin_s390_vec_any_ge
231 #define vec_any_gt __builtin_s390_vec_any_gt
232 #define vec_any_le __builtin_s390_vec_any_le
233 #define vec_any_lt __builtin_s390_vec_any_lt
234 #define vec_cmpeq __builtin_s390_vec_cmpeq
235 #define vec_cmpge __builtin_s390_vec_cmpge
236 #define vec_cmpgt __builtin_s390_vec_cmpgt
237 #define vec_cmple __builtin_s390_vec_cmple
238 #define vec_cmplt __builtin_s390_vec_cmplt
239 #define vec_cntlz __builtin_s390_vec_cntlz
240 #define vec_cnttz __builtin_s390_vec_cnttz
241 #define vec_xor __builtin_s390_vec_xor
242 #define vec_gfmsum __builtin_s390_vec_gfmsum
243 #define vec_gfmsum_accum __builtin_s390_vec_gfmsum_accum
244 #define vec_abs __builtin_s390_vec_abs
245 #define vec_max __builtin_s390_vec_max
246 #define vec_min __builtin_s390_vec_min
247 #define vec_mladd __builtin_s390_vec_mladd
248 #define vec_mhadd __builtin_s390_vec_mhadd
249 #define vec_meadd __builtin_s390_vec_meadd
250 #define vec_moadd __builtin_s390_vec_moadd
251 #define vec_mulh __builtin_s390_vec_mulh
252 #define vec_mule __builtin_s390_vec_mule
253 #define vec_mulo __builtin_s390_vec_mulo
254 #define vec_nor __builtin_s390_vec_nor
255 #define vec_or __builtin_s390_vec_or
256 #define vec_popcnt __builtin_s390_vec_popcnt
257 #define vec_rl __builtin_s390_vec_rl
258 #define vec_rli __builtin_s390_vec_rli
259 #define vec_rl_mask __builtin_s390_vec_rl_mask
260 #define vec_sll __builtin_s390_vec_sll
261 #define vec_slb __builtin_s390_vec_slb
262 #define vec_sld __builtin_s390_vec_sld
263 #define vec_sldw __builtin_s390_vec_sldw
264 #define vec_sral __builtin_s390_vec_sral
265 #define vec_srab __builtin_s390_vec_srab
266 #define vec_srl __builtin_s390_vec_srl
267 #define vec_srb __builtin_s390_vec_srb
268 #define vec_subc __builtin_s390_vec_subc
269 #define vec_sub_u128 __builtin_s390_vec_sub_u128
270 #define vec_subc_u128 __builtin_s390_vec_subc_u128
271 #define vec_sube_u128 __builtin_s390_vec_sube_u128
272 #define vec_subec_u128 __builtin_s390_vec_subec_u128
273 #define vec_sum2 __builtin_s390_vec_sum2
274 #define vec_sum_u128 __builtin_s390_vec_sum_u128
275 #define vec_sum4 __builtin_s390_vec_sum4
276 #define vec_test_mask __builtin_s390_vec_test_mask
277 #define vec_msum_u128 __builtin_s390_vec_msum_u128
278 #define vec_eqv __builtin_s390_vec_eqv
279 #define vec_nand __builtin_s390_vec_nand
280 #define vec_orc __builtin_s390_vec_orc
281 #define vec_find_any_eq_idx __builtin_s390_vec_find_any_eq_idx
282 #define vec_find_any_ne_idx __builtin_s390_vec_find_any_ne_idx
283 #define vec_find_any_eq_or_0_idx __builtin_s390_vec_find_any_eq_or_0_idx
284 #define vec_find_any_ne_or_0_idx __builtin_s390_vec_find_any_ne_or_0_idx
285 #define vec_find_any_eq __builtin_s390_vec_find_any_eq
286 #define vec_find_any_ne __builtin_s390_vec_find_any_ne
287 #define vec_find_any_eq_idx_cc __builtin_s390_vec_find_any_eq_idx_cc
288 #define vec_find_any_ne_idx_cc __builtin_s390_vec_find_any_ne_idx_cc
289 #define vec_find_any_eq_or_0_idx_cc __builtin_s390_vec_find_any_eq_or_0_idx_cc
290 #define vec_find_any_ne_or_0_idx_cc __builtin_s390_vec_find_any_ne_or_0_idx_cc
291 #define vec_find_any_eq_cc __builtin_s390_vec_find_any_eq_cc
292 #define vec_find_any_ne_cc __builtin_s390_vec_find_any_ne_cc
293 #define vec_cmpeq_idx __builtin_s390_vec_cmpeq_idx
294 #define vec_cmpeq_or_0_idx __builtin_s390_vec_cmpeq_or_0_idx
295 #define vec_cmpeq_idx_cc __builtin_s390_vec_cmpeq_idx_cc
296 #define vec_cmpeq_or_0_idx_cc __builtin_s390_vec_cmpeq_or_0_idx_cc
297 #define vec_cmpne_idx __builtin_s390_vec_cmpne_idx
298 #define vec_cmpne_or_0_idx __builtin_s390_vec_cmpne_or_0_idx
299 #define vec_cmpne_idx_cc __builtin_s390_vec_cmpne_idx_cc
300 #define vec_cmpne_or_0_idx_cc __builtin_s390_vec_cmpne_or_0_idx_cc
301 #define vec_cp_until_zero __builtin_s390_vec_cp_until_zero
302 #define vec_cp_until_zero_cc __builtin_s390_vec_cp_until_zero_cc
303 #define vec_cmprg_idx __builtin_s390_vec_cmprg_idx
304 #define vec_cmpnrg_idx __builtin_s390_vec_cmpnrg_idx
305 #define vec_cmprg_or_0_idx __builtin_s390_vec_cmprg_or_0_idx
306 #define vec_cmpnrg_or_0_idx __builtin_s390_vec_cmpnrg_or_0_idx
307 #define vec_cmprg __builtin_s390_vec_cmprg
308 #define vec_cmpnrg __builtin_s390_vec_cmpnrg
309 #define vec_cmprg_idx_cc __builtin_s390_vec_cmprg_idx_cc
310 #define vec_cmpnrg_idx_cc __builtin_s390_vec_cmpnrg_idx_cc
311 #define vec_cmprg_or_0_idx_cc __builtin_s390_vec_cmprg_or_0_idx_cc
312 #define vec_cmpnrg_or_0_idx_cc __builtin_s390_vec_cmpnrg_or_0_idx_cc
313 #define vec_cmprg_cc __builtin_s390_vec_cmprg_cc
314 #define vec_cmpnrg_cc __builtin_s390_vec_cmpnrg_cc
315 #define vec_all_nge __builtin_s390_vec_all_nge
316 #define vec_all_ngt __builtin_s390_vec_all_ngt
317 #define vec_any_nge __builtin_s390_vec_any_nge
318 #define vec_any_ngt __builtin_s390_vec_any_ngt
319 #define vec_ctd __builtin_s390_vec_ctd
320 #define vec_ctd_s64 __builtin_s390_vec_ctd_s64
321 #define vec_ctd_u64 __builtin_s390_vec_ctd_u64
322 #define vec_ctsl __builtin_s390_vec_ctsl
323 #define vec_ctul __builtin_s390_vec_ctul
324 #define vec_float __builtin_s390_vec_float
325 #define vec_double __builtin_s390_vec_double
326 #define vec_signed __builtin_s390_vec_signed
327 #define vec_unsigned __builtin_s390_vec_unsigned
328 #define vec_ld2f __builtin_s390_vec_ld2f
329 #define vec_st2f __builtin_s390_vec_st2f
330 #define vec_madd __builtin_s390_vec_madd
331 #define vec_msub __builtin_s390_vec_msub
332 #define vec_nmadd __builtin_s390_vec_nmadd
333 #define vec_nmsub __builtin_s390_vec_nmsub
334 #define vec_nabs __builtin_s390_vec_nabs
335 #define vec_sqrt __builtin_s390_vec_sqrt
336 #define vec_fp_test_data_class __builtin_s390_vec_fp_test_data_class
337 #define vec_revb __builtin_s390_vec_revb
338 #define vec_reve __builtin_s390_vec_reve
339 #define vec_sldb __builtin_s390_vec_sldb
340 #define vec_srdb __builtin_s390_vec_srdb
341 #define vec_search_string_cc __builtin_s390_vec_search_string_cc
342 #define vec_search_string_until_zero_cc __builtin_s390_vec_search_string_until_zero_cc
343 #endif /* _VECINTRIN_H */