authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2015-12-08 17:51:59-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2015-12-08 17:51:59-07:00
logface8d65a85e9b6184d9eb7c3d5b345090350b27
tree9ce8d04d970862b3d29b8952e3c1579c91fa8deb
parent358d699fa9e879cf0e027b2fd60d9dc739dac642

parseh: add c header files


69 files changed, 32943 insertions(+), 7 deletions(-)

CMakeLists.txt+71
......@@ -46,7 +46,76 @@ set(TEST_SOURCES
4646 "${CMAKE_SOURCE_DIR}/test/run_tests.cpp"
4747)
4848
49set(C_HEADERS
50 "${CMAKE_SOURCE_DIR}/c_headers/adxintrin.h"
51 "${CMAKE_SOURCE_DIR}/c_headers/ammintrin.h"
52 "${CMAKE_SOURCE_DIR}/c_headers/arm_acle.h"
53 "${CMAKE_SOURCE_DIR}/c_headers/avx2intrin.h"
54 "${CMAKE_SOURCE_DIR}/c_headers/avx512bwintrin.h"
55 "${CMAKE_SOURCE_DIR}/c_headers/avx512cdintrin.h"
56 "${CMAKE_SOURCE_DIR}/c_headers/avx512dqintrin.h"
57 "${CMAKE_SOURCE_DIR}/c_headers/avx512erintrin.h"
58 "${CMAKE_SOURCE_DIR}/c_headers/avx512fintrin.h"
59 "${CMAKE_SOURCE_DIR}/c_headers/avx512vlbwintrin.h"
60 "${CMAKE_SOURCE_DIR}/c_headers/avx512vldqintrin.h"
61 "${CMAKE_SOURCE_DIR}/c_headers/avx512vlintrin.h"
62 "${CMAKE_SOURCE_DIR}/c_headers/avxintrin.h"
63 "${CMAKE_SOURCE_DIR}/c_headers/bmi2intrin.h"
64 "${CMAKE_SOURCE_DIR}/c_headers/bmiintrin.h"
65 "${CMAKE_SOURCE_DIR}/c_headers/cpuid.h"
66 "${CMAKE_SOURCE_DIR}/c_headers/cuda_builtin_vars.h"
67 "${CMAKE_SOURCE_DIR}/c_headers/emmintrin.h"
68 "${CMAKE_SOURCE_DIR}/c_headers/f16cintrin.h"
69 "${CMAKE_SOURCE_DIR}/c_headers/float.h"
70 "${CMAKE_SOURCE_DIR}/c_headers/fma4intrin.h"
71 "${CMAKE_SOURCE_DIR}/c_headers/fmaintrin.h"
72 "${CMAKE_SOURCE_DIR}/c_headers/fxsrintrin.h"
73 "${CMAKE_SOURCE_DIR}/c_headers/htmintrin.h"
74 "${CMAKE_SOURCE_DIR}/c_headers/htmxlintrin.h"
75 "${CMAKE_SOURCE_DIR}/c_headers/ia32intrin.h"
76 "${CMAKE_SOURCE_DIR}/c_headers/immintrin.h"
77 "${CMAKE_SOURCE_DIR}/c_headers/Intrin.h"
78 "${CMAKE_SOURCE_DIR}/c_headers/inttypes.h"
79 "${CMAKE_SOURCE_DIR}/c_headers/iso646.h"
80 "${CMAKE_SOURCE_DIR}/c_headers/limits.h"
81 "${CMAKE_SOURCE_DIR}/c_headers/lzcntintrin.h"
82 "${CMAKE_SOURCE_DIR}/c_headers/mm3dnow.h"
83 "${CMAKE_SOURCE_DIR}/c_headers/mmintrin.h"
84 "${CMAKE_SOURCE_DIR}/c_headers/mm_malloc.h"
85 "${CMAKE_SOURCE_DIR}/c_headers/nmmintrin.h"
86 "${CMAKE_SOURCE_DIR}/c_headers/pmmintrin.h"
87 "${CMAKE_SOURCE_DIR}/c_headers/popcntintrin.h"
88 "${CMAKE_SOURCE_DIR}/c_headers/prfchwintrin.h"
89 "${CMAKE_SOURCE_DIR}/c_headers/rdseedintrin.h"
90 "${CMAKE_SOURCE_DIR}/c_headers/rtmintrin.h"
91 "${CMAKE_SOURCE_DIR}/c_headers/s390intrin.h"
92 "${CMAKE_SOURCE_DIR}/c_headers/shaintrin.h"
93 "${CMAKE_SOURCE_DIR}/c_headers/smmintrin.h"
94 "${CMAKE_SOURCE_DIR}/c_headers/stdalign.h"
95 "${CMAKE_SOURCE_DIR}/c_headers/stdarg.h"
96 "${CMAKE_SOURCE_DIR}/c_headers/stdatomic.h"
97 "${CMAKE_SOURCE_DIR}/c_headers/stdbool.h"
98 "${CMAKE_SOURCE_DIR}/c_headers/stddef.h"
99 "${CMAKE_SOURCE_DIR}/c_headers/__stddef_max_align_t.h"
100 "${CMAKE_SOURCE_DIR}/c_headers/stdint.h"
101 "${CMAKE_SOURCE_DIR}/c_headers/stdnoreturn.h"
102 "${CMAKE_SOURCE_DIR}/c_headers/tbmintrin.h"
103 "${CMAKE_SOURCE_DIR}/c_headers/tgmath.h"
104 "${CMAKE_SOURCE_DIR}/c_headers/tmmintrin.h"
105 "${CMAKE_SOURCE_DIR}/c_headers/unwind.h"
106 "${CMAKE_SOURCE_DIR}/c_headers/vadefs.h"
107 "${CMAKE_SOURCE_DIR}/c_headers/varargs.h"
108 "${CMAKE_SOURCE_DIR}/c_headers/vecintrin.h"
109 "${CMAKE_SOURCE_DIR}/c_headers/__wmmintrin_aes.h"
110 "${CMAKE_SOURCE_DIR}/c_headers/wmmintrin.h"
111 "${CMAKE_SOURCE_DIR}/c_headers/__wmmintrin_pclmul.h"
112 "${CMAKE_SOURCE_DIR}/c_headers/x86intrin.h"
113 "${CMAKE_SOURCE_DIR}/c_headers/xmmintrin.h"
114 "${CMAKE_SOURCE_DIR}/c_headers/xopintrin.h"
115 "${CMAKE_SOURCE_DIR}/c_headers/xtestintrin.h"
116)
49117
118set(C_HEADERS_DEST "lib/zig/include")
50119set(CONFIGURE_OUT_FILE "${CMAKE_BINARY_DIR}/config.h")
51120configure_file (
52121 "${CMAKE_SOURCE_DIR}/src/config.h.in"
......@@ -72,6 +141,8 @@ target_link_libraries(zig LINK_PUBLIC
72141)
73142install(TARGETS zig DESTINATION bin)
74143
144install(FILES ${C_HEADERS} DESTINATION ${C_HEADERS_DEST})
145
75146add_executable(run_tests ${TEST_SOURCES})
76147target_link_libraries(run_tests)
77148set_target_properties(run_tests PROPERTIES
c_headers/Intrin.h created+958
......@@ -0,0 +1,958 @@
1/* ===-------- Intrin.h ---------------------------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24/* Only include this if we're compiling for the windows platform. */
25#ifndef _MSC_VER
26#include_next <Intrin.h>
27#else
28
29#ifndef __INTRIN_H
30#define __INTRIN_H
31
32/* First include the standard intrinsics. */
33#if defined(__i386__) || defined(__x86_64__)
34#include <x86intrin.h>
35#endif
36
37/* For the definition of jmp_buf. */
38#if __STDC_HOSTED__
39#include <setjmp.h>
40#endif
41
42/* Define the default attributes for the functions in this file. */
43#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
44
45#ifdef __cplusplus
46extern "C" {
47#endif
48
49#if defined(__MMX__)
50/* And the random ones that aren't in those files. */
51__m64 _m_from_float(float);
52__m64 _m_from_int(int _l);
53void _m_prefetch(void *);
54float _m_to_float(__m64);
55int _m_to_int(__m64 _M);
56#endif
57
58/* Other assorted instruction intrinsics. */
59void __addfsbyte(unsigned long, unsigned char);
60void __addfsdword(unsigned long, unsigned long);
61void __addfsword(unsigned long, unsigned short);
62void __code_seg(const char *);
63static __inline__
64void __cpuid(int[4], int);
65static __inline__
66void __cpuidex(int[4], int, int);
67void __debugbreak(void);
68__int64 __emul(int, int);
69unsigned __int64 __emulu(unsigned int, unsigned int);
70void __cdecl __fastfail(unsigned int);
71unsigned int __getcallerseflags(void);
72static __inline__
73void __halt(void);
74unsigned char __inbyte(unsigned short);
75void __inbytestring(unsigned short, unsigned char *, unsigned long);
76void __incfsbyte(unsigned long);
77void __incfsdword(unsigned long);
78void __incfsword(unsigned long);
79unsigned long __indword(unsigned short);
80void __indwordstring(unsigned short, unsigned long *, unsigned long);
81void __int2c(void);
82void __invlpg(void *);
83unsigned short __inword(unsigned short);
84void __inwordstring(unsigned short, unsigned short *, unsigned long);
85void __lidt(void *);
86unsigned __int64 __ll_lshift(unsigned __int64, int);
87__int64 __ll_rshift(__int64, int);
88void __llwpcb(void *);
89unsigned char __lwpins32(unsigned int, unsigned int, unsigned int);
90void __lwpval32(unsigned int, unsigned int, unsigned int);
91unsigned int __lzcnt(unsigned int);
92unsigned short __lzcnt16(unsigned short);
93static __inline__
94void __movsb(unsigned char *, unsigned char const *, size_t);
95static __inline__
96void __movsd(unsigned long *, unsigned long const *, size_t);
97static __inline__
98void __movsw(unsigned short *, unsigned short const *, size_t);
99void __nop(void);
100void __nvreg_restore_fence(void);
101void __nvreg_save_fence(void);
102void __outbyte(unsigned short, unsigned char);
103void __outbytestring(unsigned short, unsigned char *, unsigned long);
104void __outdword(unsigned short, unsigned long);
105void __outdwordstring(unsigned short, unsigned long *, unsigned long);
106void __outword(unsigned short, unsigned short);
107void __outwordstring(unsigned short, unsigned short *, unsigned long);
108static __inline__
109unsigned int __popcnt(unsigned int);
110static __inline__
111unsigned short __popcnt16(unsigned short);
112unsigned long __readcr0(void);
113unsigned long __readcr2(void);
114static __inline__
115unsigned long __readcr3(void);
116unsigned long __readcr4(void);
117unsigned long __readcr8(void);
118unsigned int __readdr(unsigned int);
119#ifdef __i386__
120static __inline__
121unsigned char __readfsbyte(unsigned long);
122static __inline__
123unsigned long __readfsdword(unsigned long);
124static __inline__
125unsigned __int64 __readfsqword(unsigned long);
126static __inline__
127unsigned short __readfsword(unsigned long);
128#endif
129static __inline__
130unsigned __int64 __readmsr(unsigned long);
131unsigned __int64 __readpmc(unsigned long);
132unsigned long __segmentlimit(unsigned long);
133void __sidt(void *);
134void *__slwpcb(void);
135static __inline__
136void __stosb(unsigned char *, unsigned char, size_t);
137static __inline__
138void __stosd(unsigned long *, unsigned long, size_t);
139static __inline__
140void __stosw(unsigned short *, unsigned short, size_t);
141void __svm_clgi(void);
142void __svm_invlpga(void *, int);
143void __svm_skinit(int);
144void __svm_stgi(void);
145void __svm_vmload(size_t);
146void __svm_vmrun(size_t);
147void __svm_vmsave(size_t);
148void __ud2(void);
149unsigned __int64 __ull_rshift(unsigned __int64, int);
150void __vmx_off(void);
151void __vmx_vmptrst(unsigned __int64 *);
152void __wbinvd(void);
153void __writecr0(unsigned int);
154static __inline__
155void __writecr3(unsigned int);
156void __writecr4(unsigned int);
157void __writecr8(unsigned int);
158void __writedr(unsigned int, unsigned int);
159void __writefsbyte(unsigned long, unsigned char);
160void __writefsdword(unsigned long, unsigned long);
161void __writefsqword(unsigned long, unsigned __int64);
162void __writefsword(unsigned long, unsigned short);
163void __writemsr(unsigned long, unsigned __int64);
164static __inline__
165void *_AddressOfReturnAddress(void);
166static __inline__
167unsigned char _BitScanForward(unsigned long *_Index, unsigned long _Mask);
168static __inline__
169unsigned char _BitScanReverse(unsigned long *_Index, unsigned long _Mask);
170static __inline__
171unsigned char _bittest(long const *, long);
172static __inline__
173unsigned char _bittestandcomplement(long *, long);
174static __inline__
175unsigned char _bittestandreset(long *, long);
176static __inline__
177unsigned char _bittestandset(long *, long);
178unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64);
179unsigned long __cdecl _byteswap_ulong(unsigned long);
180unsigned short __cdecl _byteswap_ushort(unsigned short);
181void __cdecl _disable(void);
182void __cdecl _enable(void);
183long _InterlockedAddLargeStatistic(__int64 volatile *_Addend, long _Value);
184static __inline__
185long _InterlockedAnd(long volatile *_Value, long _Mask);
186static __inline__
187short _InterlockedAnd16(short volatile *_Value, short _Mask);
188static __inline__
189char _InterlockedAnd8(char volatile *_Value, char _Mask);
190unsigned char _interlockedbittestandreset(long volatile *, long);
191static __inline__
192unsigned char _interlockedbittestandset(long volatile *, long);
193static __inline__
194long __cdecl _InterlockedCompareExchange(long volatile *_Destination,
195 long _Exchange, long _Comparand);
196long _InterlockedCompareExchange_HLEAcquire(long volatile *, long, long);
197long _InterlockedCompareExchange_HLERelease(long volatile *, long, long);
198static __inline__
199short _InterlockedCompareExchange16(short volatile *_Destination,
200 short _Exchange, short _Comparand);
201static __inline__
202__int64 _InterlockedCompareExchange64(__int64 volatile *_Destination,
203 __int64 _Exchange, __int64 _Comparand);
204__int64 _InterlockedcompareExchange64_HLEAcquire(__int64 volatile *, __int64,
205 __int64);
206__int64 _InterlockedCompareExchange64_HLERelease(__int64 volatile *, __int64,
207 __int64);
208static __inline__
209char _InterlockedCompareExchange8(char volatile *_Destination, char _Exchange,
210 char _Comparand);
211void *_InterlockedCompareExchangePointer_HLEAcquire(void *volatile *, void *,
212 void *);
213void *_InterlockedCompareExchangePointer_HLERelease(void *volatile *, void *,
214 void *);
215static __inline__
216long __cdecl _InterlockedDecrement(long volatile *_Addend);
217static __inline__
218short _InterlockedDecrement16(short volatile *_Addend);
219long _InterlockedExchange(long volatile *_Target, long _Value);
220static __inline__
221short _InterlockedExchange16(short volatile *_Target, short _Value);
222static __inline__
223char _InterlockedExchange8(char volatile *_Target, char _Value);
224static __inline__
225long __cdecl _InterlockedExchangeAdd(long volatile *_Addend, long _Value);
226long _InterlockedExchangeAdd_HLEAcquire(long volatile *, long);
227long _InterlockedExchangeAdd_HLERelease(long volatile *, long);
228static __inline__
229short _InterlockedExchangeAdd16(short volatile *_Addend, short _Value);
230__int64 _InterlockedExchangeAdd64_HLEAcquire(__int64 volatile *, __int64);
231__int64 _InterlockedExchangeAdd64_HLERelease(__int64 volatile *, __int64);
232static __inline__
233char _InterlockedExchangeAdd8(char volatile *_Addend, char _Value);
234static __inline__
235long __cdecl _InterlockedIncrement(long volatile *_Addend);
236static __inline__
237short _InterlockedIncrement16(short volatile *_Addend);
238static __inline__
239long _InterlockedOr(long volatile *_Value, long _Mask);
240static __inline__
241short _InterlockedOr16(short volatile *_Value, short _Mask);
242static __inline__
243char _InterlockedOr8(char volatile *_Value, char _Mask);
244static __inline__
245long _InterlockedXor(long volatile *_Value, long _Mask);
246static __inline__
247short _InterlockedXor16(short volatile *_Value, short _Mask);
248static __inline__
249char _InterlockedXor8(char volatile *_Value, char _Mask);
250void __cdecl _invpcid(unsigned int, void *);
251static __inline__
252unsigned long __cdecl _lrotl(unsigned long, int);
253static __inline__
254unsigned long __cdecl _lrotr(unsigned long, int);
255static __inline__
256static __inline__
257void _ReadBarrier(void);
258static __inline__
259void _ReadWriteBarrier(void);
260static __inline__
261void *_ReturnAddress(void);
262unsigned int _rorx_u32(unsigned int, const unsigned int);
263static __inline__
264unsigned int __cdecl _rotl(unsigned int _Value, int _Shift);
265static __inline__
266unsigned short _rotl16(unsigned short _Value, unsigned char _Shift);
267static __inline__
268unsigned __int64 __cdecl _rotl64(unsigned __int64 _Value, int _Shift);
269static __inline__
270unsigned char _rotl8(unsigned char _Value, unsigned char _Shift);
271static __inline__
272unsigned int __cdecl _rotr(unsigned int _Value, int _Shift);
273static __inline__
274unsigned short _rotr16(unsigned short _Value, unsigned char _Shift);
275static __inline__
276unsigned __int64 __cdecl _rotr64(unsigned __int64 _Value, int _Shift);
277static __inline__
278unsigned char _rotr8(unsigned char _Value, unsigned char _Shift);
279int _sarx_i32(int, unsigned int);
280#if __STDC_HOSTED__
281int __cdecl _setjmp(jmp_buf);
282#endif
283unsigned int _shlx_u32(unsigned int, unsigned int);
284unsigned int _shrx_u32(unsigned int, unsigned int);
285void _Store_HLERelease(long volatile *, long);
286void _Store64_HLERelease(__int64 volatile *, __int64);
287void _StorePointer_HLERelease(void *volatile *, void *);
288static __inline__
289void _WriteBarrier(void);
290unsigned __int32 xbegin(void);
291void _xend(void);
292static __inline__
293#define _XCR_XFEATURE_ENABLED_MASK 0
294unsigned __int64 __cdecl _xgetbv(unsigned int);
295void __cdecl _xrstor(void const *, unsigned __int64);
296void __cdecl _xsave(void *, unsigned __int64);
297void __cdecl _xsaveopt(void *, unsigned __int64);
298void __cdecl _xsetbv(unsigned int, unsigned __int64);
299
300/* These additional intrinsics are turned on in x64/amd64/x86_64 mode. */
301#ifdef __x86_64__
302void __addgsbyte(unsigned long, unsigned char);
303void __addgsdword(unsigned long, unsigned long);
304void __addgsqword(unsigned long, unsigned __int64);
305void __addgsword(unsigned long, unsigned short);
306static __inline__
307void __faststorefence(void);
308void __incgsbyte(unsigned long);
309void __incgsdword(unsigned long);
310void __incgsqword(unsigned long);
311void __incgsword(unsigned long);
312unsigned char __lwpins64(unsigned __int64, unsigned int, unsigned int);
313void __lwpval64(unsigned __int64, unsigned int, unsigned int);
314unsigned __int64 __lzcnt64(unsigned __int64);
315static __inline__
316void __movsq(unsigned long long *, unsigned long long const *, size_t);
317__int64 __mulh(__int64, __int64);
318static __inline__
319unsigned __int64 __popcnt64(unsigned __int64);
320static __inline__
321unsigned char __readgsbyte(unsigned long);
322static __inline__
323unsigned long __readgsdword(unsigned long);
324static __inline__
325unsigned __int64 __readgsqword(unsigned long);
326unsigned short __readgsword(unsigned long);
327unsigned __int64 __shiftleft128(unsigned __int64 _LowPart,
328 unsigned __int64 _HighPart,
329 unsigned char _Shift);
330unsigned __int64 __shiftright128(unsigned __int64 _LowPart,
331 unsigned __int64 _HighPart,
332 unsigned char _Shift);
333static __inline__
334void __stosq(unsigned __int64 *, unsigned __int64, size_t);
335unsigned char __vmx_on(unsigned __int64 *);
336unsigned char __vmx_vmclear(unsigned __int64 *);
337unsigned char __vmx_vmlaunch(void);
338unsigned char __vmx_vmptrld(unsigned __int64 *);
339unsigned char __vmx_vmread(size_t, size_t *);
340unsigned char __vmx_vmresume(void);
341unsigned char __vmx_vmwrite(size_t, size_t);
342void __writegsbyte(unsigned long, unsigned char);
343void __writegsdword(unsigned long, unsigned long);
344void __writegsqword(unsigned long, unsigned __int64);
345void __writegsword(unsigned long, unsigned short);
346static __inline__
347unsigned char _BitScanForward64(unsigned long *_Index, unsigned __int64 _Mask);
348static __inline__
349unsigned char _BitScanReverse64(unsigned long *_Index, unsigned __int64 _Mask);
350static __inline__
351unsigned char _bittest64(__int64 const *, __int64);
352static __inline__
353unsigned char _bittestandcomplement64(__int64 *, __int64);
354static __inline__
355unsigned char _bittestandreset64(__int64 *, __int64);
356static __inline__
357unsigned char _bittestandset64(__int64 *, __int64);
358unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64);
359long _InterlockedAnd_np(long volatile *_Value, long _Mask);
360short _InterlockedAnd16_np(short volatile *_Value, short _Mask);
361__int64 _InterlockedAnd64_np(__int64 volatile *_Value, __int64 _Mask);
362char _InterlockedAnd8_np(char volatile *_Value, char _Mask);
363unsigned char _interlockedbittestandreset64(__int64 volatile *, __int64);
364static __inline__
365unsigned char _interlockedbittestandset64(__int64 volatile *, __int64);
366long _InterlockedCompareExchange_np(long volatile *_Destination, long _Exchange,
367 long _Comparand);
368unsigned char _InterlockedCompareExchange128(__int64 volatile *_Destination,
369 __int64 _ExchangeHigh,
370 __int64 _ExchangeLow,
371 __int64 *_CompareandResult);
372unsigned char _InterlockedCompareExchange128_np(__int64 volatile *_Destination,
373 __int64 _ExchangeHigh,
374 __int64 _ExchangeLow,
375 __int64 *_ComparandResult);
376short _InterlockedCompareExchange16_np(short volatile *_Destination,
377 short _Exchange, short _Comparand);
378__int64 _InterlockedCompareExchange64_HLEAcquire(__int64 volatile *, __int64,
379 __int64);
380__int64 _InterlockedCompareExchange64_HLERelease(__int64 volatile *, __int64,
381 __int64);
382__int64 _InterlockedCompareExchange64_np(__int64 volatile *_Destination,
383 __int64 _Exchange, __int64 _Comparand);
384void *_InterlockedCompareExchangePointer(void *volatile *_Destination,
385 void *_Exchange, void *_Comparand);
386void *_InterlockedCompareExchangePointer_np(void *volatile *_Destination,
387 void *_Exchange, void *_Comparand);
388static __inline__
389__int64 _InterlockedDecrement64(__int64 volatile *_Addend);
390static __inline__
391__int64 _InterlockedExchange64(__int64 volatile *_Target, __int64 _Value);
392static __inline__
393__int64 _InterlockedExchangeAdd64(__int64 volatile *_Addend, __int64 _Value);
394void *_InterlockedExchangePointer(void *volatile *_Target, void *_Value);
395static __inline__
396__int64 _InterlockedIncrement64(__int64 volatile *_Addend);
397long _InterlockedOr_np(long volatile *_Value, long _Mask);
398short _InterlockedOr16_np(short volatile *_Value, short _Mask);
399static __inline__
400__int64 _InterlockedOr64(__int64 volatile *_Value, __int64 _Mask);
401__int64 _InterlockedOr64_np(__int64 volatile *_Value, __int64 _Mask);
402char _InterlockedOr8_np(char volatile *_Value, char _Mask);
403long _InterlockedXor_np(long volatile *_Value, long _Mask);
404short _InterlockedXor16_np(short volatile *_Value, short _Mask);
405static __inline__
406__int64 _InterlockedXor64(__int64 volatile *_Value, __int64 _Mask);
407__int64 _InterlockedXor64_np(__int64 volatile *_Value, __int64 _Mask);
408char _InterlockedXor8_np(char volatile *_Value, char _Mask);
409static __inline__
410__int64 _mul128(__int64 _Multiplier, __int64 _Multiplicand,
411 __int64 *_HighProduct);
412unsigned __int64 _rorx_u64(unsigned __int64, const unsigned int);
413__int64 _sarx_i64(__int64, unsigned int);
414#if __STDC_HOSTED__
415int __cdecl _setjmpex(jmp_buf);
416#endif
417unsigned __int64 _shlx_u64(unsigned __int64, unsigned int);
418unsigned __int64 _shrx_u64(unsigned __int64, unsigned int);
419/*
420 * Multiply two 64-bit integers and obtain a 64-bit result.
421 * The low-half is returned directly and the high half is in an out parameter.
422 */
423static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS
424_umul128(unsigned __int64 _Multiplier, unsigned __int64 _Multiplicand,
425 unsigned __int64 *_HighProduct) {
426 unsigned __int128 _FullProduct =
427 (unsigned __int128)_Multiplier * (unsigned __int128)_Multiplicand;
428 *_HighProduct = _FullProduct >> 64;
429 return _FullProduct;
430}
431static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS
432__umulh(unsigned __int64 _Multiplier, unsigned __int64 _Multiplicand) {
433 unsigned __int128 _FullProduct =
434 (unsigned __int128)_Multiplier * (unsigned __int128)_Multiplicand;
435 return _FullProduct >> 64;
436}
437void __cdecl _xrstor64(void const *, unsigned __int64);
438void __cdecl _xsave64(void *, unsigned __int64);
439void __cdecl _xsaveopt64(void *, unsigned __int64);
440
441#endif /* __x86_64__ */
442
443/*----------------------------------------------------------------------------*\
444|* Bit Twiddling
445\*----------------------------------------------------------------------------*/
446static __inline__ unsigned char __DEFAULT_FN_ATTRS
447_rotl8(unsigned char _Value, unsigned char _Shift) {
448 _Shift &= 0x7;
449 return _Shift ? (_Value << _Shift) | (_Value >> (8 - _Shift)) : _Value;
450}
451static __inline__ unsigned char __DEFAULT_FN_ATTRS
452_rotr8(unsigned char _Value, unsigned char _Shift) {
453 _Shift &= 0x7;
454 return _Shift ? (_Value >> _Shift) | (_Value << (8 - _Shift)) : _Value;
455}
456static __inline__ unsigned short __DEFAULT_FN_ATTRS
457_rotl16(unsigned short _Value, unsigned char _Shift) {
458 _Shift &= 0xf;
459 return _Shift ? (_Value << _Shift) | (_Value >> (16 - _Shift)) : _Value;
460}
461static __inline__ unsigned short __DEFAULT_FN_ATTRS
462_rotr16(unsigned short _Value, unsigned char _Shift) {
463 _Shift &= 0xf;
464 return _Shift ? (_Value >> _Shift) | (_Value << (16 - _Shift)) : _Value;
465}
466static __inline__ unsigned int __DEFAULT_FN_ATTRS
467_rotl(unsigned int _Value, int _Shift) {
468 _Shift &= 0x1f;
469 return _Shift ? (_Value << _Shift) | (_Value >> (32 - _Shift)) : _Value;
470}
471static __inline__ unsigned int __DEFAULT_FN_ATTRS
472_rotr(unsigned int _Value, int _Shift) {
473 _Shift &= 0x1f;
474 return _Shift ? (_Value >> _Shift) | (_Value << (32 - _Shift)) : _Value;
475}
476static __inline__ unsigned long __DEFAULT_FN_ATTRS
477_lrotl(unsigned long _Value, int _Shift) {
478 _Shift &= 0x1f;
479 return _Shift ? (_Value << _Shift) | (_Value >> (32 - _Shift)) : _Value;
480}
481static __inline__ unsigned long __DEFAULT_FN_ATTRS
482_lrotr(unsigned long _Value, int _Shift) {
483 _Shift &= 0x1f;
484 return _Shift ? (_Value >> _Shift) | (_Value << (32 - _Shift)) : _Value;
485}
486static
487__inline__ unsigned __int64 __DEFAULT_FN_ATTRS
488_rotl64(unsigned __int64 _Value, int _Shift) {
489 _Shift &= 0x3f;
490 return _Shift ? (_Value << _Shift) | (_Value >> (64 - _Shift)) : _Value;
491}
492static
493__inline__ unsigned __int64 __DEFAULT_FN_ATTRS
494_rotr64(unsigned __int64 _Value, int _Shift) {
495 _Shift &= 0x3f;
496 return _Shift ? (_Value >> _Shift) | (_Value << (64 - _Shift)) : _Value;
497}
498/*----------------------------------------------------------------------------*\
499|* Bit Counting and Testing
500\*----------------------------------------------------------------------------*/
501static __inline__ unsigned char __DEFAULT_FN_ATTRS
502_BitScanForward(unsigned long *_Index, unsigned long _Mask) {
503 if (!_Mask)
504 return 0;
505 *_Index = __builtin_ctzl(_Mask);
506 return 1;
507}
508static __inline__ unsigned char __DEFAULT_FN_ATTRS
509_BitScanReverse(unsigned long *_Index, unsigned long _Mask) {
510 if (!_Mask)
511 return 0;
512 *_Index = 31 - __builtin_clzl(_Mask);
513 return 1;
514}
515static __inline__ unsigned short __DEFAULT_FN_ATTRS
516__popcnt16(unsigned short _Value) {
517 return __builtin_popcount((int)_Value);
518}
519static __inline__ unsigned int __DEFAULT_FN_ATTRS
520__popcnt(unsigned int _Value) {
521 return __builtin_popcount(_Value);
522}
523static __inline__ unsigned char __DEFAULT_FN_ATTRS
524_bittest(long const *_BitBase, long _BitPos) {
525 return (*_BitBase >> _BitPos) & 1;
526}
527static __inline__ unsigned char __DEFAULT_FN_ATTRS
528_bittestandcomplement(long *_BitBase, long _BitPos) {
529 unsigned char _Res = (*_BitBase >> _BitPos) & 1;
530 *_BitBase = *_BitBase ^ (1 << _BitPos);
531 return _Res;
532}
533static __inline__ unsigned char __DEFAULT_FN_ATTRS
534_bittestandreset(long *_BitBase, long _BitPos) {
535 unsigned char _Res = (*_BitBase >> _BitPos) & 1;
536 *_BitBase = *_BitBase & ~(1 << _BitPos);
537 return _Res;
538}
539static __inline__ unsigned char __DEFAULT_FN_ATTRS
540_bittestandset(long *_BitBase, long _BitPos) {
541 unsigned char _Res = (*_BitBase >> _BitPos) & 1;
542 *_BitBase = *_BitBase | (1 << _BitPos);
543 return _Res;
544}
545static __inline__ unsigned char __DEFAULT_FN_ATTRS
546_interlockedbittestandset(long volatile *_BitBase, long _BitPos) {
547 long _PrevVal = __atomic_fetch_or(_BitBase, 1l << _BitPos, __ATOMIC_SEQ_CST);
548 return (_PrevVal >> _BitPos) & 1;
549}
550#ifdef __x86_64__
551static __inline__ unsigned char __DEFAULT_FN_ATTRS
552_BitScanForward64(unsigned long *_Index, unsigned __int64 _Mask) {
553 if (!_Mask)
554 return 0;
555 *_Index = __builtin_ctzll(_Mask);
556 return 1;
557}
558static __inline__ unsigned char __DEFAULT_FN_ATTRS
559_BitScanReverse64(unsigned long *_Index, unsigned __int64 _Mask) {
560 if (!_Mask)
561 return 0;
562 *_Index = 63 - __builtin_clzll(_Mask);
563 return 1;
564}
565static __inline__
566unsigned __int64 __DEFAULT_FN_ATTRS
567__popcnt64(unsigned __int64 _Value) {
568 return __builtin_popcountll(_Value);
569}
570static __inline__ unsigned char __DEFAULT_FN_ATTRS
571_bittest64(__int64 const *_BitBase, __int64 _BitPos) {
572 return (*_BitBase >> _BitPos) & 1;
573}
574static __inline__ unsigned char __DEFAULT_FN_ATTRS
575_bittestandcomplement64(__int64 *_BitBase, __int64 _BitPos) {
576 unsigned char _Res = (*_BitBase >> _BitPos) & 1;
577 *_BitBase = *_BitBase ^ (1ll << _BitPos);
578 return _Res;
579}
580static __inline__ unsigned char __DEFAULT_FN_ATTRS
581_bittestandreset64(__int64 *_BitBase, __int64 _BitPos) {
582 unsigned char _Res = (*_BitBase >> _BitPos) & 1;
583 *_BitBase = *_BitBase & ~(1ll << _BitPos);
584 return _Res;
585}
586static __inline__ unsigned char __DEFAULT_FN_ATTRS
587_bittestandset64(__int64 *_BitBase, __int64 _BitPos) {
588 unsigned char _Res = (*_BitBase >> _BitPos) & 1;
589 *_BitBase = *_BitBase | (1ll << _BitPos);
590 return _Res;
591}
592static __inline__ unsigned char __DEFAULT_FN_ATTRS
593_interlockedbittestandset64(__int64 volatile *_BitBase, __int64 _BitPos) {
594 long long _PrevVal =
595 __atomic_fetch_or(_BitBase, 1ll << _BitPos, __ATOMIC_SEQ_CST);
596 return (_PrevVal >> _BitPos) & 1;
597}
598#endif
599/*----------------------------------------------------------------------------*\
600|* Interlocked Exchange Add
601\*----------------------------------------------------------------------------*/
602static __inline__ char __DEFAULT_FN_ATTRS
603_InterlockedExchangeAdd8(char volatile *_Addend, char _Value) {
604 return __atomic_fetch_add(_Addend, _Value, __ATOMIC_SEQ_CST);
605}
606static __inline__ short __DEFAULT_FN_ATTRS
607_InterlockedExchangeAdd16(short volatile *_Addend, short _Value) {
608 return __atomic_fetch_add(_Addend, _Value, __ATOMIC_SEQ_CST);
609}
610#ifdef __x86_64__
611static __inline__ __int64 __DEFAULT_FN_ATTRS
612_InterlockedExchangeAdd64(__int64 volatile *_Addend, __int64 _Value) {
613 return __atomic_fetch_add(_Addend, _Value, __ATOMIC_SEQ_CST);
614}
615#endif
616/*----------------------------------------------------------------------------*\
617|* Interlocked Exchange Sub
618\*----------------------------------------------------------------------------*/
619static __inline__ char __DEFAULT_FN_ATTRS
620_InterlockedExchangeSub8(char volatile *_Subend, char _Value) {
621 return __atomic_fetch_sub(_Subend, _Value, __ATOMIC_SEQ_CST);
622}
623static __inline__ short __DEFAULT_FN_ATTRS
624_InterlockedExchangeSub16(short volatile *_Subend, short _Value) {
625 return __atomic_fetch_sub(_Subend, _Value, __ATOMIC_SEQ_CST);
626}
627static __inline__ long __DEFAULT_FN_ATTRS
628_InterlockedExchangeSub(long volatile *_Subend, long _Value) {
629 return __atomic_fetch_sub(_Subend, _Value, __ATOMIC_SEQ_CST);
630}
631#ifdef __x86_64__
632static __inline__ __int64 __DEFAULT_FN_ATTRS
633_InterlockedExchangeSub64(__int64 volatile *_Subend, __int64 _Value) {
634 return __atomic_fetch_sub(_Subend, _Value, __ATOMIC_SEQ_CST);
635}
636#endif
637/*----------------------------------------------------------------------------*\
638|* Interlocked Increment
639\*----------------------------------------------------------------------------*/
640static __inline__ short __DEFAULT_FN_ATTRS
641_InterlockedIncrement16(short volatile *_Value) {
642 return __atomic_add_fetch(_Value, 1, __ATOMIC_SEQ_CST);
643}
644#ifdef __x86_64__
645static __inline__ __int64 __DEFAULT_FN_ATTRS
646_InterlockedIncrement64(__int64 volatile *_Value) {
647 return __atomic_add_fetch(_Value, 1, __ATOMIC_SEQ_CST);
648}
649#endif
650/*----------------------------------------------------------------------------*\
651|* Interlocked Decrement
652\*----------------------------------------------------------------------------*/
653static __inline__ short __DEFAULT_FN_ATTRS
654_InterlockedDecrement16(short volatile *_Value) {
655 return __atomic_sub_fetch(_Value, 1, __ATOMIC_SEQ_CST);
656}
657#ifdef __x86_64__
658static __inline__ __int64 __DEFAULT_FN_ATTRS
659_InterlockedDecrement64(__int64 volatile *_Value) {
660 return __atomic_sub_fetch(_Value, 1, __ATOMIC_SEQ_CST);
661}
662#endif
663/*----------------------------------------------------------------------------*\
664|* Interlocked And
665\*----------------------------------------------------------------------------*/
666static __inline__ char __DEFAULT_FN_ATTRS
667_InterlockedAnd8(char volatile *_Value, char _Mask) {
668 return __atomic_and_fetch(_Value, _Mask, __ATOMIC_SEQ_CST);
669}
670static __inline__ short __DEFAULT_FN_ATTRS
671_InterlockedAnd16(short volatile *_Value, short _Mask) {
672 return __atomic_and_fetch(_Value, _Mask, __ATOMIC_SEQ_CST);
673}
674static __inline__ long __DEFAULT_FN_ATTRS
675_InterlockedAnd(long volatile *_Value, long _Mask) {
676 return __atomic_and_fetch(_Value, _Mask, __ATOMIC_SEQ_CST);
677}
678#ifdef __x86_64__
679static __inline__ __int64 __DEFAULT_FN_ATTRS
680_InterlockedAnd64(__int64 volatile *_Value, __int64 _Mask) {
681 return __atomic_and_fetch(_Value, _Mask, __ATOMIC_SEQ_CST);
682}
683#endif
684/*----------------------------------------------------------------------------*\
685|* Interlocked Or
686\*----------------------------------------------------------------------------*/
687static __inline__ char __DEFAULT_FN_ATTRS
688_InterlockedOr8(char volatile *_Value, char _Mask) {
689 return __atomic_or_fetch(_Value, _Mask, __ATOMIC_SEQ_CST);
690}
691static __inline__ short __DEFAULT_FN_ATTRS
692_InterlockedOr16(short volatile *_Value, short _Mask) {
693 return __atomic_or_fetch(_Value, _Mask, __ATOMIC_SEQ_CST);
694}
695static __inline__ long __DEFAULT_FN_ATTRS
696_InterlockedOr(long volatile *_Value, long _Mask) {
697 return __atomic_or_fetch(_Value, _Mask, __ATOMIC_SEQ_CST);
698}
699#ifdef __x86_64__
700static __inline__ __int64 __DEFAULT_FN_ATTRS
701_InterlockedOr64(__int64 volatile *_Value, __int64 _Mask) {
702 return __atomic_or_fetch(_Value, _Mask, __ATOMIC_SEQ_CST);
703}
704#endif
705/*----------------------------------------------------------------------------*\
706|* Interlocked Xor
707\*----------------------------------------------------------------------------*/
708static __inline__ char __DEFAULT_FN_ATTRS
709_InterlockedXor8(char volatile *_Value, char _Mask) {
710 return __atomic_xor_fetch(_Value, _Mask, __ATOMIC_SEQ_CST);
711}
712static __inline__ short __DEFAULT_FN_ATTRS
713_InterlockedXor16(short volatile *_Value, short _Mask) {
714 return __atomic_xor_fetch(_Value, _Mask, __ATOMIC_SEQ_CST);
715}
716static __inline__ long __DEFAULT_FN_ATTRS
717_InterlockedXor(long volatile *_Value, long _Mask) {
718 return __atomic_xor_fetch(_Value, _Mask, __ATOMIC_SEQ_CST);
719}
720#ifdef __x86_64__
721static __inline__ __int64 __DEFAULT_FN_ATTRS
722_InterlockedXor64(__int64 volatile *_Value, __int64 _Mask) {
723 return __atomic_xor_fetch(_Value, _Mask, __ATOMIC_SEQ_CST);
724}
725#endif
726/*----------------------------------------------------------------------------*\
727|* Interlocked Exchange
728\*----------------------------------------------------------------------------*/
729static __inline__ char __DEFAULT_FN_ATTRS
730_InterlockedExchange8(char volatile *_Target, char _Value) {
731 __atomic_exchange(_Target, &_Value, &_Value, __ATOMIC_SEQ_CST);
732 return _Value;
733}
734static __inline__ short __DEFAULT_FN_ATTRS
735_InterlockedExchange16(short volatile *_Target, short _Value) {
736 __atomic_exchange(_Target, &_Value, &_Value, __ATOMIC_SEQ_CST);
737 return _Value;
738}
739#ifdef __x86_64__
740static __inline__ __int64 __DEFAULT_FN_ATTRS
741_InterlockedExchange64(__int64 volatile *_Target, __int64 _Value) {
742 __atomic_exchange(_Target, &_Value, &_Value, __ATOMIC_SEQ_CST);
743 return _Value;
744}
745#endif
746/*----------------------------------------------------------------------------*\
747|* Interlocked Compare Exchange
748\*----------------------------------------------------------------------------*/
749static __inline__ char __DEFAULT_FN_ATTRS
750_InterlockedCompareExchange8(char volatile *_Destination,
751 char _Exchange, char _Comparand) {
752 __atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
753 __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
754 return _Comparand;
755}
756static __inline__ short __DEFAULT_FN_ATTRS
757_InterlockedCompareExchange16(short volatile *_Destination,
758 short _Exchange, short _Comparand) {
759 __atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
760 __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
761 return _Comparand;
762}
763static __inline__ __int64 __DEFAULT_FN_ATTRS
764_InterlockedCompareExchange64(__int64 volatile *_Destination,
765 __int64 _Exchange, __int64 _Comparand) {
766 __atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0,
767 __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
768 return _Comparand;
769}
770/*----------------------------------------------------------------------------*\
771|* Barriers
772\*----------------------------------------------------------------------------*/
773#if defined(__i386__) || defined(__x86_64__)
774static __inline__ void __DEFAULT_FN_ATTRS
775__attribute__((__deprecated__("use other intrinsics or C++11 atomics instead")))
776_ReadWriteBarrier(void) {
777 __asm__ volatile ("" : : : "memory");
778}
779static __inline__ void __DEFAULT_FN_ATTRS
780__attribute__((__deprecated__("use other intrinsics or C++11 atomics instead")))
781_ReadBarrier(void) {
782 __asm__ volatile ("" : : : "memory");
783}
784static __inline__ void __DEFAULT_FN_ATTRS
785__attribute__((__deprecated__("use other intrinsics or C++11 atomics instead")))
786_WriteBarrier(void) {
787 __asm__ volatile ("" : : : "memory");
788}
789#endif
790#ifdef __x86_64__
791static __inline__ void __DEFAULT_FN_ATTRS
792__faststorefence(void) {
793 __asm__ volatile("lock orq $0, (%%rsp)" : : : "memory");
794}
795#endif
796/*----------------------------------------------------------------------------*\
797|* readfs, readgs
798|* (Pointers in address space #256 and #257 are relative to the GS and FS
799|* segment registers, respectively.)
800\*----------------------------------------------------------------------------*/
801#define __ptr_to_addr_space(__addr_space_nbr, __type, __offset) \
802 ((volatile __type __attribute__((__address_space__(__addr_space_nbr)))*) \
803 (__offset))
804
805#ifdef __i386__
806static __inline__ unsigned char __DEFAULT_FN_ATTRS
807__readfsbyte(unsigned long __offset) {
808 return *__ptr_to_addr_space(257, unsigned char, __offset);
809}
810static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS
811__readfsqword(unsigned long __offset) {
812 return *__ptr_to_addr_space(257, unsigned __int64, __offset);
813}
814static __inline__ unsigned short __DEFAULT_FN_ATTRS
815__readfsword(unsigned long __offset) {
816 return *__ptr_to_addr_space(257, unsigned short, __offset);
817}
818#endif
819#ifdef __x86_64__
820static __inline__ unsigned char __DEFAULT_FN_ATTRS
821__readgsbyte(unsigned long __offset) {
822 return *__ptr_to_addr_space(256, unsigned char, __offset);
823}
824static __inline__ unsigned long __DEFAULT_FN_ATTRS
825__readgsdword(unsigned long __offset) {
826 return *__ptr_to_addr_space(256, unsigned long, __offset);
827}
828static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS
829__readgsqword(unsigned long __offset) {
830 return *__ptr_to_addr_space(256, unsigned __int64, __offset);
831}
832static __inline__ unsigned short __DEFAULT_FN_ATTRS
833__readgsword(unsigned long __offset) {
834 return *__ptr_to_addr_space(256, unsigned short, __offset);
835}
836#endif
837#undef __ptr_to_addr_space
838/*----------------------------------------------------------------------------*\
839|* movs, stos
840\*----------------------------------------------------------------------------*/
841#if defined(__i386__) || defined(__x86_64__)
842static __inline__ void __DEFAULT_FN_ATTRS
843__movsb(unsigned char *__dst, unsigned char const *__src, size_t __n) {
844 __asm__("rep movsb" : : "D"(__dst), "S"(__src), "c"(__n)
845 : "%edi", "%esi", "%ecx");
846}
847static __inline__ void __DEFAULT_FN_ATTRS
848__movsd(unsigned long *__dst, unsigned long const *__src, size_t __n) {
849 __asm__("rep movsl" : : "D"(__dst), "S"(__src), "c"(__n)
850 : "%edi", "%esi", "%ecx");
851}
852static __inline__ void __DEFAULT_FN_ATTRS
853__movsw(unsigned short *__dst, unsigned short const *__src, size_t __n) {
854 __asm__("rep movsh" : : "D"(__dst), "S"(__src), "c"(__n)
855 : "%edi", "%esi", "%ecx");
856}
857static __inline__ void __DEFAULT_FN_ATTRS
858__stosb(unsigned char *__dst, unsigned char __x, size_t __n) {
859 __asm__("rep stosb" : : "D"(__dst), "a"(__x), "c"(__n)
860 : "%edi", "%ecx");
861}
862static __inline__ void __DEFAULT_FN_ATTRS
863__stosd(unsigned long *__dst, unsigned long __x, size_t __n) {
864 __asm__("rep stosl" : : "D"(__dst), "a"(__x), "c"(__n)
865 : "%edi", "%ecx");
866}
867static __inline__ void __DEFAULT_FN_ATTRS
868__stosw(unsigned short *__dst, unsigned short __x, size_t __n) {
869 __asm__("rep stosh" : : "D"(__dst), "a"(__x), "c"(__n)
870 : "%edi", "%ecx");
871}
872#endif
873#ifdef __x86_64__
874static __inline__ void __DEFAULT_FN_ATTRS
875__movsq(unsigned long long *__dst, unsigned long long const *__src, size_t __n) {
876 __asm__("rep movsq" : : "D"(__dst), "S"(__src), "c"(__n)
877 : "%edi", "%esi", "%ecx");
878}
879static __inline__ void __DEFAULT_FN_ATTRS
880__stosq(unsigned __int64 *__dst, unsigned __int64 __x, size_t __n) {
881 __asm__("rep stosq" : : "D"(__dst), "a"(__x), "c"(__n)
882 : "%edi", "%ecx");
883}
884#endif
885
886/*----------------------------------------------------------------------------*\
887|* Misc
888\*----------------------------------------------------------------------------*/
889static __inline__ void * __DEFAULT_FN_ATTRS
890_AddressOfReturnAddress(void) {
891 return (void*)((char*)__builtin_frame_address(0) + sizeof(void*));
892}
893static __inline__ void * __DEFAULT_FN_ATTRS
894_ReturnAddress(void) {
895 return __builtin_return_address(0);
896}
897#if defined(__i386__) || defined(__x86_64__)
898static __inline__ void __DEFAULT_FN_ATTRS
899__cpuid(int __info[4], int __level) {
900 __asm__ ("cpuid" : "=a"(__info[0]), "=b" (__info[1]), "=c"(__info[2]), "=d"(__info[3])
901 : "a"(__level));
902}
903static __inline__ void __DEFAULT_FN_ATTRS
904__cpuidex(int __info[4], int __level, int __ecx) {
905 __asm__ ("cpuid" : "=a"(__info[0]), "=b" (__info[1]), "=c"(__info[2]), "=d"(__info[3])
906 : "a"(__level), "c"(__ecx));
907}
908static __inline__ unsigned __int64 __cdecl __DEFAULT_FN_ATTRS
909_xgetbv(unsigned int __xcr_no) {
910 unsigned int __eax, __edx;
911 __asm__ ("xgetbv" : "=a" (__eax), "=d" (__edx) : "c" (__xcr_no));
912 return ((unsigned __int64)__edx << 32) | __eax;
913}
914static __inline__ void __DEFAULT_FN_ATTRS
915__halt(void) {
916 __asm__ volatile ("hlt");
917}
918#endif
919
920/*----------------------------------------------------------------------------*\
921|* Privileged intrinsics
922\*----------------------------------------------------------------------------*/
923#if defined(__i386__) || defined(__x86_64__)
924static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS
925__readmsr(unsigned long __register) {
926 // Loads the contents of a 64-bit model specific register (MSR) specified in
927 // the ECX register into registers EDX:EAX. The EDX register is loaded with
928 // the high-order 32 bits of the MSR and the EAX register is loaded with the
929 // low-order 32 bits. If less than 64 bits are implemented in the MSR being
930 // read, the values returned to EDX:EAX in unimplemented bit locations are
931 // undefined.
932 unsigned long __edx;
933 unsigned long __eax;
934 __asm__ ("rdmsr" : "=d"(__edx), "=a"(__eax) : "c"(__register));
935 return (((unsigned __int64)__edx) << 32) | (unsigned __int64)__eax;
936}
937
938static __inline__ unsigned long __DEFAULT_FN_ATTRS
939__readcr3(void) {
940 unsigned long __cr3_val;
941 __asm__ __volatile__ ("mov %%cr3, %0" : "=q"(__cr3_val) : : "memory");
942 return __cr3_val;
943}
944
945static __inline__ void __DEFAULT_FN_ATTRS
946__writecr3(unsigned int __cr3_val) {
947 __asm__ ("mov %0, %%cr3" : : "q"(__cr3_val) : "memory");
948}
949#endif
950
951#ifdef __cplusplus
952}
953#endif
954
955#undef __DEFAULT_FN_ATTRS
956
957#endif /* __INTRIN_H */
958#endif /* _MSC_VER */
c_headers/__stddef_max_align_t.h created+43
......@@ -0,0 +1,43 @@
1/*===---- __stddef_max_align_t.h - Definition of max_align_t for modules ---===
2 *
3 * Copyright (c) 2014 Chandler Carruth
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 * THE SOFTWARE.
22 *
23 *===-----------------------------------------------------------------------===
24 */
25
26#ifndef __CLANG_MAX_ALIGN_T_DEFINED
27#define __CLANG_MAX_ALIGN_T_DEFINED
28
29#if defined(_MSC_VER)
30typedef double max_align_t;
31#elif defined(__APPLE__)
32typedef long double max_align_t;
33#else
34// Define 'max_align_t' to match the GCC definition.
35typedef struct {
36 long long __clang_max_align_nonce1
37 __attribute__((__aligned__(__alignof__(long long))));
38 long double __clang_max_align_nonce2
39 __attribute__((__aligned__(__alignof__(long double))));
40} max_align_t;
41#endif
42
43#endif
c_headers/__wmmintrin_aes.h created+72
......@@ -0,0 +1,72 @@
1/*===---- __wmmintrin_aes.h - AES intrinsics -------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23#ifndef _WMMINTRIN_AES_H
24#define _WMMINTRIN_AES_H
25
26#include <emmintrin.h>
27
28#if !defined (__AES__)
29# error "AES instructions not enabled"
30#else
31
32/* Define the default attributes for the functions in this file. */
33#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
34
35static __inline__ __m128i __DEFAULT_FN_ATTRS
36_mm_aesenc_si128(__m128i __V, __m128i __R)
37{
38 return (__m128i)__builtin_ia32_aesenc128(__V, __R);
39}
40
41static __inline__ __m128i __DEFAULT_FN_ATTRS
42_mm_aesenclast_si128(__m128i __V, __m128i __R)
43{
44 return (__m128i)__builtin_ia32_aesenclast128(__V, __R);
45}
46
47static __inline__ __m128i __DEFAULT_FN_ATTRS
48_mm_aesdec_si128(__m128i __V, __m128i __R)
49{
50 return (__m128i)__builtin_ia32_aesdec128(__V, __R);
51}
52
53static __inline__ __m128i __DEFAULT_FN_ATTRS
54_mm_aesdeclast_si128(__m128i __V, __m128i __R)
55{
56 return (__m128i)__builtin_ia32_aesdeclast128(__V, __R);
57}
58
59static __inline__ __m128i __DEFAULT_FN_ATTRS
60_mm_aesimc_si128(__m128i __V)
61{
62 return (__m128i)__builtin_ia32_aesimc128(__V);
63}
64
65#define _mm_aeskeygenassist_si128(C, R) \
66 __builtin_ia32_aeskeygenassist128((C), (R))
67
68#undef __DEFAULT_FN_ATTRS
69
70#endif
71
72#endif /* _WMMINTRIN_AES_H */
c_headers/__wmmintrin_pclmul.h created+34
......@@ -0,0 +1,34 @@
1/*===---- __wmmintrin_pclmul.h - AES intrinsics ----------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23#ifndef _WMMINTRIN_PCLMUL_H
24#define _WMMINTRIN_PCLMUL_H
25
26#if !defined (__PCLMUL__)
27# error "PCLMUL instruction is not enabled"
28#else
29#define _mm_clmulepi64_si128(__X, __Y, __I) \
30 ((__m128i)__builtin_ia32_pclmulqdq128((__v2di)(__m128i)(__X), \
31 (__v2di)(__m128i)(__Y), (char)(__I)))
32#endif
33
34#endif /* _WMMINTRIN_PCLMUL_H */
c_headers/adxintrin.h created+88
......@@ -0,0 +1,88 @@
1/*===---- adxintrin.h - ADX intrinsics -------------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __IMMINTRIN_H
25#error "Never use <adxintrin.h> directly; include <immintrin.h> instead."
26#endif
27
28#ifndef __ADXINTRIN_H
29#define __ADXINTRIN_H
30
31/* Define the default attributes for the functions in this file. */
32#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
33
34/* Intrinsics that are available only if __ADX__ defined */
35#ifdef __ADX__
36static __inline unsigned char __DEFAULT_FN_ATTRS
37_addcarryx_u32(unsigned char __cf, unsigned int __x, unsigned int __y,
38 unsigned int *__p)
39{
40 return __builtin_ia32_addcarryx_u32(__cf, __x, __y, __p);
41}
42
43#ifdef __x86_64__
44static __inline unsigned char __DEFAULT_FN_ATTRS
45_addcarryx_u64(unsigned char __cf, unsigned long long __x,
46 unsigned long long __y, unsigned long long *__p)
47{
48 return __builtin_ia32_addcarryx_u64(__cf, __x, __y, __p);
49}
50#endif
51#endif
52
53/* Intrinsics that are also available if __ADX__ undefined */
54static __inline unsigned char __DEFAULT_FN_ATTRS
55_addcarry_u32(unsigned char __cf, unsigned int __x, unsigned int __y,
56 unsigned int *__p)
57{
58 return __builtin_ia32_addcarry_u32(__cf, __x, __y, __p);
59}
60
61#ifdef __x86_64__
62static __inline unsigned char __DEFAULT_FN_ATTRS
63_addcarry_u64(unsigned char __cf, unsigned long long __x,
64 unsigned long long __y, unsigned long long *__p)
65{
66 return __builtin_ia32_addcarry_u64(__cf, __x, __y, __p);
67}
68#endif
69
70static __inline unsigned char __DEFAULT_FN_ATTRS
71_subborrow_u32(unsigned char __cf, unsigned int __x, unsigned int __y,
72 unsigned int *__p)
73{
74 return __builtin_ia32_subborrow_u32(__cf, __x, __y, __p);
75}
76
77#ifdef __x86_64__
78static __inline unsigned char __DEFAULT_FN_ATTRS
79_subborrow_u64(unsigned char __cf, unsigned long long __x,
80 unsigned long long __y, unsigned long long *__p)
81{
82 return __builtin_ia32_subborrow_u64(__cf, __x, __y, __p);
83}
84#endif
85
86#undef __DEFAULT_FN_ATTRS
87
88#endif /* __ADXINTRIN_H */
c_headers/ammintrin.h created+215
......@@ -0,0 +1,215 @@
1/*===---- ammintrin.h - SSE4a intrinsics -----------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __AMMINTRIN_H
25#define __AMMINTRIN_H
26
27#ifndef __SSE4A__
28#error "SSE4A instruction set not enabled"
29#else
30
31#include <pmmintrin.h>
32
33/* Define the default attributes for the functions in this file. */
34#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
35
36/// \brief Extracts the specified bits from the lower 64 bits of the 128-bit
37/// integer vector operand at the index idx and of the length len.
38///
39/// \headerfile <x86intrin.h>
40///
41/// \code
42/// __m128i _mm_extracti_si64(__m128i x, const int len, const int idx);
43/// \endcode
44///
45/// \code
46/// This intrinsic corresponds to the \c EXTRQ instruction.
47/// \endcode
48///
49/// \param x
50/// The value from which bits are extracted.
51/// \param len
52/// Bits [5:0] specify the length; the other bits are ignored. If bits [5:0]
53/// are zero, the length is interpreted as 64.
54/// \param idx
55/// Bits [5:0] specify the index of the least significant bit; the other
56/// bits are ignored. If the sum of the index and length is greater than
57/// 64, the result is undefined. If the length and index are both zero,
58/// bits [63:0] of parameter x are extracted. If the length is zero
59/// but the index is non-zero, the result is undefined.
60/// \returns A 128-bit integer vector whose lower 64 bits contain the bits
61/// extracted from the source operand.
62#define _mm_extracti_si64(x, len, idx) \
63 ((__m128i)__builtin_ia32_extrqi((__v2di)(__m128i)(x), \
64 (char)(len), (char)(idx)))
65
66/// \brief Extracts the specified bits from the lower 64 bits of the 128-bit
67/// integer vector operand at the index and of the length specified by __y.
68///
69/// \headerfile <x86intrin.h>
70///
71/// \code
72/// This intrinsic corresponds to the \c EXTRQ instruction.
73/// \endcode
74///
75/// \param __x
76/// The value from which bits are extracted.
77/// \param __y
78/// Specifies the index of the least significant bit at [13:8]
79/// and the length at [5:0]; all other bits are ignored.
80/// If bits [5:0] are zero, the length is interpreted as 64.
81/// If the sum of the index and length is greater than 64, the result is
82/// undefined. If the length and index are both zero, bits [63:0] of
83/// parameter __x are extracted. If the length is zero but the index is
84/// non-zero, the result is undefined.
85/// \returns A 128-bit vector whose lower 64 bits contain the bits extracted
86/// from the source operand.
87static __inline__ __m128i __DEFAULT_FN_ATTRS
88_mm_extract_si64(__m128i __x, __m128i __y)
89{
90 return (__m128i)__builtin_ia32_extrq((__v2di)__x, (__v16qi)__y);
91}
92
93/// \brief Inserts bits of a specified length from the source integer vector
94/// y into the lower 64 bits of the destination integer vector x at the
95/// index idx and of the length len.
96///
97/// \headerfile <x86intrin.h>
98///
99/// \code
100/// __m128i _mm_inserti_si64(__m128i x, __m128i y, const int len,
101/// const int idx);
102/// \endcode
103///
104/// \code
105/// This intrinsic corresponds to the \c INSERTQ instruction.
106/// \endcode
107///
108/// \param x
109/// The destination operand where bits will be inserted. The inserted bits
110/// are defined by the length len and by the index idx specifying the least
111/// significant bit.
112/// \param y
113/// The source operand containing the bits to be extracted. The extracted
114/// bits are the least significant bits of operand y of length len.
115/// \param len
116/// Bits [5:0] specify the length; the other bits are ignored. If bits [5:0]
117/// are zero, the length is interpreted as 64.
118/// \param idx
119/// Bits [5:0] specify the index of the least significant bit; the other
120/// bits are ignored. If the sum of the index and length is greater than
121/// 64, the result is undefined. If the length and index are both zero,
122/// bits [63:0] of parameter y are inserted into parameter x. If the
123/// length is zero but the index is non-zero, the result is undefined.
124/// \returns A 128-bit integer vector containing the original lower 64-bits
125/// of destination operand x with the specified bitfields replaced by the
126/// lower bits of source operand y. The upper 64 bits of the return value
127/// are undefined.
128
129#define _mm_inserti_si64(x, y, len, idx) \
130 ((__m128i)__builtin_ia32_insertqi((__v2di)(__m128i)(x), \
131 (__v2di)(__m128i)(y), \
132 (char)(len), (char)(idx)))
133
134/// \brief Inserts bits of a specified length from the source integer vector
135/// __y into the lower 64 bits of the destination integer vector __x at
136/// the index and of the length specified by __y.
137///
138/// \headerfile <x86intrin.h>
139///
140/// \code
141/// This intrinsic corresponds to the \c INSERTQ instruction.
142/// \endcode
143///
144/// \param __x
145/// The destination operand where bits will be inserted. The inserted bits
146/// are defined by the length and by the index of the least significant bit
147/// specified by operand __y.
148/// \param __y
149/// The source operand containing the bits to be extracted. The extracted
150/// bits are the least significant bits of operand __y with length specified
151/// by bits [69:64]. These are inserted into the destination at the index
152/// specified by bits [77:72]; all other bits are ignored.
153/// If bits [69:64] are zero, the length is interpreted as 64.
154/// If the sum of the index and length is greater than 64, the result is
155/// undefined. If the length and index are both zero, bits [63:0] of
156/// parameter __y are inserted into parameter __x. If the length
157/// is zero but the index is non-zero, the result is undefined.
158/// \returns A 128-bit integer vector containing the original lower 64-bits
159/// of destination operand __x with the specified bitfields replaced by the
160/// lower bits of source operand __y. The upper 64 bits of the return value
161/// are undefined.
162
163static __inline__ __m128i __DEFAULT_FN_ATTRS
164_mm_insert_si64(__m128i __x, __m128i __y)
165{
166 return (__m128i)__builtin_ia32_insertq((__v2di)__x, (__v2di)__y);
167}
168
169/// \brief Stores a 64-bit double-precision value in a 64-bit memory location.
170/// To minimize caching, the data is flagged as non-temporal (unlikely to be
171/// used again soon).
172///
173/// \headerfile <x86intrin.h>
174///
175/// \code
176/// This intrinsic corresponds to the \c MOVNTSD instruction.
177/// \endcode
178///
179/// \param __p
180/// The 64-bit memory location used to store the register value.
181/// \param __a
182/// The 64-bit double-precision floating-point register value to
183/// be stored.
184static __inline__ void __DEFAULT_FN_ATTRS
185_mm_stream_sd(double *__p, __m128d __a)
186{
187 __builtin_ia32_movntsd(__p, (__v2df)__a);
188}
189
190/// \brief Stores a 32-bit single-precision floating-point value in a 32-bit
191/// memory location. To minimize caching, the data is flagged as
192/// non-temporal (unlikely to be used again soon).
193///
194/// \headerfile <x86intrin.h>
195///
196/// \code
197/// This intrinsic corresponds to the \c MOVNTSS instruction.
198/// \endcode
199///
200/// \param __p
201/// The 32-bit memory location used to store the register value.
202/// \param __a
203/// The 32-bit single-precision floating-point register value to
204/// be stored.
205static __inline__ void __DEFAULT_FN_ATTRS
206_mm_stream_ss(float *__p, __m128 __a)
207{
208 __builtin_ia32_movntss(__p, (__v4sf)__a);
209}
210
211#undef __DEFAULT_FN_ATTRS
212
213#endif /* __SSE4A__ */
214
215#endif /* __AMMINTRIN_H */
c_headers/arm_acle.h created+304
......@@ -0,0 +1,304 @@
1/*===---- arm_acle.h - ARM Non-Neon intrinsics -----------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __ARM_ACLE_H
25#define __ARM_ACLE_H
26
27#ifndef __ARM_ACLE
28#error "ACLE intrinsics support not enabled."
29#endif
30
31#include <stdint.h>
32
33#if defined(__cplusplus)
34extern "C" {
35#endif
36
37/* 8 SYNCHRONIZATION, BARRIER AND HINT INTRINSICS */
38/* 8.3 Memory barriers */
39#if !defined(_MSC_VER)
40#define __dmb(i) __builtin_arm_dmb(i)
41#define __dsb(i) __builtin_arm_dsb(i)
42#define __isb(i) __builtin_arm_isb(i)
43#endif
44
45/* 8.4 Hints */
46
47#if !defined(_MSC_VER)
48static __inline__ void __attribute__((__always_inline__, __nodebug__)) __wfi(void) {
49 __builtin_arm_wfi();
50}
51
52static __inline__ void __attribute__((__always_inline__, __nodebug__)) __wfe(void) {
53 __builtin_arm_wfe();
54}
55
56static __inline__ void __attribute__((__always_inline__, __nodebug__)) __sev(void) {
57 __builtin_arm_sev();
58}
59
60static __inline__ void __attribute__((__always_inline__, __nodebug__)) __sevl(void) {
61 __builtin_arm_sevl();
62}
63
64static __inline__ void __attribute__((__always_inline__, __nodebug__)) __yield(void) {
65 __builtin_arm_yield();
66}
67#endif
68
69#if __ARM_32BIT_STATE
70#define __dbg(t) __builtin_arm_dbg(t)
71#endif
72
73/* 8.5 Swap */
74static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
75 __swp(uint32_t x, volatile uint32_t *p) {
76 uint32_t v;
77 do v = __builtin_arm_ldrex(p); while (__builtin_arm_strex(x, p));
78 return v;
79}
80
81/* 8.6 Memory prefetch intrinsics */
82/* 8.6.1 Data prefetch */
83#define __pld(addr) __pldx(0, 0, 0, addr)
84
85#if __ARM_32BIT_STATE
86#define __pldx(access_kind, cache_level, retention_policy, addr) \
87 __builtin_arm_prefetch(addr, access_kind, 1)
88#else
89#define __pldx(access_kind, cache_level, retention_policy, addr) \
90 __builtin_arm_prefetch(addr, access_kind, cache_level, retention_policy, 1)
91#endif
92
93/* 8.6.2 Instruction prefetch */
94#define __pli(addr) __plix(0, 0, addr)
95
96#if __ARM_32BIT_STATE
97#define __plix(cache_level, retention_policy, addr) \
98 __builtin_arm_prefetch(addr, 0, 0)
99#else
100#define __plix(cache_level, retention_policy, addr) \
101 __builtin_arm_prefetch(addr, 0, cache_level, retention_policy, 0)
102#endif
103
104/* 8.7 NOP */
105static __inline__ void __attribute__((__always_inline__, __nodebug__)) __nop(void) {
106 __builtin_arm_nop();
107}
108
109/* 9 DATA-PROCESSING INTRINSICS */
110/* 9.2 Miscellaneous data-processing intrinsics */
111/* ROR */
112static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
113 __ror(uint32_t x, uint32_t y) {
114 y %= 32;
115 if (y == 0) return x;
116 return (x >> y) | (x << (32 - y));
117}
118
119static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__))
120 __rorll(uint64_t x, uint32_t y) {
121 y %= 64;
122 if (y == 0) return x;
123 return (x >> y) | (x << (64 - y));
124}
125
126static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
127 __rorl(unsigned long x, uint32_t y) {
128#if __SIZEOF_LONG__ == 4
129 return __ror(x, y);
130#else
131 return __rorll(x, y);
132#endif
133}
134
135
136/* CLZ */
137static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
138 __clz(uint32_t t) {
139 return __builtin_clz(t);
140}
141
142static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
143 __clzl(unsigned long t) {
144 return __builtin_clzl(t);
145}
146
147static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__))
148 __clzll(uint64_t t) {
149 return __builtin_clzll(t);
150}
151
152/* REV */
153static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
154 __rev(uint32_t t) {
155 return __builtin_bswap32(t);
156}
157
158static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
159 __revl(unsigned long t) {
160#if __SIZEOF_LONG__ == 4
161 return __builtin_bswap32(t);
162#else
163 return __builtin_bswap64(t);
164#endif
165}
166
167static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__))
168 __revll(uint64_t t) {
169 return __builtin_bswap64(t);
170}
171
172/* REV16 */
173static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
174 __rev16(uint32_t t) {
175 return __ror(__rev(t), 16);
176}
177
178static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
179 __rev16l(unsigned long t) {
180 return __rorl(__revl(t), sizeof(long) / 2);
181}
182
183static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__))
184 __rev16ll(uint64_t t) {
185 return __rorll(__revll(t), 32);
186}
187
188/* REVSH */
189static __inline__ int16_t __attribute__((__always_inline__, __nodebug__))
190 __revsh(int16_t t) {
191 return __builtin_bswap16(t);
192}
193
194/* RBIT */
195static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
196 __rbit(uint32_t t) {
197 return __builtin_arm_rbit(t);
198}
199
200static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__))
201 __rbitll(uint64_t t) {
202#if __ARM_32BIT_STATE
203 return (((uint64_t) __builtin_arm_rbit(t)) << 32) |
204 __builtin_arm_rbit(t >> 32);
205#else
206 return __builtin_arm_rbit64(t);
207#endif
208}
209
210static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
211 __rbitl(unsigned long t) {
212#if __SIZEOF_LONG__ == 4
213 return __rbit(t);
214#else
215 return __rbitll(t);
216#endif
217}
218
219/*
220 * 9.4 Saturating intrinsics
221 *
222 * FIXME: Change guard to their corrosponding __ARM_FEATURE flag when Q flag
223 * intrinsics are implemented and the flag is enabled.
224 */
225/* 9.4.1 Width-specified saturation intrinsics */
226#if __ARM_32BIT_STATE
227#define __ssat(x, y) __builtin_arm_ssat(x, y)
228#define __usat(x, y) __builtin_arm_usat(x, y)
229#endif
230
231/* 9.4.2 Saturating addition and subtraction intrinsics */
232#if __ARM_32BIT_STATE
233static __inline__ int32_t __attribute__((__always_inline__, __nodebug__))
234 __qadd(int32_t t, int32_t v) {
235 return __builtin_arm_qadd(t, v);
236}
237
238static __inline__ int32_t __attribute__((__always_inline__, __nodebug__))
239 __qsub(int32_t t, int32_t v) {
240 return __builtin_arm_qsub(t, v);
241}
242
243static __inline__ int32_t __attribute__((__always_inline__, __nodebug__))
244__qdbl(int32_t t) {
245 return __builtin_arm_qadd(t, t);
246}
247#endif
248
249/* 9.7 CRC32 intrinsics */
250#if __ARM_FEATURE_CRC32
251static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
252 __crc32b(uint32_t a, uint8_t b) {
253 return __builtin_arm_crc32b(a, b);
254}
255
256static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
257 __crc32h(uint32_t a, uint16_t b) {
258 return __builtin_arm_crc32h(a, b);
259}
260
261static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
262 __crc32w(uint32_t a, uint32_t b) {
263 return __builtin_arm_crc32w(a, b);
264}
265
266static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
267 __crc32d(uint32_t a, uint64_t b) {
268 return __builtin_arm_crc32d(a, b);
269}
270
271static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
272 __crc32cb(uint32_t a, uint8_t b) {
273 return __builtin_arm_crc32cb(a, b);
274}
275
276static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
277 __crc32ch(uint32_t a, uint16_t b) {
278 return __builtin_arm_crc32ch(a, b);
279}
280
281static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
282 __crc32cw(uint32_t a, uint32_t b) {
283 return __builtin_arm_crc32cw(a, b);
284}
285
286static __inline__ uint32_t __attribute__((__always_inline__, __nodebug__))
287 __crc32cd(uint32_t a, uint64_t b) {
288 return __builtin_arm_crc32cd(a, b);
289}
290#endif
291
292/* 10.1 Special register intrinsics */
293#define __arm_rsr(sysreg) __builtin_arm_rsr(sysreg)
294#define __arm_rsr64(sysreg) __builtin_arm_rsr64(sysreg)
295#define __arm_rsrp(sysreg) __builtin_arm_rsrp(sysreg)
296#define __arm_wsr(sysreg, v) __builtin_arm_wsr(sysreg, v)
297#define __arm_wsr64(sysreg, v) __builtin_arm_wsr64(sysreg, v)
298#define __arm_wsrp(sysreg, v) __builtin_arm_wsrp(sysreg, v)
299
300#if defined(__cplusplus)
301}
302#endif
303
304#endif /* __ARM_ACLE_H */
c_headers/avx2intrin.h created+1256
......@@ -0,0 +1,1256 @@
1/*===---- avx2intrin.h - AVX2 intrinsics -----------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __IMMINTRIN_H
25#error "Never use <avx2intrin.h> directly; include <immintrin.h> instead."
26#endif
27
28#ifndef __AVX2INTRIN_H
29#define __AVX2INTRIN_H
30
31/* Define the default attributes for the functions in this file. */
32#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
33
34/* SSE4 Multiple Packed Sums of Absolute Difference. */
35#define _mm256_mpsadbw_epu8(X, Y, M) __builtin_ia32_mpsadbw256((X), (Y), (M))
36
37static __inline__ __m256i __DEFAULT_FN_ATTRS
38_mm256_abs_epi8(__m256i __a)
39{
40 return (__m256i)__builtin_ia32_pabsb256((__v32qi)__a);
41}
42
43static __inline__ __m256i __DEFAULT_FN_ATTRS
44_mm256_abs_epi16(__m256i __a)
45{
46 return (__m256i)__builtin_ia32_pabsw256((__v16hi)__a);
47}
48
49static __inline__ __m256i __DEFAULT_FN_ATTRS
50_mm256_abs_epi32(__m256i __a)
51{
52 return (__m256i)__builtin_ia32_pabsd256((__v8si)__a);
53}
54
55static __inline__ __m256i __DEFAULT_FN_ATTRS
56_mm256_packs_epi16(__m256i __a, __m256i __b)
57{
58 return (__m256i)__builtin_ia32_packsswb256((__v16hi)__a, (__v16hi)__b);
59}
60
61static __inline__ __m256i __DEFAULT_FN_ATTRS
62_mm256_packs_epi32(__m256i __a, __m256i __b)
63{
64 return (__m256i)__builtin_ia32_packssdw256((__v8si)__a, (__v8si)__b);
65}
66
67static __inline__ __m256i __DEFAULT_FN_ATTRS
68_mm256_packus_epi16(__m256i __a, __m256i __b)
69{
70 return (__m256i)__builtin_ia32_packuswb256((__v16hi)__a, (__v16hi)__b);
71}
72
73static __inline__ __m256i __DEFAULT_FN_ATTRS
74_mm256_packus_epi32(__m256i __V1, __m256i __V2)
75{
76 return (__m256i) __builtin_ia32_packusdw256((__v8si)__V1, (__v8si)__V2);
77}
78
79static __inline__ __m256i __DEFAULT_FN_ATTRS
80_mm256_add_epi8(__m256i __a, __m256i __b)
81{
82 return (__m256i)((__v32qi)__a + (__v32qi)__b);
83}
84
85static __inline__ __m256i __DEFAULT_FN_ATTRS
86_mm256_add_epi16(__m256i __a, __m256i __b)
87{
88 return (__m256i)((__v16hi)__a + (__v16hi)__b);
89}
90
91static __inline__ __m256i __DEFAULT_FN_ATTRS
92_mm256_add_epi32(__m256i __a, __m256i __b)
93{
94 return (__m256i)((__v8si)__a + (__v8si)__b);
95}
96
97static __inline__ __m256i __DEFAULT_FN_ATTRS
98_mm256_add_epi64(__m256i __a, __m256i __b)
99{
100 return __a + __b;
101}
102
103static __inline__ __m256i __DEFAULT_FN_ATTRS
104_mm256_adds_epi8(__m256i __a, __m256i __b)
105{
106 return (__m256i)__builtin_ia32_paddsb256((__v32qi)__a, (__v32qi)__b);
107}
108
109static __inline__ __m256i __DEFAULT_FN_ATTRS
110_mm256_adds_epi16(__m256i __a, __m256i __b)
111{
112 return (__m256i)__builtin_ia32_paddsw256((__v16hi)__a, (__v16hi)__b);
113}
114
115static __inline__ __m256i __DEFAULT_FN_ATTRS
116_mm256_adds_epu8(__m256i __a, __m256i __b)
117{
118 return (__m256i)__builtin_ia32_paddusb256((__v32qi)__a, (__v32qi)__b);
119}
120
121static __inline__ __m256i __DEFAULT_FN_ATTRS
122_mm256_adds_epu16(__m256i __a, __m256i __b)
123{
124 return (__m256i)__builtin_ia32_paddusw256((__v16hi)__a, (__v16hi)__b);
125}
126
127#define _mm256_alignr_epi8(a, b, n) __extension__ ({ \
128 __m256i __a = (a); \
129 __m256i __b = (b); \
130 (__m256i)__builtin_ia32_palignr256((__v32qi)__a, (__v32qi)__b, (n)); })
131
132static __inline__ __m256i __DEFAULT_FN_ATTRS
133_mm256_and_si256(__m256i __a, __m256i __b)
134{
135 return __a & __b;
136}
137
138static __inline__ __m256i __DEFAULT_FN_ATTRS
139_mm256_andnot_si256(__m256i __a, __m256i __b)
140{
141 return ~__a & __b;
142}
143
144static __inline__ __m256i __DEFAULT_FN_ATTRS
145_mm256_avg_epu8(__m256i __a, __m256i __b)
146{
147 return (__m256i)__builtin_ia32_pavgb256((__v32qi)__a, (__v32qi)__b);
148}
149
150static __inline__ __m256i __DEFAULT_FN_ATTRS
151_mm256_avg_epu16(__m256i __a, __m256i __b)
152{
153 return (__m256i)__builtin_ia32_pavgw256((__v16hi)__a, (__v16hi)__b);
154}
155
156static __inline__ __m256i __DEFAULT_FN_ATTRS
157_mm256_blendv_epi8(__m256i __V1, __m256i __V2, __m256i __M)
158{
159 return (__m256i)__builtin_ia32_pblendvb256((__v32qi)__V1, (__v32qi)__V2,
160 (__v32qi)__M);
161}
162
163#define _mm256_blend_epi16(V1, V2, M) __extension__ ({ \
164 __m256i __V1 = (V1); \
165 __m256i __V2 = (V2); \
166 (__m256i)__builtin_shufflevector((__v16hi)__V1, (__v16hi)__V2, \
167 (((M) & 0x01) ? 16 : 0), \
168 (((M) & 0x02) ? 17 : 1), \
169 (((M) & 0x04) ? 18 : 2), \
170 (((M) & 0x08) ? 19 : 3), \
171 (((M) & 0x10) ? 20 : 4), \
172 (((M) & 0x20) ? 21 : 5), \
173 (((M) & 0x40) ? 22 : 6), \
174 (((M) & 0x80) ? 23 : 7), \
175 (((M) & 0x01) ? 24 : 8), \
176 (((M) & 0x02) ? 25 : 9), \
177 (((M) & 0x04) ? 26 : 10), \
178 (((M) & 0x08) ? 27 : 11), \
179 (((M) & 0x10) ? 28 : 12), \
180 (((M) & 0x20) ? 29 : 13), \
181 (((M) & 0x40) ? 30 : 14), \
182 (((M) & 0x80) ? 31 : 15)); })
183
184static __inline__ __m256i __DEFAULT_FN_ATTRS
185_mm256_cmpeq_epi8(__m256i __a, __m256i __b)
186{
187 return (__m256i)((__v32qi)__a == (__v32qi)__b);
188}
189
190static __inline__ __m256i __DEFAULT_FN_ATTRS
191_mm256_cmpeq_epi16(__m256i __a, __m256i __b)
192{
193 return (__m256i)((__v16hi)__a == (__v16hi)__b);
194}
195
196static __inline__ __m256i __DEFAULT_FN_ATTRS
197_mm256_cmpeq_epi32(__m256i __a, __m256i __b)
198{
199 return (__m256i)((__v8si)__a == (__v8si)__b);
200}
201
202static __inline__ __m256i __DEFAULT_FN_ATTRS
203_mm256_cmpeq_epi64(__m256i __a, __m256i __b)
204{
205 return (__m256i)(__a == __b);
206}
207
208static __inline__ __m256i __DEFAULT_FN_ATTRS
209_mm256_cmpgt_epi8(__m256i __a, __m256i __b)
210{
211 return (__m256i)((__v32qi)__a > (__v32qi)__b);
212}
213
214static __inline__ __m256i __DEFAULT_FN_ATTRS
215_mm256_cmpgt_epi16(__m256i __a, __m256i __b)
216{
217 return (__m256i)((__v16hi)__a > (__v16hi)__b);
218}
219
220static __inline__ __m256i __DEFAULT_FN_ATTRS
221_mm256_cmpgt_epi32(__m256i __a, __m256i __b)
222{
223 return (__m256i)((__v8si)__a > (__v8si)__b);
224}
225
226static __inline__ __m256i __DEFAULT_FN_ATTRS
227_mm256_cmpgt_epi64(__m256i __a, __m256i __b)
228{
229 return (__m256i)(__a > __b);
230}
231
232static __inline__ __m256i __DEFAULT_FN_ATTRS
233_mm256_hadd_epi16(__m256i __a, __m256i __b)
234{
235 return (__m256i)__builtin_ia32_phaddw256((__v16hi)__a, (__v16hi)__b);
236}
237
238static __inline__ __m256i __DEFAULT_FN_ATTRS
239_mm256_hadd_epi32(__m256i __a, __m256i __b)
240{
241 return (__m256i)__builtin_ia32_phaddd256((__v8si)__a, (__v8si)__b);
242}
243
244static __inline__ __m256i __DEFAULT_FN_ATTRS
245_mm256_hadds_epi16(__m256i __a, __m256i __b)
246{
247 return (__m256i)__builtin_ia32_phaddsw256((__v16hi)__a, (__v16hi)__b);
248}
249
250static __inline__ __m256i __DEFAULT_FN_ATTRS
251_mm256_hsub_epi16(__m256i __a, __m256i __b)
252{
253 return (__m256i)__builtin_ia32_phsubw256((__v16hi)__a, (__v16hi)__b);
254}
255
256static __inline__ __m256i __DEFAULT_FN_ATTRS
257_mm256_hsub_epi32(__m256i __a, __m256i __b)
258{
259 return (__m256i)__builtin_ia32_phsubd256((__v8si)__a, (__v8si)__b);
260}
261
262static __inline__ __m256i __DEFAULT_FN_ATTRS
263_mm256_hsubs_epi16(__m256i __a, __m256i __b)
264{
265 return (__m256i)__builtin_ia32_phsubsw256((__v16hi)__a, (__v16hi)__b);
266}
267
268static __inline__ __m256i __DEFAULT_FN_ATTRS
269_mm256_maddubs_epi16(__m256i __a, __m256i __b)
270{
271 return (__m256i)__builtin_ia32_pmaddubsw256((__v32qi)__a, (__v32qi)__b);
272}
273
274static __inline__ __m256i __DEFAULT_FN_ATTRS
275_mm256_madd_epi16(__m256i __a, __m256i __b)
276{
277 return (__m256i)__builtin_ia32_pmaddwd256((__v16hi)__a, (__v16hi)__b);
278}
279
280static __inline__ __m256i __DEFAULT_FN_ATTRS
281_mm256_max_epi8(__m256i __a, __m256i __b)
282{
283 return (__m256i)__builtin_ia32_pmaxsb256((__v32qi)__a, (__v32qi)__b);
284}
285
286static __inline__ __m256i __DEFAULT_FN_ATTRS
287_mm256_max_epi16(__m256i __a, __m256i __b)
288{
289 return (__m256i)__builtin_ia32_pmaxsw256((__v16hi)__a, (__v16hi)__b);
290}
291
292static __inline__ __m256i __DEFAULT_FN_ATTRS
293_mm256_max_epi32(__m256i __a, __m256i __b)
294{
295 return (__m256i)__builtin_ia32_pmaxsd256((__v8si)__a, (__v8si)__b);
296}
297
298static __inline__ __m256i __DEFAULT_FN_ATTRS
299_mm256_max_epu8(__m256i __a, __m256i __b)
300{
301 return (__m256i)__builtin_ia32_pmaxub256((__v32qi)__a, (__v32qi)__b);
302}
303
304static __inline__ __m256i __DEFAULT_FN_ATTRS
305_mm256_max_epu16(__m256i __a, __m256i __b)
306{
307 return (__m256i)__builtin_ia32_pmaxuw256((__v16hi)__a, (__v16hi)__b);
308}
309
310static __inline__ __m256i __DEFAULT_FN_ATTRS
311_mm256_max_epu32(__m256i __a, __m256i __b)
312{
313 return (__m256i)__builtin_ia32_pmaxud256((__v8si)__a, (__v8si)__b);
314}
315
316static __inline__ __m256i __DEFAULT_FN_ATTRS
317_mm256_min_epi8(__m256i __a, __m256i __b)
318{
319 return (__m256i)__builtin_ia32_pminsb256((__v32qi)__a, (__v32qi)__b);
320}
321
322static __inline__ __m256i __DEFAULT_FN_ATTRS
323_mm256_min_epi16(__m256i __a, __m256i __b)
324{
325 return (__m256i)__builtin_ia32_pminsw256((__v16hi)__a, (__v16hi)__b);
326}
327
328static __inline__ __m256i __DEFAULT_FN_ATTRS
329_mm256_min_epi32(__m256i __a, __m256i __b)
330{
331 return (__m256i)__builtin_ia32_pminsd256((__v8si)__a, (__v8si)__b);
332}
333
334static __inline__ __m256i __DEFAULT_FN_ATTRS
335_mm256_min_epu8(__m256i __a, __m256i __b)
336{
337 return (__m256i)__builtin_ia32_pminub256((__v32qi)__a, (__v32qi)__b);
338}
339
340static __inline__ __m256i __DEFAULT_FN_ATTRS
341_mm256_min_epu16(__m256i __a, __m256i __b)
342{
343 return (__m256i)__builtin_ia32_pminuw256 ((__v16hi)__a, (__v16hi)__b);
344}
345
346static __inline__ __m256i __DEFAULT_FN_ATTRS
347_mm256_min_epu32(__m256i __a, __m256i __b)
348{
349 return (__m256i)__builtin_ia32_pminud256((__v8si)__a, (__v8si)__b);
350}
351
352static __inline__ int __DEFAULT_FN_ATTRS
353_mm256_movemask_epi8(__m256i __a)
354{
355 return __builtin_ia32_pmovmskb256((__v32qi)__a);
356}
357
358static __inline__ __m256i __DEFAULT_FN_ATTRS
359_mm256_cvtepi8_epi16(__m128i __V)
360{
361 return (__m256i)__builtin_ia32_pmovsxbw256((__v16qi)__V);
362}
363
364static __inline__ __m256i __DEFAULT_FN_ATTRS
365_mm256_cvtepi8_epi32(__m128i __V)
366{
367 return (__m256i)__builtin_ia32_pmovsxbd256((__v16qi)__V);
368}
369
370static __inline__ __m256i __DEFAULT_FN_ATTRS
371_mm256_cvtepi8_epi64(__m128i __V)
372{
373 return (__m256i)__builtin_ia32_pmovsxbq256((__v16qi)__V);
374}
375
376static __inline__ __m256i __DEFAULT_FN_ATTRS
377_mm256_cvtepi16_epi32(__m128i __V)
378{
379 return (__m256i)__builtin_ia32_pmovsxwd256((__v8hi)__V);
380}
381
382static __inline__ __m256i __DEFAULT_FN_ATTRS
383_mm256_cvtepi16_epi64(__m128i __V)
384{
385 return (__m256i)__builtin_ia32_pmovsxwq256((__v8hi)__V);
386}
387
388static __inline__ __m256i __DEFAULT_FN_ATTRS
389_mm256_cvtepi32_epi64(__m128i __V)
390{
391 return (__m256i)__builtin_ia32_pmovsxdq256((__v4si)__V);
392}
393
394static __inline__ __m256i __DEFAULT_FN_ATTRS
395_mm256_cvtepu8_epi16(__m128i __V)
396{
397 return (__m256i)__builtin_ia32_pmovzxbw256((__v16qi)__V);
398}
399
400static __inline__ __m256i __DEFAULT_FN_ATTRS
401_mm256_cvtepu8_epi32(__m128i __V)
402{
403 return (__m256i)__builtin_ia32_pmovzxbd256((__v16qi)__V);
404}
405
406static __inline__ __m256i __DEFAULT_FN_ATTRS
407_mm256_cvtepu8_epi64(__m128i __V)
408{
409 return (__m256i)__builtin_ia32_pmovzxbq256((__v16qi)__V);
410}
411
412static __inline__ __m256i __DEFAULT_FN_ATTRS
413_mm256_cvtepu16_epi32(__m128i __V)
414{
415 return (__m256i)__builtin_ia32_pmovzxwd256((__v8hi)__V);
416}
417
418static __inline__ __m256i __DEFAULT_FN_ATTRS
419_mm256_cvtepu16_epi64(__m128i __V)
420{
421 return (__m256i)__builtin_ia32_pmovzxwq256((__v8hi)__V);
422}
423
424static __inline__ __m256i __DEFAULT_FN_ATTRS
425_mm256_cvtepu32_epi64(__m128i __V)
426{
427 return (__m256i)__builtin_ia32_pmovzxdq256((__v4si)__V);
428}
429
430static __inline__ __m256i __DEFAULT_FN_ATTRS
431_mm256_mul_epi32(__m256i __a, __m256i __b)
432{
433 return (__m256i)__builtin_ia32_pmuldq256((__v8si)__a, (__v8si)__b);
434}
435
436static __inline__ __m256i __DEFAULT_FN_ATTRS
437_mm256_mulhrs_epi16(__m256i __a, __m256i __b)
438{
439 return (__m256i)__builtin_ia32_pmulhrsw256((__v16hi)__a, (__v16hi)__b);
440}
441
442static __inline__ __m256i __DEFAULT_FN_ATTRS
443_mm256_mulhi_epu16(__m256i __a, __m256i __b)
444{
445 return (__m256i)__builtin_ia32_pmulhuw256((__v16hi)__a, (__v16hi)__b);
446}
447
448static __inline__ __m256i __DEFAULT_FN_ATTRS
449_mm256_mulhi_epi16(__m256i __a, __m256i __b)
450{
451 return (__m256i)__builtin_ia32_pmulhw256((__v16hi)__a, (__v16hi)__b);
452}
453
454static __inline__ __m256i __DEFAULT_FN_ATTRS
455_mm256_mullo_epi16(__m256i __a, __m256i __b)
456{
457 return (__m256i)((__v16hi)__a * (__v16hi)__b);
458}
459
460static __inline__ __m256i __DEFAULT_FN_ATTRS
461_mm256_mullo_epi32 (__m256i __a, __m256i __b)
462{
463 return (__m256i)((__v8si)__a * (__v8si)__b);
464}
465
466static __inline__ __m256i __DEFAULT_FN_ATTRS
467_mm256_mul_epu32(__m256i __a, __m256i __b)
468{
469 return __builtin_ia32_pmuludq256((__v8si)__a, (__v8si)__b);
470}
471
472static __inline__ __m256i __DEFAULT_FN_ATTRS
473_mm256_or_si256(__m256i __a, __m256i __b)
474{
475 return __a | __b;
476}
477
478static __inline__ __m256i __DEFAULT_FN_ATTRS
479_mm256_sad_epu8(__m256i __a, __m256i __b)
480{
481 return __builtin_ia32_psadbw256((__v32qi)__a, (__v32qi)__b);
482}
483
484static __inline__ __m256i __DEFAULT_FN_ATTRS
485_mm256_shuffle_epi8(__m256i __a, __m256i __b)
486{
487 return (__m256i)__builtin_ia32_pshufb256((__v32qi)__a, (__v32qi)__b);
488}
489
490#define _mm256_shuffle_epi32(a, imm) __extension__ ({ \
491 __m256i __a = (a); \
492 (__m256i)__builtin_shufflevector((__v8si)__a, (__v8si)_mm256_set1_epi32(0), \
493 (imm) & 0x3, ((imm) & 0xc) >> 2, \
494 ((imm) & 0x30) >> 4, ((imm) & 0xc0) >> 6, \
495 4 + (((imm) & 0x03) >> 0), \
496 4 + (((imm) & 0x0c) >> 2), \
497 4 + (((imm) & 0x30) >> 4), \
498 4 + (((imm) & 0xc0) >> 6)); })
499
500#define _mm256_shufflehi_epi16(a, imm) __extension__ ({ \
501 __m256i __a = (a); \
502 (__m256i)__builtin_shufflevector((__v16hi)__a, (__v16hi)_mm256_set1_epi16(0), \
503 0, 1, 2, 3, \
504 4 + (((imm) & 0x03) >> 0), \
505 4 + (((imm) & 0x0c) >> 2), \
506 4 + (((imm) & 0x30) >> 4), \
507 4 + (((imm) & 0xc0) >> 6), \
508 8, 9, 10, 11, \
509 12 + (((imm) & 0x03) >> 0), \
510 12 + (((imm) & 0x0c) >> 2), \
511 12 + (((imm) & 0x30) >> 4), \
512 12 + (((imm) & 0xc0) >> 6)); })
513
514#define _mm256_shufflelo_epi16(a, imm) __extension__ ({ \
515 __m256i __a = (a); \
516 (__m256i)__builtin_shufflevector((__v16hi)__a, (__v16hi)_mm256_set1_epi16(0), \
517 (imm) & 0x3,((imm) & 0xc) >> 2, \
518 ((imm) & 0x30) >> 4, ((imm) & 0xc0) >> 6, \
519 4, 5, 6, 7, \
520 8 + (((imm) & 0x03) >> 0), \
521 8 + (((imm) & 0x0c) >> 2), \
522 8 + (((imm) & 0x30) >> 4), \
523 8 + (((imm) & 0xc0) >> 6), \
524 12, 13, 14, 15); })
525
526static __inline__ __m256i __DEFAULT_FN_ATTRS
527_mm256_sign_epi8(__m256i __a, __m256i __b)
528{
529 return (__m256i)__builtin_ia32_psignb256((__v32qi)__a, (__v32qi)__b);
530}
531
532static __inline__ __m256i __DEFAULT_FN_ATTRS
533_mm256_sign_epi16(__m256i __a, __m256i __b)
534{
535 return (__m256i)__builtin_ia32_psignw256((__v16hi)__a, (__v16hi)__b);
536}
537
538static __inline__ __m256i __DEFAULT_FN_ATTRS
539_mm256_sign_epi32(__m256i __a, __m256i __b)
540{
541 return (__m256i)__builtin_ia32_psignd256((__v8si)__a, (__v8si)__b);
542}
543
544#define _mm256_slli_si256(a, count) __extension__ ({ \
545 __m256i __a = (a); \
546 (__m256i)__builtin_ia32_pslldqi256(__a, (count)*8); })
547
548#define _mm256_bslli_epi128(a, count) _mm256_slli_si256((a), (count))
549
550static __inline__ __m256i __DEFAULT_FN_ATTRS
551_mm256_slli_epi16(__m256i __a, int __count)
552{
553 return (__m256i)__builtin_ia32_psllwi256((__v16hi)__a, __count);
554}
555
556static __inline__ __m256i __DEFAULT_FN_ATTRS
557_mm256_sll_epi16(__m256i __a, __m128i __count)
558{
559 return (__m256i)__builtin_ia32_psllw256((__v16hi)__a, (__v8hi)__count);
560}
561
562static __inline__ __m256i __DEFAULT_FN_ATTRS
563_mm256_slli_epi32(__m256i __a, int __count)
564{
565 return (__m256i)__builtin_ia32_pslldi256((__v8si)__a, __count);
566}
567
568static __inline__ __m256i __DEFAULT_FN_ATTRS
569_mm256_sll_epi32(__m256i __a, __m128i __count)
570{
571 return (__m256i)__builtin_ia32_pslld256((__v8si)__a, (__v4si)__count);
572}
573
574static __inline__ __m256i __DEFAULT_FN_ATTRS
575_mm256_slli_epi64(__m256i __a, int __count)
576{
577 return __builtin_ia32_psllqi256(__a, __count);
578}
579
580static __inline__ __m256i __DEFAULT_FN_ATTRS
581_mm256_sll_epi64(__m256i __a, __m128i __count)
582{
583 return __builtin_ia32_psllq256(__a, __count);
584}
585
586static __inline__ __m256i __DEFAULT_FN_ATTRS
587_mm256_srai_epi16(__m256i __a, int __count)
588{
589 return (__m256i)__builtin_ia32_psrawi256((__v16hi)__a, __count);
590}
591
592static __inline__ __m256i __DEFAULT_FN_ATTRS
593_mm256_sra_epi16(__m256i __a, __m128i __count)
594{
595 return (__m256i)__builtin_ia32_psraw256((__v16hi)__a, (__v8hi)__count);
596}
597
598static __inline__ __m256i __DEFAULT_FN_ATTRS
599_mm256_srai_epi32(__m256i __a, int __count)
600{
601 return (__m256i)__builtin_ia32_psradi256((__v8si)__a, __count);
602}
603
604static __inline__ __m256i __DEFAULT_FN_ATTRS
605_mm256_sra_epi32(__m256i __a, __m128i __count)
606{
607 return (__m256i)__builtin_ia32_psrad256((__v8si)__a, (__v4si)__count);
608}
609
610#define _mm256_srli_si256(a, count) __extension__ ({ \
611 __m256i __a = (a); \
612 (__m256i)__builtin_ia32_psrldqi256(__a, (count)*8); })
613
614#define _mm256_bsrli_epi128(a, count) _mm256_srli_si256((a), (count))
615
616static __inline__ __m256i __DEFAULT_FN_ATTRS
617_mm256_srli_epi16(__m256i __a, int __count)
618{
619 return (__m256i)__builtin_ia32_psrlwi256((__v16hi)__a, __count);
620}
621
622static __inline__ __m256i __DEFAULT_FN_ATTRS
623_mm256_srl_epi16(__m256i __a, __m128i __count)
624{
625 return (__m256i)__builtin_ia32_psrlw256((__v16hi)__a, (__v8hi)__count);
626}
627
628static __inline__ __m256i __DEFAULT_FN_ATTRS
629_mm256_srli_epi32(__m256i __a, int __count)
630{
631 return (__m256i)__builtin_ia32_psrldi256((__v8si)__a, __count);
632}
633
634static __inline__ __m256i __DEFAULT_FN_ATTRS
635_mm256_srl_epi32(__m256i __a, __m128i __count)
636{
637 return (__m256i)__builtin_ia32_psrld256((__v8si)__a, (__v4si)__count);
638}
639
640static __inline__ __m256i __DEFAULT_FN_ATTRS
641_mm256_srli_epi64(__m256i __a, int __count)
642{
643 return __builtin_ia32_psrlqi256(__a, __count);
644}
645
646static __inline__ __m256i __DEFAULT_FN_ATTRS
647_mm256_srl_epi64(__m256i __a, __m128i __count)
648{
649 return __builtin_ia32_psrlq256(__a, __count);
650}
651
652static __inline__ __m256i __DEFAULT_FN_ATTRS
653_mm256_sub_epi8(__m256i __a, __m256i __b)
654{
655 return (__m256i)((__v32qi)__a - (__v32qi)__b);
656}
657
658static __inline__ __m256i __DEFAULT_FN_ATTRS
659_mm256_sub_epi16(__m256i __a, __m256i __b)
660{
661 return (__m256i)((__v16hi)__a - (__v16hi)__b);
662}
663
664static __inline__ __m256i __DEFAULT_FN_ATTRS
665_mm256_sub_epi32(__m256i __a, __m256i __b)
666{
667 return (__m256i)((__v8si)__a - (__v8si)__b);
668}
669
670static __inline__ __m256i __DEFAULT_FN_ATTRS
671_mm256_sub_epi64(__m256i __a, __m256i __b)
672{
673 return __a - __b;
674}
675
676static __inline__ __m256i __DEFAULT_FN_ATTRS
677_mm256_subs_epi8(__m256i __a, __m256i __b)
678{
679 return (__m256i)__builtin_ia32_psubsb256((__v32qi)__a, (__v32qi)__b);
680}
681
682static __inline__ __m256i __DEFAULT_FN_ATTRS
683_mm256_subs_epi16(__m256i __a, __m256i __b)
684{
685 return (__m256i)__builtin_ia32_psubsw256((__v16hi)__a, (__v16hi)__b);
686}
687
688static __inline__ __m256i __DEFAULT_FN_ATTRS
689_mm256_subs_epu8(__m256i __a, __m256i __b)
690{
691 return (__m256i)__builtin_ia32_psubusb256((__v32qi)__a, (__v32qi)__b);
692}
693
694static __inline__ __m256i __DEFAULT_FN_ATTRS
695_mm256_subs_epu16(__m256i __a, __m256i __b)
696{
697 return (__m256i)__builtin_ia32_psubusw256((__v16hi)__a, (__v16hi)__b);
698}
699
700static __inline__ __m256i __DEFAULT_FN_ATTRS
701_mm256_unpackhi_epi8(__m256i __a, __m256i __b)
702{
703 return (__m256i)__builtin_shufflevector((__v32qi)__a, (__v32qi)__b, 8, 32+8, 9, 32+9, 10, 32+10, 11, 32+11, 12, 32+12, 13, 32+13, 14, 32+14, 15, 32+15, 24, 32+24, 25, 32+25, 26, 32+26, 27, 32+27, 28, 32+28, 29, 32+29, 30, 32+30, 31, 32+31);
704}
705
706static __inline__ __m256i __DEFAULT_FN_ATTRS
707_mm256_unpackhi_epi16(__m256i __a, __m256i __b)
708{
709 return (__m256i)__builtin_shufflevector((__v16hi)__a, (__v16hi)__b, 4, 16+4, 5, 16+5, 6, 16+6, 7, 16+7, 12, 16+12, 13, 16+13, 14, 16+14, 15, 16+15);
710}
711
712static __inline__ __m256i __DEFAULT_FN_ATTRS
713_mm256_unpackhi_epi32(__m256i __a, __m256i __b)
714{
715 return (__m256i)__builtin_shufflevector((__v8si)__a, (__v8si)__b, 2, 8+2, 3, 8+3, 6, 8+6, 7, 8+7);
716}
717
718static __inline__ __m256i __DEFAULT_FN_ATTRS
719_mm256_unpackhi_epi64(__m256i __a, __m256i __b)
720{
721 return (__m256i)__builtin_shufflevector(__a, __b, 1, 4+1, 3, 4+3);
722}
723
724static __inline__ __m256i __DEFAULT_FN_ATTRS
725_mm256_unpacklo_epi8(__m256i __a, __m256i __b)
726{
727 return (__m256i)__builtin_shufflevector((__v32qi)__a, (__v32qi)__b, 0, 32+0, 1, 32+1, 2, 32+2, 3, 32+3, 4, 32+4, 5, 32+5, 6, 32+6, 7, 32+7, 16, 32+16, 17, 32+17, 18, 32+18, 19, 32+19, 20, 32+20, 21, 32+21, 22, 32+22, 23, 32+23);
728}
729
730static __inline__ __m256i __DEFAULT_FN_ATTRS
731_mm256_unpacklo_epi16(__m256i __a, __m256i __b)
732{
733 return (__m256i)__builtin_shufflevector((__v16hi)__a, (__v16hi)__b, 0, 16+0, 1, 16+1, 2, 16+2, 3, 16+3, 8, 16+8, 9, 16+9, 10, 16+10, 11, 16+11);
734}
735
736static __inline__ __m256i __DEFAULT_FN_ATTRS
737_mm256_unpacklo_epi32(__m256i __a, __m256i __b)
738{
739 return (__m256i)__builtin_shufflevector((__v8si)__a, (__v8si)__b, 0, 8+0, 1, 8+1, 4, 8+4, 5, 8+5);
740}
741
742static __inline__ __m256i __DEFAULT_FN_ATTRS
743_mm256_unpacklo_epi64(__m256i __a, __m256i __b)
744{
745 return (__m256i)__builtin_shufflevector(__a, __b, 0, 4+0, 2, 4+2);
746}
747
748static __inline__ __m256i __DEFAULT_FN_ATTRS
749_mm256_xor_si256(__m256i __a, __m256i __b)
750{
751 return __a ^ __b;
752}
753
754static __inline__ __m256i __DEFAULT_FN_ATTRS
755_mm256_stream_load_si256(__m256i *__V)
756{
757 return (__m256i)__builtin_ia32_movntdqa256((__v4di *)__V);
758}
759
760static __inline__ __m128 __DEFAULT_FN_ATTRS
761_mm_broadcastss_ps(__m128 __X)
762{
763 return (__m128)__builtin_ia32_vbroadcastss_ps((__v4sf)__X);
764}
765
766static __inline__ __m128d __DEFAULT_FN_ATTRS
767_mm_broadcastsd_pd(__m128d __a)
768{
769 return __builtin_shufflevector(__a, __a, 0, 0);
770}
771
772static __inline__ __m256 __DEFAULT_FN_ATTRS
773_mm256_broadcastss_ps(__m128 __X)
774{
775 return (__m256)__builtin_ia32_vbroadcastss_ps256((__v4sf)__X);
776}
777
778static __inline__ __m256d __DEFAULT_FN_ATTRS
779_mm256_broadcastsd_pd(__m128d __X)
780{
781 return (__m256d)__builtin_ia32_vbroadcastsd_pd256((__v2df)__X);
782}
783
784static __inline__ __m256i __DEFAULT_FN_ATTRS
785_mm256_broadcastsi128_si256(__m128i __X)
786{
787 return (__m256i)__builtin_shufflevector(__X, __X, 0, 1, 0, 1);
788}
789
790#define _mm_blend_epi32(V1, V2, M) __extension__ ({ \
791 __m128i __V1 = (V1); \
792 __m128i __V2 = (V2); \
793 (__m128i)__builtin_shufflevector((__v4si)__V1, (__v4si)__V2, \
794 (((M) & 0x01) ? 4 : 0), \
795 (((M) & 0x02) ? 5 : 1), \
796 (((M) & 0x04) ? 6 : 2), \
797 (((M) & 0x08) ? 7 : 3)); })
798
799#define _mm256_blend_epi32(V1, V2, M) __extension__ ({ \
800 __m256i __V1 = (V1); \
801 __m256i __V2 = (V2); \
802 (__m256i)__builtin_shufflevector((__v8si)__V1, (__v8si)__V2, \
803 (((M) & 0x01) ? 8 : 0), \
804 (((M) & 0x02) ? 9 : 1), \
805 (((M) & 0x04) ? 10 : 2), \
806 (((M) & 0x08) ? 11 : 3), \
807 (((M) & 0x10) ? 12 : 4), \
808 (((M) & 0x20) ? 13 : 5), \
809 (((M) & 0x40) ? 14 : 6), \
810 (((M) & 0x80) ? 15 : 7)); })
811
812static __inline__ __m256i __DEFAULT_FN_ATTRS
813_mm256_broadcastb_epi8(__m128i __X)
814{
815 return (__m256i)__builtin_ia32_pbroadcastb256((__v16qi)__X);
816}
817
818static __inline__ __m256i __DEFAULT_FN_ATTRS
819_mm256_broadcastw_epi16(__m128i __X)
820{
821 return (__m256i)__builtin_ia32_pbroadcastw256((__v8hi)__X);
822}
823
824static __inline__ __m256i __DEFAULT_FN_ATTRS
825_mm256_broadcastd_epi32(__m128i __X)
826{
827 return (__m256i)__builtin_ia32_pbroadcastd256((__v4si)__X);
828}
829
830static __inline__ __m256i __DEFAULT_FN_ATTRS
831_mm256_broadcastq_epi64(__m128i __X)
832{
833 return (__m256i)__builtin_ia32_pbroadcastq256(__X);
834}
835
836static __inline__ __m128i __DEFAULT_FN_ATTRS
837_mm_broadcastb_epi8(__m128i __X)
838{
839 return (__m128i)__builtin_ia32_pbroadcastb128((__v16qi)__X);
840}
841
842static __inline__ __m128i __DEFAULT_FN_ATTRS
843_mm_broadcastw_epi16(__m128i __X)
844{
845 return (__m128i)__builtin_ia32_pbroadcastw128((__v8hi)__X);
846}
847
848
849static __inline__ __m128i __DEFAULT_FN_ATTRS
850_mm_broadcastd_epi32(__m128i __X)
851{
852 return (__m128i)__builtin_ia32_pbroadcastd128((__v4si)__X);
853}
854
855static __inline__ __m128i __DEFAULT_FN_ATTRS
856_mm_broadcastq_epi64(__m128i __X)
857{
858 return (__m128i)__builtin_ia32_pbroadcastq128(__X);
859}
860
861static __inline__ __m256i __DEFAULT_FN_ATTRS
862_mm256_permutevar8x32_epi32(__m256i __a, __m256i __b)
863{
864 return (__m256i)__builtin_ia32_permvarsi256((__v8si)__a, (__v8si)__b);
865}
866
867#define _mm256_permute4x64_pd(V, M) __extension__ ({ \
868 __m256d __V = (V); \
869 (__m256d)__builtin_shufflevector((__v4df)__V, (__v4df) _mm256_setzero_pd(), \
870 (M) & 0x3, ((M) & 0xc) >> 2, \
871 ((M) & 0x30) >> 4, ((M) & 0xc0) >> 6); })
872
873static __inline__ __m256 __DEFAULT_FN_ATTRS
874_mm256_permutevar8x32_ps(__m256 __a, __m256 __b)
875{
876 return (__m256)__builtin_ia32_permvarsf256((__v8sf)__a, (__v8sf)__b);
877}
878
879#define _mm256_permute4x64_epi64(V, M) __extension__ ({ \
880 __m256i __V = (V); \
881 (__m256i)__builtin_shufflevector((__v4di)__V, (__v4di) _mm256_setzero_si256(), \
882 (M) & 0x3, ((M) & 0xc) >> 2, \
883 ((M) & 0x30) >> 4, ((M) & 0xc0) >> 6); })
884
885#define _mm256_permute2x128_si256(V1, V2, M) __extension__ ({ \
886 __m256i __V1 = (V1); \
887 __m256i __V2 = (V2); \
888 (__m256i)__builtin_ia32_permti256(__V1, __V2, (M)); })
889
890#define _mm256_extracti128_si256(V, M) __extension__ ({ \
891 (__m128i)__builtin_shufflevector( \
892 (__v4di)(V), \
893 (__v4di)(_mm256_setzero_si256()), \
894 (((M) & 1) ? 2 : 0), \
895 (((M) & 1) ? 3 : 1) );})
896
897#define _mm256_inserti128_si256(V1, V2, M) __extension__ ({ \
898 (__m256i)__builtin_shufflevector( \
899 (__v4di)(V1), \
900 (__v4di)_mm256_castsi128_si256((__m128i)(V2)), \
901 (((M) & 1) ? 0 : 4), \
902 (((M) & 1) ? 1 : 5), \
903 (((M) & 1) ? 4 : 2), \
904 (((M) & 1) ? 5 : 3) );})
905
906static __inline__ __m256i __DEFAULT_FN_ATTRS
907_mm256_maskload_epi32(int const *__X, __m256i __M)
908{
909 return (__m256i)__builtin_ia32_maskloadd256((const __v8si *)__X, (__v8si)__M);
910}
911
912static __inline__ __m256i __DEFAULT_FN_ATTRS
913_mm256_maskload_epi64(long long const *__X, __m256i __M)
914{
915 return (__m256i)__builtin_ia32_maskloadq256((const __v4di *)__X, __M);
916}
917
918static __inline__ __m128i __DEFAULT_FN_ATTRS
919_mm_maskload_epi32(int const *__X, __m128i __M)
920{
921 return (__m128i)__builtin_ia32_maskloadd((const __v4si *)__X, (__v4si)__M);
922}
923
924static __inline__ __m128i __DEFAULT_FN_ATTRS
925_mm_maskload_epi64(long long const *__X, __m128i __M)
926{
927 return (__m128i)__builtin_ia32_maskloadq((const __v2di *)__X, (__v2di)__M);
928}
929
930static __inline__ void __DEFAULT_FN_ATTRS
931_mm256_maskstore_epi32(int *__X, __m256i __M, __m256i __Y)
932{
933 __builtin_ia32_maskstored256((__v8si *)__X, (__v8si)__M, (__v8si)__Y);
934}
935
936static __inline__ void __DEFAULT_FN_ATTRS
937_mm256_maskstore_epi64(long long *__X, __m256i __M, __m256i __Y)
938{
939 __builtin_ia32_maskstoreq256((__v4di *)__X, __M, __Y);
940}
941
942static __inline__ void __DEFAULT_FN_ATTRS
943_mm_maskstore_epi32(int *__X, __m128i __M, __m128i __Y)
944{
945 __builtin_ia32_maskstored((__v4si *)__X, (__v4si)__M, (__v4si)__Y);
946}
947
948static __inline__ void __DEFAULT_FN_ATTRS
949_mm_maskstore_epi64(long long *__X, __m128i __M, __m128i __Y)
950{
951 __builtin_ia32_maskstoreq(( __v2di *)__X, __M, __Y);
952}
953
954static __inline__ __m256i __DEFAULT_FN_ATTRS
955_mm256_sllv_epi32(__m256i __X, __m256i __Y)
956{
957 return (__m256i)__builtin_ia32_psllv8si((__v8si)__X, (__v8si)__Y);
958}
959
960static __inline__ __m128i __DEFAULT_FN_ATTRS
961_mm_sllv_epi32(__m128i __X, __m128i __Y)
962{
963 return (__m128i)__builtin_ia32_psllv4si((__v4si)__X, (__v4si)__Y);
964}
965
966static __inline__ __m256i __DEFAULT_FN_ATTRS
967_mm256_sllv_epi64(__m256i __X, __m256i __Y)
968{
969 return (__m256i)__builtin_ia32_psllv4di(__X, __Y);
970}
971
972static __inline__ __m128i __DEFAULT_FN_ATTRS
973_mm_sllv_epi64(__m128i __X, __m128i __Y)
974{
975 return (__m128i)__builtin_ia32_psllv2di(__X, __Y);
976}
977
978static __inline__ __m256i __DEFAULT_FN_ATTRS
979_mm256_srav_epi32(__m256i __X, __m256i __Y)
980{
981 return (__m256i)__builtin_ia32_psrav8si((__v8si)__X, (__v8si)__Y);
982}
983
984static __inline__ __m128i __DEFAULT_FN_ATTRS
985_mm_srav_epi32(__m128i __X, __m128i __Y)
986{
987 return (__m128i)__builtin_ia32_psrav4si((__v4si)__X, (__v4si)__Y);
988}
989
990static __inline__ __m256i __DEFAULT_FN_ATTRS
991_mm256_srlv_epi32(__m256i __X, __m256i __Y)
992{
993 return (__m256i)__builtin_ia32_psrlv8si((__v8si)__X, (__v8si)__Y);
994}
995
996static __inline__ __m128i __DEFAULT_FN_ATTRS
997_mm_srlv_epi32(__m128i __X, __m128i __Y)
998{
999 return (__m128i)__builtin_ia32_psrlv4si((__v4si)__X, (__v4si)__Y);
1000}
1001
1002static __inline__ __m256i __DEFAULT_FN_ATTRS
1003_mm256_srlv_epi64(__m256i __X, __m256i __Y)
1004{
1005 return (__m256i)__builtin_ia32_psrlv4di(__X, __Y);
1006}
1007
1008static __inline__ __m128i __DEFAULT_FN_ATTRS
1009_mm_srlv_epi64(__m128i __X, __m128i __Y)
1010{
1011 return (__m128i)__builtin_ia32_psrlv2di(__X, __Y);
1012}
1013
1014#define _mm_mask_i32gather_pd(a, m, i, mask, s) __extension__ ({ \
1015 __m128d __a = (a); \
1016 double const *__m = (m); \
1017 __m128i __i = (i); \
1018 __m128d __mask = (mask); \
1019 (__m128d)__builtin_ia32_gatherd_pd((__v2df)__a, (const __v2df *)__m, \
1020 (__v4si)__i, (__v2df)__mask, (s)); })
1021
1022#define _mm256_mask_i32gather_pd(a, m, i, mask, s) __extension__ ({ \
1023 __m256d __a = (a); \
1024 double const *__m = (m); \
1025 __m128i __i = (i); \
1026 __m256d __mask = (mask); \
1027 (__m256d)__builtin_ia32_gatherd_pd256((__v4df)__a, (const __v4df *)__m, \
1028 (__v4si)__i, (__v4df)__mask, (s)); })
1029
1030#define _mm_mask_i64gather_pd(a, m, i, mask, s) __extension__ ({ \
1031 __m128d __a = (a); \
1032 double const *__m = (m); \
1033 __m128i __i = (i); \
1034 __m128d __mask = (mask); \
1035 (__m128d)__builtin_ia32_gatherq_pd((__v2df)__a, (const __v2df *)__m, \
1036 (__v2di)__i, (__v2df)__mask, (s)); })
1037
1038#define _mm256_mask_i64gather_pd(a, m, i, mask, s) __extension__ ({ \
1039 __m256d __a = (a); \
1040 double const *__m = (m); \
1041 __m256i __i = (i); \
1042 __m256d __mask = (mask); \
1043 (__m256d)__builtin_ia32_gatherq_pd256((__v4df)__a, (const __v4df *)__m, \
1044 (__v4di)__i, (__v4df)__mask, (s)); })
1045
1046#define _mm_mask_i32gather_ps(a, m, i, mask, s) __extension__ ({ \
1047 __m128 __a = (a); \
1048 float const *__m = (m); \
1049 __m128i __i = (i); \
1050 __m128 __mask = (mask); \
1051 (__m128)__builtin_ia32_gatherd_ps((__v4sf)__a, (const __v4sf *)__m, \
1052 (__v4si)__i, (__v4sf)__mask, (s)); })
1053
1054#define _mm256_mask_i32gather_ps(a, m, i, mask, s) __extension__ ({ \
1055 __m256 __a = (a); \
1056 float const *__m = (m); \
1057 __m256i __i = (i); \
1058 __m256 __mask = (mask); \
1059 (__m256)__builtin_ia32_gatherd_ps256((__v8sf)__a, (const __v8sf *)__m, \
1060 (__v8si)__i, (__v8sf)__mask, (s)); })
1061
1062#define _mm_mask_i64gather_ps(a, m, i, mask, s) __extension__ ({ \
1063 __m128 __a = (a); \
1064 float const *__m = (m); \
1065 __m128i __i = (i); \
1066 __m128 __mask = (mask); \
1067 (__m128)__builtin_ia32_gatherq_ps((__v4sf)__a, (const __v4sf *)__m, \
1068 (__v2di)__i, (__v4sf)__mask, (s)); })
1069
1070#define _mm256_mask_i64gather_ps(a, m, i, mask, s) __extension__ ({ \
1071 __m128 __a = (a); \
1072 float const *__m = (m); \
1073 __m256i __i = (i); \
1074 __m128 __mask = (mask); \
1075 (__m128)__builtin_ia32_gatherq_ps256((__v4sf)__a, (const __v4sf *)__m, \
1076 (__v4di)__i, (__v4sf)__mask, (s)); })
1077
1078#define _mm_mask_i32gather_epi32(a, m, i, mask, s) __extension__ ({ \
1079 __m128i __a = (a); \
1080 int const *__m = (m); \
1081 __m128i __i = (i); \
1082 __m128i __mask = (mask); \
1083 (__m128i)__builtin_ia32_gatherd_d((__v4si)__a, (const __v4si *)__m, \
1084 (__v4si)__i, (__v4si)__mask, (s)); })
1085
1086#define _mm256_mask_i32gather_epi32(a, m, i, mask, s) __extension__ ({ \
1087 __m256i __a = (a); \
1088 int const *__m = (m); \
1089 __m256i __i = (i); \
1090 __m256i __mask = (mask); \
1091 (__m256i)__builtin_ia32_gatherd_d256((__v8si)__a, (const __v8si *)__m, \
1092 (__v8si)__i, (__v8si)__mask, (s)); })
1093
1094#define _mm_mask_i64gather_epi32(a, m, i, mask, s) __extension__ ({ \
1095 __m128i __a = (a); \
1096 int const *__m = (m); \
1097 __m128i __i = (i); \
1098 __m128i __mask = (mask); \
1099 (__m128i)__builtin_ia32_gatherq_d((__v4si)__a, (const __v4si *)__m, \
1100 (__v2di)__i, (__v4si)__mask, (s)); })
1101
1102#define _mm256_mask_i64gather_epi32(a, m, i, mask, s) __extension__ ({ \
1103 __m128i __a = (a); \
1104 int const *__m = (m); \
1105 __m256i __i = (i); \
1106 __m128i __mask = (mask); \
1107 (__m128i)__builtin_ia32_gatherq_d256((__v4si)__a, (const __v4si *)__m, \
1108 (__v4di)__i, (__v4si)__mask, (s)); })
1109
1110#define _mm_mask_i32gather_epi64(a, m, i, mask, s) __extension__ ({ \
1111 __m128i __a = (a); \
1112 long long const *__m = (m); \
1113 __m128i __i = (i); \
1114 __m128i __mask = (mask); \
1115 (__m128i)__builtin_ia32_gatherd_q((__v2di)__a, (const __v2di *)__m, \
1116 (__v4si)__i, (__v2di)__mask, (s)); })
1117
1118#define _mm256_mask_i32gather_epi64(a, m, i, mask, s) __extension__ ({ \
1119 __m256i __a = (a); \
1120 long long const *__m = (m); \
1121 __m128i __i = (i); \
1122 __m256i __mask = (mask); \
1123 (__m256i)__builtin_ia32_gatherd_q256((__v4di)__a, (const __v4di *)__m, \
1124 (__v4si)__i, (__v4di)__mask, (s)); })
1125
1126#define _mm_mask_i64gather_epi64(a, m, i, mask, s) __extension__ ({ \
1127 __m128i __a = (a); \
1128 long long const *__m = (m); \
1129 __m128i __i = (i); \
1130 __m128i __mask = (mask); \
1131 (__m128i)__builtin_ia32_gatherq_q((__v2di)__a, (const __v2di *)__m, \
1132 (__v2di)__i, (__v2di)__mask, (s)); })
1133
1134#define _mm256_mask_i64gather_epi64(a, m, i, mask, s) __extension__ ({ \
1135 __m256i __a = (a); \
1136 long long const *__m = (m); \
1137 __m256i __i = (i); \
1138 __m256i __mask = (mask); \
1139 (__m256i)__builtin_ia32_gatherq_q256((__v4di)__a, (const __v4di *)__m, \
1140 (__v4di)__i, (__v4di)__mask, (s)); })
1141
1142#define _mm_i32gather_pd(m, i, s) __extension__ ({ \
1143 double const *__m = (m); \
1144 __m128i __i = (i); \
1145 (__m128d)__builtin_ia32_gatherd_pd((__v2df)_mm_setzero_pd(), \
1146 (const __v2df *)__m, (__v4si)__i, \
1147 (__v2df)_mm_set1_pd((double)(long long int)-1), (s)); })
1148
1149#define _mm256_i32gather_pd(m, i, s) __extension__ ({ \
1150 double const *__m = (m); \
1151 __m128i __i = (i); \
1152 (__m256d)__builtin_ia32_gatherd_pd256((__v4df)_mm256_setzero_pd(), \
1153 (const __v4df *)__m, (__v4si)__i, \
1154 (__v4df)_mm256_set1_pd((double)(long long int)-1), (s)); })
1155
1156#define _mm_i64gather_pd(m, i, s) __extension__ ({ \
1157 double const *__m = (m); \
1158 __m128i __i = (i); \
1159 (__m128d)__builtin_ia32_gatherq_pd((__v2df)_mm_setzero_pd(), \
1160 (const __v2df *)__m, (__v2di)__i, \
1161 (__v2df)_mm_set1_pd((double)(long long int)-1), (s)); })
1162
1163#define _mm256_i64gather_pd(m, i, s) __extension__ ({ \
1164 double const *__m = (m); \
1165 __m256i __i = (i); \
1166 (__m256d)__builtin_ia32_gatherq_pd256((__v4df)_mm256_setzero_pd(), \
1167 (const __v4df *)__m, (__v4di)__i, \
1168 (__v4df)_mm256_set1_pd((double)(long long int)-1), (s)); })
1169
1170#define _mm_i32gather_ps(m, i, s) __extension__ ({ \
1171 float const *__m = (m); \
1172 __m128i __i = (i); \
1173 (__m128)__builtin_ia32_gatherd_ps((__v4sf)_mm_setzero_ps(), \
1174 (const __v4sf *)__m, (__v4si)__i, \
1175 (__v4sf)_mm_set1_ps((float)(int)-1), (s)); })
1176
1177#define _mm256_i32gather_ps(m, i, s) __extension__ ({ \
1178 float const *__m = (m); \
1179 __m256i __i = (i); \
1180 (__m256)__builtin_ia32_gatherd_ps256((__v8sf)_mm256_setzero_ps(), \
1181 (const __v8sf *)__m, (__v8si)__i, \
1182 (__v8sf)_mm256_set1_ps((float)(int)-1), (s)); })
1183
1184#define _mm_i64gather_ps(m, i, s) __extension__ ({ \
1185 float const *__m = (m); \
1186 __m128i __i = (i); \
1187 (__m128)__builtin_ia32_gatherq_ps((__v4sf)_mm_setzero_ps(), \
1188 (const __v4sf *)__m, (__v2di)__i, \
1189 (__v4sf)_mm_set1_ps((float)(int)-1), (s)); })
1190
1191#define _mm256_i64gather_ps(m, i, s) __extension__ ({ \
1192 float const *__m = (m); \
1193 __m256i __i = (i); \
1194 (__m128)__builtin_ia32_gatherq_ps256((__v4sf)_mm_setzero_ps(), \
1195 (const __v4sf *)__m, (__v4di)__i, \
1196 (__v4sf)_mm_set1_ps((float)(int)-1), (s)); })
1197
1198#define _mm_i32gather_epi32(m, i, s) __extension__ ({ \
1199 int const *__m = (m); \
1200 __m128i __i = (i); \
1201 (__m128i)__builtin_ia32_gatherd_d((__v4si)_mm_setzero_si128(), \
1202 (const __v4si *)__m, (__v4si)__i, \
1203 (__v4si)_mm_set1_epi32(-1), (s)); })
1204
1205#define _mm256_i32gather_epi32(m, i, s) __extension__ ({ \
1206 int const *__m = (m); \
1207 __m256i __i = (i); \
1208 (__m256i)__builtin_ia32_gatherd_d256((__v8si)_mm256_setzero_si256(), \
1209 (const __v8si *)__m, (__v8si)__i, \
1210 (__v8si)_mm256_set1_epi32(-1), (s)); })
1211
1212#define _mm_i64gather_epi32(m, i, s) __extension__ ({ \
1213 int const *__m = (m); \
1214 __m128i __i = (i); \
1215 (__m128i)__builtin_ia32_gatherq_d((__v4si)_mm_setzero_si128(), \
1216 (const __v4si *)__m, (__v2di)__i, \
1217 (__v4si)_mm_set1_epi32(-1), (s)); })
1218
1219#define _mm256_i64gather_epi32(m, i, s) __extension__ ({ \
1220 int const *__m = (m); \
1221 __m256i __i = (i); \
1222 (__m128i)__builtin_ia32_gatherq_d256((__v4si)_mm_setzero_si128(), \
1223 (const __v4si *)__m, (__v4di)__i, \
1224 (__v4si)_mm_set1_epi32(-1), (s)); })
1225
1226#define _mm_i32gather_epi64(m, i, s) __extension__ ({ \
1227 long long const *__m = (m); \
1228 __m128i __i = (i); \
1229 (__m128i)__builtin_ia32_gatherd_q((__v2di)_mm_setzero_si128(), \
1230 (const __v2di *)__m, (__v4si)__i, \
1231 (__v2di)_mm_set1_epi64x(-1), (s)); })
1232
1233#define _mm256_i32gather_epi64(m, i, s) __extension__ ({ \
1234 long long const *__m = (m); \
1235 __m128i __i = (i); \
1236 (__m256i)__builtin_ia32_gatherd_q256((__v4di)_mm256_setzero_si256(), \
1237 (const __v4di *)__m, (__v4si)__i, \
1238 (__v4di)_mm256_set1_epi64x(-1), (s)); })
1239
1240#define _mm_i64gather_epi64(m, i, s) __extension__ ({ \
1241 long long const *__m = (m); \
1242 __m128i __i = (i); \
1243 (__m128i)__builtin_ia32_gatherq_q((__v2di)_mm_setzero_si128(), \
1244 (const __v2di *)__m, (__v2di)__i, \
1245 (__v2di)_mm_set1_epi64x(-1), (s)); })
1246
1247#define _mm256_i64gather_epi64(m, i, s) __extension__ ({ \
1248 long long const *__m = (m); \
1249 __m256i __i = (i); \
1250 (__m256i)__builtin_ia32_gatherq_q256((__v4di)_mm256_setzero_si256(), \
1251 (const __v4di *)__m, (__v4di)__i, \
1252 (__v4di)_mm256_set1_epi64x(-1), (s)); })
1253
1254#undef __DEFAULT_FN_ATTRS
1255
1256#endif /* __AVX2INTRIN_H */
c_headers/avx512bwintrin.h created+1250
......@@ -0,0 +1,1250 @@
1/*===------------- avx512bwintrin.h - AVX512BW intrinsics ------------------===
2 *
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 *
22 *===-----------------------------------------------------------------------===
23 */
24#ifndef __IMMINTRIN_H
25#error "Never use <avx512bwintrin.h> directly; include <immintrin.h> instead."
26#endif
27
28#ifndef __AVX512BWINTRIN_H
29#define __AVX512BWINTRIN_H
30
31typedef unsigned int __mmask32;
32typedef unsigned long long __mmask64;
33typedef char __v64qi __attribute__ ((__vector_size__ (64)));
34typedef short __v32hi __attribute__ ((__vector_size__ (64)));
35
36/* Define the default attributes for the functions in this file. */
37#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
38
39static __inline __v64qi __DEFAULT_FN_ATTRS
40_mm512_setzero_qi (void) {
41 return (__v64qi){ 0, 0, 0, 0, 0, 0, 0, 0,
42 0, 0, 0, 0, 0, 0, 0, 0,
43 0, 0, 0, 0, 0, 0, 0, 0,
44 0, 0, 0, 0, 0, 0, 0, 0,
45 0, 0, 0, 0, 0, 0, 0, 0,
46 0, 0, 0, 0, 0, 0, 0, 0,
47 0, 0, 0, 0, 0, 0, 0, 0,
48 0, 0, 0, 0, 0, 0, 0, 0 };
49}
50
51static __inline __v32hi __DEFAULT_FN_ATTRS
52_mm512_setzero_hi (void) {
53 return (__v32hi){ 0, 0, 0, 0, 0, 0, 0, 0,
54 0, 0, 0, 0, 0, 0, 0, 0,
55 0, 0, 0, 0, 0, 0, 0, 0,
56 0, 0, 0, 0, 0, 0, 0, 0 };
57}
58
59/* Integer compare */
60
61static __inline__ __mmask64 __DEFAULT_FN_ATTRS
62_mm512_cmpeq_epi8_mask(__m512i __a, __m512i __b) {
63 return (__mmask64)__builtin_ia32_pcmpeqb512_mask((__v64qi)__a, (__v64qi)__b,
64 (__mmask64)-1);
65}
66
67static __inline__ __mmask64 __DEFAULT_FN_ATTRS
68_mm512_mask_cmpeq_epi8_mask(__mmask64 __u, __m512i __a, __m512i __b) {
69 return (__mmask64)__builtin_ia32_pcmpeqb512_mask((__v64qi)__a, (__v64qi)__b,
70 __u);
71}
72
73static __inline__ __mmask64 __DEFAULT_FN_ATTRS
74_mm512_cmpeq_epu8_mask(__m512i __a, __m512i __b) {
75 return (__mmask64)__builtin_ia32_ucmpb512_mask((__v64qi)__a, (__v64qi)__b, 0,
76 (__mmask64)-1);
77}
78
79static __inline__ __mmask64 __DEFAULT_FN_ATTRS
80_mm512_mask_cmpeq_epu8_mask(__mmask64 __u, __m512i __a, __m512i __b) {
81 return (__mmask64)__builtin_ia32_ucmpb512_mask((__v64qi)__a, (__v64qi)__b, 0,
82 __u);
83}
84
85static __inline__ __mmask32 __DEFAULT_FN_ATTRS
86_mm512_cmpeq_epi16_mask(__m512i __a, __m512i __b) {
87 return (__mmask32)__builtin_ia32_pcmpeqw512_mask((__v32hi)__a, (__v32hi)__b,
88 (__mmask32)-1);
89}
90
91static __inline__ __mmask32 __DEFAULT_FN_ATTRS
92_mm512_mask_cmpeq_epi16_mask(__mmask32 __u, __m512i __a, __m512i __b) {
93 return (__mmask32)__builtin_ia32_pcmpeqw512_mask((__v32hi)__a, (__v32hi)__b,
94 __u);
95}
96
97static __inline__ __mmask32 __DEFAULT_FN_ATTRS
98_mm512_cmpeq_epu16_mask(__m512i __a, __m512i __b) {
99 return (__mmask32)__builtin_ia32_ucmpw512_mask((__v32hi)__a, (__v32hi)__b, 0,
100 (__mmask32)-1);
101}
102
103static __inline__ __mmask32 __DEFAULT_FN_ATTRS
104_mm512_mask_cmpeq_epu16_mask(__mmask32 __u, __m512i __a, __m512i __b) {
105 return (__mmask32)__builtin_ia32_ucmpw512_mask((__v32hi)__a, (__v32hi)__b, 0,
106 __u);
107}
108
109static __inline__ __mmask64 __DEFAULT_FN_ATTRS
110_mm512_cmpge_epi8_mask(__m512i __a, __m512i __b) {
111 return (__mmask64)__builtin_ia32_cmpb512_mask((__v64qi)__a, (__v64qi)__b, 5,
112 (__mmask64)-1);
113}
114
115static __inline__ __mmask64 __DEFAULT_FN_ATTRS
116_mm512_mask_cmpge_epi8_mask(__mmask64 __u, __m512i __a, __m512i __b) {
117 return (__mmask64)__builtin_ia32_cmpb512_mask((__v64qi)__a, (__v64qi)__b, 5,
118 __u);
119}
120
121static __inline__ __mmask64 __DEFAULT_FN_ATTRS
122_mm512_cmpge_epu8_mask(__m512i __a, __m512i __b) {
123 return (__mmask64)__builtin_ia32_ucmpb512_mask((__v64qi)__a, (__v64qi)__b, 5,
124 (__mmask64)-1);
125}
126
127static __inline__ __mmask64 __DEFAULT_FN_ATTRS
128_mm512_mask_cmpge_epu8_mask(__mmask64 __u, __m512i __a, __m512i __b) {
129 return (__mmask64)__builtin_ia32_ucmpb512_mask((__v64qi)__a, (__v64qi)__b, 5,
130 __u);
131}
132
133static __inline__ __mmask32 __DEFAULT_FN_ATTRS
134_mm512_cmpge_epi16_mask(__m512i __a, __m512i __b) {
135 return (__mmask32)__builtin_ia32_cmpw512_mask((__v32hi)__a, (__v32hi)__b, 5,
136 (__mmask32)-1);
137}
138
139static __inline__ __mmask32 __DEFAULT_FN_ATTRS
140_mm512_mask_cmpge_epi16_mask(__mmask32 __u, __m512i __a, __m512i __b) {
141 return (__mmask32)__builtin_ia32_cmpw512_mask((__v32hi)__a, (__v32hi)__b, 5,
142 __u);
143}
144
145static __inline__ __mmask32 __DEFAULT_FN_ATTRS
146_mm512_cmpge_epu16_mask(__m512i __a, __m512i __b) {
147 return (__mmask32)__builtin_ia32_ucmpw512_mask((__v32hi)__a, (__v32hi)__b, 5,
148 (__mmask32)-1);
149}
150
151static __inline__ __mmask32 __DEFAULT_FN_ATTRS
152_mm512_mask_cmpge_epu16_mask(__mmask32 __u, __m512i __a, __m512i __b) {
153 return (__mmask32)__builtin_ia32_ucmpw512_mask((__v32hi)__a, (__v32hi)__b, 5,
154 __u);
155}
156
157static __inline__ __mmask64 __DEFAULT_FN_ATTRS
158_mm512_cmpgt_epi8_mask(__m512i __a, __m512i __b) {
159 return (__mmask64)__builtin_ia32_pcmpgtb512_mask((__v64qi)__a, (__v64qi)__b,
160 (__mmask64)-1);
161}
162
163static __inline__ __mmask64 __DEFAULT_FN_ATTRS
164_mm512_mask_cmpgt_epi8_mask(__mmask64 __u, __m512i __a, __m512i __b) {
165 return (__mmask64)__builtin_ia32_pcmpgtb512_mask((__v64qi)__a, (__v64qi)__b,
166 __u);
167}
168
169static __inline__ __mmask64 __DEFAULT_FN_ATTRS
170_mm512_cmpgt_epu8_mask(__m512i __a, __m512i __b) {
171 return (__mmask64)__builtin_ia32_ucmpb512_mask((__v64qi)__a, (__v64qi)__b, 6,
172 (__mmask64)-1);
173}
174
175static __inline__ __mmask64 __DEFAULT_FN_ATTRS
176_mm512_mask_cmpgt_epu8_mask(__mmask64 __u, __m512i __a, __m512i __b) {
177 return (__mmask64)__builtin_ia32_ucmpb512_mask((__v64qi)__a, (__v64qi)__b, 6,
178 __u);
179}
180
181static __inline__ __mmask32 __DEFAULT_FN_ATTRS
182_mm512_cmpgt_epi16_mask(__m512i __a, __m512i __b) {
183 return (__mmask32)__builtin_ia32_pcmpgtw512_mask((__v32hi)__a, (__v32hi)__b,
184 (__mmask32)-1);
185}
186
187static __inline__ __mmask32 __DEFAULT_FN_ATTRS
188_mm512_mask_cmpgt_epi16_mask(__mmask32 __u, __m512i __a, __m512i __b) {
189 return (__mmask32)__builtin_ia32_pcmpgtw512_mask((__v32hi)__a, (__v32hi)__b,
190 __u);
191}
192
193static __inline__ __mmask32 __DEFAULT_FN_ATTRS
194_mm512_cmpgt_epu16_mask(__m512i __a, __m512i __b) {
195 return (__mmask32)__builtin_ia32_ucmpw512_mask((__v32hi)__a, (__v32hi)__b, 6,
196 (__mmask32)-1);
197}
198
199static __inline__ __mmask32 __DEFAULT_FN_ATTRS
200_mm512_mask_cmpgt_epu16_mask(__mmask32 __u, __m512i __a, __m512i __b) {
201 return (__mmask32)__builtin_ia32_ucmpw512_mask((__v32hi)__a, (__v32hi)__b, 6,
202 __u);
203}
204
205static __inline__ __mmask64 __DEFAULT_FN_ATTRS
206_mm512_cmple_epi8_mask(__m512i __a, __m512i __b) {
207 return (__mmask64)__builtin_ia32_cmpb512_mask((__v64qi)__a, (__v64qi)__b, 2,
208 (__mmask64)-1);
209}
210
211static __inline__ __mmask64 __DEFAULT_FN_ATTRS
212_mm512_mask_cmple_epi8_mask(__mmask64 __u, __m512i __a, __m512i __b) {
213 return (__mmask64)__builtin_ia32_cmpb512_mask((__v64qi)__a, (__v64qi)__b, 2,
214 __u);
215}
216
217static __inline__ __mmask64 __DEFAULT_FN_ATTRS
218_mm512_cmple_epu8_mask(__m512i __a, __m512i __b) {
219 return (__mmask64)__builtin_ia32_ucmpb512_mask((__v64qi)__a, (__v64qi)__b, 2,
220 (__mmask64)-1);
221}
222
223static __inline__ __mmask64 __DEFAULT_FN_ATTRS
224_mm512_mask_cmple_epu8_mask(__mmask64 __u, __m512i __a, __m512i __b) {
225 return (__mmask64)__builtin_ia32_ucmpb512_mask((__v64qi)__a, (__v64qi)__b, 2,
226 __u);
227}
228
229static __inline__ __mmask32 __DEFAULT_FN_ATTRS
230_mm512_cmple_epi16_mask(__m512i __a, __m512i __b) {
231 return (__mmask32)__builtin_ia32_cmpw512_mask((__v32hi)__a, (__v32hi)__b, 2,
232 (__mmask32)-1);
233}
234
235static __inline__ __mmask32 __DEFAULT_FN_ATTRS
236_mm512_mask_cmple_epi16_mask(__mmask32 __u, __m512i __a, __m512i __b) {
237 return (__mmask32)__builtin_ia32_cmpw512_mask((__v32hi)__a, (__v32hi)__b, 2,
238 __u);
239}
240
241static __inline__ __mmask32 __DEFAULT_FN_ATTRS
242_mm512_cmple_epu16_mask(__m512i __a, __m512i __b) {
243 return (__mmask32)__builtin_ia32_ucmpw512_mask((__v32hi)__a, (__v32hi)__b, 2,
244 (__mmask32)-1);
245}
246
247static __inline__ __mmask32 __DEFAULT_FN_ATTRS
248_mm512_mask_cmple_epu16_mask(__mmask32 __u, __m512i __a, __m512i __b) {
249 return (__mmask32)__builtin_ia32_ucmpw512_mask((__v32hi)__a, (__v32hi)__b, 2,
250 __u);
251}
252
253static __inline__ __mmask64 __DEFAULT_FN_ATTRS
254_mm512_cmplt_epi8_mask(__m512i __a, __m512i __b) {
255 return (__mmask64)__builtin_ia32_cmpb512_mask((__v64qi)__a, (__v64qi)__b, 1,
256 (__mmask64)-1);
257}
258
259static __inline__ __mmask64 __DEFAULT_FN_ATTRS
260_mm512_mask_cmplt_epi8_mask(__mmask64 __u, __m512i __a, __m512i __b) {
261 return (__mmask64)__builtin_ia32_cmpb512_mask((__v64qi)__a, (__v64qi)__b, 1,
262 __u);
263}
264
265static __inline__ __mmask64 __DEFAULT_FN_ATTRS
266_mm512_cmplt_epu8_mask(__m512i __a, __m512i __b) {
267 return (__mmask64)__builtin_ia32_ucmpb512_mask((__v64qi)__a, (__v64qi)__b, 1,
268 (__mmask64)-1);
269}
270
271static __inline__ __mmask64 __DEFAULT_FN_ATTRS
272_mm512_mask_cmplt_epu8_mask(__mmask64 __u, __m512i __a, __m512i __b) {
273 return (__mmask64)__builtin_ia32_ucmpb512_mask((__v64qi)__a, (__v64qi)__b, 1,
274 __u);
275}
276
277static __inline__ __mmask32 __DEFAULT_FN_ATTRS
278_mm512_cmplt_epi16_mask(__m512i __a, __m512i __b) {
279 return (__mmask32)__builtin_ia32_cmpw512_mask((__v32hi)__a, (__v32hi)__b, 1,
280 (__mmask32)-1);
281}
282
283static __inline__ __mmask32 __DEFAULT_FN_ATTRS
284_mm512_mask_cmplt_epi16_mask(__mmask32 __u, __m512i __a, __m512i __b) {
285 return (__mmask32)__builtin_ia32_cmpw512_mask((__v32hi)__a, (__v32hi)__b, 1,
286 __u);
287}
288
289static __inline__ __mmask32 __DEFAULT_FN_ATTRS
290_mm512_cmplt_epu16_mask(__m512i __a, __m512i __b) {
291 return (__mmask32)__builtin_ia32_ucmpw512_mask((__v32hi)__a, (__v32hi)__b, 1,
292 (__mmask32)-1);
293}
294
295static __inline__ __mmask32 __DEFAULT_FN_ATTRS
296_mm512_mask_cmplt_epu16_mask(__mmask32 __u, __m512i __a, __m512i __b) {
297 return (__mmask32)__builtin_ia32_ucmpw512_mask((__v32hi)__a, (__v32hi)__b, 1,
298 __u);
299}
300
301static __inline__ __mmask64 __DEFAULT_FN_ATTRS
302_mm512_cmpneq_epi8_mask(__m512i __a, __m512i __b) {
303 return (__mmask64)__builtin_ia32_cmpb512_mask((__v64qi)__a, (__v64qi)__b, 4,
304 (__mmask64)-1);
305}
306
307static __inline__ __mmask64 __DEFAULT_FN_ATTRS
308_mm512_mask_cmpneq_epi8_mask(__mmask64 __u, __m512i __a, __m512i __b) {
309 return (__mmask64)__builtin_ia32_cmpb512_mask((__v64qi)__a, (__v64qi)__b, 4,
310 __u);
311}
312
313static __inline__ __mmask64 __DEFAULT_FN_ATTRS
314_mm512_cmpneq_epu8_mask(__m512i __a, __m512i __b) {
315 return (__mmask64)__builtin_ia32_ucmpb512_mask((__v64qi)__a, (__v64qi)__b, 4,
316 (__mmask64)-1);
317}
318
319static __inline__ __mmask64 __DEFAULT_FN_ATTRS
320_mm512_mask_cmpneq_epu8_mask(__mmask64 __u, __m512i __a, __m512i __b) {
321 return (__mmask64)__builtin_ia32_ucmpb512_mask((__v64qi)__a, (__v64qi)__b, 4,
322 __u);
323}
324
325static __inline__ __mmask32 __DEFAULT_FN_ATTRS
326_mm512_cmpneq_epi16_mask(__m512i __a, __m512i __b) {
327 return (__mmask32)__builtin_ia32_cmpw512_mask((__v32hi)__a, (__v32hi)__b, 4,
328 (__mmask32)-1);
329}
330
331static __inline__ __mmask32 __DEFAULT_FN_ATTRS
332_mm512_mask_cmpneq_epi16_mask(__mmask32 __u, __m512i __a, __m512i __b) {
333 return (__mmask32)__builtin_ia32_cmpw512_mask((__v32hi)__a, (__v32hi)__b, 4,
334 __u);
335}
336
337static __inline__ __mmask32 __DEFAULT_FN_ATTRS
338_mm512_cmpneq_epu16_mask(__m512i __a, __m512i __b) {
339 return (__mmask32)__builtin_ia32_ucmpw512_mask((__v32hi)__a, (__v32hi)__b, 4,
340 (__mmask32)-1);
341}
342
343static __inline__ __mmask32 __DEFAULT_FN_ATTRS
344_mm512_mask_cmpneq_epu16_mask(__mmask32 __u, __m512i __a, __m512i __b) {
345 return (__mmask32)__builtin_ia32_ucmpw512_mask((__v32hi)__a, (__v32hi)__b, 4,
346 __u);
347}
348
349static __inline__ __m512i __DEFAULT_FN_ATTRS
350_mm512_add_epi8 (__m512i __A, __m512i __B) {
351 return (__m512i) ((__v64qi) __A + (__v64qi) __B);
352}
353
354static __inline__ __m512i __DEFAULT_FN_ATTRS
355_mm512_mask_add_epi8 (__m512i __W, __mmask64 __U, __m512i __A, __m512i __B) {
356 return (__m512i) __builtin_ia32_paddb512_mask ((__v64qi) __A,
357 (__v64qi) __B,
358 (__v64qi) __W,
359 (__mmask64) __U);
360}
361
362static __inline__ __m512i __DEFAULT_FN_ATTRS
363_mm512_maskz_add_epi8 (__mmask64 __U, __m512i __A, __m512i __B) {
364 return (__m512i) __builtin_ia32_paddb512_mask ((__v64qi) __A,
365 (__v64qi) __B,
366 (__v64qi)
367 _mm512_setzero_qi (),
368 (__mmask64) __U);
369}
370
371static __inline__ __m512i __DEFAULT_FN_ATTRS
372_mm512_sub_epi8 (__m512i __A, __m512i __B) {
373 return (__m512i) ((__v64qi) __A - (__v64qi) __B);
374}
375
376static __inline__ __m512i __DEFAULT_FN_ATTRS
377_mm512_mask_sub_epi8 (__m512i __W, __mmask64 __U, __m512i __A, __m512i __B) {
378 return (__m512i) __builtin_ia32_psubb512_mask ((__v64qi) __A,
379 (__v64qi) __B,
380 (__v64qi) __W,
381 (__mmask64) __U);
382}
383
384static __inline__ __m512i __DEFAULT_FN_ATTRS
385_mm512_maskz_sub_epi8 (__mmask64 __U, __m512i __A, __m512i __B) {
386 return (__m512i) __builtin_ia32_psubb512_mask ((__v64qi) __A,
387 (__v64qi) __B,
388 (__v64qi)
389 _mm512_setzero_qi (),
390 (__mmask64) __U);
391}
392
393static __inline__ __m512i __DEFAULT_FN_ATTRS
394_mm512_add_epi16 (__m512i __A, __m512i __B) {
395 return (__m512i) ((__v32hi) __A + (__v32hi) __B);
396}
397
398static __inline__ __m512i __DEFAULT_FN_ATTRS
399_mm512_mask_add_epi16 (__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) {
400 return (__m512i) __builtin_ia32_paddw512_mask ((__v32hi) __A,
401 (__v32hi) __B,
402 (__v32hi) __W,
403 (__mmask32) __U);
404}
405
406static __inline__ __m512i __DEFAULT_FN_ATTRS
407_mm512_maskz_add_epi16 (__mmask32 __U, __m512i __A, __m512i __B) {
408 return (__m512i) __builtin_ia32_paddw512_mask ((__v32hi) __A,
409 (__v32hi) __B,
410 (__v32hi)
411 _mm512_setzero_hi (),
412 (__mmask32) __U);
413}
414
415static __inline__ __m512i __DEFAULT_FN_ATTRS
416_mm512_sub_epi16 (__m512i __A, __m512i __B) {
417 return (__m512i) ((__v32hi) __A - (__v32hi) __B);
418}
419
420static __inline__ __m512i __DEFAULT_FN_ATTRS
421_mm512_mask_sub_epi16 (__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) {
422 return (__m512i) __builtin_ia32_psubw512_mask ((__v32hi) __A,
423 (__v32hi) __B,
424 (__v32hi) __W,
425 (__mmask32) __U);
426}
427
428static __inline__ __m512i __DEFAULT_FN_ATTRS
429_mm512_maskz_sub_epi16 (__mmask32 __U, __m512i __A, __m512i __B) {
430 return (__m512i) __builtin_ia32_psubw512_mask ((__v32hi) __A,
431 (__v32hi) __B,
432 (__v32hi)
433 _mm512_setzero_hi (),
434 (__mmask32) __U);
435}
436
437static __inline__ __m512i __DEFAULT_FN_ATTRS
438_mm512_mullo_epi16 (__m512i __A, __m512i __B) {
439 return (__m512i) ((__v32hi) __A * (__v32hi) __B);
440}
441
442static __inline__ __m512i __DEFAULT_FN_ATTRS
443_mm512_mask_mullo_epi16 (__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) {
444 return (__m512i) __builtin_ia32_pmullw512_mask ((__v32hi) __A,
445 (__v32hi) __B,
446 (__v32hi) __W,
447 (__mmask32) __U);
448}
449
450static __inline__ __m512i __DEFAULT_FN_ATTRS
451_mm512_maskz_mullo_epi16 (__mmask32 __U, __m512i __A, __m512i __B) {
452 return (__m512i) __builtin_ia32_pmullw512_mask ((__v32hi) __A,
453 (__v32hi) __B,
454 (__v32hi)
455 _mm512_setzero_hi (),
456 (__mmask32) __U);
457}
458
459static __inline__ __m512i __DEFAULT_FN_ATTRS
460_mm512_mask_blend_epi8 (__mmask64 __U, __m512i __A, __m512i __W)
461{
462 return (__m512i) __builtin_ia32_blendmb_512_mask ((__v64qi) __A,
463 (__v64qi) __W,
464 (__mmask64) __U);
465}
466
467static __inline__ __m512i __DEFAULT_FN_ATTRS
468_mm512_mask_blend_epi16 (__mmask32 __U, __m512i __A, __m512i __W)
469{
470 return (__m512i) __builtin_ia32_blendmw_512_mask ((__v32hi) __A,
471 (__v32hi) __W,
472 (__mmask32) __U);
473}
474
475static __inline__ __m512i __DEFAULT_FN_ATTRS
476_mm512_abs_epi8 (__m512i __A)
477{
478 return (__m512i) __builtin_ia32_pabsb512_mask ((__v64qi) __A,
479 (__v64qi) _mm512_setzero_qi (),
480 (__mmask64) -1);
481}
482
483static __inline__ __m512i __DEFAULT_FN_ATTRS
484_mm512_mask_abs_epi8 (__m512i __W, __mmask64 __U, __m512i __A)
485{
486 return (__m512i) __builtin_ia32_pabsb512_mask ((__v64qi) __A,
487 (__v64qi) __W,
488 (__mmask64) __U);
489}
490
491static __inline__ __m512i __DEFAULT_FN_ATTRS
492_mm512_maskz_abs_epi8 (__mmask64 __U, __m512i __A)
493{
494 return (__m512i) __builtin_ia32_pabsb512_mask ((__v64qi) __A,
495 (__v64qi) _mm512_setzero_qi (),
496 (__mmask64) __U);
497}
498
499static __inline__ __m512i __DEFAULT_FN_ATTRS
500_mm512_abs_epi16 (__m512i __A)
501{
502 return (__m512i) __builtin_ia32_pabsw512_mask ((__v32hi) __A,
503 (__v32hi) _mm512_setzero_hi (),
504 (__mmask32) -1);
505}
506
507static __inline__ __m512i __DEFAULT_FN_ATTRS
508_mm512_mask_abs_epi16 (__m512i __W, __mmask32 __U, __m512i __A)
509{
510 return (__m512i) __builtin_ia32_pabsw512_mask ((__v32hi) __A,
511 (__v32hi) __W,
512 (__mmask32) __U);
513}
514
515static __inline__ __m512i __DEFAULT_FN_ATTRS
516_mm512_maskz_abs_epi16 (__mmask32 __U, __m512i __A)
517{
518 return (__m512i) __builtin_ia32_pabsw512_mask ((__v32hi) __A,
519 (__v32hi) _mm512_setzero_hi (),
520 (__mmask32) __U);
521}
522
523static __inline__ __m512i __DEFAULT_FN_ATTRS
524_mm512_packs_epi32 (__m512i __A, __m512i __B)
525{
526 return (__m512i) __builtin_ia32_packssdw512_mask ((__v16si) __A,
527 (__v16si) __B,
528 (__v32hi) _mm512_setzero_hi (),
529 (__mmask32) -1);
530}
531
532static __inline__ __m512i __DEFAULT_FN_ATTRS
533_mm512_maskz_packs_epi32 (__mmask32 __M, __m512i __A, __m512i __B)
534{
535 return (__m512i) __builtin_ia32_packssdw512_mask ((__v16si) __A,
536 (__v16si) __B,
537 (__v32hi) _mm512_setzero_hi(),
538 __M);
539}
540
541static __inline__ __m512i __DEFAULT_FN_ATTRS
542_mm512_mask_packs_epi32 (__m512i __W, __mmask32 __M, __m512i __A,
543 __m512i __B)
544{
545 return (__m512i) __builtin_ia32_packssdw512_mask ((__v16si) __A,
546 (__v16si) __B,
547 (__v32hi) __W,
548 __M);
549}
550
551static __inline__ __m512i __DEFAULT_FN_ATTRS
552_mm512_packs_epi16 (__m512i __A, __m512i __B)
553{
554 return (__m512i) __builtin_ia32_packsswb512_mask ((__v32hi) __A,
555 (__v32hi) __B,
556 (__v64qi) _mm512_setzero_qi (),
557 (__mmask64) -1);
558}
559
560static __inline__ __m512i __DEFAULT_FN_ATTRS
561_mm512_mask_packs_epi16 (__m512i __W, __mmask64 __M, __m512i __A,
562 __m512i __B)
563{
564 return (__m512i) __builtin_ia32_packsswb512_mask ((__v32hi) __A,
565 (__v32hi) __B,
566 (__v64qi) __W,
567 (__mmask64) __M);
568}
569
570static __inline__ __m512i __DEFAULT_FN_ATTRS
571_mm512_maskz_packs_epi16 (__mmask64 __M, __m512i __A, __m512i __B)
572{
573 return (__m512i) __builtin_ia32_packsswb512_mask ((__v32hi) __A,
574 (__v32hi) __B,
575 (__v64qi) _mm512_setzero_qi(),
576 __M);
577}
578
579static __inline__ __m512i __DEFAULT_FN_ATTRS
580_mm512_packus_epi32 (__m512i __A, __m512i __B)
581{
582 return (__m512i) __builtin_ia32_packusdw512_mask ((__v16si) __A,
583 (__v16si) __B,
584 (__v32hi) _mm512_setzero_hi (),
585 (__mmask32) -1);
586}
587
588static __inline__ __m512i __DEFAULT_FN_ATTRS
589_mm512_maskz_packus_epi32 (__mmask32 __M, __m512i __A, __m512i __B)
590{
591 return (__m512i) __builtin_ia32_packusdw512_mask ((__v16si) __A,
592 (__v16si) __B,
593 (__v32hi) _mm512_setzero_hi(),
594 __M);
595}
596
597static __inline__ __m512i __DEFAULT_FN_ATTRS
598_mm512_mask_packus_epi32 (__m512i __W, __mmask32 __M, __m512i __A,
599 __m512i __B)
600{
601 return (__m512i) __builtin_ia32_packusdw512_mask ((__v16si) __A,
602 (__v16si) __B,
603 (__v32hi) __W,
604 __M);
605}
606
607static __inline__ __m512i __DEFAULT_FN_ATTRS
608_mm512_packus_epi16 (__m512i __A, __m512i __B)
609{
610 return (__m512i) __builtin_ia32_packuswb512_mask ((__v32hi) __A,
611 (__v32hi) __B,
612 (__v64qi) _mm512_setzero_qi (),
613 (__mmask64) -1);
614}
615
616static __inline__ __m512i __DEFAULT_FN_ATTRS
617_mm512_mask_packus_epi16 (__m512i __W, __mmask64 __M, __m512i __A,
618 __m512i __B)
619{
620 return (__m512i) __builtin_ia32_packuswb512_mask ((__v32hi) __A,
621 (__v32hi) __B,
622 (__v64qi) __W,
623 (__mmask64) __M);
624}
625
626static __inline__ __m512i __DEFAULT_FN_ATTRS
627_mm512_maskz_packus_epi16 (__mmask64 __M, __m512i __A, __m512i __B)
628{
629 return (__m512i) __builtin_ia32_packuswb512_mask ((__v32hi) __A,
630 (__v32hi) __B,
631 (__v64qi) _mm512_setzero_qi(),
632 (__mmask64) __M);
633}
634
635static __inline__ __m512i __DEFAULT_FN_ATTRS
636_mm512_adds_epi8 (__m512i __A, __m512i __B)
637{
638 return (__m512i) __builtin_ia32_paddsb512_mask ((__v64qi) __A,
639 (__v64qi) __B,
640 (__v64qi) _mm512_setzero_qi (),
641 (__mmask64) -1);
642}
643
644static __inline__ __m512i __DEFAULT_FN_ATTRS
645_mm512_mask_adds_epi8 (__m512i __W, __mmask64 __U, __m512i __A,
646 __m512i __B)
647{
648 return (__m512i) __builtin_ia32_paddsb512_mask ((__v64qi) __A,
649 (__v64qi) __B,
650 (__v64qi) __W,
651 (__mmask64) __U);
652}
653
654static __inline__ __m512i __DEFAULT_FN_ATTRS
655_mm512_maskz_adds_epi8 (__mmask64 __U, __m512i __A, __m512i __B)
656{
657 return (__m512i) __builtin_ia32_paddsb512_mask ((__v64qi) __A,
658 (__v64qi) __B,
659 (__v64qi) _mm512_setzero_qi (),
660 (__mmask64) __U);
661}
662
663static __inline__ __m512i __DEFAULT_FN_ATTRS
664_mm512_adds_epi16 (__m512i __A, __m512i __B)
665{
666 return (__m512i) __builtin_ia32_paddsw512_mask ((__v32hi) __A,
667 (__v32hi) __B,
668 (__v32hi) _mm512_setzero_hi (),
669 (__mmask32) -1);
670}
671
672static __inline__ __m512i __DEFAULT_FN_ATTRS
673_mm512_mask_adds_epi16 (__m512i __W, __mmask32 __U, __m512i __A,
674 __m512i __B)
675{
676 return (__m512i) __builtin_ia32_paddsw512_mask ((__v32hi) __A,
677 (__v32hi) __B,
678 (__v32hi) __W,
679 (__mmask32) __U);
680}
681
682static __inline__ __m512i __DEFAULT_FN_ATTRS
683_mm512_maskz_adds_epi16 (__mmask32 __U, __m512i __A, __m512i __B)
684{
685 return (__m512i) __builtin_ia32_paddsw512_mask ((__v32hi) __A,
686 (__v32hi) __B,
687 (__v32hi) _mm512_setzero_hi (),
688 (__mmask32) __U);
689}
690
691static __inline__ __m512i __DEFAULT_FN_ATTRS
692_mm512_adds_epu8 (__m512i __A, __m512i __B)
693{
694 return (__m512i) __builtin_ia32_paddusb512_mask ((__v64qi) __A,
695 (__v64qi) __B,
696 (__v64qi) _mm512_setzero_qi (),
697 (__mmask64) -1);
698}
699
700static __inline__ __m512i __DEFAULT_FN_ATTRS
701_mm512_mask_adds_epu8 (__m512i __W, __mmask64 __U, __m512i __A,
702 __m512i __B)
703{
704 return (__m512i) __builtin_ia32_paddusb512_mask ((__v64qi) __A,
705 (__v64qi) __B,
706 (__v64qi) __W,
707 (__mmask64) __U);
708}
709
710static __inline__ __m512i __DEFAULT_FN_ATTRS
711_mm512_maskz_adds_epu8 (__mmask64 __U, __m512i __A, __m512i __B)
712{
713 return (__m512i) __builtin_ia32_paddusb512_mask ((__v64qi) __A,
714 (__v64qi) __B,
715 (__v64qi) _mm512_setzero_qi (),
716 (__mmask64) __U);
717}
718
719static __inline__ __m512i __DEFAULT_FN_ATTRS
720_mm512_adds_epu16 (__m512i __A, __m512i __B)
721{
722 return (__m512i) __builtin_ia32_paddusw512_mask ((__v32hi) __A,
723 (__v32hi) __B,
724 (__v32hi) _mm512_setzero_hi (),
725 (__mmask32) -1);
726}
727
728static __inline__ __m512i __DEFAULT_FN_ATTRS
729_mm512_mask_adds_epu16 (__m512i __W, __mmask32 __U, __m512i __A,
730 __m512i __B)
731{
732 return (__m512i) __builtin_ia32_paddusw512_mask ((__v32hi) __A,
733 (__v32hi) __B,
734 (__v32hi) __W,
735 (__mmask32) __U);
736}
737
738static __inline__ __m512i __DEFAULT_FN_ATTRS
739_mm512_maskz_adds_epu16 (__mmask32 __U, __m512i __A, __m512i __B)
740{
741 return (__m512i) __builtin_ia32_paddusw512_mask ((__v32hi) __A,
742 (__v32hi) __B,
743 (__v32hi) _mm512_setzero_hi (),
744 (__mmask32) __U);
745}
746
747static __inline__ __m512i __DEFAULT_FN_ATTRS
748_mm512_avg_epu8 (__m512i __A, __m512i __B)
749{
750 return (__m512i) __builtin_ia32_pavgb512_mask ((__v64qi) __A,
751 (__v64qi) __B,
752 (__v64qi) _mm512_setzero_qi (),
753 (__mmask64) -1);
754}
755
756static __inline__ __m512i __DEFAULT_FN_ATTRS
757_mm512_mask_avg_epu8 (__m512i __W, __mmask64 __U, __m512i __A,
758 __m512i __B)
759{
760 return (__m512i) __builtin_ia32_pavgb512_mask ((__v64qi) __A,
761 (__v64qi) __B,
762 (__v64qi) __W,
763 (__mmask64) __U);
764}
765
766static __inline__ __m512i __DEFAULT_FN_ATTRS
767_mm512_maskz_avg_epu8 (__mmask64 __U, __m512i __A, __m512i __B)
768{
769 return (__m512i) __builtin_ia32_pavgb512_mask ((__v64qi) __A,
770 (__v64qi) __B,
771 (__v64qi) _mm512_setzero_qi(),
772 (__mmask64) __U);
773}
774
775static __inline__ __m512i __DEFAULT_FN_ATTRS
776_mm512_avg_epu16 (__m512i __A, __m512i __B)
777{
778 return (__m512i) __builtin_ia32_pavgw512_mask ((__v32hi) __A,
779 (__v32hi) __B,
780 (__v32hi) _mm512_setzero_hi (),
781 (__mmask32) -1);
782}
783
784static __inline__ __m512i __DEFAULT_FN_ATTRS
785_mm512_mask_avg_epu16 (__m512i __W, __mmask32 __U, __m512i __A,
786 __m512i __B)
787{
788 return (__m512i) __builtin_ia32_pavgw512_mask ((__v32hi) __A,
789 (__v32hi) __B,
790 (__v32hi) __W,
791 (__mmask32) __U);
792}
793
794static __inline__ __m512i __DEFAULT_FN_ATTRS
795_mm512_maskz_avg_epu16 (__mmask32 __U, __m512i __A, __m512i __B)
796{
797 return (__m512i) __builtin_ia32_pavgw512_mask ((__v32hi) __A,
798 (__v32hi) __B,
799 (__v32hi) _mm512_setzero_hi(),
800 (__mmask32) __U);
801}
802
803static __inline__ __m512i __DEFAULT_FN_ATTRS
804_mm512_max_epi8 (__m512i __A, __m512i __B)
805{
806 return (__m512i) __builtin_ia32_pmaxsb512_mask ((__v64qi) __A,
807 (__v64qi) __B,
808 (__v64qi) _mm512_setzero_qi (),
809 (__mmask64) -1);
810}
811
812static __inline__ __m512i __DEFAULT_FN_ATTRS
813_mm512_maskz_max_epi8 (__mmask64 __M, __m512i __A, __m512i __B)
814{
815 return (__m512i) __builtin_ia32_pmaxsb512_mask ((__v64qi) __A,
816 (__v64qi) __B,
817 (__v64qi) _mm512_setzero_qi(),
818 (__mmask64) __M);
819}
820
821static __inline__ __m512i __DEFAULT_FN_ATTRS
822_mm512_mask_max_epi8 (__m512i __W, __mmask64 __M, __m512i __A,
823 __m512i __B)
824{
825 return (__m512i) __builtin_ia32_pmaxsb512_mask ((__v64qi) __A,
826 (__v64qi) __B,
827 (__v64qi) __W,
828 (__mmask64) __M);
829}
830
831static __inline__ __m512i __DEFAULT_FN_ATTRS
832_mm512_max_epi16 (__m512i __A, __m512i __B)
833{
834 return (__m512i) __builtin_ia32_pmaxsw512_mask ((__v32hi) __A,
835 (__v32hi) __B,
836 (__v32hi) _mm512_setzero_hi (),
837 (__mmask32) -1);
838}
839
840static __inline__ __m512i __DEFAULT_FN_ATTRS
841_mm512_maskz_max_epi16 (__mmask32 __M, __m512i __A, __m512i __B)
842{
843 return (__m512i) __builtin_ia32_pmaxsw512_mask ((__v32hi) __A,
844 (__v32hi) __B,
845 (__v32hi) _mm512_setzero_hi(),
846 (__mmask32) __M);
847}
848
849static __inline__ __m512i __DEFAULT_FN_ATTRS
850_mm512_mask_max_epi16 (__m512i __W, __mmask32 __M, __m512i __A,
851 __m512i __B)
852{
853 return (__m512i) __builtin_ia32_pmaxsw512_mask ((__v32hi) __A,
854 (__v32hi) __B,
855 (__v32hi) __W,
856 (__mmask32) __M);
857}
858
859static __inline__ __m512i __DEFAULT_FN_ATTRS
860_mm512_max_epu8 (__m512i __A, __m512i __B)
861{
862 return (__m512i) __builtin_ia32_pmaxub512_mask ((__v64qi) __A,
863 (__v64qi) __B,
864 (__v64qi) _mm512_setzero_qi (),
865 (__mmask64) -1);
866}
867
868static __inline__ __m512i __DEFAULT_FN_ATTRS
869_mm512_maskz_max_epu8 (__mmask64 __M, __m512i __A, __m512i __B)
870{
871 return (__m512i) __builtin_ia32_pmaxub512_mask ((__v64qi) __A,
872 (__v64qi) __B,
873 (__v64qi) _mm512_setzero_qi(),
874 (__mmask64) __M);
875}
876
877static __inline__ __m512i __DEFAULT_FN_ATTRS
878_mm512_mask_max_epu8 (__m512i __W, __mmask64 __M, __m512i __A,
879 __m512i __B)
880{
881 return (__m512i) __builtin_ia32_pmaxub512_mask ((__v64qi) __A,
882 (__v64qi) __B,
883 (__v64qi) __W,
884 (__mmask64) __M);
885}
886
887static __inline__ __m512i __DEFAULT_FN_ATTRS
888_mm512_max_epu16 (__m512i __A, __m512i __B)
889{
890 return (__m512i) __builtin_ia32_pmaxuw512_mask ((__v32hi) __A,
891 (__v32hi) __B,
892 (__v32hi) _mm512_setzero_hi (),
893 (__mmask32) -1);
894}
895
896static __inline__ __m512i __DEFAULT_FN_ATTRS
897_mm512_maskz_max_epu16 (__mmask32 __M, __m512i __A, __m512i __B)
898{
899 return (__m512i) __builtin_ia32_pmaxuw512_mask ((__v32hi) __A,
900 (__v32hi) __B,
901 (__v32hi) _mm512_setzero_hi(),
902 (__mmask32) __M);
903}
904
905static __inline__ __m512i __DEFAULT_FN_ATTRS
906_mm512_mask_max_epu16 (__m512i __W, __mmask32 __M, __m512i __A,
907 __m512i __B)
908{
909 return (__m512i) __builtin_ia32_pmaxuw512_mask ((__v32hi) __A,
910 (__v32hi) __B,
911 (__v32hi) __W,
912 (__mmask32) __M);
913}
914
915static __inline__ __m512i __DEFAULT_FN_ATTRS
916_mm512_min_epi8 (__m512i __A, __m512i __B)
917{
918 return (__m512i) __builtin_ia32_pminsb512_mask ((__v64qi) __A,
919 (__v64qi) __B,
920 (__v64qi) _mm512_setzero_qi (),
921 (__mmask64) -1);
922}
923
924static __inline__ __m512i __DEFAULT_FN_ATTRS
925_mm512_maskz_min_epi8 (__mmask64 __M, __m512i __A, __m512i __B)
926{
927 return (__m512i) __builtin_ia32_pminsb512_mask ((__v64qi) __A,
928 (__v64qi) __B,
929 (__v64qi) _mm512_setzero_qi(),
930 (__mmask64) __M);
931}
932
933static __inline__ __m512i __DEFAULT_FN_ATTRS
934_mm512_mask_min_epi8 (__m512i __W, __mmask64 __M, __m512i __A,
935 __m512i __B)
936{
937 return (__m512i) __builtin_ia32_pminsb512_mask ((__v64qi) __A,
938 (__v64qi) __B,
939 (__v64qi) __W,
940 (__mmask64) __M);
941}
942
943static __inline__ __m512i __DEFAULT_FN_ATTRS
944_mm512_min_epi16 (__m512i __A, __m512i __B)
945{
946 return (__m512i) __builtin_ia32_pminsw512_mask ((__v32hi) __A,
947 (__v32hi) __B,
948 (__v32hi) _mm512_setzero_hi (),
949 (__mmask32) -1);
950}
951
952static __inline__ __m512i __DEFAULT_FN_ATTRS
953_mm512_maskz_min_epi16 (__mmask32 __M, __m512i __A, __m512i __B)
954{
955 return (__m512i) __builtin_ia32_pminsw512_mask ((__v32hi) __A,
956 (__v32hi) __B,
957 (__v32hi) _mm512_setzero_hi(),
958 (__mmask32) __M);
959}
960
961static __inline__ __m512i __DEFAULT_FN_ATTRS
962_mm512_mask_min_epi16 (__m512i __W, __mmask32 __M, __m512i __A,
963 __m512i __B)
964{
965 return (__m512i) __builtin_ia32_pminsw512_mask ((__v32hi) __A,
966 (__v32hi) __B,
967 (__v32hi) __W,
968 (__mmask32) __M);
969}
970
971static __inline__ __m512i __DEFAULT_FN_ATTRS
972_mm512_min_epu8 (__m512i __A, __m512i __B)
973{
974 return (__m512i) __builtin_ia32_pminub512_mask ((__v64qi) __A,
975 (__v64qi) __B,
976 (__v64qi) _mm512_setzero_qi (),
977 (__mmask64) -1);
978}
979
980static __inline__ __m512i __DEFAULT_FN_ATTRS
981_mm512_maskz_min_epu8 (__mmask64 __M, __m512i __A, __m512i __B)
982{
983 return (__m512i) __builtin_ia32_pminub512_mask ((__v64qi) __A,
984 (__v64qi) __B,
985 (__v64qi) _mm512_setzero_qi(),
986 (__mmask64) __M);
987}
988
989static __inline__ __m512i __DEFAULT_FN_ATTRS
990_mm512_mask_min_epu8 (__m512i __W, __mmask64 __M, __m512i __A,
991 __m512i __B)
992{
993 return (__m512i) __builtin_ia32_pminub512_mask ((__v64qi) __A,
994 (__v64qi) __B,
995 (__v64qi) __W,
996 (__mmask64) __M);
997}
998
999static __inline__ __m512i __DEFAULT_FN_ATTRS
1000_mm512_min_epu16 (__m512i __A, __m512i __B)
1001{
1002 return (__m512i) __builtin_ia32_pminuw512_mask ((__v32hi) __A,
1003 (__v32hi) __B,
1004 (__v32hi) _mm512_setzero_hi (),
1005 (__mmask32) -1);
1006}
1007
1008static __inline__ __m512i __DEFAULT_FN_ATTRS
1009_mm512_maskz_min_epu16 (__mmask32 __M, __m512i __A, __m512i __B)
1010{
1011 return (__m512i) __builtin_ia32_pminuw512_mask ((__v32hi) __A,
1012 (__v32hi) __B,
1013 (__v32hi) _mm512_setzero_hi(),
1014 (__mmask32) __M);
1015}
1016
1017static __inline__ __m512i __DEFAULT_FN_ATTRS
1018_mm512_mask_min_epu16 (__m512i __W, __mmask32 __M, __m512i __A,
1019 __m512i __B)
1020{
1021 return (__m512i) __builtin_ia32_pminuw512_mask ((__v32hi) __A,
1022 (__v32hi) __B,
1023 (__v32hi) __W,
1024 (__mmask32) __M);
1025}
1026
1027static __inline__ __m512i __DEFAULT_FN_ATTRS
1028_mm512_shuffle_epi8 (__m512i __A, __m512i __B)
1029{
1030 return (__m512i) __builtin_ia32_pshufb512_mask ((__v64qi) __A,
1031 (__v64qi) __B,
1032 (__v64qi) _mm512_setzero_qi (),
1033 (__mmask64) -1);
1034}
1035
1036static __inline__ __m512i __DEFAULT_FN_ATTRS
1037_mm512_mask_shuffle_epi8 (__m512i __W, __mmask64 __U, __m512i __A,
1038 __m512i __B)
1039{
1040 return (__m512i) __builtin_ia32_pshufb512_mask ((__v64qi) __A,
1041 (__v64qi) __B,
1042 (__v64qi) __W,
1043 (__mmask64) __U);
1044}
1045
1046static __inline__ __m512i __DEFAULT_FN_ATTRS
1047_mm512_maskz_shuffle_epi8 (__mmask64 __U, __m512i __A, __m512i __B)
1048{
1049 return (__m512i) __builtin_ia32_pshufb512_mask ((__v64qi) __A,
1050 (__v64qi) __B,
1051 (__v64qi) _mm512_setzero_qi (),
1052 (__mmask64) __U);
1053}
1054
1055static __inline__ __m512i __DEFAULT_FN_ATTRS
1056_mm512_subs_epi8 (__m512i __A, __m512i __B)
1057{
1058 return (__m512i) __builtin_ia32_psubsb512_mask ((__v64qi) __A,
1059 (__v64qi) __B,
1060 (__v64qi) _mm512_setzero_qi (),
1061 (__mmask64) -1);
1062}
1063
1064static __inline__ __m512i __DEFAULT_FN_ATTRS
1065_mm512_mask_subs_epi8 (__m512i __W, __mmask64 __U, __m512i __A,
1066 __m512i __B)
1067{
1068 return (__m512i) __builtin_ia32_psubsb512_mask ((__v64qi) __A,
1069 (__v64qi) __B,
1070 (__v64qi) __W,
1071 (__mmask64) __U);
1072}
1073
1074static __inline__ __m512i __DEFAULT_FN_ATTRS
1075_mm512_maskz_subs_epi8 (__mmask64 __U, __m512i __A, __m512i __B)
1076{
1077 return (__m512i) __builtin_ia32_psubsb512_mask ((__v64qi) __A,
1078 (__v64qi) __B,
1079 (__v64qi) _mm512_setzero_qi (),
1080 (__mmask64) __U);
1081}
1082
1083static __inline__ __m512i __DEFAULT_FN_ATTRS
1084_mm512_subs_epi16 (__m512i __A, __m512i __B)
1085{
1086 return (__m512i) __builtin_ia32_psubsw512_mask ((__v32hi) __A,
1087 (__v32hi) __B,
1088 (__v32hi) _mm512_setzero_hi (),
1089 (__mmask32) -1);
1090}
1091
1092static __inline__ __m512i __DEFAULT_FN_ATTRS
1093_mm512_mask_subs_epi16 (__m512i __W, __mmask32 __U, __m512i __A,
1094 __m512i __B)
1095{
1096 return (__m512i) __builtin_ia32_psubsw512_mask ((__v32hi) __A,
1097 (__v32hi) __B,
1098 (__v32hi) __W,
1099 (__mmask32) __U);
1100}
1101
1102static __inline__ __m512i __DEFAULT_FN_ATTRS
1103_mm512_maskz_subs_epi16 (__mmask32 __U, __m512i __A, __m512i __B)
1104{
1105 return (__m512i) __builtin_ia32_psubsw512_mask ((__v32hi) __A,
1106 (__v32hi) __B,
1107 (__v32hi) _mm512_setzero_hi (),
1108 (__mmask32) __U);
1109}
1110
1111static __inline__ __m512i __DEFAULT_FN_ATTRS
1112_mm512_subs_epu8 (__m512i __A, __m512i __B)
1113{
1114 return (__m512i) __builtin_ia32_psubusb512_mask ((__v64qi) __A,
1115 (__v64qi) __B,
1116 (__v64qi) _mm512_setzero_qi (),
1117 (__mmask64) -1);
1118}
1119
1120static __inline__ __m512i __DEFAULT_FN_ATTRS
1121_mm512_mask_subs_epu8 (__m512i __W, __mmask64 __U, __m512i __A,
1122 __m512i __B)
1123{
1124 return (__m512i) __builtin_ia32_psubusb512_mask ((__v64qi) __A,
1125 (__v64qi) __B,
1126 (__v64qi) __W,
1127 (__mmask64) __U);
1128}
1129
1130static __inline__ __m512i __DEFAULT_FN_ATTRS
1131_mm512_maskz_subs_epu8 (__mmask64 __U, __m512i __A, __m512i __B)
1132{
1133 return (__m512i) __builtin_ia32_psubusb512_mask ((__v64qi) __A,
1134 (__v64qi) __B,
1135 (__v64qi) _mm512_setzero_qi (),
1136 (__mmask64) __U);
1137}
1138
1139static __inline__ __m512i __DEFAULT_FN_ATTRS
1140_mm512_subs_epu16 (__m512i __A, __m512i __B)
1141{
1142 return (__m512i) __builtin_ia32_psubusw512_mask ((__v32hi) __A,
1143 (__v32hi) __B,
1144 (__v32hi) _mm512_setzero_hi (),
1145 (__mmask32) -1);
1146}
1147
1148static __inline__ __m512i __DEFAULT_FN_ATTRS
1149_mm512_mask_subs_epu16 (__m512i __W, __mmask32 __U, __m512i __A,
1150 __m512i __B)
1151{
1152 return (__m512i) __builtin_ia32_psubusw512_mask ((__v32hi) __A,
1153 (__v32hi) __B,
1154 (__v32hi) __W,
1155 (__mmask32) __U);
1156}
1157
1158static __inline__ __m512i __DEFAULT_FN_ATTRS
1159_mm512_maskz_subs_epu16 (__mmask32 __U, __m512i __A, __m512i __B)
1160{
1161 return (__m512i) __builtin_ia32_psubusw512_mask ((__v32hi) __A,
1162 (__v32hi) __B,
1163 (__v32hi) _mm512_setzero_hi (),
1164 (__mmask32) __U);
1165}
1166
1167static __inline__ __m512i __DEFAULT_FN_ATTRS
1168_mm512_mask2_permutex2var_epi16 (__m512i __A, __m512i __I,
1169 __mmask32 __U, __m512i __B)
1170{
1171 return (__m512i) __builtin_ia32_vpermi2varhi512_mask ((__v32hi) __A,
1172 (__v32hi) __I /* idx */ ,
1173 (__v32hi) __B,
1174 (__mmask32) __U);
1175}
1176
1177static __inline__ __m512i __DEFAULT_FN_ATTRS
1178_mm512_permutex2var_epi16 (__m512i __A, __m512i __I, __m512i __B)
1179{
1180 return (__m512i) __builtin_ia32_vpermt2varhi512_mask ((__v32hi) __I /* idx */,
1181 (__v32hi) __A,
1182 (__v32hi) __B,
1183 (__mmask32) -1);
1184}
1185
1186static __inline__ __m512i __DEFAULT_FN_ATTRS
1187_mm512_mask_permutex2var_epi16 (__m512i __A, __mmask32 __U,
1188 __m512i __I, __m512i __B)
1189{
1190 return (__m512i) __builtin_ia32_vpermt2varhi512_mask ((__v32hi) __I /* idx */,
1191 (__v32hi) __A,
1192 (__v32hi) __B,
1193 (__mmask32) __U);
1194}
1195
1196static __inline__ __m512i __DEFAULT_FN_ATTRS
1197_mm512_maskz_permutex2var_epi16 (__mmask32 __U, __m512i __A,
1198 __m512i __I, __m512i __B)
1199{
1200 return (__m512i) __builtin_ia32_vpermt2varhi512_maskz ((__v32hi) __I
1201 /* idx */ ,
1202 (__v32hi) __A,
1203 (__v32hi) __B,
1204 (__mmask32) __U);
1205}
1206
1207#define _mm512_cmp_epi8_mask(a, b, p) __extension__ ({ \
1208 (__mmask16)__builtin_ia32_cmpb512_mask((__v64qi)(__m512i)(a), \
1209 (__v64qi)(__m512i)(b), \
1210 (p), (__mmask64)-1); })
1211
1212#define _mm512_mask_cmp_epi8_mask(m, a, b, p) __extension__ ({ \
1213 (__mmask16)__builtin_ia32_cmpb512_mask((__v64qi)(__m512i)(a), \
1214 (__v64qi)(__m512i)(b), \
1215 (p), (__mmask64)(m)); })
1216
1217#define _mm512_cmp_epu8_mask(a, b, p) __extension__ ({ \
1218 (__mmask16)__builtin_ia32_ucmpb512_mask((__v64qi)(__m512i)(a), \
1219 (__v64qi)(__m512i)(b), \
1220 (p), (__mmask64)-1); })
1221
1222#define _mm512_mask_cmp_epu8_mask(m, a, b, p) __extension__ ({ \
1223 (__mmask16)__builtin_ia32_ucmpb512_mask((__v64qi)(__m512i)(a), \
1224 (__v64qi)(__m512i)(b), \
1225 (p), (__mmask64)(m)); })
1226
1227#define _mm512_cmp_epi16_mask(a, b, p) __extension__ ({ \
1228 (__mmask16)__builtin_ia32_cmpw512_mask((__v32hi)(__m512i)(a), \
1229 (__v32hi)(__m512i)(b), \
1230 (p), (__mmask32)-1); })
1231
1232#define _mm512_mask_cmp_epi16_mask(m, a, b, p) __extension__ ({ \
1233 (__mmask16)__builtin_ia32_cmpw512_mask((__v32hi)(__m512i)(a), \
1234 (__v32hi)(__m512i)(b), \
1235 (p), (__mmask32)(m)); })
1236
1237#define _mm512_cmp_epu16_mask(a, b, p) __extension__ ({ \
1238 (__mmask16)__builtin_ia32_ucmpw512_mask((__v32hi)(__m512i)(a), \
1239 (__v32hi)(__m512i)(b), \
1240 (p), (__mmask32)-1); })
1241
1242#define _mm512_mask_cmp_epu16_mask(m, a, b, p) __extension__ ({ \
1243 (__mmask16)__builtin_ia32_ucmpw512_mask((__v32hi)(__m512i)(a), \
1244 (__v32hi)(__m512i)(b), \
1245 (p), (__mmask32)(m)); })
1246
1247
1248#undef __DEFAULT_FN_ATTRS
1249
1250#endif
c_headers/avx512cdintrin.h created+131
......@@ -0,0 +1,131 @@
1/*===------------- avx512cdintrin.h - AVX512CD intrinsics ------------------===
2 *
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 *
22 *===-----------------------------------------------------------------------===
23 */
24#ifndef __IMMINTRIN_H
25#error "Never use <avx512cdintrin.h> directly; include <immintrin.h> instead."
26#endif
27
28#ifndef __AVX512CDINTRIN_H
29#define __AVX512CDINTRIN_H
30
31/* Define the default attributes for the functions in this file. */
32#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512cd")))
33
34static __inline__ __m512i __DEFAULT_FN_ATTRS
35_mm512_conflict_epi64 (__m512i __A)
36{
37 return (__m512i) __builtin_ia32_vpconflictdi_512_mask ((__v8di) __A,
38 (__v8di) _mm512_setzero_si512 (),
39 (__mmask8) -1);
40}
41
42static __inline__ __m512i __DEFAULT_FN_ATTRS
43_mm512_mask_conflict_epi64 (__m512i __W, __mmask8 __U, __m512i __A)
44{
45 return (__m512i) __builtin_ia32_vpconflictdi_512_mask ((__v8di) __A,
46 (__v8di) __W,
47 (__mmask8) __U);
48}
49
50static __inline__ __m512i __DEFAULT_FN_ATTRS
51_mm512_maskz_conflict_epi64 (__mmask8 __U, __m512i __A)
52{
53 return (__m512i) __builtin_ia32_vpconflictdi_512_mask ((__v8di) __A,
54 (__v8di) _mm512_setzero_si512 (),
55 (__mmask8) __U);
56}
57
58static __inline__ __m512i __DEFAULT_FN_ATTRS
59_mm512_conflict_epi32 (__m512i __A)
60{
61 return (__m512i) __builtin_ia32_vpconflictsi_512_mask ((__v16si) __A,
62 (__v16si) _mm512_setzero_si512 (),
63 (__mmask16) -1);
64}
65
66static __inline__ __m512i __DEFAULT_FN_ATTRS
67_mm512_mask_conflict_epi32 (__m512i __W, __mmask16 __U, __m512i __A)
68{
69 return (__m512i) __builtin_ia32_vpconflictsi_512_mask ((__v16si) __A,
70 (__v16si) __W,
71 (__mmask16) __U);
72}
73
74static __inline__ __m512i __DEFAULT_FN_ATTRS
75_mm512_maskz_conflict_epi32 (__mmask16 __U, __m512i __A)
76{
77 return (__m512i) __builtin_ia32_vpconflictsi_512_mask ((__v16si) __A,
78 (__v16si) _mm512_setzero_si512 (),
79 (__mmask16) __U);
80}
81
82static __inline__ __m512i __DEFAULT_FN_ATTRS
83_mm512_lzcnt_epi32 (__m512i __A)
84{
85 return (__m512i) __builtin_ia32_vplzcntd_512_mask ((__v16si) __A,
86 (__v16si) _mm512_setzero_si512 (),
87 (__mmask16) -1);
88}
89
90static __inline__ __m512i __DEFAULT_FN_ATTRS
91_mm512_mask_lzcnt_epi32 (__m512i __W, __mmask16 __U, __m512i __A)
92{
93 return (__m512i) __builtin_ia32_vplzcntd_512_mask ((__v16si) __A,
94 (__v16si) __W,
95 (__mmask16) __U);
96}
97
98static __inline__ __m512i __DEFAULT_FN_ATTRS
99_mm512_maskz_lzcnt_epi32 (__mmask16 __U, __m512i __A)
100{
101 return (__m512i) __builtin_ia32_vplzcntd_512_mask ((__v16si) __A,
102 (__v16si) _mm512_setzero_si512 (),
103 (__mmask16) __U);
104}
105
106static __inline__ __m512i __DEFAULT_FN_ATTRS
107_mm512_lzcnt_epi64 (__m512i __A)
108{
109 return (__m512i) __builtin_ia32_vplzcntq_512_mask ((__v8di) __A,
110 (__v8di) _mm512_setzero_si512 (),
111 (__mmask8) -1);
112}
113
114static __inline__ __m512i __DEFAULT_FN_ATTRS
115_mm512_mask_lzcnt_epi64 (__m512i __W, __mmask8 __U, __m512i __A)
116{
117 return (__m512i) __builtin_ia32_vplzcntq_512_mask ((__v8di) __A,
118 (__v8di) __W,
119 (__mmask8) __U);
120}
121
122static __inline__ __m512i __DEFAULT_FN_ATTRS
123_mm512_maskz_lzcnt_epi64 (__mmask8 __U, __m512i __A)
124{
125 return (__m512i) __builtin_ia32_vplzcntq_512_mask ((__v8di) __A,
126 (__v8di) _mm512_setzero_si512 (),
127 (__mmask8) __U);
128}
129#undef __DEFAULT_FN_ATTRS
130
131#endif
c_headers/avx512dqintrin.h created+242
......@@ -0,0 +1,242 @@
1/*===---- avx512dqintrin.h - AVX512DQ intrinsics ---------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __IMMINTRIN_H
25#error "Never use <avx512dqintrin.h> directly; include <immintrin.h> instead."
26#endif
27
28#ifndef __AVX512DQINTRIN_H
29#define __AVX512DQINTRIN_H
30
31/* Define the default attributes for the functions in this file. */
32#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
33
34static __inline__ __m512i __DEFAULT_FN_ATTRS
35_mm512_mullo_epi64 (__m512i __A, __m512i __B) {
36 return (__m512i) ((__v8di) __A * (__v8di) __B);
37}
38
39static __inline__ __m512i __DEFAULT_FN_ATTRS
40_mm512_mask_mullo_epi64 (__m512i __W, __mmask8 __U, __m512i __A, __m512i __B) {
41 return (__m512i) __builtin_ia32_pmullq512_mask ((__v8di) __A,
42 (__v8di) __B,
43 (__v8di) __W,
44 (__mmask8) __U);
45}
46
47static __inline__ __m512i __DEFAULT_FN_ATTRS
48_mm512_maskz_mullo_epi64 (__mmask8 __U, __m512i __A, __m512i __B) {
49 return (__m512i) __builtin_ia32_pmullq512_mask ((__v8di) __A,
50 (__v8di) __B,
51 (__v8di)
52 _mm512_setzero_si512 (),
53 (__mmask8) __U);
54}
55
56static __inline__ __m512d __DEFAULT_FN_ATTRS
57_mm512_xor_pd (__m512d __A, __m512d __B) {
58 return (__m512d) ((__v8di) __A ^ (__v8di) __B);
59}
60
61static __inline__ __m512d __DEFAULT_FN_ATTRS
62_mm512_mask_xor_pd (__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) {
63 return (__m512d) __builtin_ia32_xorpd512_mask ((__v8df) __A,
64 (__v8df) __B,
65 (__v8df) __W,
66 (__mmask8) __U);
67}
68
69static __inline__ __m512d __DEFAULT_FN_ATTRS
70_mm512_maskz_xor_pd (__mmask8 __U, __m512d __A, __m512d __B) {
71 return (__m512d) __builtin_ia32_xorpd512_mask ((__v8df) __A,
72 (__v8df) __B,
73 (__v8df)
74 _mm512_setzero_pd (),
75 (__mmask8) __U);
76}
77
78static __inline__ __m512 __DEFAULT_FN_ATTRS
79_mm512_xor_ps (__m512 __A, __m512 __B) {
80 return (__m512) ((__v16si) __A ^ (__v16si) __B);
81}
82
83static __inline__ __m512 __DEFAULT_FN_ATTRS
84_mm512_mask_xor_ps (__m512 __W, __mmask16 __U, __m512 __A, __m512 __B) {
85 return (__m512) __builtin_ia32_xorps512_mask ((__v16sf) __A,
86 (__v16sf) __B,
87 (__v16sf) __W,
88 (__mmask16) __U);
89}
90
91static __inline__ __m512 __DEFAULT_FN_ATTRS
92_mm512_maskz_xor_ps (__mmask16 __U, __m512 __A, __m512 __B) {
93 return (__m512) __builtin_ia32_xorps512_mask ((__v16sf) __A,
94 (__v16sf) __B,
95 (__v16sf)
96 _mm512_setzero_ps (),
97 (__mmask16) __U);
98}
99
100static __inline__ __m512d __DEFAULT_FN_ATTRS
101_mm512_or_pd (__m512d __A, __m512d __B) {
102 return (__m512d) ((__v8di) __A | (__v8di) __B);
103}
104
105static __inline__ __m512d __DEFAULT_FN_ATTRS
106_mm512_mask_or_pd (__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) {
107 return (__m512d) __builtin_ia32_orpd512_mask ((__v8df) __A,
108 (__v8df) __B,
109 (__v8df) __W,
110 (__mmask8) __U);
111}
112
113static __inline__ __m512d __DEFAULT_FN_ATTRS
114_mm512_maskz_or_pd (__mmask8 __U, __m512d __A, __m512d __B) {
115 return (__m512d) __builtin_ia32_orpd512_mask ((__v8df) __A,
116 (__v8df) __B,
117 (__v8df)
118 _mm512_setzero_pd (),
119 (__mmask8) __U);
120}
121
122static __inline__ __m512 __DEFAULT_FN_ATTRS
123_mm512_or_ps (__m512 __A, __m512 __B) {
124 return (__m512) ((__v16si) __A | (__v16si) __B);
125}
126
127static __inline__ __m512 __DEFAULT_FN_ATTRS
128_mm512_mask_or_ps (__m512 __W, __mmask16 __U, __m512 __A, __m512 __B) {
129 return (__m512) __builtin_ia32_orps512_mask ((__v16sf) __A,
130 (__v16sf) __B,
131 (__v16sf) __W,
132 (__mmask16) __U);
133}
134
135static __inline__ __m512 __DEFAULT_FN_ATTRS
136_mm512_maskz_or_ps (__mmask16 __U, __m512 __A, __m512 __B) {
137 return (__m512) __builtin_ia32_orps512_mask ((__v16sf) __A,
138 (__v16sf) __B,
139 (__v16sf)
140 _mm512_setzero_ps (),
141 (__mmask16) __U);
142}
143
144static __inline__ __m512d __DEFAULT_FN_ATTRS
145_mm512_and_pd (__m512d __A, __m512d __B) {
146 return (__m512d) ((__v8di) __A & (__v8di) __B);
147}
148
149static __inline__ __m512d __DEFAULT_FN_ATTRS
150_mm512_mask_and_pd (__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) {
151 return (__m512d) __builtin_ia32_andpd512_mask ((__v8df) __A,
152 (__v8df) __B,
153 (__v8df) __W,
154 (__mmask8) __U);
155}
156
157static __inline__ __m512d __DEFAULT_FN_ATTRS
158_mm512_maskz_and_pd (__mmask8 __U, __m512d __A, __m512d __B) {
159 return (__m512d) __builtin_ia32_andpd512_mask ((__v8df) __A,
160 (__v8df) __B,
161 (__v8df)
162 _mm512_setzero_pd (),
163 (__mmask8) __U);
164}
165
166static __inline__ __m512 __DEFAULT_FN_ATTRS
167_mm512_and_ps (__m512 __A, __m512 __B) {
168 return (__m512) ((__v16si) __A & (__v16si) __B);
169}
170
171static __inline__ __m512 __DEFAULT_FN_ATTRS
172_mm512_mask_and_ps (__m512 __W, __mmask16 __U, __m512 __A, __m512 __B) {
173 return (__m512) __builtin_ia32_andps512_mask ((__v16sf) __A,
174 (__v16sf) __B,
175 (__v16sf) __W,
176 (__mmask16) __U);
177}
178
179static __inline__ __m512 __DEFAULT_FN_ATTRS
180_mm512_maskz_and_ps (__mmask16 __U, __m512 __A, __m512 __B) {
181 return (__m512) __builtin_ia32_andps512_mask ((__v16sf) __A,
182 (__v16sf) __B,
183 (__v16sf)
184 _mm512_setzero_ps (),
185 (__mmask16) __U);
186}
187
188static __inline__ __m512d __DEFAULT_FN_ATTRS
189_mm512_andnot_pd (__m512d __A, __m512d __B) {
190 return (__m512d) __builtin_ia32_andnpd512_mask ((__v8df) __A,
191 (__v8df) __B,
192 (__v8df)
193 _mm512_setzero_pd (),
194 (__mmask8) -1);
195}
196
197static __inline__ __m512d __DEFAULT_FN_ATTRS
198_mm512_mask_andnot_pd (__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) {
199 return (__m512d) __builtin_ia32_andnpd512_mask ((__v8df) __A,
200 (__v8df) __B,
201 (__v8df) __W,
202 (__mmask8) __U);
203}
204
205static __inline__ __m512d __DEFAULT_FN_ATTRS
206_mm512_maskz_andnot_pd (__mmask8 __U, __m512d __A, __m512d __B) {
207 return (__m512d) __builtin_ia32_andnpd512_mask ((__v8df) __A,
208 (__v8df) __B,
209 (__v8df)
210 _mm512_setzero_pd (),
211 (__mmask8) __U);
212}
213
214static __inline__ __m512 __DEFAULT_FN_ATTRS
215_mm512_andnot_ps (__m512 __A, __m512 __B) {
216 return (__m512) __builtin_ia32_andnps512_mask ((__v16sf) __A,
217 (__v16sf) __B,
218 (__v16sf)
219 _mm512_setzero_ps (),
220 (__mmask16) -1);
221}
222
223static __inline__ __m512 __DEFAULT_FN_ATTRS
224_mm512_mask_andnot_ps (__m512 __W, __mmask16 __U, __m512 __A, __m512 __B) {
225 return (__m512) __builtin_ia32_andnps512_mask ((__v16sf) __A,
226 (__v16sf) __B,
227 (__v16sf) __W,
228 (__mmask16) __U);
229}
230
231static __inline__ __m512 __DEFAULT_FN_ATTRS
232_mm512_maskz_andnot_ps (__mmask16 __U, __m512 __A, __m512 __B) {
233 return (__m512) __builtin_ia32_andnps512_mask ((__v16sf) __A,
234 (__v16sf) __B,
235 (__v16sf)
236 _mm512_setzero_ps (),
237 (__mmask16) __U);
238}
239
240#undef __DEFAULT_FN_ATTRS
241
242#endif
c_headers/avx512erintrin.h created+285
......@@ -0,0 +1,285 @@
1/*===---- avx512fintrin.h - AVX2 intrinsics -----------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23#ifndef __IMMINTRIN_H
24#error "Never use <avx512erintrin.h> directly; include <immintrin.h> instead."
25#endif
26
27#ifndef __AVX512ERINTRIN_H
28#define __AVX512ERINTRIN_H
29
30// exp2a23
31#define _mm512_exp2a23_round_pd(A, R) __extension__ ({ \
32 (__m512d)__builtin_ia32_exp2pd_mask((__v8df)(__m512d)(A), \
33 (__v8df)_mm512_setzero_pd(), \
34 (__mmask8)-1, (R)); })
35
36#define _mm512_mask_exp2a23_round_pd(S, M, A, R) __extension__ ({ \
37 (__m512d)__builtin_ia32_exp2pd_mask((__v8df)(__m512d)(A), \
38 (__v8df)(__m512d)(S), \
39 (__mmask8)(M), (R)); })
40
41#define _mm512_maskz_exp2a23_round_pd(M, A, R) __extension__ ({ \
42 (__m512d)__builtin_ia32_exp2pd_mask((__v8df)(__m512d)(A), \
43 (__v8df)_mm512_setzero_pd(), \
44 (__mmask8)(M), (R)); })
45
46#define _mm512_exp2a23_pd(A) \
47 _mm512_exp2a23_round_pd((A), _MM_FROUND_CUR_DIRECTION)
48
49#define _mm512_mask_exp2a23_pd(S, M, A) \
50 _mm512_mask_exp2a23_round_pd((S), (M), (A), _MM_FROUND_CUR_DIRECTION)
51
52#define _mm512_maskz_exp2a23_pd(M, A) \
53 _mm512_maskz_exp2a23_round_pd((M), (A), _MM_FROUND_CUR_DIRECTION)
54
55#define _mm512_exp2a23_round_ps(A, R) __extension__ ({ \
56 (__m512)__builtin_ia32_exp2ps_mask((__v16sf)(__m512)(A), \
57 (__v16sf)_mm512_setzero_ps(), \
58 (__mmask8)-1, (R)); })
59
60#define _mm512_mask_exp2a23_round_ps(S, M, A, R) __extension__ ({ \
61 (__m512)__builtin_ia32_exp2ps_mask((__v16sf)(__m512)(A), \
62 (__v16sf)(__m512)(S), \
63 (__mmask8)(M), (R)); })
64
65#define _mm512_maskz_exp2a23_round_ps(M, A, R) __extension__ ({ \
66 (__m512)__builtin_ia32_exp2ps_mask((__v16sf)(__m512)(A), \
67 (__v16sf)_mm512_setzero_ps(), \
68 (__mmask8)(M), (R)); })
69
70#define _mm512_exp2a23_ps(A) \
71 _mm512_exp2a23_round_ps((A), _MM_FROUND_CUR_DIRECTION)
72
73#define _mm512_mask_exp2a23_ps(S, M, A) \
74 _mm512_mask_exp2a23_round_ps((S), (M), (A), _MM_FROUND_CUR_DIRECTION)
75
76#define _mm512_maskz_exp2a23_ps(M, A) \
77 _mm512_maskz_exp2a23_round_ps((M), (A), _MM_FROUND_CUR_DIRECTION)
78
79// rsqrt28
80#define _mm512_rsqrt28_round_pd(A, R) __extension__ ({ \
81 (__m512d)__builtin_ia32_rsqrt28pd_mask((__v8df)(__m512d)(A), \
82 (__v8df)_mm512_setzero_pd(), \
83 (__mmask8)-1, (R)); })
84
85#define _mm512_mask_rsqrt28_round_pd(S, M, A, R) __extension__ ({ \
86 (__m512d)__builtin_ia32_rsqrt28pd_mask((__v8df)(__m512d)(A), \
87 (__v8df)(__m512d)(S), \
88 (__mmask8)(M), (R)); })
89
90#define _mm512_maskz_rsqrt28_round_pd(M, A, R) __extension__ ({ \
91 (__m512d)__builtin_ia32_rsqrt28pd_mask((__v8df)(__m512d)(A), \
92 (__v8df)_mm512_setzero_pd(), \
93 (__mmask8)(M), (R)); })
94
95#define _mm512_rsqrt28_pd(A) \
96 _mm512_rsqrt28_round_pd((A), _MM_FROUND_CUR_DIRECTION)
97
98#define _mm512_mask_rsqrt28_pd(S, M, A) \
99 _mm512_mask_rsqrt28_round_pd((S), (M), (A), _MM_FROUND_CUR_DIRECTION)
100
101#define _mm512_maskz_rsqrt28_pd(M, A) \
102 _mm512_maskz_rsqrt28_round_pd((M), (A), _MM_FROUND_CUR_DIRECTION)
103
104#define _mm512_rsqrt28_round_ps(A, R) __extension__ ({ \
105 (__m512)__builtin_ia32_rsqrt28ps_mask((__v16sf)(__m512)(A), \
106 (__v16sf)_mm512_setzero_ps(), \
107 (__mmask16)-1, (R)); })
108
109#define _mm512_mask_rsqrt28_round_ps(S, M, A, R) __extension__ ({ \
110 (__m512)__builtin_ia32_rsqrt28ps_mask((__v16sf)(__m512)(A), \
111 (__v16sf)(__m512)(S), \
112 (__mmask16)(M), (R)); })
113
114#define _mm512_maskz_rsqrt28_round_ps(M, A, R) __extension__ ({ \
115 (__m512)__builtin_ia32_rsqrt28ps_mask((__v16sf)(__m512)(A), \
116 (__v16sf)_mm512_setzero_ps(), \
117 (__mmask16)(M), (R)); })
118
119#define _mm512_rsqrt28_ps(A) \
120 _mm512_rsqrt28_round_ps((A), _MM_FROUND_CUR_DIRECTION)
121
122#define _mm512_mask_rsqrt28_ps(S, M, A) \
123 _mm512_mask_rsqrt28_round_ps((S), (M), A, _MM_FROUND_CUR_DIRECTION)
124
125#define _mm512_maskz_rsqrt28_ps(M, A) \
126 _mm512_maskz_rsqrt28_round_ps((M), (A), _MM_FROUND_CUR_DIRECTION)
127
128#define _mm_rsqrt28_round_ss(A, B, R) __extension__ ({ \
129 (__m128)__builtin_ia32_rsqrt28ss_mask((__v4sf)(__m128)(A), \
130 (__v4sf)(__m128)(B), \
131 (__v4sf)_mm_setzero_ps(), \
132 (__mmask8)-1, (R)); })
133
134#define _mm_mask_rsqrt28_round_ss(S, M, A, B, R) __extension__ ({ \
135 (__m128)__builtin_ia32_rsqrt28ss_mask((__v4sf)(__m128)(A), \
136 (__v4sf)(__m128)(B), \
137 (__v4sf)(__m128)(S), \
138 (__mmask8)(M), (R)); })
139
140#define _mm_maskz_rsqrt28_round_ss(M, A, B, R) __extension__ ({ \
141 (__m128)__builtin_ia32_rsqrt28ss_mask((__v4sf)(__m128)(A), \
142 (__v4sf)(__m128)(B), \
143 (__v4sf)_mm_setzero_ps(), \
144 (__mmask8)(M), (R)); })
145
146#define _mm_rsqrt28_ss(A, B) \
147 _mm_rsqrt28_round_ss((A), (B), _MM_FROUND_CUR_DIRECTION)
148
149#define _mm_mask_rsqrt28_ss(S, M, A, B) \
150 _mm_mask_rsqrt28_round_ss((S), (M), (A), (B), _MM_FROUND_CUR_DIRECTION)
151
152#define _mm_maskz_rsqrt28_ss(M, A, B) \
153 _mm_maskz_rsqrt28_round_ss((M), (A), (B), _MM_FROUND_CUR_DIRECTION)
154
155#define _mm_rsqrt28_round_sd(A, B, R) __extension__ ({ \
156 (__m128d)__builtin_ia32_rsqrt28sd_mask((__v2df)(__m128d)(A), \
157 (__v2df)(__m128d)(B), \
158 (__v2df)_mm_setzero_pd(), \
159 (__mmask8)-1, (R)); })
160
161#define _mm_mask_rsqrt28_round_sd(S, M, A, B, R) __extension__ ({ \
162 (__m128d)__builtin_ia32_rsqrt28sd_mask((__v2df)(__m128d)(A), \
163 (__v2df)(__m128d)(B), \
164 (__v2df)(__m128d)(S), \
165 (__mmask8)(M), (R)); })
166
167#define _mm_maskz_rsqrt28_round_sd(M, A, B, R) __extension__ ({ \
168 (__m128d)__builtin_ia32_rsqrt28sd_mask((__v2df)(__m128d)(A), \
169 (__v2df)(__m128d)(B), \
170 (__v2df)_mm_setzero_pd(), \
171 (__mmask8)(M), (R)); })
172
173#define _mm_rsqrt28_sd(A, B) \
174 _mm_rsqrt28_round_sd((A), (B), _MM_FROUND_CUR_DIRECTION)
175
176#define _mm_mask_rsqrt28_sd(S, M, A, B) \
177 _mm_mask_rsqrt28_round_sd((S), (M), (A), (B), _MM_FROUND_CUR_DIRECTION)
178
179#define _mm_maskz_rsqrt28_sd(M, A, B) \
180 _mm_mask_rsqrt28_round_sd((M), (A), (B), _MM_FROUND_CUR_DIRECTION)
181
182// rcp28
183#define _mm512_rcp28_round_pd(A, R) __extension__ ({ \
184 (__m512d)__builtin_ia32_rcp28pd_mask((__v8df)(__m512d)(A), \
185 (__v8df)_mm512_setzero_pd(), \
186 (__mmask8)-1, (R)); })
187
188#define _mm512_mask_rcp28_round_pd(S, M, A, R) __extension__ ({ \
189 (__m512d)__builtin_ia32_rcp28pd_mask((__v8df)(__m512d)(A), \
190 (__v8df)(__m512d)(S), \
191 (__mmask8)(M), (R)); })
192
193#define _mm512_maskz_rcp28_round_pd(M, A, R) __extension__ ({ \
194 (__m512d)__builtin_ia32_rcp28pd_mask((__v8df)(__m512d)(A), \
195 (__v8df)_mm512_setzero_pd(), \
196 (__mmask8)(M), (R)); })
197
198#define _mm512_rcp28_pd(A) \
199 _mm512_rcp28_round_pd((A), _MM_FROUND_CUR_DIRECTION)
200
201#define _mm512_mask_rcp28_pd(S, M, A) \
202 _mm512_mask_rcp28_round_pd((S), (M), (A), _MM_FROUND_CUR_DIRECTION)
203
204#define _mm512_maskz_rcp28_pd(M, A) \
205 _mm512_maskz_rcp28_round_pd((M), (A), _MM_FROUND_CUR_DIRECTION)
206
207#define _mm512_rcp28_round_ps(A, R) __extension__ ({ \
208 (__m512)__builtin_ia32_rcp28ps_mask((__v16sf)(__m512)(A), \
209 (__v16sf)_mm512_setzero_ps(), \
210 (__mmask16)-1, (R)); })
211
212#define _mm512_mask_rcp28_round_ps(S, M, A, R) __extension__ ({ \
213 (__m512)__builtin_ia32_rcp28ps_mask((__v16sf)(__m512)(A), \
214 (__v16sf)(__m512)(S), \
215 (__mmask16)(M), (R)); })
216
217#define _mm512_maskz_rcp28_round_ps(M, A, R) __extension__ ({ \
218 (__m512)__builtin_ia32_rcp28ps_mask((__v16sf)(__m512)(A), \
219 (__v16sf)_mm512_setzero_ps(), \
220 (__mmask16)(M), (R)); })
221
222#define _mm512_rcp28_ps(A) \
223 _mm512_rcp28_round_ps((A), _MM_FROUND_CUR_DIRECTION)
224
225#define _mm512_mask_rcp28_ps(S, M, A) \
226 _mm512_mask_rcp28_round_ps((S), (M), (A), _MM_FROUND_CUR_DIRECTION)
227
228#define _mm512_maskz_rcp28_ps(M, A) \
229 _mm512_maskz_rcp28_round_ps((M), (A), _MM_FROUND_CUR_DIRECTION)
230
231#define _mm_rcp28_round_ss(A, B, R) __extension__ ({ \
232 (__m128)__builtin_ia32_rcp28ss_mask((__v4sf)(__m128)(A), \
233 (__v4sf)(__m128)(B), \
234 (__v4sf)_mm_setzero_ps(), \
235 (__mmask8)-1, (R)); })
236
237#define _mm_mask_rcp28_round_ss(S, M, A, B, R) __extension__ ({ \
238 (__m128)__builtin_ia32_rcp28ss_mask((__v4sf)(__m128)(A), \
239 (__v4sf)(__m128)(B), \
240 (__v4sf)(__m128)(S), \
241 (__mmask8)(M), (R)); })
242
243#define _mm_maskz_rcp28_round_ss(M, A, B, R) __extension__ ({ \
244 (__m128)__builtin_ia32_rcp28ss_mask((__v4sf)(__m128)(A), \
245 (__v4sf)(__m128)(B), \
246 (__v4sf)_mm_setzero_ps(), \
247 (__mmask8)(M), (R)); })
248
249#define _mm_rcp28_ss(A, B) \
250 _mm_rcp28_round_ss((A), (B), _MM_FROUND_CUR_DIRECTION)
251
252#define _mm_mask_rcp28_ss(S, M, A, B) \
253 _mm_mask_rcp28_round_ss((S), (M), (A), (B), _MM_FROUND_CUR_DIRECTION)
254
255#define _mm_maskz_rcp28_ss(M, A, B) \
256 _mm_maskz_rcp28_round_ss((M), (A), (B), _MM_FROUND_CUR_DIRECTION)
257
258#define _mm_rcp28_round_sd(A, B, R) __extension__ ({ \
259 (__m128d)__builtin_ia32_rcp28sd_mask((__v2df)(__m128d)(A), \
260 (__v2df)(__m128d)(B), \
261 (__v2df)_mm_setzero_pd(), \
262 (__mmask8)-1, (R)); })
263
264#define _mm_mask_rcp28_round_sd(S, M, A, B, R) __extension__ ({ \
265 (__m128d)__builtin_ia32_rcp28sd_mask((__v2df)(__m128d)(A), \
266 (__v2df)(__m128d)(B), \
267 (__v2df)(__m128d)(S), \
268 (__mmask8)(M), (R)); })
269
270#define _mm_maskz_rcp28_round_sd(M, A, B, R) __extension__ ({ \
271 (__m128d)__builtin_ia32_rcp28sd_mask((__v2df)(__m128d)(A), \
272 (__v2df)(__m128d)(B), \
273 (__v2df)_mm_setzero_pd(), \
274 (__mmask8)(M), (R)); })
275
276#define _mm_rcp28_sd(A, B) \
277 _mm_rcp28_round_sd((A), (B), _MM_FROUND_CUR_DIRECTION)
278
279#define _mm_mask_rcp28_sd(S, M, A, B) \
280 _mm_mask_rcp28_round_sd((S), (M), (A), (B), _MM_FROUND_CUR_DIRECTION)
281
282#define _mm_maskz_rcp28_sd(M, A, B) \
283 _mm_maskz_rcp28_round_sd((M), (A), (B), _MM_FROUND_CUR_DIRECTION)
284
285#endif // __AVX512ERINTRIN_H
c_headers/avx512fintrin.h created+2457
......@@ -0,0 +1,2457 @@
1/*===---- avx512fintrin.h - AVX2 intrinsics --------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23#ifndef __IMMINTRIN_H
24#error "Never use <avx512fintrin.h> directly; include <immintrin.h> instead."
25#endif
26
27#ifndef __AVX512FINTRIN_H
28#define __AVX512FINTRIN_H
29
30typedef double __v8df __attribute__((__vector_size__(64)));
31typedef float __v16sf __attribute__((__vector_size__(64)));
32typedef long long __v8di __attribute__((__vector_size__(64)));
33typedef int __v16si __attribute__((__vector_size__(64)));
34
35typedef float __m512 __attribute__((__vector_size__(64)));
36typedef double __m512d __attribute__((__vector_size__(64)));
37typedef long long __m512i __attribute__((__vector_size__(64)));
38
39typedef unsigned char __mmask8;
40typedef unsigned short __mmask16;
41
42/* Rounding mode macros. */
43#define _MM_FROUND_TO_NEAREST_INT 0x00
44#define _MM_FROUND_TO_NEG_INF 0x01
45#define _MM_FROUND_TO_POS_INF 0x02
46#define _MM_FROUND_TO_ZERO 0x03
47#define _MM_FROUND_CUR_DIRECTION 0x04
48
49/* Define the default attributes for the functions in this file. */
50#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
51
52/* Create vectors with repeated elements */
53
54static __inline __m512i __DEFAULT_FN_ATTRS
55_mm512_setzero_si512(void)
56{
57 return (__m512i)(__v8di){ 0, 0, 0, 0, 0, 0, 0, 0 };
58}
59
60static __inline __m512i __DEFAULT_FN_ATTRS
61_mm512_maskz_set1_epi32(__mmask16 __M, int __A)
62{
63 return (__m512i) __builtin_ia32_pbroadcastd512_gpr_mask (__A,
64 (__v16si)
65 _mm512_setzero_si512 (),
66 __M);
67}
68
69static __inline __m512i __DEFAULT_FN_ATTRS
70_mm512_maskz_set1_epi64(__mmask8 __M, long long __A)
71{
72#ifdef __x86_64__
73 return (__m512i) __builtin_ia32_pbroadcastq512_gpr_mask (__A,
74 (__v8di)
75 _mm512_setzero_si512 (),
76 __M);
77#else
78 return (__m512i) __builtin_ia32_pbroadcastq512_mem_mask (__A,
79 (__v8di)
80 _mm512_setzero_si512 (),
81 __M);
82#endif
83}
84
85static __inline __m512 __DEFAULT_FN_ATTRS
86_mm512_setzero_ps(void)
87{
88 return (__m512){ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
89 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
90}
91static __inline __m512d __DEFAULT_FN_ATTRS
92_mm512_setzero_pd(void)
93{
94 return (__m512d){ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
95}
96
97static __inline __m512 __DEFAULT_FN_ATTRS
98_mm512_set1_ps(float __w)
99{
100 return (__m512){ __w, __w, __w, __w, __w, __w, __w, __w,
101 __w, __w, __w, __w, __w, __w, __w, __w };
102}
103
104static __inline __m512d __DEFAULT_FN_ATTRS
105_mm512_set1_pd(double __w)
106{
107 return (__m512d){ __w, __w, __w, __w, __w, __w, __w, __w };
108}
109
110static __inline __m512i __DEFAULT_FN_ATTRS
111_mm512_set1_epi32(int __s)
112{
113 return (__m512i)(__v16si){ __s, __s, __s, __s, __s, __s, __s, __s,
114 __s, __s, __s, __s, __s, __s, __s, __s };
115}
116
117static __inline __m512i __DEFAULT_FN_ATTRS
118_mm512_set1_epi64(long long __d)
119{
120 return (__m512i)(__v8di){ __d, __d, __d, __d, __d, __d, __d, __d };
121}
122
123static __inline__ __m512 __DEFAULT_FN_ATTRS
124_mm512_broadcastss_ps(__m128 __X)
125{
126 float __f = __X[0];
127 return (__v16sf){ __f, __f, __f, __f,
128 __f, __f, __f, __f,
129 __f, __f, __f, __f,
130 __f, __f, __f, __f };
131}
132
133static __inline__ __m512d __DEFAULT_FN_ATTRS
134_mm512_broadcastsd_pd(__m128d __X)
135{
136 double __d = __X[0];
137 return (__v8df){ __d, __d, __d, __d,
138 __d, __d, __d, __d };
139}
140
141/* Cast between vector types */
142
143static __inline __m512d __DEFAULT_FN_ATTRS
144_mm512_castpd256_pd512(__m256d __a)
145{
146 return __builtin_shufflevector(__a, __a, 0, 1, 2, 3, -1, -1, -1, -1);
147}
148
149static __inline __m512 __DEFAULT_FN_ATTRS
150_mm512_castps256_ps512(__m256 __a)
151{
152 return __builtin_shufflevector(__a, __a, 0, 1, 2, 3, 4, 5, 6, 7,
153 -1, -1, -1, -1, -1, -1, -1, -1);
154}
155
156static __inline __m128d __DEFAULT_FN_ATTRS
157_mm512_castpd512_pd128(__m512d __a)
158{
159 return __builtin_shufflevector(__a, __a, 0, 1);
160}
161
162static __inline __m128 __DEFAULT_FN_ATTRS
163_mm512_castps512_ps128(__m512 __a)
164{
165 return __builtin_shufflevector(__a, __a, 0, 1, 2, 3);
166}
167
168/* Bitwise operators */
169static __inline__ __m512i __DEFAULT_FN_ATTRS
170_mm512_and_epi32(__m512i __a, __m512i __b)
171{
172 return __a & __b;
173}
174
175static __inline__ __m512i __DEFAULT_FN_ATTRS
176_mm512_mask_and_epi32(__m512i __src, __mmask16 __k, __m512i __a, __m512i __b)
177{
178 return (__m512i) __builtin_ia32_pandd512_mask((__v16si) __a,
179 (__v16si) __b,
180 (__v16si) __src,
181 (__mmask16) __k);
182}
183static __inline__ __m512i __DEFAULT_FN_ATTRS
184_mm512_maskz_and_epi32(__mmask16 __k, __m512i __a, __m512i __b)
185{
186 return (__m512i) __builtin_ia32_pandd512_mask((__v16si) __a,
187 (__v16si) __b,
188 (__v16si)
189 _mm512_setzero_si512 (),
190 (__mmask16) __k);
191}
192
193static __inline__ __m512i __DEFAULT_FN_ATTRS
194_mm512_and_epi64(__m512i __a, __m512i __b)
195{
196 return __a & __b;
197}
198
199static __inline__ __m512i __DEFAULT_FN_ATTRS
200_mm512_mask_and_epi64(__m512i __src, __mmask8 __k, __m512i __a, __m512i __b)
201{
202 return (__m512i) __builtin_ia32_pandq512_mask ((__v8di) __a,
203 (__v8di) __b,
204 (__v8di) __src,
205 (__mmask8) __k);
206}
207static __inline__ __m512i __DEFAULT_FN_ATTRS
208_mm512_maskz_and_epi64(__mmask8 __k, __m512i __a, __m512i __b)
209{
210 return (__m512i) __builtin_ia32_pandq512_mask ((__v8di) __a,
211 (__v8di) __b,
212 (__v8di)
213 _mm512_setzero_si512 (),
214 (__mmask8) __k);
215}
216
217static __inline__ __m512i __DEFAULT_FN_ATTRS
218_mm512_andnot_epi32 (__m512i __A, __m512i __B)
219{
220 return (__m512i) __builtin_ia32_pandnd512_mask ((__v16si) __A,
221 (__v16si) __B,
222 (__v16si)
223 _mm512_setzero_si512 (),
224 (__mmask16) -1);
225}
226
227static __inline__ __m512i __DEFAULT_FN_ATTRS
228_mm512_mask_andnot_epi32 (__m512i __W, __mmask16 __U, __m512i __A, __m512i __B)
229{
230 return (__m512i) __builtin_ia32_pandnd512_mask ((__v16si) __A,
231 (__v16si) __B,
232 (__v16si) __W,
233 (__mmask16) __U);
234}
235
236static __inline__ __m512i __DEFAULT_FN_ATTRS
237_mm512_maskz_andnot_epi32 (__mmask16 __U, __m512i __A, __m512i __B)
238{
239 return (__m512i) __builtin_ia32_pandnd512_mask ((__v16si) __A,
240 (__v16si) __B,
241 (__v16si)
242 _mm512_setzero_si512 (),
243 (__mmask16) __U);
244}
245
246static __inline__ __m512i __DEFAULT_FN_ATTRS
247_mm512_andnot_epi64 (__m512i __A, __m512i __B)
248{
249 return (__m512i) __builtin_ia32_pandnq512_mask ((__v8di) __A,
250 (__v8di) __B,
251 (__v8di)
252 _mm512_setzero_si512 (),
253 (__mmask8) -1);
254}
255
256static __inline__ __m512i __DEFAULT_FN_ATTRS
257_mm512_mask_andnot_epi64 (__m512i __W, __mmask8 __U, __m512i __A, __m512i __B)
258{
259 return (__m512i) __builtin_ia32_pandnq512_mask ((__v8di) __A,
260 (__v8di) __B,
261 (__v8di) __W, __U);
262}
263
264static __inline__ __m512i __DEFAULT_FN_ATTRS
265_mm512_maskz_andnot_epi64 (__mmask8 __U, __m512i __A, __m512i __B)
266{
267 return (__m512i) __builtin_ia32_pandnq512_mask ((__v8di) __A,
268 (__v8di) __B,
269 (__v8di)
270 _mm512_setzero_pd (),
271 __U);
272}
273static __inline__ __m512i __DEFAULT_FN_ATTRS
274_mm512_or_epi32(__m512i __a, __m512i __b)
275{
276 return __a | __b;
277}
278
279static __inline__ __m512i __DEFAULT_FN_ATTRS
280_mm512_mask_or_epi32(__m512i __src, __mmask16 __k, __m512i __a, __m512i __b)
281{
282 return (__m512i) __builtin_ia32_pord512_mask((__v16si) __a,
283 (__v16si) __b,
284 (__v16si) __src,
285 (__mmask16) __k);
286}
287static __inline__ __m512i __DEFAULT_FN_ATTRS
288_mm512_maskz_or_epi32(__mmask16 __k, __m512i __a, __m512i __b)
289{
290 return (__m512i) __builtin_ia32_pord512_mask((__v16si) __a,
291 (__v16si) __b,
292 (__v16si)
293 _mm512_setzero_si512 (),
294 (__mmask16) __k);
295}
296
297static __inline__ __m512i __DEFAULT_FN_ATTRS
298_mm512_or_epi64(__m512i __a, __m512i __b)
299{
300 return __a | __b;
301}
302
303static __inline__ __m512i __DEFAULT_FN_ATTRS
304_mm512_mask_or_epi64(__m512i __src, __mmask8 __k, __m512i __a, __m512i __b)
305{
306 return (__m512i) __builtin_ia32_porq512_mask ((__v8di) __a,
307 (__v8di) __b,
308 (__v8di) __src,
309 (__mmask8) __k);
310}
311static __inline__ __m512i __DEFAULT_FN_ATTRS
312_mm512_maskz_or_epi64(__mmask8 __k, __m512i __a, __m512i __b)
313{
314 return (__m512i) __builtin_ia32_porq512_mask ((__v8di) __a,
315 (__v8di) __b,
316 (__v8di)
317 _mm512_setzero_si512 (),
318 (__mmask8) __k);
319}
320
321static __inline__ __m512i __DEFAULT_FN_ATTRS
322_mm512_xor_epi32(__m512i __a, __m512i __b)
323{
324 return __a ^ __b;
325}
326
327static __inline__ __m512i __DEFAULT_FN_ATTRS
328_mm512_mask_xor_epi32(__m512i __src, __mmask16 __k, __m512i __a, __m512i __b)
329{
330 return (__m512i) __builtin_ia32_pxord512_mask((__v16si) __a,
331 (__v16si) __b,
332 (__v16si) __src,
333 (__mmask16) __k);
334}
335static __inline__ __m512i __DEFAULT_FN_ATTRS
336_mm512_maskz_xor_epi32(__mmask16 __k, __m512i __a, __m512i __b)
337{
338 return (__m512i) __builtin_ia32_pxord512_mask((__v16si) __a,
339 (__v16si) __b,
340 (__v16si)
341 _mm512_setzero_si512 (),
342 (__mmask16) __k);
343}
344
345static __inline__ __m512i __DEFAULT_FN_ATTRS
346_mm512_xor_epi64(__m512i __a, __m512i __b)
347{
348 return __a ^ __b;
349}
350
351static __inline__ __m512i __DEFAULT_FN_ATTRS
352_mm512_mask_xor_epi64(__m512i __src, __mmask8 __k, __m512i __a, __m512i __b)
353{
354 return (__m512i) __builtin_ia32_pxorq512_mask ((__v8di) __a,
355 (__v8di) __b,
356 (__v8di) __src,
357 (__mmask8) __k);
358}
359static __inline__ __m512i __DEFAULT_FN_ATTRS
360_mm512_maskz_xor_epi64(__mmask8 __k, __m512i __a, __m512i __b)
361{
362 return (__m512i) __builtin_ia32_pxorq512_mask ((__v8di) __a,
363 (__v8di) __b,
364 (__v8di)
365 _mm512_setzero_si512 (),
366 (__mmask8) __k);
367}
368
369static __inline__ __m512i __DEFAULT_FN_ATTRS
370_mm512_and_si512(__m512i __a, __m512i __b)
371{
372 return __a & __b;
373}
374
375static __inline__ __m512i __DEFAULT_FN_ATTRS
376_mm512_or_si512(__m512i __a, __m512i __b)
377{
378 return __a | __b;
379}
380
381static __inline__ __m512i __DEFAULT_FN_ATTRS
382_mm512_xor_si512(__m512i __a, __m512i __b)
383{
384 return __a ^ __b;
385}
386/* Arithmetic */
387
388static __inline __m512d __DEFAULT_FN_ATTRS
389_mm512_add_pd(__m512d __a, __m512d __b)
390{
391 return __a + __b;
392}
393
394static __inline __m512 __DEFAULT_FN_ATTRS
395_mm512_add_ps(__m512 __a, __m512 __b)
396{
397 return __a + __b;
398}
399
400static __inline __m512d __DEFAULT_FN_ATTRS
401_mm512_mul_pd(__m512d __a, __m512d __b)
402{
403 return __a * __b;
404}
405
406static __inline __m512 __DEFAULT_FN_ATTRS
407_mm512_mul_ps(__m512 __a, __m512 __b)
408{
409 return __a * __b;
410}
411
412static __inline __m512d __DEFAULT_FN_ATTRS
413_mm512_sub_pd(__m512d __a, __m512d __b)
414{
415 return __a - __b;
416}
417
418static __inline __m512 __DEFAULT_FN_ATTRS
419_mm512_sub_ps(__m512 __a, __m512 __b)
420{
421 return __a - __b;
422}
423
424static __inline__ __m512i __DEFAULT_FN_ATTRS
425_mm512_add_epi64 (__m512i __A, __m512i __B)
426{
427 return (__m512i) ((__v8di) __A + (__v8di) __B);
428}
429
430static __inline__ __m512i __DEFAULT_FN_ATTRS
431_mm512_mask_add_epi64 (__m512i __W, __mmask8 __U, __m512i __A, __m512i __B)
432{
433 return (__m512i) __builtin_ia32_paddq512_mask ((__v8di) __A,
434 (__v8di) __B,
435 (__v8di) __W,
436 (__mmask8) __U);
437}
438
439static __inline__ __m512i __DEFAULT_FN_ATTRS
440_mm512_maskz_add_epi64 (__mmask8 __U, __m512i __A, __m512i __B)
441{
442 return (__m512i) __builtin_ia32_paddq512_mask ((__v8di) __A,
443 (__v8di) __B,
444 (__v8di)
445 _mm512_setzero_si512 (),
446 (__mmask8) __U);
447}
448
449static __inline__ __m512i __DEFAULT_FN_ATTRS
450_mm512_sub_epi64 (__m512i __A, __m512i __B)
451{
452 return (__m512i) ((__v8di) __A - (__v8di) __B);
453}
454
455static __inline__ __m512i __DEFAULT_FN_ATTRS
456_mm512_mask_sub_epi64 (__m512i __W, __mmask8 __U, __m512i __A, __m512i __B)
457{
458 return (__m512i) __builtin_ia32_psubq512_mask ((__v8di) __A,
459 (__v8di) __B,
460 (__v8di) __W,
461 (__mmask8) __U);
462}
463
464static __inline__ __m512i __DEFAULT_FN_ATTRS
465_mm512_maskz_sub_epi64 (__mmask8 __U, __m512i __A, __m512i __B)
466{
467 return (__m512i) __builtin_ia32_psubq512_mask ((__v8di) __A,
468 (__v8di) __B,
469 (__v8di)
470 _mm512_setzero_si512 (),
471 (__mmask8) __U);
472}
473
474static __inline__ __m512i __DEFAULT_FN_ATTRS
475_mm512_add_epi32 (__m512i __A, __m512i __B)
476{
477 return (__m512i) ((__v16si) __A + (__v16si) __B);
478}
479
480static __inline__ __m512i __DEFAULT_FN_ATTRS
481_mm512_mask_add_epi32 (__m512i __W, __mmask16 __U, __m512i __A, __m512i __B)
482{
483 return (__m512i) __builtin_ia32_paddd512_mask ((__v16si) __A,
484 (__v16si) __B,
485 (__v16si) __W,
486 (__mmask16) __U);
487}
488
489static __inline__ __m512i __DEFAULT_FN_ATTRS
490_mm512_maskz_add_epi32 (__mmask16 __U, __m512i __A, __m512i __B)
491{
492 return (__m512i) __builtin_ia32_paddd512_mask ((__v16si) __A,
493 (__v16si) __B,
494 (__v16si)
495 _mm512_setzero_si512 (),
496 (__mmask16) __U);
497}
498
499static __inline__ __m512i __DEFAULT_FN_ATTRS
500_mm512_sub_epi32 (__m512i __A, __m512i __B)
501{
502 return (__m512i) ((__v16si) __A - (__v16si) __B);
503}
504
505static __inline__ __m512i __DEFAULT_FN_ATTRS
506_mm512_mask_sub_epi32 (__m512i __W, __mmask16 __U, __m512i __A, __m512i __B)
507{
508 return (__m512i) __builtin_ia32_psubd512_mask ((__v16si) __A,
509 (__v16si) __B,
510 (__v16si) __W,
511 (__mmask16) __U);
512}
513
514static __inline__ __m512i __DEFAULT_FN_ATTRS
515_mm512_maskz_sub_epi32 (__mmask16 __U, __m512i __A, __m512i __B)
516{
517 return (__m512i) __builtin_ia32_psubd512_mask ((__v16si) __A,
518 (__v16si) __B,
519 (__v16si)
520 _mm512_setzero_si512 (),
521 (__mmask16) __U);
522}
523
524static __inline__ __m512d __DEFAULT_FN_ATTRS
525_mm512_max_pd(__m512d __A, __m512d __B)
526{
527 return (__m512d) __builtin_ia32_maxpd512_mask ((__v8df) __A,
528 (__v8df) __B,
529 (__v8df)
530 _mm512_setzero_pd (),
531 (__mmask8) -1,
532 _MM_FROUND_CUR_DIRECTION);
533}
534
535static __inline__ __m512 __DEFAULT_FN_ATTRS
536_mm512_max_ps(__m512 __A, __m512 __B)
537{
538 return (__m512) __builtin_ia32_maxps512_mask ((__v16sf) __A,
539 (__v16sf) __B,
540 (__v16sf)
541 _mm512_setzero_ps (),
542 (__mmask16) -1,
543 _MM_FROUND_CUR_DIRECTION);
544}
545
546static __inline __m512i
547__DEFAULT_FN_ATTRS
548_mm512_max_epi32(__m512i __A, __m512i __B)
549{
550 return (__m512i) __builtin_ia32_pmaxsd512_mask ((__v16si) __A,
551 (__v16si) __B,
552 (__v16si)
553 _mm512_setzero_si512 (),
554 (__mmask16) -1);
555}
556
557static __inline __m512i __DEFAULT_FN_ATTRS
558_mm512_max_epu32(__m512i __A, __m512i __B)
559{
560 return (__m512i) __builtin_ia32_pmaxud512_mask ((__v16si) __A,
561 (__v16si) __B,
562 (__v16si)
563 _mm512_setzero_si512 (),
564 (__mmask16) -1);
565}
566
567static __inline __m512i __DEFAULT_FN_ATTRS
568_mm512_max_epi64(__m512i __A, __m512i __B)
569{
570 return (__m512i) __builtin_ia32_pmaxsq512_mask ((__v8di) __A,
571 (__v8di) __B,
572 (__v8di)
573 _mm512_setzero_si512 (),
574 (__mmask8) -1);
575}
576
577static __inline __m512i __DEFAULT_FN_ATTRS
578_mm512_max_epu64(__m512i __A, __m512i __B)
579{
580 return (__m512i) __builtin_ia32_pmaxuq512_mask ((__v8di) __A,
581 (__v8di) __B,
582 (__v8di)
583 _mm512_setzero_si512 (),
584 (__mmask8) -1);
585}
586
587static __inline__ __m512d __DEFAULT_FN_ATTRS
588_mm512_min_pd(__m512d __A, __m512d __B)
589{
590 return (__m512d) __builtin_ia32_minpd512_mask ((__v8df) __A,
591 (__v8df) __B,
592 (__v8df)
593 _mm512_setzero_pd (),
594 (__mmask8) -1,
595 _MM_FROUND_CUR_DIRECTION);
596}
597
598static __inline__ __m512 __DEFAULT_FN_ATTRS
599_mm512_min_ps(__m512 __A, __m512 __B)
600{
601 return (__m512) __builtin_ia32_minps512_mask ((__v16sf) __A,
602 (__v16sf) __B,
603 (__v16sf)
604 _mm512_setzero_ps (),
605 (__mmask16) -1,
606 _MM_FROUND_CUR_DIRECTION);
607}
608
609static __inline __m512i
610__DEFAULT_FN_ATTRS
611_mm512_min_epi32(__m512i __A, __m512i __B)
612{
613 return (__m512i) __builtin_ia32_pminsd512_mask ((__v16si) __A,
614 (__v16si) __B,
615 (__v16si)
616 _mm512_setzero_si512 (),
617 (__mmask16) -1);
618}
619
620static __inline __m512i __DEFAULT_FN_ATTRS
621_mm512_min_epu32(__m512i __A, __m512i __B)
622{
623 return (__m512i) __builtin_ia32_pminud512_mask ((__v16si) __A,
624 (__v16si) __B,
625 (__v16si)
626 _mm512_setzero_si512 (),
627 (__mmask16) -1);
628}
629
630static __inline __m512i __DEFAULT_FN_ATTRS
631_mm512_min_epi64(__m512i __A, __m512i __B)
632{
633 return (__m512i) __builtin_ia32_pminsq512_mask ((__v8di) __A,
634 (__v8di) __B,
635 (__v8di)
636 _mm512_setzero_si512 (),
637 (__mmask8) -1);
638}
639
640static __inline __m512i __DEFAULT_FN_ATTRS
641_mm512_min_epu64(__m512i __A, __m512i __B)
642{
643 return (__m512i) __builtin_ia32_pminuq512_mask ((__v8di) __A,
644 (__v8di) __B,
645 (__v8di)
646 _mm512_setzero_si512 (),
647 (__mmask8) -1);
648}
649
650static __inline __m512i __DEFAULT_FN_ATTRS
651_mm512_mul_epi32(__m512i __X, __m512i __Y)
652{
653 return (__m512i) __builtin_ia32_pmuldq512_mask ((__v16si) __X,
654 (__v16si) __Y,
655 (__v8di)
656 _mm512_setzero_si512 (),
657 (__mmask8) -1);
658}
659
660static __inline __m512i __DEFAULT_FN_ATTRS
661_mm512_mask_mul_epi32 (__m512i __W, __mmask8 __M, __m512i __X, __m512i __Y)
662{
663 return (__m512i) __builtin_ia32_pmuldq512_mask ((__v16si) __X,
664 (__v16si) __Y,
665 (__v8di) __W, __M);
666}
667
668static __inline __m512i __DEFAULT_FN_ATTRS
669_mm512_maskz_mul_epi32 (__mmask8 __M, __m512i __X, __m512i __Y)
670{
671 return (__m512i) __builtin_ia32_pmuldq512_mask ((__v16si) __X,
672 (__v16si) __Y,
673 (__v8di)
674 _mm512_setzero_si512 (),
675 __M);
676}
677
678static __inline __m512i __DEFAULT_FN_ATTRS
679_mm512_mul_epu32(__m512i __X, __m512i __Y)
680{
681 return (__m512i) __builtin_ia32_pmuludq512_mask ((__v16si) __X,
682 (__v16si) __Y,
683 (__v8di)
684 _mm512_setzero_si512 (),
685 (__mmask8) -1);
686}
687
688static __inline __m512i __DEFAULT_FN_ATTRS
689_mm512_mask_mul_epu32 (__m512i __W, __mmask8 __M, __m512i __X, __m512i __Y)
690{
691 return (__m512i) __builtin_ia32_pmuludq512_mask ((__v16si) __X,
692 (__v16si) __Y,
693 (__v8di) __W, __M);
694}
695
696static __inline __m512i __DEFAULT_FN_ATTRS
697_mm512_maskz_mul_epu32 (__mmask8 __M, __m512i __X, __m512i __Y)
698{
699 return (__m512i) __builtin_ia32_pmuludq512_mask ((__v16si) __X,
700 (__v16si) __Y,
701 (__v8di)
702 _mm512_setzero_si512 (),
703 __M);
704}
705
706static __inline __m512i __DEFAULT_FN_ATTRS
707_mm512_mullo_epi32 (__m512i __A, __m512i __B)
708{
709 return (__m512i) ((__v16si) __A * (__v16si) __B);
710}
711
712static __inline __m512i __DEFAULT_FN_ATTRS
713_mm512_maskz_mullo_epi32 (__mmask16 __M, __m512i __A, __m512i __B)
714{
715 return (__m512i) __builtin_ia32_pmulld512_mask ((__v16si) __A,
716 (__v16si) __B,
717 (__v16si)
718 _mm512_setzero_si512 (),
719 __M);
720}
721
722static __inline __m512i __DEFAULT_FN_ATTRS
723_mm512_mask_mullo_epi32 (__m512i __W, __mmask16 __M, __m512i __A, __m512i __B)
724{
725 return (__m512i) __builtin_ia32_pmulld512_mask ((__v16si) __A,
726 (__v16si) __B,
727 (__v16si) __W, __M);
728}
729
730static __inline__ __m512d __DEFAULT_FN_ATTRS
731_mm512_sqrt_pd(__m512d a)
732{
733 return (__m512d)__builtin_ia32_sqrtpd512_mask((__v8df)a,
734 (__v8df) _mm512_setzero_pd (),
735 (__mmask8) -1,
736 _MM_FROUND_CUR_DIRECTION);
737}
738
739static __inline__ __m512 __DEFAULT_FN_ATTRS
740_mm512_sqrt_ps(__m512 a)
741{
742 return (__m512)__builtin_ia32_sqrtps512_mask((__v16sf)a,
743 (__v16sf) _mm512_setzero_ps (),
744 (__mmask16) -1,
745 _MM_FROUND_CUR_DIRECTION);
746}
747
748static __inline__ __m512d __DEFAULT_FN_ATTRS
749_mm512_rsqrt14_pd(__m512d __A)
750{
751 return (__m512d) __builtin_ia32_rsqrt14pd512_mask ((__v8df) __A,
752 (__v8df)
753 _mm512_setzero_pd (),
754 (__mmask8) -1);}
755
756static __inline__ __m512 __DEFAULT_FN_ATTRS
757_mm512_rsqrt14_ps(__m512 __A)
758{
759 return (__m512) __builtin_ia32_rsqrt14ps512_mask ((__v16sf) __A,
760 (__v16sf)
761 _mm512_setzero_ps (),
762 (__mmask16) -1);
763}
764
765static __inline__ __m128 __DEFAULT_FN_ATTRS
766_mm_rsqrt14_ss(__m128 __A, __m128 __B)
767{
768 return (__m128) __builtin_ia32_rsqrt14ss_mask ((__v4sf) __A,
769 (__v4sf) __B,
770 (__v4sf)
771 _mm_setzero_ps (),
772 (__mmask8) -1);
773}
774
775static __inline__ __m128d __DEFAULT_FN_ATTRS
776_mm_rsqrt14_sd(__m128d __A, __m128d __B)
777{
778 return (__m128d) __builtin_ia32_rsqrt14sd_mask ((__v2df) __A,
779 (__v2df) __B,
780 (__v2df)
781 _mm_setzero_pd (),
782 (__mmask8) -1);
783}
784
785static __inline__ __m512d __DEFAULT_FN_ATTRS
786_mm512_rcp14_pd(__m512d __A)
787{
788 return (__m512d) __builtin_ia32_rcp14pd512_mask ((__v8df) __A,
789 (__v8df)
790 _mm512_setzero_pd (),
791 (__mmask8) -1);
792}
793
794static __inline__ __m512 __DEFAULT_FN_ATTRS
795_mm512_rcp14_ps(__m512 __A)
796{
797 return (__m512) __builtin_ia32_rcp14ps512_mask ((__v16sf) __A,
798 (__v16sf)
799 _mm512_setzero_ps (),
800 (__mmask16) -1);
801}
802static __inline__ __m128 __DEFAULT_FN_ATTRS
803_mm_rcp14_ss(__m128 __A, __m128 __B)
804{
805 return (__m128) __builtin_ia32_rcp14ss_mask ((__v4sf) __A,
806 (__v4sf) __B,
807 (__v4sf)
808 _mm_setzero_ps (),
809 (__mmask8) -1);
810}
811
812static __inline__ __m128d __DEFAULT_FN_ATTRS
813_mm_rcp14_sd(__m128d __A, __m128d __B)
814{
815 return (__m128d) __builtin_ia32_rcp14sd_mask ((__v2df) __A,
816 (__v2df) __B,
817 (__v2df)
818 _mm_setzero_pd (),
819 (__mmask8) -1);
820}
821
822static __inline __m512 __DEFAULT_FN_ATTRS
823_mm512_floor_ps(__m512 __A)
824{
825 return (__m512) __builtin_ia32_rndscaleps_mask ((__v16sf) __A,
826 _MM_FROUND_FLOOR,
827 (__v16sf) __A, -1,
828 _MM_FROUND_CUR_DIRECTION);
829}
830
831static __inline __m512d __DEFAULT_FN_ATTRS
832_mm512_floor_pd(__m512d __A)
833{
834 return (__m512d) __builtin_ia32_rndscalepd_mask ((__v8df) __A,
835 _MM_FROUND_FLOOR,
836 (__v8df) __A, -1,
837 _MM_FROUND_CUR_DIRECTION);
838}
839
840static __inline __m512 __DEFAULT_FN_ATTRS
841_mm512_ceil_ps(__m512 __A)
842{
843 return (__m512) __builtin_ia32_rndscaleps_mask ((__v16sf) __A,
844 _MM_FROUND_CEIL,
845 (__v16sf) __A, -1,
846 _MM_FROUND_CUR_DIRECTION);
847}
848
849static __inline __m512d __DEFAULT_FN_ATTRS
850_mm512_ceil_pd(__m512d __A)
851{
852 return (__m512d) __builtin_ia32_rndscalepd_mask ((__v8df) __A,
853 _MM_FROUND_CEIL,
854 (__v8df) __A, -1,
855 _MM_FROUND_CUR_DIRECTION);
856}
857
858static __inline __m512i __DEFAULT_FN_ATTRS
859_mm512_abs_epi64(__m512i __A)
860{
861 return (__m512i) __builtin_ia32_pabsq512_mask ((__v8di) __A,
862 (__v8di)
863 _mm512_setzero_si512 (),
864 (__mmask8) -1);
865}
866
867static __inline __m512i __DEFAULT_FN_ATTRS
868_mm512_abs_epi32(__m512i __A)
869{
870 return (__m512i) __builtin_ia32_pabsd512_mask ((__v16si) __A,
871 (__v16si)
872 _mm512_setzero_si512 (),
873 (__mmask16) -1);
874}
875
876#define _mm512_roundscale_ps(A, B) __extension__ ({ \
877 (__m512)__builtin_ia32_rndscaleps_mask((__v16sf)(A), (B), (__v16sf)(A), \
878 -1, _MM_FROUND_CUR_DIRECTION); })
879
880#define _mm512_roundscale_pd(A, B) __extension__ ({ \
881 (__m512d)__builtin_ia32_rndscalepd_mask((__v8df)(A), (B), (__v8df)(A), \
882 -1, _MM_FROUND_CUR_DIRECTION); })
883
884#define _mm512_fmadd_round_pd(A, B, C, R) __extension__ ({ \
885 (__m512d) __builtin_ia32_vfmaddpd512_mask ((__v8df) (A), \
886 (__v8df) (B), (__v8df) (C), \
887 (__mmask8) -1, (R)); })
888
889
890#define _mm512_mask_fmadd_round_pd(A, U, B, C, R) __extension__ ({ \
891 (__m512d) __builtin_ia32_vfmaddpd512_mask ((__v8df) (A), \
892 (__v8df) (B), (__v8df) (C), \
893 (__mmask8) (U), (R)); })
894
895
896#define _mm512_mask3_fmadd_round_pd(A, B, C, U, R) __extension__ ({ \
897 (__m512d) __builtin_ia32_vfmaddpd512_mask3 ((__v8df) (A), \
898 (__v8df) (B), (__v8df) (C), \
899 (__mmask8) (U), (R)); })
900
901
902#define _mm512_maskz_fmadd_round_pd(U, A, B, C, R) __extension__ ({ \
903 (__m512d) __builtin_ia32_vfmaddpd512_maskz ((__v8df) (A), \
904 (__v8df) (B), (__v8df) (C), \
905 (__mmask8) (U), (R)); })
906
907
908#define _mm512_fmsub_round_pd(A, B, C, R) __extension__ ({ \
909 (__m512d) __builtin_ia32_vfmaddpd512_mask ((__v8df) (A), \
910 (__v8df) (B), -(__v8df) (C), \
911 (__mmask8) -1, (R)); })
912
913
914#define _mm512_mask_fmsub_round_pd(A, U, B, C, R) __extension__ ({ \
915 (__m512d) __builtin_ia32_vfmaddpd512_mask ((__v8df) (A), \
916 (__v8df) (B), -(__v8df) (C), \
917 (__mmask8) (U), (R)); })
918
919
920#define _mm512_maskz_fmsub_round_pd(U, A, B, C, R) __extension__ ({ \
921 (__m512d) __builtin_ia32_vfmaddpd512_maskz ((__v8df) (A), \
922 (__v8df) (B), -(__v8df) (C), \
923 (__mmask8) (U), (R)); })
924
925
926#define _mm512_fnmadd_round_pd(A, B, C, R) __extension__ ({ \
927 (__m512d) __builtin_ia32_vfmaddpd512_mask (-(__v8df) (A), \
928 (__v8df) (B), (__v8df) (C), \
929 (__mmask8) -1, (R)); })
930
931
932#define _mm512_mask3_fnmadd_round_pd(A, B, C, U, R) __extension__ ({ \
933 (__m512d) __builtin_ia32_vfmaddpd512_mask3 (-(__v8df) (A), \
934 (__v8df) (B), (__v8df) (C), \
935 (__mmask8) (U), (R)); })
936
937
938#define _mm512_maskz_fnmadd_round_pd(U, A, B, C, R) __extension__ ({ \
939 (__m512d) __builtin_ia32_vfmaddpd512_maskz (-(__v8df) (A), \
940 (__v8df) (B), (__v8df) (C), \
941 (__mmask8) (U), (R)); })
942
943
944#define _mm512_fnmsub_round_pd(A, B, C, R) __extension__ ({ \
945 (__m512d) __builtin_ia32_vfmaddpd512_mask (-(__v8df) (A), \
946 (__v8df) (B), -(__v8df) (C), \
947 (__mmask8) -1, (R)); })
948
949
950#define _mm512_maskz_fnmsub_round_pd(U, A, B, C, R) __extension__ ({ \
951 (__m512d) __builtin_ia32_vfmaddpd512_maskz (-(__v8df) (A), \
952 (__v8df) (B), -(__v8df) (C), \
953 (__mmask8) (U), (R)); })
954
955
956static __inline__ __m512d __DEFAULT_FN_ATTRS
957_mm512_fmadd_pd(__m512d __A, __m512d __B, __m512d __C)
958{
959 return (__m512d) __builtin_ia32_vfmaddpd512_mask ((__v8df) __A,
960 (__v8df) __B,
961 (__v8df) __C,
962 (__mmask8) -1,
963 _MM_FROUND_CUR_DIRECTION);
964}
965
966static __inline__ __m512d __DEFAULT_FN_ATTRS
967_mm512_mask_fmadd_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C)
968{
969 return (__m512d) __builtin_ia32_vfmaddpd512_mask ((__v8df) __A,
970 (__v8df) __B,
971 (__v8df) __C,
972 (__mmask8) __U,
973 _MM_FROUND_CUR_DIRECTION);
974}
975
976static __inline__ __m512d __DEFAULT_FN_ATTRS
977_mm512_mask3_fmadd_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U)
978{
979 return (__m512d) __builtin_ia32_vfmaddpd512_mask3 ((__v8df) __A,
980 (__v8df) __B,
981 (__v8df) __C,
982 (__mmask8) __U,
983 _MM_FROUND_CUR_DIRECTION);
984}
985
986static __inline__ __m512d __DEFAULT_FN_ATTRS
987_mm512_maskz_fmadd_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C)
988{
989 return (__m512d) __builtin_ia32_vfmaddpd512_maskz ((__v8df) __A,
990 (__v8df) __B,
991 (__v8df) __C,
992 (__mmask8) __U,
993 _MM_FROUND_CUR_DIRECTION);
994}
995
996static __inline__ __m512d __DEFAULT_FN_ATTRS
997_mm512_fmsub_pd(__m512d __A, __m512d __B, __m512d __C)
998{
999 return (__m512d) __builtin_ia32_vfmaddpd512_mask ((__v8df) __A,
1000 (__v8df) __B,
1001 -(__v8df) __C,
1002 (__mmask8) -1,
1003 _MM_FROUND_CUR_DIRECTION);
1004}
1005
1006static __inline__ __m512d __DEFAULT_FN_ATTRS
1007_mm512_mask_fmsub_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C)
1008{
1009 return (__m512d) __builtin_ia32_vfmaddpd512_mask ((__v8df) __A,
1010 (__v8df) __B,
1011 -(__v8df) __C,
1012 (__mmask8) __U,
1013 _MM_FROUND_CUR_DIRECTION);
1014}
1015
1016static __inline__ __m512d __DEFAULT_FN_ATTRS
1017_mm512_maskz_fmsub_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C)
1018{
1019 return (__m512d) __builtin_ia32_vfmaddpd512_maskz ((__v8df) __A,
1020 (__v8df) __B,
1021 -(__v8df) __C,
1022 (__mmask8) __U,
1023 _MM_FROUND_CUR_DIRECTION);
1024}
1025
1026static __inline__ __m512d __DEFAULT_FN_ATTRS
1027_mm512_fnmadd_pd(__m512d __A, __m512d __B, __m512d __C)
1028{
1029 return (__m512d) __builtin_ia32_vfmaddpd512_mask (-(__v8df) __A,
1030 (__v8df) __B,
1031 (__v8df) __C,
1032 (__mmask8) -1,
1033 _MM_FROUND_CUR_DIRECTION);
1034}
1035
1036static __inline__ __m512d __DEFAULT_FN_ATTRS
1037_mm512_mask3_fnmadd_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U)
1038{
1039 return (__m512d) __builtin_ia32_vfmaddpd512_mask3 (-(__v8df) __A,
1040 (__v8df) __B,
1041 (__v8df) __C,
1042 (__mmask8) __U,
1043 _MM_FROUND_CUR_DIRECTION);
1044}
1045
1046static __inline__ __m512d __DEFAULT_FN_ATTRS
1047_mm512_maskz_fnmadd_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C)
1048{
1049 return (__m512d) __builtin_ia32_vfmaddpd512_maskz (-(__v8df) __A,
1050 (__v8df) __B,
1051 (__v8df) __C,
1052 (__mmask8) __U,
1053 _MM_FROUND_CUR_DIRECTION);
1054}
1055
1056static __inline__ __m512d __DEFAULT_FN_ATTRS
1057_mm512_fnmsub_pd(__m512d __A, __m512d __B, __m512d __C)
1058{
1059 return (__m512d) __builtin_ia32_vfmaddpd512_mask (-(__v8df) __A,
1060 (__v8df) __B,
1061 -(__v8df) __C,
1062 (__mmask8) -1,
1063 _MM_FROUND_CUR_DIRECTION);
1064}
1065
1066static __inline__ __m512d __DEFAULT_FN_ATTRS
1067_mm512_maskz_fnmsub_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C)
1068{
1069 return (__m512d) __builtin_ia32_vfmaddpd512_maskz (-(__v8df) __A,
1070 (__v8df) __B,
1071 -(__v8df) __C,
1072 (__mmask8) __U,
1073 _MM_FROUND_CUR_DIRECTION);
1074}
1075
1076#define _mm512_fmadd_round_ps(A, B, C, R) __extension__ ({ \
1077 (__m512) __builtin_ia32_vfmaddps512_mask ((__v16sf) (A), \
1078 (__v16sf) (B), (__v16sf) (C), \
1079 (__mmask16) -1, (R)); })
1080
1081
1082#define _mm512_mask_fmadd_round_ps(A, U, B, C, R) __extension__ ({ \
1083 (__m512) __builtin_ia32_vfmaddps512_mask ((__v16sf) (A), \
1084 (__v16sf) (B), (__v16sf) (C), \
1085 (__mmask16) (U), (R)); })
1086
1087
1088#define _mm512_mask3_fmadd_round_ps(A, B, C, U, R) __extension__ ({ \
1089 (__m512) __builtin_ia32_vfmaddps512_mask3 ((__v16sf) (A), \
1090 (__v16sf) (B), (__v16sf) (C), \
1091 (__mmask16) (U), (R)); })
1092
1093
1094#define _mm512_maskz_fmadd_round_ps(U, A, B, C, R) __extension__ ({ \
1095 (__m512) __builtin_ia32_vfmaddps512_maskz ((__v16sf) (A), \
1096 (__v16sf) (B), (__v16sf) (C), \
1097 (__mmask16) (U), (R)); })
1098
1099
1100#define _mm512_fmsub_round_ps(A, B, C, R) __extension__ ({ \
1101 (__m512) __builtin_ia32_vfmaddps512_mask ((__v16sf) (A), \
1102 (__v16sf) (B), -(__v16sf) (C), \
1103 (__mmask16) -1, (R)); })
1104
1105
1106#define _mm512_mask_fmsub_round_ps(A, U, B, C, R) __extension__ ({ \
1107 (__m512) __builtin_ia32_vfmaddps512_mask ((__v16sf) (A), \
1108 (__v16sf) (B), -(__v16sf) (C), \
1109 (__mmask16) (U), (R)); })
1110
1111
1112#define _mm512_maskz_fmsub_round_ps(U, A, B, C, R) __extension__ ({ \
1113 (__m512) __builtin_ia32_vfmaddps512_maskz ((__v16sf) (A), \
1114 (__v16sf) (B), -(__v16sf) (C), \
1115 (__mmask16) (U), (R)); })
1116
1117
1118#define _mm512_fnmadd_round_ps(A, B, C, R) __extension__ ({ \
1119 (__m512) __builtin_ia32_vfmaddps512_mask (-(__v16sf) (A), \
1120 (__v16sf) (B), (__v16sf) (C), \
1121 (__mmask16) -1, (R)); })
1122
1123
1124#define _mm512_mask3_fnmadd_round_ps(A, B, C, U, R) __extension__ ({ \
1125 (__m512) __builtin_ia32_vfmaddps512_mask3 (-(__v16sf) (A), \
1126 (__v16sf) (B), (__v16sf) (C), \
1127 (__mmask16) (U), (R)); })
1128
1129
1130#define _mm512_maskz_fnmadd_round_ps(U, A, B, C, R) __extension__ ({ \
1131 (__m512) __builtin_ia32_vfmaddps512_maskz (-(__v16sf) (A), \
1132 (__v16sf) (B), (__v16sf) (C), \
1133 (__mmask16) (U), (R)); })
1134
1135
1136#define _mm512_fnmsub_round_ps(A, B, C, R) __extension__ ({ \
1137 (__m512) __builtin_ia32_vfmaddps512_mask (-(__v16sf) (A), \
1138 (__v16sf) (B), -(__v16sf) (C), \
1139 (__mmask16) -1, (R)); })
1140
1141
1142#define _mm512_maskz_fnmsub_round_ps(U, A, B, C, R) __extension__ ({ \
1143 (__m512) __builtin_ia32_vfmaddps512_maskz (-(__v16sf) (A), \
1144 (__v16sf) (B), -(__v16sf) (C), \
1145 (__mmask16) (U), (R)); })
1146
1147
1148static __inline__ __m512 __DEFAULT_FN_ATTRS
1149_mm512_fmadd_ps(__m512 __A, __m512 __B, __m512 __C)
1150{
1151 return (__m512) __builtin_ia32_vfmaddps512_mask ((__v16sf) __A,
1152 (__v16sf) __B,
1153 (__v16sf) __C,
1154 (__mmask16) -1,
1155 _MM_FROUND_CUR_DIRECTION);
1156}
1157
1158static __inline__ __m512 __DEFAULT_FN_ATTRS
1159_mm512_mask_fmadd_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C)
1160{
1161 return (__m512) __builtin_ia32_vfmaddps512_mask ((__v16sf) __A,
1162 (__v16sf) __B,
1163 (__v16sf) __C,
1164 (__mmask16) __U,
1165 _MM_FROUND_CUR_DIRECTION);
1166}
1167
1168static __inline__ __m512 __DEFAULT_FN_ATTRS
1169_mm512_mask3_fmadd_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U)
1170{
1171 return (__m512) __builtin_ia32_vfmaddps512_mask3 ((__v16sf) __A,
1172 (__v16sf) __B,
1173 (__v16sf) __C,
1174 (__mmask16) __U,
1175 _MM_FROUND_CUR_DIRECTION);
1176}
1177
1178static __inline__ __m512 __DEFAULT_FN_ATTRS
1179_mm512_maskz_fmadd_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C)
1180{
1181 return (__m512) __builtin_ia32_vfmaddps512_maskz ((__v16sf) __A,
1182 (__v16sf) __B,
1183 (__v16sf) __C,
1184 (__mmask16) __U,
1185 _MM_FROUND_CUR_DIRECTION);
1186}
1187
1188static __inline__ __m512 __DEFAULT_FN_ATTRS
1189_mm512_fmsub_ps(__m512 __A, __m512 __B, __m512 __C)
1190{
1191 return (__m512) __builtin_ia32_vfmaddps512_mask ((__v16sf) __A,
1192 (__v16sf) __B,
1193 -(__v16sf) __C,
1194 (__mmask16) -1,
1195 _MM_FROUND_CUR_DIRECTION);
1196}
1197
1198static __inline__ __m512 __DEFAULT_FN_ATTRS
1199_mm512_mask_fmsub_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C)
1200{
1201 return (__m512) __builtin_ia32_vfmaddps512_mask ((__v16sf) __A,
1202 (__v16sf) __B,
1203 -(__v16sf) __C,
1204 (__mmask16) __U,
1205 _MM_FROUND_CUR_DIRECTION);
1206}
1207
1208static __inline__ __m512 __DEFAULT_FN_ATTRS
1209_mm512_maskz_fmsub_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C)
1210{
1211 return (__m512) __builtin_ia32_vfmaddps512_maskz ((__v16sf) __A,
1212 (__v16sf) __B,
1213 -(__v16sf) __C,
1214 (__mmask16) __U,
1215 _MM_FROUND_CUR_DIRECTION);
1216}
1217
1218static __inline__ __m512 __DEFAULT_FN_ATTRS
1219_mm512_fnmadd_ps(__m512 __A, __m512 __B, __m512 __C)
1220{
1221 return (__m512) __builtin_ia32_vfmaddps512_mask (-(__v16sf) __A,
1222 (__v16sf) __B,
1223 (__v16sf) __C,
1224 (__mmask16) -1,
1225 _MM_FROUND_CUR_DIRECTION);
1226}
1227
1228static __inline__ __m512 __DEFAULT_FN_ATTRS
1229_mm512_mask3_fnmadd_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U)
1230{
1231 return (__m512) __builtin_ia32_vfmaddps512_mask3 (-(__v16sf) __A,
1232 (__v16sf) __B,
1233 (__v16sf) __C,
1234 (__mmask16) __U,
1235 _MM_FROUND_CUR_DIRECTION);
1236}
1237
1238static __inline__ __m512 __DEFAULT_FN_ATTRS
1239_mm512_maskz_fnmadd_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C)
1240{
1241 return (__m512) __builtin_ia32_vfmaddps512_maskz (-(__v16sf) __A,
1242 (__v16sf) __B,
1243 (__v16sf) __C,
1244 (__mmask16) __U,
1245 _MM_FROUND_CUR_DIRECTION);
1246}
1247
1248static __inline__ __m512 __DEFAULT_FN_ATTRS
1249_mm512_fnmsub_ps(__m512 __A, __m512 __B, __m512 __C)
1250{
1251 return (__m512) __builtin_ia32_vfmaddps512_mask (-(__v16sf) __A,
1252 (__v16sf) __B,
1253 -(__v16sf) __C,
1254 (__mmask16) -1,
1255 _MM_FROUND_CUR_DIRECTION);
1256}
1257
1258static __inline__ __m512 __DEFAULT_FN_ATTRS
1259_mm512_maskz_fnmsub_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C)
1260{
1261 return (__m512) __builtin_ia32_vfmaddps512_maskz (-(__v16sf) __A,
1262 (__v16sf) __B,
1263 -(__v16sf) __C,
1264 (__mmask16) __U,
1265 _MM_FROUND_CUR_DIRECTION);
1266}
1267
1268#define _mm512_fmaddsub_round_pd(A, B, C, R) __extension__ ({ \
1269 (__m512d) __builtin_ia32_vfmaddsubpd512_mask ((__v8df) (A), \
1270 (__v8df) (B), (__v8df) (C), \
1271 (__mmask8) -1, (R)); })
1272
1273
1274#define _mm512_mask_fmaddsub_round_pd(A, U, B, C, R) __extension__ ({ \
1275 (__m512d) __builtin_ia32_vfmaddsubpd512_mask ((__v8df) (A), \
1276 (__v8df) (B), (__v8df) (C), \
1277 (__mmask8) (U), (R)); })
1278
1279
1280#define _mm512_mask3_fmaddsub_round_pd(A, B, C, U, R) __extension__ ({ \
1281 (__m512d) __builtin_ia32_vfmaddsubpd512_mask3 ((__v8df) (A), \
1282 (__v8df) (B), (__v8df) (C), \
1283 (__mmask8) (U), (R)); })
1284
1285
1286#define _mm512_maskz_fmaddsub_round_pd(U, A, B, C, R) __extension__ ({ \
1287 (__m512d) __builtin_ia32_vfmaddsubpd512_maskz ((__v8df) (A), \
1288 (__v8df) (B), (__v8df) (C), \
1289 (__mmask8) (U), (R)); })
1290
1291
1292#define _mm512_fmsubadd_round_pd(A, B, C, R) __extension__ ({ \
1293 (__m512d) __builtin_ia32_vfmaddsubpd512_mask ((__v8df) (A), \
1294 (__v8df) (B), -(__v8df) (C), \
1295 (__mmask8) -1, (R)); })
1296
1297
1298#define _mm512_mask_fmsubadd_round_pd(A, U, B, C, R) __extension__ ({ \
1299 (__m512d) __builtin_ia32_vfmaddsubpd512_mask ((__v8df) (A), \
1300 (__v8df) (B), -(__v8df) (C), \
1301 (__mmask8) (U), (R)); })
1302
1303
1304#define _mm512_maskz_fmsubadd_round_pd(U, A, B, C, R) __extension__ ({ \
1305 (__m512d) __builtin_ia32_vfmaddsubpd512_maskz ((__v8df) (A), \
1306 (__v8df) (B), -(__v8df) (C), \
1307 (__mmask8) (U), (R)); })
1308
1309
1310static __inline__ __m512d __DEFAULT_FN_ATTRS
1311_mm512_fmaddsub_pd(__m512d __A, __m512d __B, __m512d __C)
1312{
1313 return (__m512d) __builtin_ia32_vfmaddsubpd512_mask ((__v8df) __A,
1314 (__v8df) __B,
1315 (__v8df) __C,
1316 (__mmask8) -1,
1317 _MM_FROUND_CUR_DIRECTION);
1318}
1319
1320static __inline__ __m512d __DEFAULT_FN_ATTRS
1321_mm512_mask_fmaddsub_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C)
1322{
1323 return (__m512d) __builtin_ia32_vfmaddsubpd512_mask ((__v8df) __A,
1324 (__v8df) __B,
1325 (__v8df) __C,
1326 (__mmask8) __U,
1327 _MM_FROUND_CUR_DIRECTION);
1328}
1329
1330static __inline__ __m512d __DEFAULT_FN_ATTRS
1331_mm512_mask3_fmaddsub_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U)
1332{
1333 return (__m512d) __builtin_ia32_vfmaddsubpd512_mask3 ((__v8df) __A,
1334 (__v8df) __B,
1335 (__v8df) __C,
1336 (__mmask8) __U,
1337 _MM_FROUND_CUR_DIRECTION);
1338}
1339
1340static __inline__ __m512d __DEFAULT_FN_ATTRS
1341_mm512_maskz_fmaddsub_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C)
1342{
1343 return (__m512d) __builtin_ia32_vfmaddsubpd512_maskz ((__v8df) __A,
1344 (__v8df) __B,
1345 (__v8df) __C,
1346 (__mmask8) __U,
1347 _MM_FROUND_CUR_DIRECTION);
1348}
1349
1350static __inline__ __m512d __DEFAULT_FN_ATTRS
1351_mm512_fmsubadd_pd(__m512d __A, __m512d __B, __m512d __C)
1352{
1353 return (__m512d) __builtin_ia32_vfmaddsubpd512_mask ((__v8df) __A,
1354 (__v8df) __B,
1355 -(__v8df) __C,
1356 (__mmask8) -1,
1357 _MM_FROUND_CUR_DIRECTION);
1358}
1359
1360static __inline__ __m512d __DEFAULT_FN_ATTRS
1361_mm512_mask_fmsubadd_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C)
1362{
1363 return (__m512d) __builtin_ia32_vfmaddsubpd512_mask ((__v8df) __A,
1364 (__v8df) __B,
1365 -(__v8df) __C,
1366 (__mmask8) __U,
1367 _MM_FROUND_CUR_DIRECTION);
1368}
1369
1370static __inline__ __m512d __DEFAULT_FN_ATTRS
1371_mm512_maskz_fmsubadd_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C)
1372{
1373 return (__m512d) __builtin_ia32_vfmaddsubpd512_maskz ((__v8df) __A,
1374 (__v8df) __B,
1375 -(__v8df) __C,
1376 (__mmask8) __U,
1377 _MM_FROUND_CUR_DIRECTION);
1378}
1379
1380#define _mm512_fmaddsub_round_ps(A, B, C, R) __extension__ ({ \
1381 (__m512) __builtin_ia32_vfmaddsubps512_mask ((__v16sf) (A), \
1382 (__v16sf) (B), (__v16sf) (C), \
1383 (__mmask16) -1, (R)); })
1384
1385
1386#define _mm512_mask_fmaddsub_round_ps(A, U, B, C, R) __extension__ ({ \
1387 (__m512) __builtin_ia32_vfmaddsubps512_mask ((__v16sf) (A), \
1388 (__v16sf) (B), (__v16sf) (C), \
1389 (__mmask16) (U), (R)); })
1390
1391
1392#define _mm512_mask3_fmaddsub_round_ps(A, B, C, U, R) __extension__ ({ \
1393 (__m512) __builtin_ia32_vfmaddsubps512_mask3 ((__v16sf) (A), \
1394 (__v16sf) (B), (__v16sf) (C), \
1395 (__mmask16) (U), (R)); })
1396
1397
1398#define _mm512_maskz_fmaddsub_round_ps(U, A, B, C, R) __extension__ ({ \
1399 (__m512) __builtin_ia32_vfmaddsubps512_maskz ((__v16sf) (A), \
1400 (__v16sf) (B), (__v16sf) (C), \
1401 (__mmask16) (U), (R)); })
1402
1403
1404#define _mm512_fmsubadd_round_ps(A, B, C, R) __extension__ ({ \
1405 (__m512) __builtin_ia32_vfmaddsubps512_mask ((__v16sf) (A), \
1406 (__v16sf) (B), -(__v16sf) (C), \
1407 (__mmask16) -1, (R)); })
1408
1409
1410#define _mm512_mask_fmsubadd_round_ps(A, U, B, C, R) __extension__ ({ \
1411 (__m512) __builtin_ia32_vfmaddsubps512_mask ((__v16sf) (A), \
1412 (__v16sf) (B), -(__v16sf) (C), \
1413 (__mmask16) (U), (R)); })
1414
1415
1416#define _mm512_maskz_fmsubadd_round_ps(U, A, B, C, R) __extension__ ({ \
1417 (__m512) __builtin_ia32_vfmaddsubps512_maskz ((__v16sf) (A), \
1418 (__v16sf) (B), -(__v16sf) (C), \
1419 (__mmask16) (U), (R)); })
1420
1421
1422static __inline__ __m512 __DEFAULT_FN_ATTRS
1423_mm512_fmaddsub_ps(__m512 __A, __m512 __B, __m512 __C)
1424{
1425 return (__m512) __builtin_ia32_vfmaddsubps512_mask ((__v16sf) __A,
1426 (__v16sf) __B,
1427 (__v16sf) __C,
1428 (__mmask16) -1,
1429 _MM_FROUND_CUR_DIRECTION);
1430}
1431
1432static __inline__ __m512 __DEFAULT_FN_ATTRS
1433_mm512_mask_fmaddsub_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C)
1434{
1435 return (__m512) __builtin_ia32_vfmaddsubps512_mask ((__v16sf) __A,
1436 (__v16sf) __B,
1437 (__v16sf) __C,
1438 (__mmask16) __U,
1439 _MM_FROUND_CUR_DIRECTION);
1440}
1441
1442static __inline__ __m512 __DEFAULT_FN_ATTRS
1443_mm512_mask3_fmaddsub_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U)
1444{
1445 return (__m512) __builtin_ia32_vfmaddsubps512_mask3 ((__v16sf) __A,
1446 (__v16sf) __B,
1447 (__v16sf) __C,
1448 (__mmask16) __U,
1449 _MM_FROUND_CUR_DIRECTION);
1450}
1451
1452static __inline__ __m512 __DEFAULT_FN_ATTRS
1453_mm512_maskz_fmaddsub_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C)
1454{
1455 return (__m512) __builtin_ia32_vfmaddsubps512_maskz ((__v16sf) __A,
1456 (__v16sf) __B,
1457 (__v16sf) __C,
1458 (__mmask16) __U,
1459 _MM_FROUND_CUR_DIRECTION);
1460}
1461
1462static __inline__ __m512 __DEFAULT_FN_ATTRS
1463_mm512_fmsubadd_ps(__m512 __A, __m512 __B, __m512 __C)
1464{
1465 return (__m512) __builtin_ia32_vfmaddsubps512_mask ((__v16sf) __A,
1466 (__v16sf) __B,
1467 -(__v16sf) __C,
1468 (__mmask16) -1,
1469 _MM_FROUND_CUR_DIRECTION);
1470}
1471
1472static __inline__ __m512 __DEFAULT_FN_ATTRS
1473_mm512_mask_fmsubadd_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C)
1474{
1475 return (__m512) __builtin_ia32_vfmaddsubps512_mask ((__v16sf) __A,
1476 (__v16sf) __B,
1477 -(__v16sf) __C,
1478 (__mmask16) __U,
1479 _MM_FROUND_CUR_DIRECTION);
1480}
1481
1482static __inline__ __m512 __DEFAULT_FN_ATTRS
1483_mm512_maskz_fmsubadd_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C)
1484{
1485 return (__m512) __builtin_ia32_vfmaddsubps512_maskz ((__v16sf) __A,
1486 (__v16sf) __B,
1487 -(__v16sf) __C,
1488 (__mmask16) __U,
1489 _MM_FROUND_CUR_DIRECTION);
1490}
1491
1492#define _mm512_mask3_fmsub_round_pd(A, B, C, U, R) __extension__ ({ \
1493 (__m512d) __builtin_ia32_vfmsubpd512_mask3 ((__v8df) (A), \
1494 (__v8df) (B), (__v8df) (C), \
1495 (__mmask8) (U), (R)); })
1496
1497
1498static __inline__ __m512d __DEFAULT_FN_ATTRS
1499_mm512_mask3_fmsub_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U)
1500{
1501 return (__m512d) __builtin_ia32_vfmsubpd512_mask3 ((__v8df) __A,
1502 (__v8df) __B,
1503 (__v8df) __C,
1504 (__mmask8) __U,
1505 _MM_FROUND_CUR_DIRECTION);
1506}
1507
1508#define _mm512_mask3_fmsub_round_ps(A, B, C, U, R) __extension__ ({ \
1509 (__m512) __builtin_ia32_vfmsubps512_mask3 ((__v16sf) (A), \
1510 (__v16sf) (B), (__v16sf) (C), \
1511 (__mmask16) (U), (R)); })
1512
1513
1514static __inline__ __m512 __DEFAULT_FN_ATTRS
1515_mm512_mask3_fmsub_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U)
1516{
1517 return (__m512) __builtin_ia32_vfmsubps512_mask3 ((__v16sf) __A,
1518 (__v16sf) __B,
1519 (__v16sf) __C,
1520 (__mmask16) __U,
1521 _MM_FROUND_CUR_DIRECTION);
1522}
1523
1524#define _mm512_mask3_fmsubadd_round_pd(A, B, C, U, R) __extension__ ({ \
1525 (__m512d) __builtin_ia32_vfmsubaddpd512_mask3 ((__v8df) (A), \
1526 (__v8df) (B), (__v8df) (C), \
1527 (__mmask8) (U), (R)); })
1528
1529
1530static __inline__ __m512d __DEFAULT_FN_ATTRS
1531_mm512_mask3_fmsubadd_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U)
1532{
1533 return (__m512d) __builtin_ia32_vfmsubaddpd512_mask3 ((__v8df) __A,
1534 (__v8df) __B,
1535 (__v8df) __C,
1536 (__mmask8) __U,
1537 _MM_FROUND_CUR_DIRECTION);
1538}
1539
1540#define _mm512_mask3_fmsubadd_round_ps(A, B, C, U, R) __extension__ ({ \
1541 (__m512) __builtin_ia32_vfmsubaddps512_mask3 ((__v16sf) (A), \
1542 (__v16sf) (B), (__v16sf) (C), \
1543 (__mmask16) (U), (R)); })
1544
1545
1546static __inline__ __m512 __DEFAULT_FN_ATTRS
1547_mm512_mask3_fmsubadd_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U)
1548{
1549 return (__m512) __builtin_ia32_vfmsubaddps512_mask3 ((__v16sf) __A,
1550 (__v16sf) __B,
1551 (__v16sf) __C,
1552 (__mmask16) __U,
1553 _MM_FROUND_CUR_DIRECTION);
1554}
1555
1556#define _mm512_mask_fnmadd_round_pd(A, U, B, C, R) __extension__ ({ \
1557 (__m512d) __builtin_ia32_vfnmaddpd512_mask ((__v8df) (A), \
1558 (__v8df) (B), (__v8df) (C), \
1559 (__mmask8) (U), (R)); })
1560
1561
1562static __inline__ __m512d __DEFAULT_FN_ATTRS
1563_mm512_mask_fnmadd_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C)
1564{
1565 return (__m512d) __builtin_ia32_vfnmaddpd512_mask ((__v8df) __A,
1566 (__v8df) __B,
1567 (__v8df) __C,
1568 (__mmask8) __U,
1569 _MM_FROUND_CUR_DIRECTION);
1570}
1571
1572#define _mm512_mask_fnmadd_round_ps(A, U, B, C, R) __extension__ ({ \
1573 (__m512) __builtin_ia32_vfnmaddps512_mask ((__v16sf) (A), \
1574 (__v16sf) (B), (__v16sf) (C), \
1575 (__mmask16) (U), (R)); })
1576
1577
1578static __inline__ __m512 __DEFAULT_FN_ATTRS
1579_mm512_mask_fnmadd_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C)
1580{
1581 return (__m512) __builtin_ia32_vfnmaddps512_mask ((__v16sf) __A,
1582 (__v16sf) __B,
1583 (__v16sf) __C,
1584 (__mmask16) __U,
1585 _MM_FROUND_CUR_DIRECTION);
1586}
1587
1588#define _mm512_mask_fnmsub_round_pd(A, U, B, C, R) __extension__ ({ \
1589 (__m512d) __builtin_ia32_vfnmsubpd512_mask ((__v8df) (A), \
1590 (__v8df) (B), (__v8df) (C), \
1591 (__mmask8) (U), (R)); })
1592
1593
1594#define _mm512_mask3_fnmsub_round_pd(A, B, C, U, R) __extension__ ({ \
1595 (__m512d) __builtin_ia32_vfnmsubpd512_mask3 ((__v8df) (A), \
1596 (__v8df) (B), (__v8df) (C), \
1597 (__mmask8) (U), (R)); })
1598
1599
1600static __inline__ __m512d __DEFAULT_FN_ATTRS
1601_mm512_mask_fnmsub_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C)
1602{
1603 return (__m512d) __builtin_ia32_vfnmsubpd512_mask ((__v8df) __A,
1604 (__v8df) __B,
1605 (__v8df) __C,
1606 (__mmask8) __U,
1607 _MM_FROUND_CUR_DIRECTION);
1608}
1609
1610static __inline__ __m512d __DEFAULT_FN_ATTRS
1611_mm512_mask3_fnmsub_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U)
1612{
1613 return (__m512d) __builtin_ia32_vfnmsubpd512_mask3 ((__v8df) __A,
1614 (__v8df) __B,
1615 (__v8df) __C,
1616 (__mmask8) __U,
1617 _MM_FROUND_CUR_DIRECTION);
1618}
1619
1620#define _mm512_mask_fnmsub_round_ps(A, U, B, C, R) __extension__ ({ \
1621 (__m512) __builtin_ia32_vfnmsubps512_mask ((__v16sf) (A), \
1622 (__v16sf) (B), (__v16sf) (C), \
1623 (__mmask16) (U), (R)); })
1624
1625
1626#define _mm512_mask3_fnmsub_round_ps(A, B, C, U, R) __extension__ ({ \
1627 (__m512) __builtin_ia32_vfnmsubps512_mask3 ((__v16sf) (A), \
1628 (__v16sf) (B), (__v16sf) (C), \
1629 (__mmask16) (U), (R)); })
1630
1631
1632static __inline__ __m512 __DEFAULT_FN_ATTRS
1633_mm512_mask_fnmsub_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C)
1634{
1635 return (__m512) __builtin_ia32_vfnmsubps512_mask ((__v16sf) __A,
1636 (__v16sf) __B,
1637 (__v16sf) __C,
1638 (__mmask16) __U,
1639 _MM_FROUND_CUR_DIRECTION);
1640}
1641
1642static __inline__ __m512 __DEFAULT_FN_ATTRS
1643_mm512_mask3_fnmsub_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U)
1644{
1645 return (__m512) __builtin_ia32_vfnmsubps512_mask3 ((__v16sf) __A,
1646 (__v16sf) __B,
1647 (__v16sf) __C,
1648 (__mmask16) __U,
1649 _MM_FROUND_CUR_DIRECTION);
1650}
1651
1652
1653
1654/* Vector permutations */
1655
1656static __inline __m512i __DEFAULT_FN_ATTRS
1657_mm512_permutex2var_epi32(__m512i __A, __m512i __I, __m512i __B)
1658{
1659 return (__m512i) __builtin_ia32_vpermt2vard512_mask ((__v16si) __I
1660 /* idx */ ,
1661 (__v16si) __A,
1662 (__v16si) __B,
1663 (__mmask16) -1);
1664}
1665static __inline __m512i __DEFAULT_FN_ATTRS
1666_mm512_permutex2var_epi64(__m512i __A, __m512i __I, __m512i __B)
1667{
1668 return (__m512i) __builtin_ia32_vpermt2varq512_mask ((__v8di) __I
1669 /* idx */ ,
1670 (__v8di) __A,
1671 (__v8di) __B,
1672 (__mmask8) -1);
1673}
1674
1675static __inline __m512d __DEFAULT_FN_ATTRS
1676_mm512_permutex2var_pd(__m512d __A, __m512i __I, __m512d __B)
1677{
1678 return (__m512d) __builtin_ia32_vpermt2varpd512_mask ((__v8di) __I
1679 /* idx */ ,
1680 (__v8df) __A,
1681 (__v8df) __B,
1682 (__mmask8) -1);
1683}
1684static __inline __m512 __DEFAULT_FN_ATTRS
1685_mm512_permutex2var_ps(__m512 __A, __m512i __I, __m512 __B)
1686{
1687 return (__m512) __builtin_ia32_vpermt2varps512_mask ((__v16si) __I
1688 /* idx */ ,
1689 (__v16sf) __A,
1690 (__v16sf) __B,
1691 (__mmask16) -1);
1692}
1693
1694#define _mm512_alignr_epi64(A, B, I) __extension__ ({ \
1695 (__m512i)__builtin_ia32_alignq512_mask((__v8di)(__m512i)(A), \
1696 (__v8di)(__m512i)(B), \
1697 (I), (__v8di)_mm512_setzero_si512(), \
1698 (__mmask8)-1); })
1699
1700#define _mm512_alignr_epi32(A, B, I) __extension__ ({ \
1701 (__m512i)__builtin_ia32_alignd512_mask((__v16si)(__m512i)(A), \
1702 (__v16si)(__m512i)(B), \
1703 (I), (__v16si)_mm512_setzero_si512(), \
1704 (__mmask16)-1); })
1705
1706/* Vector Extract */
1707
1708#define _mm512_extractf64x4_pd(A, I) __extension__ ({ \
1709 __m512d __A = (A); \
1710 (__m256d) \
1711 __builtin_ia32_extractf64x4_mask((__v8df)__A, \
1712 (I), \
1713 (__v4df)_mm256_setzero_si256(), \
1714 (__mmask8) -1); })
1715
1716#define _mm512_extractf32x4_ps(A, I) __extension__ ({ \
1717 __m512 __A = (A); \
1718 (__m128) \
1719 __builtin_ia32_extractf32x4_mask((__v16sf)__A, \
1720 (I), \
1721 (__v4sf)_mm_setzero_ps(), \
1722 (__mmask8) -1); })
1723
1724/* Vector Blend */
1725
1726static __inline __m512d __DEFAULT_FN_ATTRS
1727_mm512_mask_blend_pd(__mmask8 __U, __m512d __A, __m512d __W)
1728{
1729 return (__m512d) __builtin_ia32_blendmpd_512_mask ((__v8df) __A,
1730 (__v8df) __W,
1731 (__mmask8) __U);
1732}
1733
1734static __inline __m512 __DEFAULT_FN_ATTRS
1735_mm512_mask_blend_ps(__mmask16 __U, __m512 __A, __m512 __W)
1736{
1737 return (__m512) __builtin_ia32_blendmps_512_mask ((__v16sf) __A,
1738 (__v16sf) __W,
1739 (__mmask16) __U);
1740}
1741
1742static __inline __m512i __DEFAULT_FN_ATTRS
1743_mm512_mask_blend_epi64(__mmask8 __U, __m512i __A, __m512i __W)
1744{
1745 return (__m512i) __builtin_ia32_blendmq_512_mask ((__v8di) __A,
1746 (__v8di) __W,
1747 (__mmask8) __U);
1748}
1749
1750static __inline __m512i __DEFAULT_FN_ATTRS
1751_mm512_mask_blend_epi32(__mmask16 __U, __m512i __A, __m512i __W)
1752{
1753 return (__m512i) __builtin_ia32_blendmd_512_mask ((__v16si) __A,
1754 (__v16si) __W,
1755 (__mmask16) __U);
1756}
1757
1758/* Compare */
1759
1760#define _mm512_cmp_round_ps_mask(A, B, P, R) __extension__ ({ \
1761 (__mmask16)__builtin_ia32_cmpps512_mask((__v16sf)(__m512)(A), \
1762 (__v16sf)(__m512)(B), \
1763 (P), (__mmask16)-1, (R)); })
1764
1765#define _mm512_mask_cmp_round_ps_mask(U, A, B, P, R) __extension__ ({ \
1766 (__mmask16)__builtin_ia32_cmpps512_mask((__v16sf)(__m512)(A), \
1767 (__v16sf)(__m512)(B), \
1768 (P), (__mmask16)(U), (R)); })
1769
1770#define _mm512_cmp_ps_mask(A, B, P) \
1771 _mm512_cmp_round_ps_mask((A), (B), (P), _MM_FROUND_CUR_DIRECTION)
1772
1773#define _mm512_mask_cmp_ps_mask(U, A, B, P) \
1774 _mm512_mask_cmp_round_ps_mask((U), (A), (B), (P), _MM_FROUND_CUR_DIRECTION)
1775
1776#define _mm512_cmp_round_pd_mask(A, B, P, R) __extension__ ({ \
1777 (__mmask8)__builtin_ia32_cmppd512_mask((__v8df)(__m512d)(A), \
1778 (__v8df)(__m512d)(B), \
1779 (P), (__mmask8)-1, (R)); })
1780
1781#define _mm512_mask_cmp_round_pd_mask(U, A, B, P, R) __extension__ ({ \
1782 (__mmask8)__builtin_ia32_cmppd512_mask((__v8df)(__m512d)(A), \
1783 (__v8df)(__m512d)(B), \
1784 (P), (__mmask8)(U), (R)); })
1785
1786#define _mm512_cmp_pd_mask(A, B, P) \
1787 _mm512_cmp_round_pd_mask((A), (B), (P), _MM_FROUND_CUR_DIRECTION)
1788
1789#define _mm512_mask_cmp_pd_mask(U, A, B, P) \
1790 _mm512_mask_cmp_round_pd_mask((U), (A), (B), (P), _MM_FROUND_CUR_DIRECTION)
1791
1792/* Conversion */
1793
1794static __inline __m512i __DEFAULT_FN_ATTRS
1795_mm512_cvttps_epu32(__m512 __A)
1796{
1797 return (__m512i) __builtin_ia32_cvttps2udq512_mask ((__v16sf) __A,
1798 (__v16si)
1799 _mm512_setzero_si512 (),
1800 (__mmask16) -1,
1801 _MM_FROUND_CUR_DIRECTION);
1802}
1803
1804#define _mm512_cvt_roundepi32_ps(A, R) __extension__ ({ \
1805 (__m512)__builtin_ia32_cvtdq2ps512_mask((__v16si)(A), \
1806 (__v16sf)_mm512_setzero_ps(), \
1807 (__mmask16)-1, (R)); })
1808
1809#define _mm512_cvt_roundepu32_ps(A, R) __extension__ ({ \
1810 (__m512)__builtin_ia32_cvtudq2ps512_mask((__v16si)(A), \
1811 (__v16sf)_mm512_setzero_ps(), \
1812 (__mmask16)-1, (R)); })
1813
1814static __inline __m512d __DEFAULT_FN_ATTRS
1815_mm512_cvtepi32_pd(__m256i __A)
1816{
1817 return (__m512d) __builtin_ia32_cvtdq2pd512_mask ((__v8si) __A,
1818 (__v8df)
1819 _mm512_setzero_pd (),
1820 (__mmask8) -1);
1821}
1822
1823static __inline __m512d __DEFAULT_FN_ATTRS
1824_mm512_cvtepu32_pd(__m256i __A)
1825{
1826 return (__m512d) __builtin_ia32_cvtudq2pd512_mask ((__v8si) __A,
1827 (__v8df)
1828 _mm512_setzero_pd (),
1829 (__mmask8) -1);
1830}
1831
1832#define _mm512_cvt_roundpd_ps(A, R) __extension__ ({ \
1833 (__m256)__builtin_ia32_cvtpd2ps512_mask((__v8df)(A), \
1834 (__v8sf)_mm256_setzero_ps(), \
1835 (__mmask8)-1, (R)); })
1836
1837#define _mm512_cvtps_ph(A, I) __extension__ ({ \
1838 (__m256i)__builtin_ia32_vcvtps2ph512_mask((__v16sf)(A), (I), \
1839 (__v16hi)_mm256_setzero_si256(), \
1840 -1); })
1841
1842static __inline __m512 __DEFAULT_FN_ATTRS
1843_mm512_cvtph_ps(__m256i __A)
1844{
1845 return (__m512) __builtin_ia32_vcvtph2ps512_mask ((__v16hi) __A,
1846 (__v16sf)
1847 _mm512_setzero_ps (),
1848 (__mmask16) -1,
1849 _MM_FROUND_CUR_DIRECTION);
1850}
1851
1852static __inline __m512i __DEFAULT_FN_ATTRS
1853_mm512_cvttps_epi32(__m512 a)
1854{
1855 return (__m512i)
1856 __builtin_ia32_cvttps2dq512_mask((__v16sf) a,
1857 (__v16si) _mm512_setzero_si512 (),
1858 (__mmask16) -1, _MM_FROUND_CUR_DIRECTION);
1859}
1860
1861static __inline __m256i __DEFAULT_FN_ATTRS
1862_mm512_cvttpd_epi32(__m512d a)
1863{
1864 return (__m256i)__builtin_ia32_cvttpd2dq512_mask((__v8df) a,
1865 (__v8si)_mm256_setzero_si256(),
1866 (__mmask8) -1,
1867 _MM_FROUND_CUR_DIRECTION);
1868}
1869
1870#define _mm512_cvtt_roundpd_epi32(A, R) __extension__ ({ \
1871 (__m256i)__builtin_ia32_cvttpd2dq512_mask((__v8df)(A), \
1872 (__v8si)_mm256_setzero_si256(), \
1873 (__mmask8)-1, (R)); })
1874
1875#define _mm512_cvtt_roundps_epi32(A, R) __extension__ ({ \
1876 (__m512i)__builtin_ia32_cvttps2dq512_mask((__v16sf)(A), \
1877 (__v16si)_mm512_setzero_si512(), \
1878 (__mmask16)-1, (R)); })
1879
1880#define _mm512_cvt_roundps_epi32(A, R) __extension__ ({ \
1881 (__m512i)__builtin_ia32_cvtps2dq512_mask((__v16sf)(A), \
1882 (__v16si)_mm512_setzero_si512(), \
1883 (__mmask16)-1, (R)); })
1884
1885#define _mm512_cvt_roundpd_epi32(A, R) __extension__ ({ \
1886 (__m256i)__builtin_ia32_cvtpd2dq512_mask((__v8df)(A), \
1887 (__v8si)_mm256_setzero_si256(), \
1888 (__mmask8)-1, (R)); })
1889
1890#define _mm512_cvt_roundps_epu32(A, R) __extension__ ({ \
1891 (__m512i)__builtin_ia32_cvtps2udq512_mask((__v16sf)(A), \
1892 (__v16si)_mm512_setzero_si512(), \
1893 (__mmask16)-1, (R)); })
1894
1895#define _mm512_cvt_roundpd_epu32(A, R) __extension__ ({ \
1896 (__m256i)__builtin_ia32_cvtpd2udq512_mask((__v8df)(A), \
1897 (__v8si)_mm256_setzero_si256(), \
1898 (__mmask8) -1, (R)); })
1899
1900/* Unpack and Interleave */
1901static __inline __m512d __DEFAULT_FN_ATTRS
1902_mm512_unpackhi_pd(__m512d __a, __m512d __b)
1903{
1904 return __builtin_shufflevector(__a, __b, 1, 9, 1+2, 9+2, 1+4, 9+4, 1+6, 9+6);
1905}
1906
1907static __inline __m512d __DEFAULT_FN_ATTRS
1908_mm512_unpacklo_pd(__m512d __a, __m512d __b)
1909{
1910 return __builtin_shufflevector(__a, __b, 0, 8, 0+2, 8+2, 0+4, 8+4, 0+6, 8+6);
1911}
1912
1913static __inline __m512 __DEFAULT_FN_ATTRS
1914_mm512_unpackhi_ps(__m512 __a, __m512 __b)
1915{
1916 return __builtin_shufflevector(__a, __b,
1917 2, 18, 3, 19,
1918 2+4, 18+4, 3+4, 19+4,
1919 2+8, 18+8, 3+8, 19+8,
1920 2+12, 18+12, 3+12, 19+12);
1921}
1922
1923static __inline __m512 __DEFAULT_FN_ATTRS
1924_mm512_unpacklo_ps(__m512 __a, __m512 __b)
1925{
1926 return __builtin_shufflevector(__a, __b,
1927 0, 16, 1, 17,
1928 0+4, 16+4, 1+4, 17+4,
1929 0+8, 16+8, 1+8, 17+8,
1930 0+12, 16+12, 1+12, 17+12);
1931}
1932
1933/* Bit Test */
1934
1935static __inline __mmask16 __DEFAULT_FN_ATTRS
1936_mm512_test_epi32_mask(__m512i __A, __m512i __B)
1937{
1938 return (__mmask16) __builtin_ia32_ptestmd512 ((__v16si) __A,
1939 (__v16si) __B,
1940 (__mmask16) -1);
1941}
1942
1943static __inline __mmask8 __DEFAULT_FN_ATTRS
1944_mm512_test_epi64_mask(__m512i __A, __m512i __B)
1945{
1946 return (__mmask8) __builtin_ia32_ptestmq512 ((__v8di) __A,
1947 (__v8di) __B,
1948 (__mmask8) -1);
1949}
1950
1951/* SIMD load ops */
1952
1953static __inline __m512i __DEFAULT_FN_ATTRS
1954_mm512_maskz_loadu_epi32(__mmask16 __U, void const *__P)
1955{
1956 return (__m512i) __builtin_ia32_loaddqusi512_mask ((const __v16si *)__P,
1957 (__v16si)
1958 _mm512_setzero_si512 (),
1959 (__mmask16) __U);
1960}
1961
1962static __inline __m512i __DEFAULT_FN_ATTRS
1963_mm512_maskz_loadu_epi64(__mmask8 __U, void const *__P)
1964{
1965 return (__m512i) __builtin_ia32_loaddqudi512_mask ((const __v8di *)__P,
1966 (__v8di)
1967 _mm512_setzero_si512 (),
1968 (__mmask8) __U);
1969}
1970
1971static __inline __m512 __DEFAULT_FN_ATTRS
1972_mm512_maskz_loadu_ps(__mmask16 __U, void const *__P)
1973{
1974 return (__m512) __builtin_ia32_loadups512_mask ((const __v16sf *)__P,
1975 (__v16sf)
1976 _mm512_setzero_ps (),
1977 (__mmask16) __U);
1978}
1979
1980static __inline __m512d __DEFAULT_FN_ATTRS
1981_mm512_maskz_loadu_pd(__mmask8 __U, void const *__P)
1982{
1983 return (__m512d) __builtin_ia32_loadupd512_mask ((const __v8df *)__P,
1984 (__v8df)
1985 _mm512_setzero_pd (),
1986 (__mmask8) __U);
1987}
1988
1989static __inline __m512 __DEFAULT_FN_ATTRS
1990_mm512_maskz_load_ps(__mmask16 __U, void const *__P)
1991{
1992 return (__m512) __builtin_ia32_loadaps512_mask ((const __v16sf *)__P,
1993 (__v16sf)
1994 _mm512_setzero_ps (),
1995 (__mmask16) __U);
1996}
1997
1998static __inline __m512d __DEFAULT_FN_ATTRS
1999_mm512_maskz_load_pd(__mmask8 __U, void const *__P)
2000{
2001 return (__m512d) __builtin_ia32_loadapd512_mask ((const __v8df *)__P,
2002 (__v8df)
2003 _mm512_setzero_pd (),
2004 (__mmask8) __U);
2005}
2006
2007static __inline __m512d __DEFAULT_FN_ATTRS
2008_mm512_loadu_pd(double const *__p)
2009{
2010 struct __loadu_pd {
2011 __m512d __v;
2012 } __attribute__((__packed__, __may_alias__));
2013 return ((struct __loadu_pd*)__p)->__v;
2014}
2015
2016static __inline __m512 __DEFAULT_FN_ATTRS
2017_mm512_loadu_ps(float const *__p)
2018{
2019 struct __loadu_ps {
2020 __m512 __v;
2021 } __attribute__((__packed__, __may_alias__));
2022 return ((struct __loadu_ps*)__p)->__v;
2023}
2024
2025static __inline __m512 __DEFAULT_FN_ATTRS
2026_mm512_load_ps(double const *__p)
2027{
2028 return (__m512) __builtin_ia32_loadaps512_mask ((const __v16sf *)__p,
2029 (__v16sf)
2030 _mm512_setzero_ps (),
2031 (__mmask16) -1);
2032}
2033
2034static __inline __m512d __DEFAULT_FN_ATTRS
2035_mm512_load_pd(float const *__p)
2036{
2037 return (__m512d) __builtin_ia32_loadapd512_mask ((const __v8df *)__p,
2038 (__v8df)
2039 _mm512_setzero_pd (),
2040 (__mmask8) -1);
2041}
2042
2043/* SIMD store ops */
2044
2045static __inline void __DEFAULT_FN_ATTRS
2046_mm512_mask_storeu_epi64(void *__P, __mmask8 __U, __m512i __A)
2047{
2048 __builtin_ia32_storedqudi512_mask ((__v8di *)__P, (__v8di) __A,
2049 (__mmask8) __U);
2050}
2051
2052static __inline void __DEFAULT_FN_ATTRS
2053_mm512_mask_storeu_epi32(void *__P, __mmask16 __U, __m512i __A)
2054{
2055 __builtin_ia32_storedqusi512_mask ((__v16si *)__P, (__v16si) __A,
2056 (__mmask16) __U);
2057}
2058
2059static __inline void __DEFAULT_FN_ATTRS
2060_mm512_mask_storeu_pd(void *__P, __mmask8 __U, __m512d __A)
2061{
2062 __builtin_ia32_storeupd512_mask ((__v8df *)__P, (__v8df) __A, (__mmask8) __U);
2063}
2064
2065static __inline void __DEFAULT_FN_ATTRS
2066_mm512_storeu_pd(void *__P, __m512d __A)
2067{
2068 __builtin_ia32_storeupd512_mask((__v8df *)__P, (__v8df)__A, (__mmask8)-1);
2069}
2070
2071static __inline void __DEFAULT_FN_ATTRS
2072_mm512_mask_storeu_ps(void *__P, __mmask16 __U, __m512 __A)
2073{
2074 __builtin_ia32_storeups512_mask ((__v16sf *)__P, (__v16sf) __A,
2075 (__mmask16) __U);
2076}
2077
2078static __inline void __DEFAULT_FN_ATTRS
2079_mm512_storeu_ps(void *__P, __m512 __A)
2080{
2081 __builtin_ia32_storeups512_mask((__v16sf *)__P, (__v16sf)__A, (__mmask16)-1);
2082}
2083
2084static __inline void __DEFAULT_FN_ATTRS
2085_mm512_mask_store_pd(void *__P, __mmask8 __U, __m512d __A)
2086{
2087 __builtin_ia32_storeapd512_mask ((__v8df *)__P, (__v8df) __A, (__mmask8) __U);
2088}
2089
2090static __inline void __DEFAULT_FN_ATTRS
2091_mm512_store_pd(void *__P, __m512d __A)
2092{
2093 *(__m512d*)__P = __A;
2094}
2095
2096static __inline void __DEFAULT_FN_ATTRS
2097_mm512_mask_store_ps(void *__P, __mmask16 __U, __m512 __A)
2098{
2099 __builtin_ia32_storeaps512_mask ((__v16sf *)__P, (__v16sf) __A,
2100 (__mmask16) __U);
2101}
2102
2103static __inline void __DEFAULT_FN_ATTRS
2104_mm512_store_ps(void *__P, __m512 __A)
2105{
2106 *(__m512*)__P = __A;
2107}
2108
2109/* Mask ops */
2110
2111static __inline __mmask16 __DEFAULT_FN_ATTRS
2112_mm512_knot(__mmask16 __M)
2113{
2114 return __builtin_ia32_knothi(__M);
2115}
2116
2117/* Integer compare */
2118
2119static __inline__ __mmask16 __DEFAULT_FN_ATTRS
2120_mm512_cmpeq_epi32_mask(__m512i __a, __m512i __b) {
2121 return (__mmask16)__builtin_ia32_pcmpeqd512_mask((__v16si)__a, (__v16si)__b,
2122 (__mmask16)-1);
2123}
2124
2125static __inline__ __mmask16 __DEFAULT_FN_ATTRS
2126_mm512_mask_cmpeq_epi32_mask(__mmask16 __u, __m512i __a, __m512i __b) {
2127 return (__mmask16)__builtin_ia32_pcmpeqd512_mask((__v16si)__a, (__v16si)__b,
2128 __u);
2129}
2130
2131static __inline__ __mmask16 __DEFAULT_FN_ATTRS
2132_mm512_cmpeq_epu32_mask(__m512i __a, __m512i __b) {
2133 return (__mmask16)__builtin_ia32_ucmpd512_mask((__v16si)__a, (__v16si)__b, 0,
2134 (__mmask16)-1);
2135}
2136
2137static __inline__ __mmask16 __DEFAULT_FN_ATTRS
2138_mm512_mask_cmpeq_epu32_mask(__mmask16 __u, __m512i __a, __m512i __b) {
2139 return (__mmask16)__builtin_ia32_ucmpd512_mask((__v16si)__a, (__v16si)__b, 0,
2140 __u);
2141}
2142
2143static __inline__ __mmask8 __DEFAULT_FN_ATTRS
2144_mm512_mask_cmpeq_epi64_mask(__mmask8 __u, __m512i __a, __m512i __b) {
2145 return (__mmask8)__builtin_ia32_pcmpeqq512_mask((__v8di)__a, (__v8di)__b,
2146 __u);
2147}
2148
2149static __inline__ __mmask8 __DEFAULT_FN_ATTRS
2150_mm512_cmpeq_epi64_mask(__m512i __a, __m512i __b) {
2151 return (__mmask8)__builtin_ia32_pcmpeqq512_mask((__v8di)__a, (__v8di)__b,
2152 (__mmask8)-1);
2153}
2154
2155static __inline__ __mmask8 __DEFAULT_FN_ATTRS
2156_mm512_cmpeq_epu64_mask(__m512i __a, __m512i __b) {
2157 return (__mmask8)__builtin_ia32_ucmpq512_mask((__v8di)__a, (__v8di)__b, 0,
2158 (__mmask8)-1);
2159}
2160
2161static __inline__ __mmask8 __DEFAULT_FN_ATTRS
2162_mm512_mask_cmpeq_epu64_mask(__mmask8 __u, __m512i __a, __m512i __b) {
2163 return (__mmask8)__builtin_ia32_ucmpq512_mask((__v8di)__a, (__v8di)__b, 0,
2164 __u);
2165}
2166
2167static __inline__ __mmask16 __DEFAULT_FN_ATTRS
2168_mm512_cmpge_epi32_mask(__m512i __a, __m512i __b) {
2169 return (__mmask16)__builtin_ia32_cmpd512_mask((__v16si)__a, (__v16si)__b, 5,
2170 (__mmask16)-1);
2171}
2172
2173static __inline__ __mmask16 __DEFAULT_FN_ATTRS
2174_mm512_mask_cmpge_epi32_mask(__mmask16 __u, __m512i __a, __m512i __b) {
2175 return (__mmask16)__builtin_ia32_cmpd512_mask((__v16si)__a, (__v16si)__b, 5,
2176 __u);
2177}
2178
2179static __inline__ __mmask16 __DEFAULT_FN_ATTRS
2180_mm512_cmpge_epu32_mask(__m512i __a, __m512i __b) {
2181 return (__mmask16)__builtin_ia32_ucmpd512_mask((__v16si)__a, (__v16si)__b, 5,
2182 (__mmask16)-1);
2183}
2184
2185static __inline__ __mmask16 __DEFAULT_FN_ATTRS
2186_mm512_mask_cmpge_epu32_mask(__mmask16 __u, __m512i __a, __m512i __b) {
2187 return (__mmask16)__builtin_ia32_ucmpd512_mask((__v16si)__a, (__v16si)__b, 5,
2188 __u);
2189}
2190
2191static __inline__ __mmask8 __DEFAULT_FN_ATTRS
2192_mm512_cmpge_epi64_mask(__m512i __a, __m512i __b) {
2193 return (__mmask8)__builtin_ia32_cmpq512_mask((__v8di)__a, (__v8di)__b, 5,
2194 (__mmask8)-1);
2195}
2196
2197static __inline__ __mmask8 __DEFAULT_FN_ATTRS
2198_mm512_mask_cmpge_epi64_mask(__mmask8 __u, __m512i __a, __m512i __b) {
2199 return (__mmask8)__builtin_ia32_cmpq512_mask((__v8di)__a, (__v8di)__b, 5,
2200 __u);
2201}
2202
2203static __inline__ __mmask8 __DEFAULT_FN_ATTRS
2204_mm512_cmpge_epu64_mask(__m512i __a, __m512i __b) {
2205 return (__mmask8)__builtin_ia32_ucmpq512_mask((__v8di)__a, (__v8di)__b, 5,
2206 (__mmask8)-1);
2207}
2208
2209static __inline__ __mmask8 __DEFAULT_FN_ATTRS
2210_mm512_mask_cmpge_epu64_mask(__mmask8 __u, __m512i __a, __m512i __b) {
2211 return (__mmask8)__builtin_ia32_ucmpq512_mask((__v8di)__a, (__v8di)__b, 5,
2212 __u);
2213}
2214
2215static __inline__ __mmask16 __DEFAULT_FN_ATTRS
2216_mm512_cmpgt_epi32_mask(__m512i __a, __m512i __b) {
2217 return (__mmask16)__builtin_ia32_pcmpgtd512_mask((__v16si)__a, (__v16si)__b,
2218 (__mmask16)-1);
2219}
2220
2221static __inline__ __mmask16 __DEFAULT_FN_ATTRS
2222_mm512_mask_cmpgt_epi32_mask(__mmask16 __u, __m512i __a, __m512i __b) {
2223 return (__mmask16)__builtin_ia32_pcmpgtd512_mask((__v16si)__a, (__v16si)__b,
2224 __u);
2225}
2226
2227static __inline__ __mmask16 __DEFAULT_FN_ATTRS
2228_mm512_cmpgt_epu32_mask(__m512i __a, __m512i __b) {
2229 return (__mmask16)__builtin_ia32_ucmpd512_mask((__v16si)__a, (__v16si)__b, 6,
2230 (__mmask16)-1);
2231}
2232
2233static __inline__ __mmask16 __DEFAULT_FN_ATTRS
2234_mm512_mask_cmpgt_epu32_mask(__mmask16 __u, __m512i __a, __m512i __b) {
2235 return (__mmask16)__builtin_ia32_ucmpd512_mask((__v16si)__a, (__v16si)__b, 6,
2236 __u);
2237}
2238
2239static __inline__ __mmask8 __DEFAULT_FN_ATTRS
2240_mm512_mask_cmpgt_epi64_mask(__mmask8 __u, __m512i __a, __m512i __b) {
2241 return (__mmask8)__builtin_ia32_pcmpgtq512_mask((__v8di)__a, (__v8di)__b,
2242 __u);
2243}
2244
2245static __inline__ __mmask8 __DEFAULT_FN_ATTRS
2246_mm512_cmpgt_epi64_mask(__m512i __a, __m512i __b) {
2247 return (__mmask8)__builtin_ia32_pcmpgtq512_mask((__v8di)__a, (__v8di)__b,
2248 (__mmask8)-1);
2249}
2250
2251static __inline__ __mmask8 __DEFAULT_FN_ATTRS
2252_mm512_cmpgt_epu64_mask(__m512i __a, __m512i __b) {
2253 return (__mmask8)__builtin_ia32_ucmpq512_mask((__v8di)__a, (__v8di)__b, 6,
2254 (__mmask8)-1);
2255}
2256
2257static __inline__ __mmask8 __DEFAULT_FN_ATTRS
2258_mm512_mask_cmpgt_epu64_mask(__mmask8 __u, __m512i __a, __m512i __b) {
2259 return (__mmask8)__builtin_ia32_ucmpq512_mask((__v8di)__a, (__v8di)__b, 6,
2260 __u);
2261}
2262
2263static __inline__ __mmask16 __DEFAULT_FN_ATTRS
2264_mm512_cmple_epi32_mask(__m512i __a, __m512i __b) {
2265 return (__mmask16)__builtin_ia32_cmpd512_mask((__v16si)__a, (__v16si)__b, 2,
2266 (__mmask16)-1);
2267}
2268
2269static __inline__ __mmask16 __DEFAULT_FN_ATTRS
2270_mm512_mask_cmple_epi32_mask(__mmask16 __u, __m512i __a, __m512i __b) {
2271 return (__mmask16)__builtin_ia32_cmpd512_mask((__v16si)__a, (__v16si)__b, 2,
2272 __u);
2273}
2274
2275static __inline__ __mmask16 __DEFAULT_FN_ATTRS
2276_mm512_cmple_epu32_mask(__m512i __a, __m512i __b) {
2277 return (__mmask16)__builtin_ia32_ucmpd512_mask((__v16si)__a, (__v16si)__b, 2,
2278 (__mmask16)-1);
2279}
2280
2281static __inline__ __mmask16 __DEFAULT_FN_ATTRS
2282_mm512_mask_cmple_epu32_mask(__mmask16 __u, __m512i __a, __m512i __b) {
2283 return (__mmask16)__builtin_ia32_ucmpd512_mask((__v16si)__a, (__v16si)__b, 2,
2284 __u);
2285}
2286
2287static __inline__ __mmask8 __DEFAULT_FN_ATTRS
2288_mm512_cmple_epi64_mask(__m512i __a, __m512i __b) {
2289 return (__mmask8)__builtin_ia32_cmpq512_mask((__v8di)__a, (__v8di)__b, 2,
2290 (__mmask8)-1);
2291}
2292
2293static __inline__ __mmask8 __DEFAULT_FN_ATTRS
2294_mm512_mask_cmple_epi64_mask(__mmask8 __u, __m512i __a, __m512i __b) {
2295 return (__mmask8)__builtin_ia32_cmpq512_mask((__v8di)__a, (__v8di)__b, 2,
2296 __u);
2297}
2298
2299static __inline__ __mmask8 __DEFAULT_FN_ATTRS
2300_mm512_cmple_epu64_mask(__m512i __a, __m512i __b) {
2301 return (__mmask8)__builtin_ia32_ucmpq512_mask((__v8di)__a, (__v8di)__b, 2,
2302 (__mmask8)-1);
2303}
2304
2305static __inline__ __mmask8 __DEFAULT_FN_ATTRS
2306_mm512_mask_cmple_epu64_mask(__mmask8 __u, __m512i __a, __m512i __b) {
2307 return (__mmask8)__builtin_ia32_ucmpq512_mask((__v8di)__a, (__v8di)__b, 2,
2308 __u);
2309}
2310
2311static __inline__ __mmask16 __DEFAULT_FN_ATTRS
2312_mm512_cmplt_epi32_mask(__m512i __a, __m512i __b) {
2313 return (__mmask16)__builtin_ia32_cmpd512_mask((__v16si)__a, (__v16si)__b, 1,
2314 (__mmask16)-1);
2315}
2316
2317static __inline__ __mmask16 __DEFAULT_FN_ATTRS
2318_mm512_mask_cmplt_epi32_mask(__mmask16 __u, __m512i __a, __m512i __b) {
2319 return (__mmask16)__builtin_ia32_cmpd512_mask((__v16si)__a, (__v16si)__b, 1,
2320 __u);
2321}
2322
2323static __inline__ __mmask16 __DEFAULT_FN_ATTRS
2324_mm512_cmplt_epu32_mask(__m512i __a, __m512i __b) {
2325 return (__mmask16)__builtin_ia32_ucmpd512_mask((__v16si)__a, (__v16si)__b, 1,
2326 (__mmask16)-1);
2327}
2328
2329static __inline__ __mmask16 __DEFAULT_FN_ATTRS
2330_mm512_mask_cmplt_epu32_mask(__mmask16 __u, __m512i __a, __m512i __b) {
2331 return (__mmask16)__builtin_ia32_ucmpd512_mask((__v16si)__a, (__v16si)__b, 1,
2332 __u);
2333}
2334
2335static __inline__ __mmask8 __DEFAULT_FN_ATTRS
2336_mm512_cmplt_epi64_mask(__m512i __a, __m512i __b) {
2337 return (__mmask8)__builtin_ia32_cmpq512_mask((__v8di)__a, (__v8di)__b, 1,
2338 (__mmask8)-1);
2339}
2340
2341static __inline__ __mmask8 __DEFAULT_FN_ATTRS
2342_mm512_mask_cmplt_epi64_mask(__mmask8 __u, __m512i __a, __m512i __b) {
2343 return (__mmask8)__builtin_ia32_cmpq512_mask((__v8di)__a, (__v8di)__b, 1,
2344 __u);
2345}
2346
2347static __inline__ __mmask8 __DEFAULT_FN_ATTRS
2348_mm512_cmplt_epu64_mask(__m512i __a, __m512i __b) {
2349 return (__mmask8)__builtin_ia32_ucmpq512_mask((__v8di)__a, (__v8di)__b, 1,
2350 (__mmask8)-1);
2351}
2352
2353static __inline__ __mmask8 __DEFAULT_FN_ATTRS
2354_mm512_mask_cmplt_epu64_mask(__mmask8 __u, __m512i __a, __m512i __b) {
2355 return (__mmask8)__builtin_ia32_ucmpq512_mask((__v8di)__a, (__v8di)__b, 1,
2356 __u);
2357}
2358
2359static __inline__ __mmask16 __DEFAULT_FN_ATTRS
2360_mm512_cmpneq_epi32_mask(__m512i __a, __m512i __b) {
2361 return (__mmask16)__builtin_ia32_cmpd512_mask((__v16si)__a, (__v16si)__b, 4,
2362 (__mmask16)-1);
2363}
2364
2365static __inline__ __mmask16 __DEFAULT_FN_ATTRS
2366_mm512_mask_cmpneq_epi32_mask(__mmask16 __u, __m512i __a, __m512i __b) {
2367 return (__mmask16)__builtin_ia32_cmpd512_mask((__v16si)__a, (__v16si)__b, 4,
2368 __u);
2369}
2370
2371static __inline__ __mmask16 __DEFAULT_FN_ATTRS
2372_mm512_cmpneq_epu32_mask(__m512i __a, __m512i __b) {
2373 return (__mmask16)__builtin_ia32_ucmpd512_mask((__v16si)__a, (__v16si)__b, 4,
2374 (__mmask16)-1);
2375}
2376
2377static __inline__ __mmask16 __DEFAULT_FN_ATTRS
2378_mm512_mask_cmpneq_epu32_mask(__mmask16 __u, __m512i __a, __m512i __b) {
2379 return (__mmask16)__builtin_ia32_ucmpd512_mask((__v16si)__a, (__v16si)__b, 4,
2380 __u);
2381}
2382
2383static __inline__ __mmask8 __DEFAULT_FN_ATTRS
2384_mm512_cmpneq_epi64_mask(__m512i __a, __m512i __b) {
2385 return (__mmask8)__builtin_ia32_cmpq512_mask((__v8di)__a, (__v8di)__b, 4,
2386 (__mmask8)-1);
2387}
2388
2389static __inline__ __mmask8 __DEFAULT_FN_ATTRS
2390_mm512_mask_cmpneq_epi64_mask(__mmask8 __u, __m512i __a, __m512i __b) {
2391 return (__mmask8)__builtin_ia32_cmpq512_mask((__v8di)__a, (__v8di)__b, 4,
2392 __u);
2393}
2394
2395static __inline__ __mmask8 __DEFAULT_FN_ATTRS
2396_mm512_cmpneq_epu64_mask(__m512i __a, __m512i __b) {
2397 return (__mmask8)__builtin_ia32_ucmpq512_mask((__v8di)__a, (__v8di)__b, 4,
2398 (__mmask8)-1);
2399}
2400
2401static __inline__ __mmask8 __DEFAULT_FN_ATTRS
2402_mm512_mask_cmpneq_epu64_mask(__mmask8 __u, __m512i __a, __m512i __b) {
2403 return (__mmask8)__builtin_ia32_ucmpq512_mask((__v8di)__a, (__v8di)__b, 4,
2404 __u);
2405}
2406
2407#define _mm512_cmp_epi32_mask(a, b, p) __extension__ ({ \
2408 __m512i __a = (a); \
2409 __m512i __b = (b); \
2410 (__mmask16)__builtin_ia32_cmpd512_mask((__v16si)__a, (__v16si)__b, (p), \
2411 (__mmask16)-1); })
2412
2413#define _mm512_cmp_epu32_mask(a, b, p) __extension__ ({ \
2414 __m512i __a = (a); \
2415 __m512i __b = (b); \
2416 (__mmask16)__builtin_ia32_ucmpd512_mask((__v16si)__a, (__v16si)__b, (p), \
2417 (__mmask16)-1); })
2418
2419#define _mm512_cmp_epi64_mask(a, b, p) __extension__ ({ \
2420 __m512i __a = (a); \
2421 __m512i __b = (b); \
2422 (__mmask8)__builtin_ia32_cmpq512_mask((__v8di)__a, (__v8di)__b, (p), \
2423 (__mmask8)-1); })
2424
2425#define _mm512_cmp_epu64_mask(a, b, p) __extension__ ({ \
2426 __m512i __a = (a); \
2427 __m512i __b = (b); \
2428 (__mmask8)__builtin_ia32_ucmpq512_mask((__v8di)__a, (__v8di)__b, (p), \
2429 (__mmask8)-1); })
2430
2431#define _mm512_mask_cmp_epi32_mask(m, a, b, p) __extension__ ({ \
2432 __m512i __a = (a); \
2433 __m512i __b = (b); \
2434 (__mmask16)__builtin_ia32_cmpd512_mask((__v16si)__a, (__v16si)__b, (p), \
2435 (__mmask16)(m)); })
2436
2437#define _mm512_mask_cmp_epu32_mask(m, a, b, p) __extension__ ({ \
2438 __m512i __a = (a); \
2439 __m512i __b = (b); \
2440 (__mmask16)__builtin_ia32_ucmpd512_mask((__v16si)__a, (__v16si)__b, (p), \
2441 (__mmask16)(m)); })
2442
2443#define _mm512_mask_cmp_epi64_mask(m, a, b, p) __extension__ ({ \
2444 __m512i __a = (a); \
2445 __m512i __b = (b); \
2446 (__mmask8)__builtin_ia32_cmpq512_mask((__v8di)__a, (__v8di)__b, (p), \
2447 (__mmask8)(m)); })
2448
2449#define _mm512_mask_cmp_epu64_mask(m, a, b, p) __extension__ ({ \
2450 __m512i __a = (a); \
2451 __m512i __b = (b); \
2452 (__mmask8)__builtin_ia32_ucmpq512_mask((__v8di)__a, (__v8di)__b, (p), \
2453 (__mmask8)(m)); })
2454
2455#undef __DEFAULT_FN_ATTRS
2456
2457#endif // __AVX512FINTRIN_H
c_headers/avx512vlbwintrin.h created+1907
......@@ -0,0 +1,1907 @@
1/*===---- avx512vlbwintrin.h - AVX512VL and AVX512BW intrinsics ----------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __IMMINTRIN_H
25#error "Never use <avx512vlbwintrin.h> directly; include <immintrin.h> instead."
26#endif
27
28#ifndef __AVX512VLBWINTRIN_H
29#define __AVX512VLBWINTRIN_H
30
31/* Define the default attributes for the functions in this file. */
32#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
33
34/* Integer compare */
35
36static __inline__ __mmask16 __DEFAULT_FN_ATTRS
37_mm_cmpeq_epi8_mask(__m128i __a, __m128i __b) {
38 return (__mmask16)__builtin_ia32_pcmpeqb128_mask((__v16qi)__a, (__v16qi)__b,
39 (__mmask16)-1);
40}
41
42static __inline__ __mmask16 __DEFAULT_FN_ATTRS
43_mm_mask_cmpeq_epi8_mask(__mmask16 __u, __m128i __a, __m128i __b) {
44 return (__mmask16)__builtin_ia32_pcmpeqb128_mask((__v16qi)__a, (__v16qi)__b,
45 __u);
46}
47
48static __inline__ __mmask16 __DEFAULT_FN_ATTRS
49_mm_cmpeq_epu8_mask(__m128i __a, __m128i __b) {
50 return (__mmask16)__builtin_ia32_ucmpb128_mask((__v16qi)__a, (__v16qi)__b, 0,
51 (__mmask16)-1);
52}
53
54static __inline__ __mmask16 __DEFAULT_FN_ATTRS
55_mm_mask_cmpeq_epu8_mask(__mmask16 __u, __m128i __a, __m128i __b) {
56 return (__mmask16)__builtin_ia32_ucmpb128_mask((__v16qi)__a, (__v16qi)__b, 0,
57 __u);
58}
59
60static __inline__ __mmask32 __DEFAULT_FN_ATTRS
61_mm256_cmpeq_epi8_mask(__m256i __a, __m256i __b) {
62 return (__mmask32)__builtin_ia32_pcmpeqb256_mask((__v32qi)__a, (__v32qi)__b,
63 (__mmask32)-1);
64}
65
66static __inline__ __mmask32 __DEFAULT_FN_ATTRS
67_mm256_mask_cmpeq_epi8_mask(__mmask32 __u, __m256i __a, __m256i __b) {
68 return (__mmask32)__builtin_ia32_pcmpeqb256_mask((__v32qi)__a, (__v32qi)__b,
69 __u);
70}
71
72static __inline__ __mmask32 __DEFAULT_FN_ATTRS
73_mm256_cmpeq_epu8_mask(__m256i __a, __m256i __b) {
74 return (__mmask32)__builtin_ia32_ucmpb256_mask((__v32qi)__a, (__v32qi)__b, 0,
75 (__mmask32)-1);
76}
77
78static __inline__ __mmask32 __DEFAULT_FN_ATTRS
79_mm256_mask_cmpeq_epu8_mask(__mmask32 __u, __m256i __a, __m256i __b) {
80 return (__mmask32)__builtin_ia32_ucmpb256_mask((__v32qi)__a, (__v32qi)__b, 0,
81 __u);
82}
83
84static __inline__ __mmask8 __DEFAULT_FN_ATTRS
85_mm_cmpeq_epi16_mask(__m128i __a, __m128i __b) {
86 return (__mmask8)__builtin_ia32_pcmpeqw128_mask((__v8hi)__a, (__v8hi)__b,
87 (__mmask8)-1);
88}
89
90static __inline__ __mmask8 __DEFAULT_FN_ATTRS
91_mm_mask_cmpeq_epi16_mask(__mmask8 __u, __m128i __a, __m128i __b) {
92 return (__mmask8)__builtin_ia32_pcmpeqw128_mask((__v8hi)__a, (__v8hi)__b,
93 __u);
94}
95
96static __inline__ __mmask8 __DEFAULT_FN_ATTRS
97_mm_cmpeq_epu16_mask(__m128i __a, __m128i __b) {
98 return (__mmask8)__builtin_ia32_ucmpw128_mask((__v8hi)__a, (__v8hi)__b, 0,
99 (__mmask8)-1);
100}
101
102static __inline__ __mmask8 __DEFAULT_FN_ATTRS
103_mm_mask_cmpeq_epu16_mask(__mmask8 __u, __m128i __a, __m128i __b) {
104 return (__mmask8)__builtin_ia32_ucmpw128_mask((__v8hi)__a, (__v8hi)__b, 0,
105 __u);
106}
107
108static __inline__ __mmask16 __DEFAULT_FN_ATTRS
109_mm256_cmpeq_epi16_mask(__m256i __a, __m256i __b) {
110 return (__mmask16)__builtin_ia32_pcmpeqw256_mask((__v16hi)__a, (__v16hi)__b,
111 (__mmask16)-1);
112}
113
114static __inline__ __mmask16 __DEFAULT_FN_ATTRS
115_mm256_mask_cmpeq_epi16_mask(__mmask16 __u, __m256i __a, __m256i __b) {
116 return (__mmask16)__builtin_ia32_pcmpeqw256_mask((__v16hi)__a, (__v16hi)__b,
117 __u);
118}
119
120static __inline__ __mmask16 __DEFAULT_FN_ATTRS
121_mm256_cmpeq_epu16_mask(__m256i __a, __m256i __b) {
122 return (__mmask16)__builtin_ia32_ucmpw256_mask((__v16hi)__a, (__v16hi)__b, 0,
123 (__mmask16)-1);
124}
125
126static __inline__ __mmask16 __DEFAULT_FN_ATTRS
127_mm256_mask_cmpeq_epu16_mask(__mmask16 __u, __m256i __a, __m256i __b) {
128 return (__mmask16)__builtin_ia32_ucmpw256_mask((__v16hi)__a, (__v16hi)__b, 0,
129 __u);
130}
131
132static __inline__ __mmask16 __DEFAULT_FN_ATTRS
133_mm_cmpge_epi8_mask(__m128i __a, __m128i __b) {
134 return (__mmask16)__builtin_ia32_cmpb128_mask((__v16qi)__a, (__v16qi)__b, 5,
135 (__mmask16)-1);
136}
137
138static __inline__ __mmask16 __DEFAULT_FN_ATTRS
139_mm_mask_cmpge_epi8_mask(__mmask16 __u, __m128i __a, __m128i __b) {
140 return (__mmask16)__builtin_ia32_cmpb128_mask((__v16qi)__a, (__v16qi)__b, 5,
141 __u);
142}
143
144static __inline__ __mmask16 __DEFAULT_FN_ATTRS
145_mm_cmpge_epu8_mask(__m128i __a, __m128i __b) {
146 return (__mmask16)__builtin_ia32_ucmpb128_mask((__v16qi)__a, (__v16qi)__b, 5,
147 (__mmask16)-1);
148}
149
150static __inline__ __mmask16 __DEFAULT_FN_ATTRS
151_mm_mask_cmpge_epu8_mask(__mmask16 __u, __m128i __a, __m128i __b) {
152 return (__mmask16)__builtin_ia32_ucmpb128_mask((__v16qi)__a, (__v16qi)__b, 5,
153 __u);
154}
155
156static __inline__ __mmask32 __DEFAULT_FN_ATTRS
157_mm256_cmpge_epi8_mask(__m256i __a, __m256i __b) {
158 return (__mmask32)__builtin_ia32_cmpb256_mask((__v32qi)__a, (__v32qi)__b, 5,
159 (__mmask32)-1);
160}
161
162static __inline__ __mmask32 __DEFAULT_FN_ATTRS
163_mm256_mask_cmpge_epi8_mask(__mmask32 __u, __m256i __a, __m256i __b) {
164 return (__mmask32)__builtin_ia32_cmpb256_mask((__v32qi)__a, (__v32qi)__b, 5,
165 __u);
166}
167
168static __inline__ __mmask32 __DEFAULT_FN_ATTRS
169_mm256_cmpge_epu8_mask(__m256i __a, __m256i __b) {
170 return (__mmask32)__builtin_ia32_ucmpb256_mask((__v32qi)__a, (__v32qi)__b, 5,
171 (__mmask32)-1);
172}
173
174static __inline__ __mmask32 __DEFAULT_FN_ATTRS
175_mm256_mask_cmpge_epu8_mask(__mmask32 __u, __m256i __a, __m256i __b) {
176 return (__mmask32)__builtin_ia32_ucmpb256_mask((__v32qi)__a, (__v32qi)__b, 5,
177 __u);
178}
179
180static __inline__ __mmask8 __DEFAULT_FN_ATTRS
181_mm_cmpge_epi16_mask(__m128i __a, __m128i __b) {
182 return (__mmask8)__builtin_ia32_cmpw128_mask((__v8hi)__a, (__v8hi)__b, 5,
183 (__mmask8)-1);
184}
185
186static __inline__ __mmask8 __DEFAULT_FN_ATTRS
187_mm_mask_cmpge_epi16_mask(__mmask8 __u, __m128i __a, __m128i __b) {
188 return (__mmask8)__builtin_ia32_cmpw128_mask((__v8hi)__a, (__v8hi)__b, 5,
189 __u);
190}
191
192static __inline__ __mmask8 __DEFAULT_FN_ATTRS
193_mm_cmpge_epu16_mask(__m128i __a, __m128i __b) {
194 return (__mmask8)__builtin_ia32_ucmpw128_mask((__v8hi)__a, (__v8hi)__b, 5,
195 (__mmask8)-1);
196}
197
198static __inline__ __mmask8 __DEFAULT_FN_ATTRS
199_mm_mask_cmpge_epu16_mask(__mmask8 __u, __m128i __a, __m128i __b) {
200 return (__mmask8)__builtin_ia32_ucmpw128_mask((__v8hi)__a, (__v8hi)__b, 5,
201 __u);
202}
203
204static __inline__ __mmask16 __DEFAULT_FN_ATTRS
205_mm256_cmpge_epi16_mask(__m256i __a, __m256i __b) {
206 return (__mmask16)__builtin_ia32_cmpw256_mask((__v16hi)__a, (__v16hi)__b, 5,
207 (__mmask16)-1);
208}
209
210static __inline__ __mmask16 __DEFAULT_FN_ATTRS
211_mm256_mask_cmpge_epi16_mask(__mmask16 __u, __m256i __a, __m256i __b) {
212 return (__mmask16)__builtin_ia32_cmpw256_mask((__v16hi)__a, (__v16hi)__b, 5,
213 __u);
214}
215
216static __inline__ __mmask16 __DEFAULT_FN_ATTRS
217_mm256_cmpge_epu16_mask(__m256i __a, __m256i __b) {
218 return (__mmask16)__builtin_ia32_ucmpw256_mask((__v16hi)__a, (__v16hi)__b, 5,
219 (__mmask16)-1);
220}
221
222static __inline__ __mmask16 __DEFAULT_FN_ATTRS
223_mm256_mask_cmpge_epu16_mask(__mmask16 __u, __m256i __a, __m256i __b) {
224 return (__mmask16)__builtin_ia32_ucmpw256_mask((__v16hi)__a, (__v16hi)__b, 5,
225 __u);
226}
227
228static __inline__ __mmask16 __DEFAULT_FN_ATTRS
229_mm_cmpgt_epi8_mask(__m128i __a, __m128i __b) {
230 return (__mmask16)__builtin_ia32_pcmpgtb128_mask((__v16qi)__a, (__v16qi)__b,
231 (__mmask16)-1);
232}
233
234static __inline__ __mmask16 __DEFAULT_FN_ATTRS
235_mm_mask_cmpgt_epi8_mask(__mmask16 __u, __m128i __a, __m128i __b) {
236 return (__mmask16)__builtin_ia32_pcmpgtb128_mask((__v16qi)__a, (__v16qi)__b,
237 __u);
238}
239
240static __inline__ __mmask16 __DEFAULT_FN_ATTRS
241_mm_cmpgt_epu8_mask(__m128i __a, __m128i __b) {
242 return (__mmask16)__builtin_ia32_ucmpb128_mask((__v16qi)__a, (__v16qi)__b, 6,
243 (__mmask16)-1);
244}
245
246static __inline__ __mmask16 __DEFAULT_FN_ATTRS
247_mm_mask_cmpgt_epu8_mask(__mmask16 __u, __m128i __a, __m128i __b) {
248 return (__mmask16)__builtin_ia32_ucmpb128_mask((__v16qi)__a, (__v16qi)__b, 6,
249 __u);
250}
251
252static __inline__ __mmask32 __DEFAULT_FN_ATTRS
253_mm256_cmpgt_epi8_mask(__m256i __a, __m256i __b) {
254 return (__mmask32)__builtin_ia32_pcmpgtb256_mask((__v32qi)__a, (__v32qi)__b,
255 (__mmask32)-1);
256}
257
258static __inline__ __mmask32 __DEFAULT_FN_ATTRS
259_mm256_mask_cmpgt_epi8_mask(__mmask32 __u, __m256i __a, __m256i __b) {
260 return (__mmask32)__builtin_ia32_pcmpgtb256_mask((__v32qi)__a, (__v32qi)__b,
261 __u);
262}
263
264static __inline__ __mmask32 __DEFAULT_FN_ATTRS
265_mm256_cmpgt_epu8_mask(__m256i __a, __m256i __b) {
266 return (__mmask32)__builtin_ia32_ucmpb256_mask((__v32qi)__a, (__v32qi)__b, 6,
267 (__mmask32)-1);
268}
269
270static __inline__ __mmask32 __DEFAULT_FN_ATTRS
271_mm256_mask_cmpgt_epu8_mask(__mmask32 __u, __m256i __a, __m256i __b) {
272 return (__mmask32)__builtin_ia32_ucmpb256_mask((__v32qi)__a, (__v32qi)__b, 6,
273 __u);
274}
275
276static __inline__ __mmask8 __DEFAULT_FN_ATTRS
277_mm_cmpgt_epi16_mask(__m128i __a, __m128i __b) {
278 return (__mmask8)__builtin_ia32_pcmpgtw128_mask((__v8hi)__a, (__v8hi)__b,
279 (__mmask8)-1);
280}
281
282static __inline__ __mmask8 __DEFAULT_FN_ATTRS
283_mm_mask_cmpgt_epi16_mask(__mmask8 __u, __m128i __a, __m128i __b) {
284 return (__mmask8)__builtin_ia32_pcmpgtw128_mask((__v8hi)__a, (__v8hi)__b,
285 __u);
286}
287
288static __inline__ __mmask8 __DEFAULT_FN_ATTRS
289_mm_cmpgt_epu16_mask(__m128i __a, __m128i __b) {
290 return (__mmask8)__builtin_ia32_ucmpw128_mask((__v8hi)__a, (__v8hi)__b, 6,
291 (__mmask8)-1);
292}
293
294static __inline__ __mmask8 __DEFAULT_FN_ATTRS
295_mm_mask_cmpgt_epu16_mask(__mmask8 __u, __m128i __a, __m128i __b) {
296 return (__mmask8)__builtin_ia32_ucmpw128_mask((__v8hi)__a, (__v8hi)__b, 6,
297 __u);
298}
299
300static __inline__ __mmask16 __DEFAULT_FN_ATTRS
301_mm256_cmpgt_epi16_mask(__m256i __a, __m256i __b) {
302 return (__mmask16)__builtin_ia32_pcmpgtw256_mask((__v16hi)__a, (__v16hi)__b,
303 (__mmask16)-1);
304}
305
306static __inline__ __mmask16 __DEFAULT_FN_ATTRS
307_mm256_mask_cmpgt_epi16_mask(__mmask16 __u, __m256i __a, __m256i __b) {
308 return (__mmask16)__builtin_ia32_pcmpgtw256_mask((__v16hi)__a, (__v16hi)__b,
309 __u);
310}
311
312static __inline__ __mmask16 __DEFAULT_FN_ATTRS
313_mm256_cmpgt_epu16_mask(__m256i __a, __m256i __b) {
314 return (__mmask16)__builtin_ia32_ucmpw256_mask((__v16hi)__a, (__v16hi)__b, 6,
315 (__mmask16)-1);
316}
317
318static __inline__ __mmask16 __DEFAULT_FN_ATTRS
319_mm256_mask_cmpgt_epu16_mask(__mmask16 __u, __m256i __a, __m256i __b) {
320 return (__mmask16)__builtin_ia32_ucmpw256_mask((__v16hi)__a, (__v16hi)__b, 6,
321 __u);
322}
323
324static __inline__ __mmask16 __DEFAULT_FN_ATTRS
325_mm_cmple_epi8_mask(__m128i __a, __m128i __b) {
326 return (__mmask16)__builtin_ia32_cmpb128_mask((__v16qi)__a, (__v16qi)__b, 2,
327 (__mmask16)-1);
328}
329
330static __inline__ __mmask16 __DEFAULT_FN_ATTRS
331_mm_mask_cmple_epi8_mask(__mmask16 __u, __m128i __a, __m128i __b) {
332 return (__mmask16)__builtin_ia32_cmpb128_mask((__v16qi)__a, (__v16qi)__b, 2,
333 __u);
334}
335
336static __inline__ __mmask16 __DEFAULT_FN_ATTRS
337_mm_cmple_epu8_mask(__m128i __a, __m128i __b) {
338 return (__mmask16)__builtin_ia32_ucmpb128_mask((__v16qi)__a, (__v16qi)__b, 2,
339 (__mmask16)-1);
340}
341
342static __inline__ __mmask16 __DEFAULT_FN_ATTRS
343_mm_mask_cmple_epu8_mask(__mmask16 __u, __m128i __a, __m128i __b) {
344 return (__mmask16)__builtin_ia32_ucmpb128_mask((__v16qi)__a, (__v16qi)__b, 2,
345 __u);
346}
347
348static __inline__ __mmask32 __DEFAULT_FN_ATTRS
349_mm256_cmple_epi8_mask(__m256i __a, __m256i __b) {
350 return (__mmask32)__builtin_ia32_cmpb256_mask((__v32qi)__a, (__v32qi)__b, 2,
351 (__mmask32)-1);
352}
353
354static __inline__ __mmask32 __DEFAULT_FN_ATTRS
355_mm256_mask_cmple_epi8_mask(__mmask32 __u, __m256i __a, __m256i __b) {
356 return (__mmask32)__builtin_ia32_cmpb256_mask((__v32qi)__a, (__v32qi)__b, 2,
357 __u);
358}
359
360static __inline__ __mmask32 __DEFAULT_FN_ATTRS
361_mm256_cmple_epu8_mask(__m256i __a, __m256i __b) {
362 return (__mmask32)__builtin_ia32_ucmpb256_mask((__v32qi)__a, (__v32qi)__b, 2,
363 (__mmask32)-1);
364}
365
366static __inline__ __mmask32 __DEFAULT_FN_ATTRS
367_mm256_mask_cmple_epu8_mask(__mmask32 __u, __m256i __a, __m256i __b) {
368 return (__mmask32)__builtin_ia32_ucmpb256_mask((__v32qi)__a, (__v32qi)__b, 2,
369 __u);
370}
371
372static __inline__ __mmask8 __DEFAULT_FN_ATTRS
373_mm_cmple_epi16_mask(__m128i __a, __m128i __b) {
374 return (__mmask8)__builtin_ia32_cmpw128_mask((__v8hi)__a, (__v8hi)__b, 2,
375 (__mmask8)-1);
376}
377
378static __inline__ __mmask8 __DEFAULT_FN_ATTRS
379_mm_mask_cmple_epi16_mask(__mmask8 __u, __m128i __a, __m128i __b) {
380 return (__mmask8)__builtin_ia32_cmpw128_mask((__v8hi)__a, (__v8hi)__b, 2,
381 __u);
382}
383
384static __inline__ __mmask8 __DEFAULT_FN_ATTRS
385_mm_cmple_epu16_mask(__m128i __a, __m128i __b) {
386 return (__mmask8)__builtin_ia32_ucmpw128_mask((__v8hi)__a, (__v8hi)__b, 2,
387 (__mmask8)-1);
388}
389
390static __inline__ __mmask8 __DEFAULT_FN_ATTRS
391_mm_mask_cmple_epu16_mask(__mmask8 __u, __m128i __a, __m128i __b) {
392 return (__mmask8)__builtin_ia32_ucmpw128_mask((__v8hi)__a, (__v8hi)__b, 2,
393 __u);
394}
395
396static __inline__ __mmask16 __DEFAULT_FN_ATTRS
397_mm256_cmple_epi16_mask(__m256i __a, __m256i __b) {
398 return (__mmask16)__builtin_ia32_cmpw256_mask((__v16hi)__a, (__v16hi)__b, 2,
399 (__mmask16)-1);
400}
401
402static __inline__ __mmask16 __DEFAULT_FN_ATTRS
403_mm256_mask_cmple_epi16_mask(__mmask16 __u, __m256i __a, __m256i __b) {
404 return (__mmask16)__builtin_ia32_cmpw256_mask((__v16hi)__a, (__v16hi)__b, 2,
405 __u);
406}
407
408static __inline__ __mmask16 __DEFAULT_FN_ATTRS
409_mm256_cmple_epu16_mask(__m256i __a, __m256i __b) {
410 return (__mmask16)__builtin_ia32_ucmpw256_mask((__v16hi)__a, (__v16hi)__b, 2,
411 (__mmask16)-1);
412}
413
414static __inline__ __mmask16 __DEFAULT_FN_ATTRS
415_mm256_mask_cmple_epu16_mask(__mmask16 __u, __m256i __a, __m256i __b) {
416 return (__mmask16)__builtin_ia32_ucmpw256_mask((__v16hi)__a, (__v16hi)__b, 2,
417 __u);
418}
419
420static __inline__ __mmask16 __DEFAULT_FN_ATTRS
421_mm_cmplt_epi8_mask(__m128i __a, __m128i __b) {
422 return (__mmask16)__builtin_ia32_cmpb128_mask((__v16qi)__a, (__v16qi)__b, 1,
423 (__mmask16)-1);
424}
425
426static __inline__ __mmask16 __DEFAULT_FN_ATTRS
427_mm_mask_cmplt_epi8_mask(__mmask16 __u, __m128i __a, __m128i __b) {
428 return (__mmask16)__builtin_ia32_cmpb128_mask((__v16qi)__a, (__v16qi)__b, 1,
429 __u);
430}
431
432static __inline__ __mmask16 __DEFAULT_FN_ATTRS
433_mm_cmplt_epu8_mask(__m128i __a, __m128i __b) {
434 return (__mmask16)__builtin_ia32_ucmpb128_mask((__v16qi)__a, (__v16qi)__b, 1,
435 (__mmask16)-1);
436}
437
438static __inline__ __mmask16 __DEFAULT_FN_ATTRS
439_mm_mask_cmplt_epu8_mask(__mmask16 __u, __m128i __a, __m128i __b) {
440 return (__mmask16)__builtin_ia32_ucmpb128_mask((__v16qi)__a, (__v16qi)__b, 1,
441 __u);
442}
443
444static __inline__ __mmask32 __DEFAULT_FN_ATTRS
445_mm256_cmplt_epi8_mask(__m256i __a, __m256i __b) {
446 return (__mmask32)__builtin_ia32_cmpb256_mask((__v32qi)__a, (__v32qi)__b, 1,
447 (__mmask32)-1);
448}
449
450static __inline__ __mmask32 __DEFAULT_FN_ATTRS
451_mm256_mask_cmplt_epi8_mask(__mmask32 __u, __m256i __a, __m256i __b) {
452 return (__mmask32)__builtin_ia32_cmpb256_mask((__v32qi)__a, (__v32qi)__b, 1,
453 __u);
454}
455
456static __inline__ __mmask32 __DEFAULT_FN_ATTRS
457_mm256_cmplt_epu8_mask(__m256i __a, __m256i __b) {
458 return (__mmask32)__builtin_ia32_ucmpb256_mask((__v32qi)__a, (__v32qi)__b, 1,
459 (__mmask32)-1);
460}
461
462static __inline__ __mmask32 __DEFAULT_FN_ATTRS
463_mm256_mask_cmplt_epu8_mask(__mmask32 __u, __m256i __a, __m256i __b) {
464 return (__mmask32)__builtin_ia32_ucmpb256_mask((__v32qi)__a, (__v32qi)__b, 1,
465 __u);
466}
467
468static __inline__ __mmask8 __DEFAULT_FN_ATTRS
469_mm_cmplt_epi16_mask(__m128i __a, __m128i __b) {
470 return (__mmask8)__builtin_ia32_cmpw128_mask((__v8hi)__a, (__v8hi)__b, 1,
471 (__mmask8)-1);
472}
473
474static __inline__ __mmask8 __DEFAULT_FN_ATTRS
475_mm_mask_cmplt_epi16_mask(__mmask8 __u, __m128i __a, __m128i __b) {
476 return (__mmask8)__builtin_ia32_cmpw128_mask((__v8hi)__a, (__v8hi)__b, 1,
477 __u);
478}
479
480static __inline__ __mmask8 __DEFAULT_FN_ATTRS
481_mm_cmplt_epu16_mask(__m128i __a, __m128i __b) {
482 return (__mmask8)__builtin_ia32_ucmpw128_mask((__v8hi)__a, (__v8hi)__b, 1,
483 (__mmask8)-1);
484}
485
486static __inline__ __mmask8 __DEFAULT_FN_ATTRS
487_mm_mask_cmplt_epu16_mask(__mmask8 __u, __m128i __a, __m128i __b) {
488 return (__mmask8)__builtin_ia32_ucmpw128_mask((__v8hi)__a, (__v8hi)__b, 1,
489 __u);
490}
491
492static __inline__ __mmask16 __DEFAULT_FN_ATTRS
493_mm256_cmplt_epi16_mask(__m256i __a, __m256i __b) {
494 return (__mmask16)__builtin_ia32_cmpw256_mask((__v16hi)__a, (__v16hi)__b, 1,
495 (__mmask16)-1);
496}
497
498static __inline__ __mmask16 __DEFAULT_FN_ATTRS
499_mm256_mask_cmplt_epi16_mask(__mmask16 __u, __m256i __a, __m256i __b) {
500 return (__mmask16)__builtin_ia32_cmpw256_mask((__v16hi)__a, (__v16hi)__b, 1,
501 __u);
502}
503
504static __inline__ __mmask16 __DEFAULT_FN_ATTRS
505_mm256_cmplt_epu16_mask(__m256i __a, __m256i __b) {
506 return (__mmask16)__builtin_ia32_ucmpw256_mask((__v16hi)__a, (__v16hi)__b, 1,
507 (__mmask16)-1);
508}
509
510static __inline__ __mmask16 __DEFAULT_FN_ATTRS
511_mm256_mask_cmplt_epu16_mask(__mmask16 __u, __m256i __a, __m256i __b) {
512 return (__mmask16)__builtin_ia32_ucmpw256_mask((__v16hi)__a, (__v16hi)__b, 1,
513 __u);
514}
515
516static __inline__ __mmask16 __DEFAULT_FN_ATTRS
517_mm_cmpneq_epi8_mask(__m128i __a, __m128i __b) {
518 return (__mmask16)__builtin_ia32_cmpb128_mask((__v16qi)__a, (__v16qi)__b, 4,
519 (__mmask16)-1);
520}
521
522static __inline__ __mmask16 __DEFAULT_FN_ATTRS
523_mm_mask_cmpneq_epi8_mask(__mmask16 __u, __m128i __a, __m128i __b) {
524 return (__mmask16)__builtin_ia32_cmpb128_mask((__v16qi)__a, (__v16qi)__b, 4,
525 __u);
526}
527
528static __inline__ __mmask16 __DEFAULT_FN_ATTRS
529_mm_cmpneq_epu8_mask(__m128i __a, __m128i __b) {
530 return (__mmask16)__builtin_ia32_ucmpb128_mask((__v16qi)__a, (__v16qi)__b, 4,
531 (__mmask16)-1);
532}
533
534static __inline__ __mmask16 __DEFAULT_FN_ATTRS
535_mm_mask_cmpneq_epu8_mask(__mmask16 __u, __m128i __a, __m128i __b) {
536 return (__mmask16)__builtin_ia32_ucmpb128_mask((__v16qi)__a, (__v16qi)__b, 4,
537 __u);
538}
539
540static __inline__ __mmask32 __DEFAULT_FN_ATTRS
541_mm256_cmpneq_epi8_mask(__m256i __a, __m256i __b) {
542 return (__mmask32)__builtin_ia32_cmpb256_mask((__v32qi)__a, (__v32qi)__b, 4,
543 (__mmask32)-1);
544}
545
546static __inline__ __mmask32 __DEFAULT_FN_ATTRS
547_mm256_mask_cmpneq_epi8_mask(__mmask32 __u, __m256i __a, __m256i __b) {
548 return (__mmask32)__builtin_ia32_cmpb256_mask((__v32qi)__a, (__v32qi)__b, 4,
549 __u);
550}
551
552static __inline__ __mmask32 __DEFAULT_FN_ATTRS
553_mm256_cmpneq_epu8_mask(__m256i __a, __m256i __b) {
554 return (__mmask32)__builtin_ia32_ucmpb256_mask((__v32qi)__a, (__v32qi)__b, 4,
555 (__mmask32)-1);
556}
557
558static __inline__ __mmask32 __DEFAULT_FN_ATTRS
559_mm256_mask_cmpneq_epu8_mask(__mmask32 __u, __m256i __a, __m256i __b) {
560 return (__mmask32)__builtin_ia32_ucmpb256_mask((__v32qi)__a, (__v32qi)__b, 4,
561 __u);
562}
563
564static __inline__ __mmask8 __DEFAULT_FN_ATTRS
565_mm_cmpneq_epi16_mask(__m128i __a, __m128i __b) {
566 return (__mmask8)__builtin_ia32_cmpw128_mask((__v8hi)__a, (__v8hi)__b, 4,
567 (__mmask8)-1);
568}
569
570static __inline__ __mmask8 __DEFAULT_FN_ATTRS
571_mm_mask_cmpneq_epi16_mask(__mmask8 __u, __m128i __a, __m128i __b) {
572 return (__mmask8)__builtin_ia32_cmpw128_mask((__v8hi)__a, (__v8hi)__b, 4,
573 __u);
574}
575
576static __inline__ __mmask8 __DEFAULT_FN_ATTRS
577_mm_cmpneq_epu16_mask(__m128i __a, __m128i __b) {
578 return (__mmask8)__builtin_ia32_ucmpw128_mask((__v8hi)__a, (__v8hi)__b, 4,
579 (__mmask8)-1);
580}
581
582static __inline__ __mmask8 __DEFAULT_FN_ATTRS
583_mm_mask_cmpneq_epu16_mask(__mmask8 __u, __m128i __a, __m128i __b) {
584 return (__mmask8)__builtin_ia32_ucmpw128_mask((__v8hi)__a, (__v8hi)__b, 4,
585 __u);
586}
587
588static __inline__ __mmask16 __DEFAULT_FN_ATTRS
589_mm256_cmpneq_epi16_mask(__m256i __a, __m256i __b) {
590 return (__mmask16)__builtin_ia32_cmpw256_mask((__v16hi)__a, (__v16hi)__b, 4,
591 (__mmask16)-1);
592}
593
594static __inline__ __mmask16 __DEFAULT_FN_ATTRS
595_mm256_mask_cmpneq_epi16_mask(__mmask16 __u, __m256i __a, __m256i __b) {
596 return (__mmask16)__builtin_ia32_cmpw256_mask((__v16hi)__a, (__v16hi)__b, 4,
597 __u);
598}
599
600static __inline__ __mmask16 __DEFAULT_FN_ATTRS
601_mm256_cmpneq_epu16_mask(__m256i __a, __m256i __b) {
602 return (__mmask16)__builtin_ia32_ucmpw256_mask((__v16hi)__a, (__v16hi)__b, 4,
603 (__mmask16)-1);
604}
605
606static __inline__ __mmask16 __DEFAULT_FN_ATTRS
607_mm256_mask_cmpneq_epu16_mask(__mmask16 __u, __m256i __a, __m256i __b) {
608 return (__mmask16)__builtin_ia32_ucmpw256_mask((__v16hi)__a, (__v16hi)__b, 4,
609 __u);
610}
611
612static __inline__ __m256i __DEFAULT_FN_ATTRS
613_mm256_mask_add_epi8 (__m256i __W, __mmask32 __U, __m256i __A, __m256i __B){
614 return (__m256i) __builtin_ia32_paddb256_mask ((__v32qi) __A,
615 (__v32qi) __B,
616 (__v32qi) __W,
617 (__mmask32) __U);
618}
619
620static __inline__ __m256i __DEFAULT_FN_ATTRS
621_mm256_maskz_add_epi8 (__mmask32 __U, __m256i __A, __m256i __B) {
622 return (__m256i) __builtin_ia32_paddb256_mask ((__v32qi) __A,
623 (__v32qi) __B,
624 (__v32qi)
625 _mm256_setzero_si256 (),
626 (__mmask32) __U);
627}
628
629static __inline__ __m256i __DEFAULT_FN_ATTRS
630_mm256_mask_add_epi16 (__m256i __W, __mmask16 __U, __m256i __A, __m256i __B) {
631 return (__m256i) __builtin_ia32_paddw256_mask ((__v16hi) __A,
632 (__v16hi) __B,
633 (__v16hi) __W,
634 (__mmask16) __U);
635}
636
637static __inline__ __m256i __DEFAULT_FN_ATTRS
638_mm256_maskz_add_epi16 (__mmask16 __U, __m256i __A, __m256i __B) {
639 return (__m256i) __builtin_ia32_paddw256_mask ((__v16hi) __A,
640 (__v16hi) __B,
641 (__v16hi)
642 _mm256_setzero_si256 (),
643 (__mmask16) __U);
644}
645
646static __inline__ __m256i __DEFAULT_FN_ATTRS
647_mm256_mask_sub_epi8 (__m256i __W, __mmask32 __U, __m256i __A, __m256i __B) {
648 return (__m256i) __builtin_ia32_psubb256_mask ((__v32qi) __A,
649 (__v32qi) __B,
650 (__v32qi) __W,
651 (__mmask32) __U);
652}
653
654static __inline__ __m256i __DEFAULT_FN_ATTRS
655_mm256_maskz_sub_epi8 (__mmask32 __U, __m256i __A, __m256i __B) {
656 return (__m256i) __builtin_ia32_psubb256_mask ((__v32qi) __A,
657 (__v32qi) __B,
658 (__v32qi)
659 _mm256_setzero_si256 (),
660 (__mmask32) __U);
661}
662
663static __inline__ __m256i __DEFAULT_FN_ATTRS
664_mm256_mask_sub_epi16 (__m256i __W, __mmask16 __U, __m256i __A, __m256i __B) {
665 return (__m256i) __builtin_ia32_psubw256_mask ((__v16hi) __A,
666 (__v16hi) __B,
667 (__v16hi) __W,
668 (__mmask16) __U);
669}
670
671static __inline__ __m256i __DEFAULT_FN_ATTRS
672_mm256_maskz_sub_epi16 (__mmask16 __U, __m256i __A, __m256i __B) {
673 return (__m256i) __builtin_ia32_psubw256_mask ((__v16hi) __A,
674 (__v16hi) __B,
675 (__v16hi)
676 _mm256_setzero_si256 (),
677 (__mmask16) __U);
678}
679static __inline__ __m128i __DEFAULT_FN_ATTRS
680_mm_mask_add_epi8 (__m128i __W, __mmask16 __U, __m128i __A, __m128i __B) {
681 return (__m128i) __builtin_ia32_paddb128_mask ((__v16qi) __A,
682 (__v16qi) __B,
683 (__v16qi) __W,
684 (__mmask16) __U);
685}
686
687static __inline__ __m128i __DEFAULT_FN_ATTRS
688_mm_maskz_add_epi8 (__mmask16 __U, __m128i __A, __m128i __B) {
689 return (__m128i) __builtin_ia32_paddb128_mask ((__v16qi) __A,
690 (__v16qi) __B,
691 (__v16qi)
692 _mm_setzero_si128 (),
693 (__mmask16) __U);
694}
695
696static __inline__ __m128i __DEFAULT_FN_ATTRS
697_mm_mask_add_epi16 (__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
698 return (__m128i) __builtin_ia32_paddw128_mask ((__v8hi) __A,
699 (__v8hi) __B,
700 (__v8hi) __W,
701 (__mmask8) __U);
702}
703
704static __inline__ __m128i __DEFAULT_FN_ATTRS
705_mm_maskz_add_epi16 (__mmask8 __U, __m128i __A, __m128i __B) {
706 return (__m128i) __builtin_ia32_paddw128_mask ((__v8hi) __A,
707 (__v8hi) __B,
708 (__v8hi)
709 _mm_setzero_si128 (),
710 (__mmask8) __U);
711}
712
713static __inline__ __m128i __DEFAULT_FN_ATTRS
714_mm_mask_sub_epi8 (__m128i __W, __mmask16 __U, __m128i __A, __m128i __B) {
715 return (__m128i) __builtin_ia32_psubb128_mask ((__v16qi) __A,
716 (__v16qi) __B,
717 (__v16qi) __W,
718 (__mmask16) __U);
719}
720
721static __inline__ __m128i __DEFAULT_FN_ATTRS
722_mm_maskz_sub_epi8 (__mmask16 __U, __m128i __A, __m128i __B) {
723 return (__m128i) __builtin_ia32_psubb128_mask ((__v16qi) __A,
724 (__v16qi) __B,
725 (__v16qi)
726 _mm_setzero_si128 (),
727 (__mmask16) __U);
728}
729
730static __inline__ __m128i __DEFAULT_FN_ATTRS
731_mm_mask_sub_epi16 (__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
732 return (__m128i) __builtin_ia32_psubw128_mask ((__v8hi) __A,
733 (__v8hi) __B,
734 (__v8hi) __W,
735 (__mmask8) __U);
736}
737
738static __inline__ __m128i __DEFAULT_FN_ATTRS
739_mm_maskz_sub_epi16 (__mmask8 __U, __m128i __A, __m128i __B) {
740 return (__m128i) __builtin_ia32_psubw128_mask ((__v8hi) __A,
741 (__v8hi) __B,
742 (__v8hi)
743 _mm_setzero_si128 (),
744 (__mmask8) __U);
745}
746
747static __inline__ __m256i __DEFAULT_FN_ATTRS
748_mm256_mask_mullo_epi16 (__m256i __W, __mmask16 __U, __m256i __A, __m256i __B) {
749 return (__m256i) __builtin_ia32_pmullw256_mask ((__v16hi) __A,
750 (__v16hi) __B,
751 (__v16hi) __W,
752 (__mmask16) __U);
753}
754
755static __inline__ __m256i __DEFAULT_FN_ATTRS
756_mm256_maskz_mullo_epi16 (__mmask16 __U, __m256i __A, __m256i __B) {
757 return (__m256i) __builtin_ia32_pmullw256_mask ((__v16hi) __A,
758 (__v16hi) __B,
759 (__v16hi)
760 _mm256_setzero_si256 (),
761 (__mmask16) __U);
762}
763
764static __inline__ __m128i __DEFAULT_FN_ATTRS
765_mm_mask_mullo_epi16 (__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
766 return (__m128i) __builtin_ia32_pmullw128_mask ((__v8hi) __A,
767 (__v8hi) __B,
768 (__v8hi) __W,
769 (__mmask8) __U);
770}
771
772static __inline__ __m128i __DEFAULT_FN_ATTRS
773_mm_maskz_mullo_epi16 (__mmask8 __U, __m128i __A, __m128i __B) {
774 return (__m128i) __builtin_ia32_pmullw128_mask ((__v8hi) __A,
775 (__v8hi) __B,
776 (__v8hi)
777 _mm_setzero_si128 (),
778 (__mmask8) __U);
779}
780
781static __inline__ __m128i __DEFAULT_FN_ATTRS
782_mm_mask_blend_epi8 (__mmask16 __U, __m128i __A, __m128i __W)
783{
784 return (__m128i) __builtin_ia32_blendmb_128_mask ((__v16qi) __A,
785 (__v16qi) __W,
786 (__mmask16) __U);
787}
788
789static __inline__ __m256i __DEFAULT_FN_ATTRS
790_mm256_mask_blend_epi8 (__mmask32 __U, __m256i __A, __m256i __W)
791{
792 return (__m256i) __builtin_ia32_blendmb_256_mask ((__v32qi) __A,
793 (__v32qi) __W,
794 (__mmask32) __U);
795}
796
797static __inline__ __m128i __DEFAULT_FN_ATTRS
798_mm_mask_blend_epi16 (__mmask8 __U, __m128i __A, __m128i __W)
799{
800 return (__m128i) __builtin_ia32_blendmw_128_mask ((__v8hi) __A,
801 (__v8hi) __W,
802 (__mmask8) __U);
803}
804
805static __inline__ __m256i __DEFAULT_FN_ATTRS
806_mm256_mask_blend_epi16 (__mmask16 __U, __m256i __A, __m256i __W)
807{
808 return (__m256i) __builtin_ia32_blendmw_256_mask ((__v16hi) __A,
809 (__v16hi) __W,
810 (__mmask16) __U);
811}
812
813static __inline__ __m128i __DEFAULT_FN_ATTRS
814_mm_mask_abs_epi8 (__m128i __W, __mmask16 __U, __m128i __A)
815{
816 return (__m128i) __builtin_ia32_pabsb128_mask ((__v16qi) __A,
817 (__v16qi) __W,
818 (__mmask16) __U);
819}
820
821static __inline__ __m128i __DEFAULT_FN_ATTRS
822_mm_maskz_abs_epi8 (__mmask16 __U, __m128i __A)
823{
824 return (__m128i) __builtin_ia32_pabsb128_mask ((__v16qi) __A,
825 (__v16qi) _mm_setzero_si128 (),
826 (__mmask16) __U);
827}
828
829static __inline__ __m256i __DEFAULT_FN_ATTRS
830_mm256_mask_abs_epi8 (__m256i __W, __mmask32 __U, __m256i __A)
831{
832 return (__m256i) __builtin_ia32_pabsb256_mask ((__v32qi) __A,
833 (__v32qi) __W,
834 (__mmask32) __U);
835}
836
837static __inline__ __m256i __DEFAULT_FN_ATTRS
838_mm256_maskz_abs_epi8 (__mmask32 __U, __m256i __A)
839{
840 return (__m256i) __builtin_ia32_pabsb256_mask ((__v32qi) __A,
841 (__v32qi) _mm256_setzero_si256 (),
842 (__mmask32) __U);
843}
844
845static __inline__ __m128i __DEFAULT_FN_ATTRS
846_mm_mask_abs_epi16 (__m128i __W, __mmask8 __U, __m128i __A)
847{
848 return (__m128i) __builtin_ia32_pabsw128_mask ((__v8hi) __A,
849 (__v8hi) __W,
850 (__mmask8) __U);
851}
852
853static __inline__ __m128i __DEFAULT_FN_ATTRS
854_mm_maskz_abs_epi16 (__mmask8 __U, __m128i __A)
855{
856 return (__m128i) __builtin_ia32_pabsw128_mask ((__v8hi) __A,
857 (__v8hi) _mm_setzero_si128 (),
858 (__mmask8) __U);
859}
860
861static __inline__ __m256i __DEFAULT_FN_ATTRS
862_mm256_mask_abs_epi16 (__m256i __W, __mmask16 __U, __m256i __A)
863{
864 return (__m256i) __builtin_ia32_pabsw256_mask ((__v16hi) __A,
865 (__v16hi) __W,
866 (__mmask16) __U);
867}
868
869static __inline__ __m256i __DEFAULT_FN_ATTRS
870_mm256_maskz_abs_epi16 (__mmask16 __U, __m256i __A)
871{
872 return (__m256i) __builtin_ia32_pabsw256_mask ((__v16hi) __A,
873 (__v16hi) _mm256_setzero_si256 (),
874 (__mmask16) __U);
875}
876
877static __inline__ __m128i __DEFAULT_FN_ATTRS
878_mm_maskz_packs_epi32 (__mmask8 __M, __m128i __A, __m128i __B)
879{
880 return (__m128i) __builtin_ia32_packssdw128_mask ((__v4si) __A,
881 (__v4si) __B,
882 (__v8hi) _mm_setzero_si128 (), __M);
883}
884
885static __inline__ __m128i __DEFAULT_FN_ATTRS
886_mm_mask_packs_epi32 (__m128i __W, __mmask16 __M, __m128i __A,
887 __m128i __B)
888{
889 return (__m128i) __builtin_ia32_packssdw128_mask ((__v4si) __A,
890 (__v4si) __B,
891 (__v8hi) __W, __M);
892}
893
894static __inline__ __m256i __DEFAULT_FN_ATTRS
895_mm256_maskz_packs_epi32 (__mmask16 __M, __m256i __A, __m256i __B)
896{
897 return (__m256i) __builtin_ia32_packssdw256_mask ((__v8si) __A,
898 (__v8si) __B,
899 (__v16hi) _mm256_setzero_si256 (),
900 __M);
901}
902
903static __inline__ __m256i __DEFAULT_FN_ATTRS
904_mm256_mask_packs_epi32 (__m256i __W, __mmask16 __M, __m256i __A,
905 __m256i __B)
906{
907 return (__m256i) __builtin_ia32_packssdw256_mask ((__v8si) __A,
908 (__v8si) __B,
909 (__v16hi) __W, __M);
910}
911
912static __inline__ __m128i __DEFAULT_FN_ATTRS
913_mm_maskz_packs_epi16 (__mmask16 __M, __m128i __A, __m128i __B)
914{
915 return (__m128i) __builtin_ia32_packsswb128_mask ((__v8hi) __A,
916 (__v8hi) __B,
917 (__v16qi) _mm_setzero_si128 (),
918 __M);
919}
920
921static __inline__ __m128i __DEFAULT_FN_ATTRS
922_mm_mask_packs_epi16 (__m128i __W, __mmask16 __M, __m128i __A,
923 __m128i __B)
924{
925 return (__m128i) __builtin_ia32_packsswb128_mask ((__v8hi) __A,
926 (__v8hi) __B,
927 (__v16qi) __W,
928 __M);
929}
930
931static __inline__ __m256i __DEFAULT_FN_ATTRS
932_mm256_maskz_packs_epi16 (__mmask32 __M, __m256i __A, __m256i __B)
933{
934 return (__m256i) __builtin_ia32_packsswb256_mask ((__v16hi) __A,
935 (__v16hi) __B,
936 (__v32qi) _mm256_setzero_si256 (),
937 __M);
938}
939
940static __inline__ __m256i __DEFAULT_FN_ATTRS
941_mm256_mask_packs_epi16 (__m256i __W, __mmask32 __M, __m256i __A,
942 __m256i __B)
943{
944 return (__m256i) __builtin_ia32_packsswb256_mask ((__v16hi) __A,
945 (__v16hi) __B,
946 (__v32qi) __W,
947 __M);
948}
949
950static __inline__ __m128i __DEFAULT_FN_ATTRS
951_mm_maskz_packus_epi32 (__mmask8 __M, __m128i __A, __m128i __B)
952{
953 return (__m128i) __builtin_ia32_packusdw128_mask ((__v4si) __A,
954 (__v4si) __B,
955 (__v8hi) _mm_setzero_si128 (),
956 __M);
957}
958
959static __inline__ __m128i __DEFAULT_FN_ATTRS
960_mm_mask_packus_epi32 (__m128i __W, __mmask16 __M, __m128i __A,
961 __m128i __B)
962{
963 return (__m128i) __builtin_ia32_packusdw128_mask ((__v4si) __A,
964 (__v4si) __B,
965 (__v8hi) __W, __M);
966}
967
968static __inline__ __m256i __DEFAULT_FN_ATTRS
969_mm256_maskz_packus_epi32 (__mmask16 __M, __m256i __A, __m256i __B)
970{
971 return (__m256i) __builtin_ia32_packusdw256_mask ((__v8si) __A,
972 (__v8si) __B,
973 (__v16hi) _mm256_setzero_si256 (),
974 __M);
975}
976
977static __inline__ __m256i __DEFAULT_FN_ATTRS
978_mm256_mask_packus_epi32 (__m256i __W, __mmask16 __M, __m256i __A,
979 __m256i __B)
980{
981 return (__m256i) __builtin_ia32_packusdw256_mask ((__v8si) __A,
982 (__v8si) __B,
983 (__v16hi) __W,
984 __M);
985}
986
987static __inline__ __m128i __DEFAULT_FN_ATTRS
988_mm_maskz_packus_epi16 (__mmask16 __M, __m128i __A, __m128i __B)
989{
990 return (__m128i) __builtin_ia32_packuswb128_mask ((__v8hi) __A,
991 (__v8hi) __B,
992 (__v16qi) _mm_setzero_si128 (),
993 __M);
994}
995
996static __inline__ __m128i __DEFAULT_FN_ATTRS
997_mm_mask_packus_epi16 (__m128i __W, __mmask16 __M, __m128i __A,
998 __m128i __B)
999{
1000 return (__m128i) __builtin_ia32_packuswb128_mask ((__v8hi) __A,
1001 (__v8hi) __B,
1002 (__v16qi) __W,
1003 __M);
1004}
1005
1006static __inline__ __m256i __DEFAULT_FN_ATTRS
1007_mm256_maskz_packus_epi16 (__mmask32 __M, __m256i __A, __m256i __B)
1008{
1009 return (__m256i) __builtin_ia32_packuswb256_mask ((__v16hi) __A,
1010 (__v16hi) __B,
1011 (__v32qi) _mm256_setzero_si256 (),
1012 __M);
1013}
1014
1015static __inline__ __m256i __DEFAULT_FN_ATTRS
1016_mm256_mask_packus_epi16 (__m256i __W, __mmask32 __M, __m256i __A,
1017 __m256i __B)
1018{
1019 return (__m256i) __builtin_ia32_packuswb256_mask ((__v16hi) __A,
1020 (__v16hi) __B,
1021 (__v32qi) __W,
1022 __M);
1023}
1024
1025static __inline__ __m128i __DEFAULT_FN_ATTRS
1026_mm_mask_adds_epi8 (__m128i __W, __mmask16 __U, __m128i __A,
1027 __m128i __B)
1028{
1029 return (__m128i) __builtin_ia32_paddsb128_mask ((__v16qi) __A,
1030 (__v16qi) __B,
1031 (__v16qi) __W,
1032 (__mmask16) __U);
1033}
1034
1035static __inline__ __m128i __DEFAULT_FN_ATTRS
1036_mm_maskz_adds_epi8 (__mmask16 __U, __m128i __A, __m128i __B)
1037{
1038 return (__m128i) __builtin_ia32_paddsb128_mask ((__v16qi) __A,
1039 (__v16qi) __B,
1040 (__v16qi) _mm_setzero_si128 (),
1041 (__mmask16) __U);
1042}
1043
1044static __inline__ __m256i __DEFAULT_FN_ATTRS
1045_mm256_mask_adds_epi8 (__m256i __W, __mmask32 __U, __m256i __A,
1046 __m256i __B)
1047{
1048 return (__m256i) __builtin_ia32_paddsb256_mask ((__v32qi) __A,
1049 (__v32qi) __B,
1050 (__v32qi) __W,
1051 (__mmask32) __U);
1052}
1053
1054static __inline__ __m256i __DEFAULT_FN_ATTRS
1055_mm256_maskz_adds_epi8 (__mmask32 __U, __m256i __A, __m256i __B)
1056{
1057 return (__m256i) __builtin_ia32_paddsb256_mask ((__v32qi) __A,
1058 (__v32qi) __B,
1059 (__v32qi) _mm256_setzero_si256 (),
1060 (__mmask32) __U);
1061}
1062
1063static __inline__ __m128i __DEFAULT_FN_ATTRS
1064_mm_mask_adds_epi16 (__m128i __W, __mmask8 __U, __m128i __A,
1065 __m128i __B)
1066{
1067 return (__m128i) __builtin_ia32_paddsw128_mask ((__v8hi) __A,
1068 (__v8hi) __B,
1069 (__v8hi) __W,
1070 (__mmask8) __U);
1071}
1072
1073static __inline__ __m128i __DEFAULT_FN_ATTRS
1074_mm_maskz_adds_epi16 (__mmask8 __U, __m128i __A, __m128i __B)
1075{
1076 return (__m128i) __builtin_ia32_paddsw128_mask ((__v8hi) __A,
1077 (__v8hi) __B,
1078 (__v8hi) _mm_setzero_si128 (),
1079 (__mmask8) __U);
1080}
1081
1082static __inline__ __m256i __DEFAULT_FN_ATTRS
1083_mm256_mask_adds_epi16 (__m256i __W, __mmask16 __U, __m256i __A,
1084 __m256i __B)
1085{
1086 return (__m256i) __builtin_ia32_paddsw256_mask ((__v16hi) __A,
1087 (__v16hi) __B,
1088 (__v16hi) __W,
1089 (__mmask16) __U);
1090}
1091
1092static __inline__ __m256i __DEFAULT_FN_ATTRS
1093_mm256_maskz_adds_epi16 (__mmask16 __U, __m256i __A, __m256i __B)
1094{
1095 return (__m256i) __builtin_ia32_paddsw256_mask ((__v16hi) __A,
1096 (__v16hi) __B,
1097 (__v16hi) _mm256_setzero_si256 (),
1098 (__mmask16) __U);
1099}
1100
1101static __inline__ __m128i __DEFAULT_FN_ATTRS
1102_mm_mask_adds_epu8 (__m128i __W, __mmask16 __U, __m128i __A,
1103 __m128i __B)
1104{
1105 return (__m128i) __builtin_ia32_paddusb128_mask ((__v16qi) __A,
1106 (__v16qi) __B,
1107 (__v16qi) __W,
1108 (__mmask16) __U);
1109}
1110
1111static __inline__ __m128i __DEFAULT_FN_ATTRS
1112_mm_maskz_adds_epu8 (__mmask16 __U, __m128i __A, __m128i __B)
1113{
1114 return (__m128i) __builtin_ia32_paddusb128_mask ((__v16qi) __A,
1115 (__v16qi) __B,
1116 (__v16qi) _mm_setzero_si128 (),
1117 (__mmask16) __U);
1118}
1119
1120static __inline__ __m256i __DEFAULT_FN_ATTRS
1121_mm256_mask_adds_epu8 (__m256i __W, __mmask32 __U, __m256i __A,
1122 __m256i __B)
1123{
1124 return (__m256i) __builtin_ia32_paddusb256_mask ((__v32qi) __A,
1125 (__v32qi) __B,
1126 (__v32qi) __W,
1127 (__mmask32) __U);
1128}
1129
1130static __inline__ __m256i __DEFAULT_FN_ATTRS
1131_mm256_maskz_adds_epu8 (__mmask32 __U, __m256i __A, __m256i __B)
1132{
1133 return (__m256i) __builtin_ia32_paddusb256_mask ((__v32qi) __A,
1134 (__v32qi) __B,
1135 (__v32qi) _mm256_setzero_si256 (),
1136 (__mmask32) __U);
1137}
1138
1139static __inline__ __m128i __DEFAULT_FN_ATTRS
1140_mm_mask_adds_epu16 (__m128i __W, __mmask8 __U, __m128i __A,
1141 __m128i __B)
1142{
1143 return (__m128i) __builtin_ia32_paddusw128_mask ((__v8hi) __A,
1144 (__v8hi) __B,
1145 (__v8hi) __W,
1146 (__mmask8) __U);
1147}
1148
1149static __inline__ __m128i __DEFAULT_FN_ATTRS
1150_mm_maskz_adds_epu16 (__mmask8 __U, __m128i __A, __m128i __B)
1151{
1152 return (__m128i) __builtin_ia32_paddusw128_mask ((__v8hi) __A,
1153 (__v8hi) __B,
1154 (__v8hi) _mm_setzero_si128 (),
1155 (__mmask8) __U);
1156}
1157
1158static __inline__ __m256i __DEFAULT_FN_ATTRS
1159_mm256_mask_adds_epu16 (__m256i __W, __mmask16 __U, __m256i __A,
1160 __m256i __B)
1161{
1162 return (__m256i) __builtin_ia32_paddusw256_mask ((__v16hi) __A,
1163 (__v16hi) __B,
1164 (__v16hi) __W,
1165 (__mmask16) __U);
1166}
1167
1168static __inline__ __m256i __DEFAULT_FN_ATTRS
1169_mm256_maskz_adds_epu16 (__mmask16 __U, __m256i __A, __m256i __B)
1170{
1171 return (__m256i) __builtin_ia32_paddusw256_mask ((__v16hi) __A,
1172 (__v16hi) __B,
1173 (__v16hi) _mm256_setzero_si256 (),
1174 (__mmask16) __U);
1175}
1176
1177static __inline__ __m128i __DEFAULT_FN_ATTRS
1178_mm_mask_avg_epu8 (__m128i __W, __mmask16 __U, __m128i __A,
1179 __m128i __B)
1180{
1181 return (__m128i) __builtin_ia32_pavgb128_mask ((__v16qi) __A,
1182 (__v16qi) __B,
1183 (__v16qi) __W,
1184 (__mmask16) __U);
1185}
1186
1187static __inline__ __m128i __DEFAULT_FN_ATTRS
1188_mm_maskz_avg_epu8 (__mmask16 __U, __m128i __A, __m128i __B)
1189{
1190 return (__m128i) __builtin_ia32_pavgb128_mask ((__v16qi) __A,
1191 (__v16qi) __B,
1192 (__v16qi) _mm_setzero_si128 (),
1193 (__mmask16) __U);
1194}
1195
1196static __inline__ __m256i __DEFAULT_FN_ATTRS
1197_mm256_mask_avg_epu8 (__m256i __W, __mmask32 __U, __m256i __A,
1198 __m256i __B)
1199{
1200 return (__m256i) __builtin_ia32_pavgb256_mask ((__v32qi) __A,
1201 (__v32qi) __B,
1202 (__v32qi) __W,
1203 (__mmask32) __U);
1204}
1205
1206static __inline__ __m256i __DEFAULT_FN_ATTRS
1207_mm256_maskz_avg_epu8 (__mmask32 __U, __m256i __A, __m256i __B)
1208{
1209 return (__m256i) __builtin_ia32_pavgb256_mask ((__v32qi) __A,
1210 (__v32qi) __B,
1211 (__v32qi) _mm256_setzero_si256 (),
1212 (__mmask32) __U);
1213}
1214
1215static __inline__ __m128i __DEFAULT_FN_ATTRS
1216_mm_mask_avg_epu16 (__m128i __W, __mmask8 __U, __m128i __A,
1217 __m128i __B)
1218{
1219 return (__m128i) __builtin_ia32_pavgw128_mask ((__v8hi) __A,
1220 (__v8hi) __B,
1221 (__v8hi) __W,
1222 (__mmask8) __U);
1223}
1224
1225static __inline__ __m128i __DEFAULT_FN_ATTRS
1226_mm_maskz_avg_epu16 (__mmask8 __U, __m128i __A, __m128i __B)
1227{
1228 return (__m128i) __builtin_ia32_pavgw128_mask ((__v8hi) __A,
1229 (__v8hi) __B,
1230 (__v8hi) _mm_setzero_si128 (),
1231 (__mmask8) __U);
1232}
1233
1234static __inline__ __m256i __DEFAULT_FN_ATTRS
1235_mm256_mask_avg_epu16 (__m256i __W, __mmask16 __U, __m256i __A,
1236 __m256i __B)
1237{
1238 return (__m256i) __builtin_ia32_pavgw256_mask ((__v16hi) __A,
1239 (__v16hi) __B,
1240 (__v16hi) __W,
1241 (__mmask16) __U);
1242}
1243
1244static __inline__ __m256i __DEFAULT_FN_ATTRS
1245_mm256_maskz_avg_epu16 (__mmask16 __U, __m256i __A, __m256i __B)
1246{
1247 return (__m256i) __builtin_ia32_pavgw256_mask ((__v16hi) __A,
1248 (__v16hi) __B,
1249 (__v16hi) _mm256_setzero_si256 (),
1250 (__mmask16) __U);
1251}
1252
1253static __inline__ __m128i __DEFAULT_FN_ATTRS
1254_mm_maskz_max_epi8 (__mmask16 __M, __m128i __A, __m128i __B)
1255{
1256 return (__m128i) __builtin_ia32_pmaxsb128_mask ((__v16qi) __A,
1257 (__v16qi) __B,
1258 (__v16qi) _mm_setzero_si128 (),
1259 (__mmask16) __M);
1260}
1261
1262static __inline__ __m128i __DEFAULT_FN_ATTRS
1263_mm_mask_max_epi8 (__m128i __W, __mmask16 __M, __m128i __A,
1264 __m128i __B)
1265{
1266 return (__m128i) __builtin_ia32_pmaxsb128_mask ((__v16qi) __A,
1267 (__v16qi) __B,
1268 (__v16qi) __W,
1269 (__mmask16) __M);
1270}
1271
1272static __inline__ __m256i __DEFAULT_FN_ATTRS
1273_mm256_maskz_max_epi8 (__mmask32 __M, __m256i __A, __m256i __B)
1274{
1275 return (__m256i) __builtin_ia32_pmaxsb256_mask ((__v32qi) __A,
1276 (__v32qi) __B,
1277 (__v32qi) _mm256_setzero_si256 (),
1278 (__mmask32) __M);
1279}
1280
1281static __inline__ __m256i __DEFAULT_FN_ATTRS
1282_mm256_mask_max_epi8 (__m256i __W, __mmask32 __M, __m256i __A,
1283 __m256i __B)
1284{
1285 return (__m256i) __builtin_ia32_pmaxsb256_mask ((__v32qi) __A,
1286 (__v32qi) __B,
1287 (__v32qi) __W,
1288 (__mmask32) __M);
1289}
1290
1291static __inline__ __m128i __DEFAULT_FN_ATTRS
1292_mm_maskz_max_epi16 (__mmask8 __M, __m128i __A, __m128i __B)
1293{
1294 return (__m128i) __builtin_ia32_pmaxsw128_mask ((__v8hi) __A,
1295 (__v8hi) __B,
1296 (__v8hi) _mm_setzero_si128 (),
1297 (__mmask8) __M);
1298}
1299
1300static __inline__ __m128i __DEFAULT_FN_ATTRS
1301_mm_mask_max_epi16 (__m128i __W, __mmask8 __M, __m128i __A,
1302 __m128i __B)
1303{
1304 return (__m128i) __builtin_ia32_pmaxsw128_mask ((__v8hi) __A,
1305 (__v8hi) __B,
1306 (__v8hi) __W,
1307 (__mmask8) __M);
1308}
1309
1310static __inline__ __m256i __DEFAULT_FN_ATTRS
1311_mm256_maskz_max_epi16 (__mmask16 __M, __m256i __A, __m256i __B)
1312{
1313 return (__m256i) __builtin_ia32_pmaxsw256_mask ((__v16hi) __A,
1314 (__v16hi) __B,
1315 (__v16hi) _mm256_setzero_si256 (),
1316 (__mmask16) __M);
1317}
1318
1319static __inline__ __m256i __DEFAULT_FN_ATTRS
1320_mm256_mask_max_epi16 (__m256i __W, __mmask16 __M, __m256i __A,
1321 __m256i __B)
1322{
1323 return (__m256i) __builtin_ia32_pmaxsw256_mask ((__v16hi) __A,
1324 (__v16hi) __B,
1325 (__v16hi) __W,
1326 (__mmask16) __M);
1327}
1328
1329static __inline__ __m128i __DEFAULT_FN_ATTRS
1330_mm_maskz_max_epu8 (__mmask16 __M, __m128i __A, __m128i __B)
1331{
1332 return (__m128i) __builtin_ia32_pmaxub128_mask ((__v16qi) __A,
1333 (__v16qi) __B,
1334 (__v16qi) _mm_setzero_si128 (),
1335 (__mmask16) __M);
1336}
1337
1338static __inline__ __m128i __DEFAULT_FN_ATTRS
1339_mm_mask_max_epu8 (__m128i __W, __mmask16 __M, __m128i __A,
1340 __m128i __B)
1341{
1342 return (__m128i) __builtin_ia32_pmaxub128_mask ((__v16qi) __A,
1343 (__v16qi) __B,
1344 (__v16qi) __W,
1345 (__mmask16) __M);
1346}
1347
1348static __inline__ __m256i __DEFAULT_FN_ATTRS
1349_mm256_maskz_max_epu8 (__mmask32 __M, __m256i __A, __m256i __B)
1350{
1351 return (__m256i) __builtin_ia32_pmaxub256_mask ((__v32qi) __A,
1352 (__v32qi) __B,
1353 (__v32qi) _mm256_setzero_si256 (),
1354 (__mmask32) __M);
1355}
1356
1357static __inline__ __m256i __DEFAULT_FN_ATTRS
1358_mm256_mask_max_epu8 (__m256i __W, __mmask32 __M, __m256i __A,
1359 __m256i __B)
1360{
1361 return (__m256i) __builtin_ia32_pmaxub256_mask ((__v32qi) __A,
1362 (__v32qi) __B,
1363 (__v32qi) __W,
1364 (__mmask32) __M);
1365}
1366
1367static __inline__ __m128i __DEFAULT_FN_ATTRS
1368_mm_maskz_max_epu16 (__mmask8 __M, __m128i __A, __m128i __B)
1369{
1370 return (__m128i) __builtin_ia32_pmaxuw128_mask ((__v8hi) __A,
1371 (__v8hi) __B,
1372 (__v8hi) _mm_setzero_si128 (),
1373 (__mmask8) __M);
1374}
1375
1376static __inline__ __m128i __DEFAULT_FN_ATTRS
1377_mm_mask_max_epu16 (__m128i __W, __mmask8 __M, __m128i __A,
1378 __m128i __B)
1379{
1380 return (__m128i) __builtin_ia32_pmaxuw128_mask ((__v8hi) __A,
1381 (__v8hi) __B,
1382 (__v8hi) __W,
1383 (__mmask8) __M);
1384}
1385
1386static __inline__ __m256i __DEFAULT_FN_ATTRS
1387_mm256_maskz_max_epu16 (__mmask16 __M, __m256i __A, __m256i __B)
1388{
1389 return (__m256i) __builtin_ia32_pmaxuw256_mask ((__v16hi) __A,
1390 (__v16hi) __B,
1391 (__v16hi) _mm256_setzero_si256 (),
1392 (__mmask16) __M);
1393}
1394
1395static __inline__ __m256i __DEFAULT_FN_ATTRS
1396_mm256_mask_max_epu16 (__m256i __W, __mmask16 __M, __m256i __A,
1397 __m256i __B)
1398{
1399 return (__m256i) __builtin_ia32_pmaxuw256_mask ((__v16hi) __A,
1400 (__v16hi) __B,
1401 (__v16hi) __W,
1402 (__mmask16) __M);
1403}
1404
1405static __inline__ __m128i __DEFAULT_FN_ATTRS
1406_mm_maskz_min_epi8 (__mmask16 __M, __m128i __A, __m128i __B)
1407{
1408 return (__m128i) __builtin_ia32_pminsb128_mask ((__v16qi) __A,
1409 (__v16qi) __B,
1410 (__v16qi) _mm_setzero_si128 (),
1411 (__mmask16) __M);
1412}
1413
1414static __inline__ __m128i __DEFAULT_FN_ATTRS
1415_mm_mask_min_epi8 (__m128i __W, __mmask16 __M, __m128i __A,
1416 __m128i __B)
1417{
1418 return (__m128i) __builtin_ia32_pminsb128_mask ((__v16qi) __A,
1419 (__v16qi) __B,
1420 (__v16qi) __W,
1421 (__mmask16) __M);
1422}
1423
1424static __inline__ __m256i __DEFAULT_FN_ATTRS
1425_mm256_maskz_min_epi8 (__mmask32 __M, __m256i __A, __m256i __B)
1426{
1427 return (__m256i) __builtin_ia32_pminsb256_mask ((__v32qi) __A,
1428 (__v32qi) __B,
1429 (__v32qi) _mm256_setzero_si256 (),
1430 (__mmask32) __M);
1431}
1432
1433static __inline__ __m256i __DEFAULT_FN_ATTRS
1434_mm256_mask_min_epi8 (__m256i __W, __mmask32 __M, __m256i __A,
1435 __m256i __B)
1436{
1437 return (__m256i) __builtin_ia32_pminsb256_mask ((__v32qi) __A,
1438 (__v32qi) __B,
1439 (__v32qi) __W,
1440 (__mmask32) __M);
1441}
1442
1443static __inline__ __m128i __DEFAULT_FN_ATTRS
1444_mm_maskz_min_epi16 (__mmask8 __M, __m128i __A, __m128i __B)
1445{
1446 return (__m128i) __builtin_ia32_pminsw128_mask ((__v8hi) __A,
1447 (__v8hi) __B,
1448 (__v8hi) _mm_setzero_si128 (),
1449 (__mmask8) __M);
1450}
1451
1452static __inline__ __m128i __DEFAULT_FN_ATTRS
1453_mm_mask_min_epi16 (__m128i __W, __mmask8 __M, __m128i __A,
1454 __m128i __B)
1455{
1456 return (__m128i) __builtin_ia32_pminsw128_mask ((__v8hi) __A,
1457 (__v8hi) __B,
1458 (__v8hi) __W,
1459 (__mmask8) __M);
1460}
1461
1462static __inline__ __m256i __DEFAULT_FN_ATTRS
1463_mm256_maskz_min_epi16 (__mmask16 __M, __m256i __A, __m256i __B)
1464{
1465 return (__m256i) __builtin_ia32_pminsw256_mask ((__v16hi) __A,
1466 (__v16hi) __B,
1467 (__v16hi) _mm256_setzero_si256 (),
1468 (__mmask16) __M);
1469}
1470
1471static __inline__ __m256i __DEFAULT_FN_ATTRS
1472_mm256_mask_min_epi16 (__m256i __W, __mmask16 __M, __m256i __A,
1473 __m256i __B)
1474{
1475 return (__m256i) __builtin_ia32_pminsw256_mask ((__v16hi) __A,
1476 (__v16hi) __B,
1477 (__v16hi) __W,
1478 (__mmask16) __M);
1479}
1480
1481static __inline__ __m128i __DEFAULT_FN_ATTRS
1482_mm_maskz_min_epu8 (__mmask16 __M, __m128i __A, __m128i __B)
1483{
1484 return (__m128i) __builtin_ia32_pminub128_mask ((__v16qi) __A,
1485 (__v16qi) __B,
1486 (__v16qi) _mm_setzero_si128 (),
1487 (__mmask16) __M);
1488}
1489
1490static __inline__ __m128i __DEFAULT_FN_ATTRS
1491_mm_mask_min_epu8 (__m128i __W, __mmask16 __M, __m128i __A,
1492 __m128i __B)
1493{
1494 return (__m128i) __builtin_ia32_pminub128_mask ((__v16qi) __A,
1495 (__v16qi) __B,
1496 (__v16qi) __W,
1497 (__mmask16) __M);
1498}
1499
1500static __inline__ __m256i __DEFAULT_FN_ATTRS
1501_mm256_maskz_min_epu8 (__mmask32 __M, __m256i __A, __m256i __B)
1502{
1503 return (__m256i) __builtin_ia32_pminub256_mask ((__v32qi) __A,
1504 (__v32qi) __B,
1505 (__v32qi) _mm256_setzero_si256 (),
1506 (__mmask32) __M);
1507}
1508
1509static __inline__ __m256i __DEFAULT_FN_ATTRS
1510_mm256_mask_min_epu8 (__m256i __W, __mmask32 __M, __m256i __A,
1511 __m256i __B)
1512{
1513 return (__m256i) __builtin_ia32_pminub256_mask ((__v32qi) __A,
1514 (__v32qi) __B,
1515 (__v32qi) __W,
1516 (__mmask32) __M);
1517}
1518
1519static __inline__ __m128i __DEFAULT_FN_ATTRS
1520_mm_maskz_min_epu16 (__mmask8 __M, __m128i __A, __m128i __B)
1521{
1522 return (__m128i) __builtin_ia32_pminuw128_mask ((__v8hi) __A,
1523 (__v8hi) __B,
1524 (__v8hi) _mm_setzero_si128 (),
1525 (__mmask8) __M);
1526}
1527
1528static __inline__ __m128i __DEFAULT_FN_ATTRS
1529_mm_mask_min_epu16 (__m128i __W, __mmask8 __M, __m128i __A,
1530 __m128i __B)
1531{
1532 return (__m128i) __builtin_ia32_pminuw128_mask ((__v8hi) __A,
1533 (__v8hi) __B,
1534 (__v8hi) __W,
1535 (__mmask8) __M);
1536}
1537
1538static __inline__ __m256i __DEFAULT_FN_ATTRS
1539_mm256_maskz_min_epu16 (__mmask16 __M, __m256i __A, __m256i __B)
1540{
1541 return (__m256i) __builtin_ia32_pminuw256_mask ((__v16hi) __A,
1542 (__v16hi) __B,
1543 (__v16hi) _mm256_setzero_si256 (),
1544 (__mmask16) __M);
1545}
1546
1547static __inline__ __m256i __DEFAULT_FN_ATTRS
1548_mm256_mask_min_epu16 (__m256i __W, __mmask16 __M, __m256i __A,
1549 __m256i __B)
1550{
1551 return (__m256i) __builtin_ia32_pminuw256_mask ((__v16hi) __A,
1552 (__v16hi) __B,
1553 (__v16hi) __W,
1554 (__mmask16) __M);
1555}
1556
1557static __inline__ __m128i __DEFAULT_FN_ATTRS
1558_mm_mask_shuffle_epi8 (__m128i __W, __mmask16 __U, __m128i __A,
1559 __m128i __B)
1560{
1561 return (__m128i) __builtin_ia32_pshufb128_mask ((__v16qi) __A,
1562 (__v16qi) __B,
1563 (__v16qi) __W,
1564 (__mmask16) __U);
1565}
1566
1567static __inline__ __m128i __DEFAULT_FN_ATTRS
1568_mm_maskz_shuffle_epi8 (__mmask16 __U, __m128i __A, __m128i __B)
1569{
1570 return (__m128i) __builtin_ia32_pshufb128_mask ((__v16qi) __A,
1571 (__v16qi) __B,
1572 (__v16qi) _mm_setzero_si128 (),
1573 (__mmask16) __U);
1574}
1575
1576static __inline__ __m256i __DEFAULT_FN_ATTRS
1577_mm256_mask_shuffle_epi8 (__m256i __W, __mmask32 __U, __m256i __A,
1578 __m256i __B)
1579{
1580 return (__m256i) __builtin_ia32_pshufb256_mask ((__v32qi) __A,
1581 (__v32qi) __B,
1582 (__v32qi) __W,
1583 (__mmask32) __U);
1584}
1585
1586static __inline__ __m256i __DEFAULT_FN_ATTRS
1587_mm256_maskz_shuffle_epi8 (__mmask32 __U, __m256i __A, __m256i __B)
1588{
1589 return (__m256i) __builtin_ia32_pshufb256_mask ((__v32qi) __A,
1590 (__v32qi) __B,
1591 (__v32qi) _mm256_setzero_si256 (),
1592 (__mmask32) __U);
1593}
1594
1595static __inline__ __m128i __DEFAULT_FN_ATTRS
1596_mm_mask_subs_epi8 (__m128i __W, __mmask16 __U, __m128i __A,
1597 __m128i __B)
1598{
1599 return (__m128i) __builtin_ia32_psubsb128_mask ((__v16qi) __A,
1600 (__v16qi) __B,
1601 (__v16qi) __W,
1602 (__mmask16) __U);
1603}
1604
1605static __inline__ __m128i __DEFAULT_FN_ATTRS
1606_mm_maskz_subs_epi8 (__mmask16 __U, __m128i __A, __m128i __B)
1607{
1608 return (__m128i) __builtin_ia32_psubsb128_mask ((__v16qi) __A,
1609 (__v16qi) __B,
1610 (__v16qi) _mm_setzero_si128 (),
1611 (__mmask16) __U);
1612}
1613
1614static __inline__ __m256i __DEFAULT_FN_ATTRS
1615_mm256_mask_subs_epi8 (__m256i __W, __mmask32 __U, __m256i __A,
1616 __m256i __B)
1617{
1618 return (__m256i) __builtin_ia32_psubsb256_mask ((__v32qi) __A,
1619 (__v32qi) __B,
1620 (__v32qi) __W,
1621 (__mmask32) __U);
1622}
1623
1624static __inline__ __m256i __DEFAULT_FN_ATTRS
1625_mm256_maskz_subs_epi8 (__mmask32 __U, __m256i __A, __m256i __B)
1626{
1627 return (__m256i) __builtin_ia32_psubsb256_mask ((__v32qi) __A,
1628 (__v32qi) __B,
1629 (__v32qi) _mm256_setzero_si256 (),
1630 (__mmask32) __U);
1631}
1632
1633static __inline__ __m128i __DEFAULT_FN_ATTRS
1634_mm_mask_subs_epi16 (__m128i __W, __mmask8 __U, __m128i __A,
1635 __m128i __B)
1636{
1637 return (__m128i) __builtin_ia32_psubsw128_mask ((__v8hi) __A,
1638 (__v8hi) __B,
1639 (__v8hi) __W,
1640 (__mmask8) __U);
1641}
1642
1643static __inline__ __m128i __DEFAULT_FN_ATTRS
1644_mm_maskz_subs_epi16 (__mmask8 __U, __m128i __A, __m128i __B)
1645{
1646 return (__m128i) __builtin_ia32_psubsw128_mask ((__v8hi) __A,
1647 (__v8hi) __B,
1648 (__v8hi) _mm_setzero_si128 (),
1649 (__mmask8) __U);
1650}
1651
1652static __inline__ __m256i __DEFAULT_FN_ATTRS
1653_mm256_mask_subs_epi16 (__m256i __W, __mmask16 __U, __m256i __A,
1654 __m256i __B)
1655{
1656 return (__m256i) __builtin_ia32_psubsw256_mask ((__v16hi) __A,
1657 (__v16hi) __B,
1658 (__v16hi) __W,
1659 (__mmask16) __U);
1660}
1661
1662static __inline__ __m256i __DEFAULT_FN_ATTRS
1663_mm256_maskz_subs_epi16 (__mmask16 __U, __m256i __A, __m256i __B)
1664{
1665 return (__m256i) __builtin_ia32_psubsw256_mask ((__v16hi) __A,
1666 (__v16hi) __B,
1667 (__v16hi) _mm256_setzero_si256 (),
1668 (__mmask16) __U);
1669}
1670
1671static __inline__ __m128i __DEFAULT_FN_ATTRS
1672_mm_mask_subs_epu8 (__m128i __W, __mmask16 __U, __m128i __A,
1673 __m128i __B)
1674{
1675 return (__m128i) __builtin_ia32_psubusb128_mask ((__v16qi) __A,
1676 (__v16qi) __B,
1677 (__v16qi) __W,
1678 (__mmask16) __U);
1679}
1680
1681static __inline__ __m128i __DEFAULT_FN_ATTRS
1682_mm_maskz_subs_epu8 (__mmask16 __U, __m128i __A, __m128i __B)
1683{
1684 return (__m128i) __builtin_ia32_psubusb128_mask ((__v16qi) __A,
1685 (__v16qi) __B,
1686 (__v16qi) _mm_setzero_si128 (),
1687 (__mmask16) __U);
1688}
1689
1690static __inline__ __m256i __DEFAULT_FN_ATTRS
1691_mm256_mask_subs_epu8 (__m256i __W, __mmask32 __U, __m256i __A,
1692 __m256i __B)
1693{
1694 return (__m256i) __builtin_ia32_psubusb256_mask ((__v32qi) __A,
1695 (__v32qi) __B,
1696 (__v32qi) __W,
1697 (__mmask32) __U);
1698}
1699
1700static __inline__ __m256i __DEFAULT_FN_ATTRS
1701_mm256_maskz_subs_epu8 (__mmask32 __U, __m256i __A, __m256i __B)
1702{
1703 return (__m256i) __builtin_ia32_psubusb256_mask ((__v32qi) __A,
1704 (__v32qi) __B,
1705 (__v32qi) _mm256_setzero_si256 (),
1706 (__mmask32) __U);
1707}
1708
1709static __inline__ __m128i __DEFAULT_FN_ATTRS
1710_mm_mask_subs_epu16 (__m128i __W, __mmask8 __U, __m128i __A,
1711 __m128i __B)
1712{
1713 return (__m128i) __builtin_ia32_psubusw128_mask ((__v8hi) __A,
1714 (__v8hi) __B,
1715 (__v8hi) __W,
1716 (__mmask8) __U);
1717}
1718
1719static __inline__ __m128i __DEFAULT_FN_ATTRS
1720_mm_maskz_subs_epu16 (__mmask8 __U, __m128i __A, __m128i __B)
1721{
1722 return (__m128i) __builtin_ia32_psubusw128_mask ((__v8hi) __A,
1723 (__v8hi) __B,
1724 (__v8hi) _mm_setzero_si128 (),
1725 (__mmask8) __U);
1726}
1727
1728static __inline__ __m256i __DEFAULT_FN_ATTRS
1729_mm256_mask_subs_epu16 (__m256i __W, __mmask16 __U, __m256i __A,
1730 __m256i __B)
1731{
1732 return (__m256i) __builtin_ia32_psubusw256_mask ((__v16hi) __A,
1733 (__v16hi) __B,
1734 (__v16hi) __W,
1735 (__mmask16) __U);
1736}
1737
1738static __inline__ __m256i __DEFAULT_FN_ATTRS
1739_mm256_maskz_subs_epu16 (__mmask16 __U, __m256i __A, __m256i __B)
1740{
1741 return (__m256i) __builtin_ia32_psubusw256_mask ((__v16hi) __A,
1742 (__v16hi) __B,
1743 (__v16hi) _mm256_setzero_si256 (),
1744 (__mmask16) __U);
1745}
1746
1747static __inline__ __m128i __DEFAULT_FN_ATTRS
1748_mm_mask2_permutex2var_epi16 (__m128i __A, __m128i __I, __mmask8 __U,
1749 __m128i __B)
1750{
1751 return (__m128i) __builtin_ia32_vpermi2varhi128_mask ((__v8hi) __A,
1752 (__v8hi) __I /* idx */ ,
1753 (__v8hi) __B,
1754 (__mmask8) __U);
1755}
1756
1757static __inline__ __m256i __DEFAULT_FN_ATTRS
1758_mm256_mask2_permutex2var_epi16 (__m256i __A, __m256i __I,
1759 __mmask16 __U, __m256i __B)
1760{
1761 return (__m256i) __builtin_ia32_vpermi2varhi256_mask ((__v16hi) __A,
1762 (__v16hi) __I /* idx */ ,
1763 (__v16hi) __B,
1764 (__mmask16) __U);
1765}
1766
1767static __inline__ __m128i __DEFAULT_FN_ATTRS
1768_mm_permutex2var_epi16 (__m128i __A, __m128i __I, __m128i __B)
1769{
1770 return (__m128i) __builtin_ia32_vpermt2varhi128_mask ((__v8hi) __I/* idx */,
1771 (__v8hi) __A,
1772 (__v8hi) __B,
1773 (__mmask8) -1);
1774}
1775
1776static __inline__ __m128i __DEFAULT_FN_ATTRS
1777_mm_mask_permutex2var_epi16 (__m128i __A, __mmask8 __U, __m128i __I,
1778 __m128i __B)
1779{
1780 return (__m128i) __builtin_ia32_vpermt2varhi128_mask ((__v8hi) __I/* idx */,
1781 (__v8hi) __A,
1782 (__v8hi) __B,
1783 (__mmask8) __U);
1784}
1785
1786static __inline__ __m128i __DEFAULT_FN_ATTRS
1787_mm_maskz_permutex2var_epi16 (__mmask8 __U, __m128i __A, __m128i __I,
1788 __m128i __B)
1789{
1790 return (__m128i) __builtin_ia32_vpermt2varhi128_maskz ((__v8hi) __I/* idx */,
1791 (__v8hi) __A,
1792 (__v8hi) __B,
1793 (__mmask8) __U);
1794}
1795
1796static __inline__ __m256i __DEFAULT_FN_ATTRS
1797_mm256_permutex2var_epi16 (__m256i __A, __m256i __I, __m256i __B)
1798{
1799 return (__m256i) __builtin_ia32_vpermt2varhi256_mask ((__v16hi) __I/* idx */,
1800 (__v16hi) __A,
1801 (__v16hi) __B,
1802 (__mmask16) -1);
1803}
1804
1805static __inline__ __m256i __DEFAULT_FN_ATTRS
1806_mm256_mask_permutex2var_epi16 (__m256i __A, __mmask16 __U,
1807 __m256i __I, __m256i __B)
1808{
1809 return (__m256i) __builtin_ia32_vpermt2varhi256_mask ((__v16hi) __I/* idx */,
1810 (__v16hi) __A,
1811 (__v16hi) __B,
1812 (__mmask16) __U);
1813}
1814
1815static __inline__ __m256i __DEFAULT_FN_ATTRS
1816_mm256_maskz_permutex2var_epi16 (__mmask16 __U, __m256i __A,
1817 __m256i __I, __m256i __B)
1818{
1819 return (__m256i) __builtin_ia32_vpermt2varhi256_maskz ((__v16hi) __I/* idx */,
1820 (__v16hi) __A,
1821 (__v16hi) __B,
1822 (__mmask16) __U);
1823}
1824
1825#define _mm_cmp_epi8_mask(a, b, p) __extension__ ({ \
1826 (__mmask16)__builtin_ia32_cmpb128_mask((__v16qi)(__m128i)(a), \
1827 (__v16qi)(__m128i)(b), \
1828 (p), (__mmask16)-1); })
1829
1830#define _mm_mask_cmp_epi8_mask(m, a, b, p) __extension__ ({ \
1831 (__mmask16)__builtin_ia32_cmpb128_mask((__v16qi)(__m128i)(a), \
1832 (__v16qi)(__m128i)(b), \
1833 (p), (__mmask16)(m)); })
1834
1835#define _mm_cmp_epu8_mask(a, b, p) __extension__ ({ \
1836 (__mmask16)__builtin_ia32_ucmpb128_mask((__v16qi)(__m128i)(a), \
1837 (__v16qi)(__m128i)(b), \
1838 (p), (__mmask16)-1); })
1839
1840#define _mm_mask_cmp_epu8_mask(m, a, b, p) __extension__ ({ \
1841 (__mmask16)__builtin_ia32_ucmpb128_mask((__v16qi)(__m128i)(a), \
1842 (__v16qi)(__m128i)(b), \
1843 (p), (__mmask16)(m)); })
1844
1845#define _mm256_cmp_epi8_mask(a, b, p) __extension__ ({ \
1846 (__mmask32)__builtin_ia32_cmpb256_mask((__v32qi)(__m256i)(a), \
1847 (__v32qi)(__m256i)(b), \
1848 (p), (__mmask32)-1); })
1849
1850#define _mm256_mask_cmp_epi8_mask(m, a, b, p) __extension__ ({ \
1851 (__mmask32)__builtin_ia32_cmpb256_mask((__v32qi)(__m256i)(a), \
1852 (__v32qi)(__m256i)(b), \
1853 (p), (__mmask32)(m)); })
1854
1855#define _mm256_cmp_epu8_mask(a, b, p) __extension__ ({ \
1856 (__mmask32)__builtin_ia32_ucmpb256_mask((__v32qi)(__m256i)(a), \
1857 (__v32qi)(__m256i)(b), \
1858 (p), (__mmask32)-1); })
1859
1860#define _mm256_mask_cmp_epu8_mask(m, a, b, p) __extension__ ({ \
1861 (__mmask32)__builtin_ia32_ucmpb256_mask((__v32qi)(__m256i)(a), \
1862 (__v32qi)(__m256i)(b), \
1863 (p), (__mmask32)(m)); })
1864
1865#define _mm_cmp_epi16_mask(a, b, p) __extension__ ({ \
1866 (__mmask8)__builtin_ia32_cmpw128_mask((__v8hi)(__m128i)(a), \
1867 (__v8hi)(__m128i)(b), \
1868 (p), (__mmask8)-1); })
1869
1870#define _mm_mask_cmp_epi16_mask(m, a, b, p) __extension__ ({ \
1871 (__mmask8)__builtin_ia32_cmpw128_mask((__v8hi)(__m128i)(a), \
1872 (__v8hi)(__m128i)(b), \
1873 (p), (__mmask8)(m)); })
1874
1875#define _mm_cmp_epu16_mask(a, b, p) __extension__ ({ \
1876 (__mmask8)__builtin_ia32_ucmpw128_mask((__v8hi)(__m128i)(a), \
1877 (__v8hi)(__m128i)(b), \
1878 (p), (__mmask8)-1); })
1879
1880#define _mm_mask_cmp_epu16_mask(m, a, b, p) __extension__ ({ \
1881 (__mmask8)__builtin_ia32_ucmpw128_mask((__v8hi)(__m128i)(a), \
1882 (__v8hi)(__m128i)(b), \
1883 (p), (__mmask8)(m)); })
1884
1885#define _mm256_cmp_epi16_mask(a, b, p) __extension__ ({ \
1886 (__mmask16)__builtin_ia32_cmpw256_mask((__v16hi)(__m256i)(a), \
1887 (__v16hi)(__m256i)(b), \
1888 (p), (__mmask16)-1); })
1889
1890#define _mm256_mask_cmp_epi16_mask(m, a, b, p) __extension__ ({ \
1891 (__mmask16)__builtin_ia32_cmpw256_mask((__v16hi)(__m256i)(a), \
1892 (__v16hi)(__m256i)(b), \
1893 (p), (__mmask16)(m)); })
1894
1895#define _mm256_cmp_epu16_mask(a, b, p) __extension__ ({ \
1896 (__mmask16)__builtin_ia32_ucmpw256_mask((__v16hi)(__m256i)(a), \
1897 (__v16hi)(__m256i)(b), \
1898 (p), (__mmask16)-1); })
1899
1900#define _mm256_mask_cmp_epu16_mask(m, a, b, p) __extension__ ({ \
1901 (__mmask16)__builtin_ia32_ucmpw256_mask((__v16hi)(__m256i)(a), \
1902 (__v16hi)(__m256i)(b), \
1903 (p), (__mmask16)(m)); })
1904
1905#undef __DEFAULT_FN_ATTRS
1906
1907#endif /* __AVX512VLBWINTRIN_H */
c_headers/avx512vldqintrin.h created+353
......@@ -0,0 +1,353 @@
1/*===---- avx512vldqintrin.h - AVX512VL and AVX512DQ intrinsics ---------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __IMMINTRIN_H
25#error "Never use <avx512vldqintrin.h> directly; include <immintrin.h> instead."
26#endif
27
28#ifndef __AVX512VLDQINTRIN_H
29#define __AVX512VLDQINTRIN_H
30
31/* Define the default attributes for the functions in this file. */
32#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
33
34static __inline__ __m256i __DEFAULT_FN_ATTRS
35_mm256_mullo_epi64 (__m256i __A, __m256i __B) {
36 return (__m256i) ((__v4di) __A * (__v4di) __B);
37}
38
39static __inline__ __m256i __DEFAULT_FN_ATTRS
40_mm256_mask_mullo_epi64 (__m256i __W, __mmask8 __U, __m256i __A, __m256i __B) {
41 return (__m256i) __builtin_ia32_pmullq256_mask ((__v4di) __A,
42 (__v4di) __B,
43 (__v4di) __W,
44 (__mmask8) __U);
45}
46
47static __inline__ __m256i __DEFAULT_FN_ATTRS
48_mm256_maskz_mullo_epi64 (__mmask8 __U, __m256i __A, __m256i __B) {
49 return (__m256i) __builtin_ia32_pmullq256_mask ((__v4di) __A,
50 (__v4di) __B,
51 (__v4di)
52 _mm256_setzero_si256 (),
53 (__mmask8) __U);
54}
55
56static __inline__ __m128i __DEFAULT_FN_ATTRS
57_mm_mullo_epi64 (__m128i __A, __m128i __B) {
58 return (__m128i) ((__v2di) __A * (__v2di) __B);
59}
60
61static __inline__ __m128i __DEFAULT_FN_ATTRS
62_mm_mask_mullo_epi64 (__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
63 return (__m128i) __builtin_ia32_pmullq128_mask ((__v2di) __A,
64 (__v2di) __B,
65 (__v2di) __W,
66 (__mmask8) __U);
67}
68
69static __inline__ __m128i __DEFAULT_FN_ATTRS
70_mm_maskz_mullo_epi64 (__mmask8 __U, __m128i __A, __m128i __B) {
71 return (__m128i) __builtin_ia32_pmullq128_mask ((__v2di) __A,
72 (__v2di) __B,
73 (__v2di)
74 _mm_setzero_si128 (),
75 (__mmask8) __U);
76}
77
78static __inline__ __m256d __DEFAULT_FN_ATTRS
79_mm256_mask_andnot_pd (__m256d __W, __mmask8 __U, __m256d __A, __m256d __B) {
80 return (__m256d) __builtin_ia32_andnpd256_mask ((__v4df) __A,
81 (__v4df) __B,
82 (__v4df) __W,
83 (__mmask8) __U);
84}
85
86static __inline__ __m256d __DEFAULT_FN_ATTRS
87_mm256_maskz_andnot_pd (__mmask8 __U, __m256d __A, __m256d __B) {
88 return (__m256d) __builtin_ia32_andnpd256_mask ((__v4df) __A,
89 (__v4df) __B,
90 (__v4df)
91 _mm256_setzero_pd (),
92 (__mmask8) __U);
93}
94
95static __inline__ __m128d __DEFAULT_FN_ATTRS
96_mm_mask_andnot_pd (__m128d __W, __mmask8 __U, __m128d __A, __m128d __B) {
97 return (__m128d) __builtin_ia32_andnpd128_mask ((__v2df) __A,
98 (__v2df) __B,
99 (__v2df) __W,
100 (__mmask8) __U);
101}
102
103static __inline__ __m128d __DEFAULT_FN_ATTRS
104_mm_maskz_andnot_pd (__mmask8 __U, __m128d __A, __m128d __B) {
105 return (__m128d) __builtin_ia32_andnpd128_mask ((__v2df) __A,
106 (__v2df) __B,
107 (__v2df)
108 _mm_setzero_pd (),
109 (__mmask8) __U);
110}
111
112static __inline__ __m256 __DEFAULT_FN_ATTRS
113_mm256_mask_andnot_ps (__m256 __W, __mmask8 __U, __m256 __A, __m256 __B) {
114 return (__m256) __builtin_ia32_andnps256_mask ((__v8sf) __A,
115 (__v8sf) __B,
116 (__v8sf) __W,
117 (__mmask8) __U);
118}
119
120static __inline__ __m256 __DEFAULT_FN_ATTRS
121_mm256_maskz_andnot_ps (__mmask8 __U, __m256 __A, __m256 __B) {
122 return (__m256) __builtin_ia32_andnps256_mask ((__v8sf) __A,
123 (__v8sf) __B,
124 (__v8sf)
125 _mm256_setzero_ps (),
126 (__mmask8) __U);
127}
128
129static __inline__ __m128 __DEFAULT_FN_ATTRS
130_mm_mask_andnot_ps (__m128 __W, __mmask8 __U, __m128 __A, __m128 __B) {
131 return (__m128) __builtin_ia32_andnps128_mask ((__v4sf) __A,
132 (__v4sf) __B,
133 (__v4sf) __W,
134 (__mmask8) __U);
135}
136
137static __inline__ __m128 __DEFAULT_FN_ATTRS
138_mm_maskz_andnot_ps (__mmask8 __U, __m128 __A, __m128 __B) {
139 return (__m128) __builtin_ia32_andnps128_mask ((__v4sf) __A,
140 (__v4sf) __B,
141 (__v4sf)
142 _mm_setzero_ps (),
143 (__mmask8) __U);
144}
145
146static __inline__ __m256d __DEFAULT_FN_ATTRS
147_mm256_mask_and_pd (__m256d __W, __mmask8 __U, __m256d __A, __m256d __B) {
148 return (__m256d) __builtin_ia32_andpd256_mask ((__v4df) __A,
149 (__v4df) __B,
150 (__v4df) __W,
151 (__mmask8) __U);
152}
153
154static __inline__ __m256d __DEFAULT_FN_ATTRS
155_mm256_maskz_and_pd (__mmask8 __U, __m256d __A, __m256d __B) {
156 return (__m256d) __builtin_ia32_andpd256_mask ((__v4df) __A,
157 (__v4df) __B,
158 (__v4df)
159 _mm256_setzero_pd (),
160 (__mmask8) __U);
161}
162
163static __inline__ __m128d __DEFAULT_FN_ATTRS
164_mm_mask_and_pd (__m128d __W, __mmask8 __U, __m128d __A, __m128d __B) {
165 return (__m128d) __builtin_ia32_andpd128_mask ((__v2df) __A,
166 (__v2df) __B,
167 (__v2df) __W,
168 (__mmask8) __U);
169}
170
171static __inline__ __m128d __DEFAULT_FN_ATTRS
172_mm_maskz_and_pd (__mmask8 __U, __m128d __A, __m128d __B) {
173 return (__m128d) __builtin_ia32_andpd128_mask ((__v2df) __A,
174 (__v2df) __B,
175 (__v2df)
176 _mm_setzero_pd (),
177 (__mmask8) __U);
178}
179
180static __inline__ __m256 __DEFAULT_FN_ATTRS
181_mm256_mask_and_ps (__m256 __W, __mmask8 __U, __m256 __A, __m256 __B) {
182 return (__m256) __builtin_ia32_andps256_mask ((__v8sf) __A,
183 (__v8sf) __B,
184 (__v8sf) __W,
185 (__mmask8) __U);
186}
187
188static __inline__ __m256 __DEFAULT_FN_ATTRS
189_mm256_maskz_and_ps (__mmask8 __U, __m256 __A, __m256 __B) {
190 return (__m256) __builtin_ia32_andps256_mask ((__v8sf) __A,
191 (__v8sf) __B,
192 (__v8sf)
193 _mm256_setzero_ps (),
194 (__mmask8) __U);
195}
196
197static __inline__ __m128 __DEFAULT_FN_ATTRS
198_mm_mask_and_ps (__m128 __W, __mmask8 __U, __m128 __A, __m128 __B) {
199 return (__m128) __builtin_ia32_andps128_mask ((__v4sf) __A,
200 (__v4sf) __B,
201 (__v4sf) __W,
202 (__mmask8) __U);
203}
204
205static __inline__ __m128 __DEFAULT_FN_ATTRS
206_mm_maskz_and_ps (__mmask8 __U, __m128 __A, __m128 __B) {
207 return (__m128) __builtin_ia32_andps128_mask ((__v4sf) __A,
208 (__v4sf) __B,
209 (__v4sf)
210 _mm_setzero_ps (),
211 (__mmask8) __U);
212}
213
214static __inline__ __m256d __DEFAULT_FN_ATTRS
215_mm256_mask_xor_pd (__m256d __W, __mmask8 __U, __m256d __A,
216 __m256d __B) {
217 return (__m256d) __builtin_ia32_xorpd256_mask ((__v4df) __A,
218 (__v4df) __B,
219 (__v4df) __W,
220 (__mmask8) __U);
221}
222
223static __inline__ __m256d __DEFAULT_FN_ATTRS
224_mm256_maskz_xor_pd (__mmask8 __U, __m256d __A, __m256d __B) {
225 return (__m256d) __builtin_ia32_xorpd256_mask ((__v4df) __A,
226 (__v4df) __B,
227 (__v4df)
228 _mm256_setzero_pd (),
229 (__mmask8) __U);
230}
231
232static __inline__ __m128d __DEFAULT_FN_ATTRS
233_mm_mask_xor_pd (__m128d __W, __mmask8 __U, __m128d __A, __m128d __B) {
234 return (__m128d) __builtin_ia32_xorpd128_mask ((__v2df) __A,
235 (__v2df) __B,
236 (__v2df) __W,
237 (__mmask8) __U);
238}
239
240static __inline__ __m128d __DEFAULT_FN_ATTRS
241_mm_maskz_xor_pd (__mmask8 __U, __m128d __A, __m128d __B) {
242 return (__m128d) __builtin_ia32_xorpd128_mask ((__v2df) __A,
243 (__v2df) __B,
244 (__v2df)
245 _mm_setzero_pd (),
246 (__mmask8) __U);
247}
248
249static __inline__ __m256 __DEFAULT_FN_ATTRS
250_mm256_mask_xor_ps (__m256 __W, __mmask8 __U, __m256 __A, __m256 __B) {
251 return (__m256) __builtin_ia32_xorps256_mask ((__v8sf) __A,
252 (__v8sf) __B,
253 (__v8sf) __W,
254 (__mmask8) __U);
255}
256
257static __inline__ __m256 __DEFAULT_FN_ATTRS
258_mm256_maskz_xor_ps (__mmask8 __U, __m256 __A, __m256 __B) {
259 return (__m256) __builtin_ia32_xorps256_mask ((__v8sf) __A,
260 (__v8sf) __B,
261 (__v8sf)
262 _mm256_setzero_ps (),
263 (__mmask8) __U);
264}
265
266static __inline__ __m128 __DEFAULT_FN_ATTRS
267_mm_mask_xor_ps (__m128 __W, __mmask8 __U, __m128 __A, __m128 __B) {
268 return (__m128) __builtin_ia32_xorps128_mask ((__v4sf) __A,
269 (__v4sf) __B,
270 (__v4sf) __W,
271 (__mmask8) __U);
272}
273
274static __inline__ __m128 __DEFAULT_FN_ATTRS
275_mm_maskz_xor_ps (__mmask8 __U, __m128 __A, __m128 __B) {
276 return (__m128) __builtin_ia32_xorps128_mask ((__v4sf) __A,
277 (__v4sf) __B,
278 (__v4sf)
279 _mm_setzero_ps (),
280 (__mmask8) __U);
281}
282
283static __inline__ __m256d __DEFAULT_FN_ATTRS
284_mm256_mask_or_pd (__m256d __W, __mmask8 __U, __m256d __A, __m256d __B) {
285 return (__m256d) __builtin_ia32_orpd256_mask ((__v4df) __A,
286 (__v4df) __B,
287 (__v4df) __W,
288 (__mmask8) __U);
289}
290
291static __inline__ __m256d __DEFAULT_FN_ATTRS
292_mm256_maskz_or_pd (__mmask8 __U, __m256d __A, __m256d __B) {
293 return (__m256d) __builtin_ia32_orpd256_mask ((__v4df) __A,
294 (__v4df) __B,
295 (__v4df)
296 _mm256_setzero_pd (),
297 (__mmask8) __U);
298}
299
300static __inline__ __m128d __DEFAULT_FN_ATTRS
301_mm_mask_or_pd (__m128d __W, __mmask8 __U, __m128d __A, __m128d __B) {
302 return (__m128d) __builtin_ia32_orpd128_mask ((__v2df) __A,
303 (__v2df) __B,
304 (__v2df) __W,
305 (__mmask8) __U);
306}
307
308static __inline__ __m128d __DEFAULT_FN_ATTRS
309_mm_maskz_or_pd (__mmask8 __U, __m128d __A, __m128d __B) {
310 return (__m128d) __builtin_ia32_orpd128_mask ((__v2df) __A,
311 (__v2df) __B,
312 (__v2df)
313 _mm_setzero_pd (),
314 (__mmask8) __U);
315}
316
317static __inline__ __m256 __DEFAULT_FN_ATTRS
318_mm256_mask_or_ps (__m256 __W, __mmask8 __U, __m256 __A, __m256 __B) {
319 return (__m256) __builtin_ia32_orps256_mask ((__v8sf) __A,
320 (__v8sf) __B,
321 (__v8sf) __W,
322 (__mmask8) __U);
323}
324
325static __inline__ __m256 __DEFAULT_FN_ATTRS
326_mm256_maskz_or_ps (__mmask8 __U, __m256 __A, __m256 __B) {
327 return (__m256) __builtin_ia32_orps256_mask ((__v8sf) __A,
328 (__v8sf) __B,
329 (__v8sf)
330 _mm256_setzero_ps (),
331 (__mmask8) __U);
332}
333
334static __inline__ __m128 __DEFAULT_FN_ATTRS
335_mm_mask_or_ps (__m128 __W, __mmask8 __U, __m128 __A, __m128 __B) {
336 return (__m128) __builtin_ia32_orps128_mask ((__v4sf) __A,
337 (__v4sf) __B,
338 (__v4sf) __W,
339 (__mmask8) __U);
340}
341
342static __inline__ __m128 __DEFAULT_FN_ATTRS
343_mm_maskz_or_ps (__mmask8 __U, __m128 __A, __m128 __B) {
344 return (__m128) __builtin_ia32_orps128_mask ((__v4sf) __A,
345 (__v4sf) __B,
346 (__v4sf)
347 _mm_setzero_ps (),
348 (__mmask8) __U);
349}
350
351#undef __DEFAULT_FN_ATTRS
352
353#endif
c_headers/avx512vlintrin.h created+1982
......@@ -0,0 +1,1982 @@
1/*===---- avx512vlintrin.h - AVX512VL intrinsics ---------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __IMMINTRIN_H
25#error "Never use <avx512vlintrin.h> directly; include <immintrin.h> instead."
26#endif
27
28#ifndef __AVX512VLINTRIN_H
29#define __AVX512VLINTRIN_H
30
31/* Define the default attributes for the functions in this file. */
32#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
33
34/* Integer compare */
35
36static __inline__ __mmask8 __DEFAULT_FN_ATTRS
37_mm_cmpeq_epi32_mask(__m128i __a, __m128i __b) {
38 return (__mmask8)__builtin_ia32_pcmpeqd128_mask((__v4si)__a, (__v4si)__b,
39 (__mmask8)-1);
40}
41
42static __inline__ __mmask8 __DEFAULT_FN_ATTRS
43_mm_mask_cmpeq_epi32_mask(__mmask8 __u, __m128i __a, __m128i __b) {
44 return (__mmask8)__builtin_ia32_pcmpeqd128_mask((__v4si)__a, (__v4si)__b,
45 __u);
46}
47
48static __inline__ __mmask8 __DEFAULT_FN_ATTRS
49_mm_cmpeq_epu32_mask(__m128i __a, __m128i __b) {
50 return (__mmask8)__builtin_ia32_ucmpd128_mask((__v4si)__a, (__v4si)__b, 0,
51 (__mmask8)-1);
52}
53
54static __inline__ __mmask8 __DEFAULT_FN_ATTRS
55_mm_mask_cmpeq_epu32_mask(__mmask8 __u, __m128i __a, __m128i __b) {
56 return (__mmask8)__builtin_ia32_ucmpd128_mask((__v4si)__a, (__v4si)__b, 0,
57 __u);
58}
59
60static __inline__ __mmask8 __DEFAULT_FN_ATTRS
61_mm256_cmpeq_epi32_mask(__m256i __a, __m256i __b) {
62 return (__mmask8)__builtin_ia32_pcmpeqd256_mask((__v8si)__a, (__v8si)__b,
63 (__mmask8)-1);
64}
65
66static __inline__ __mmask8 __DEFAULT_FN_ATTRS
67_mm256_mask_cmpeq_epi32_mask(__mmask8 __u, __m256i __a, __m256i __b) {
68 return (__mmask8)__builtin_ia32_pcmpeqd256_mask((__v8si)__a, (__v8si)__b,
69 __u);
70}
71
72static __inline__ __mmask8 __DEFAULT_FN_ATTRS
73_mm256_cmpeq_epu32_mask(__m256i __a, __m256i __b) {
74 return (__mmask8)__builtin_ia32_ucmpd256_mask((__v8si)__a, (__v8si)__b, 0,
75 (__mmask8)-1);
76}
77
78static __inline__ __mmask8 __DEFAULT_FN_ATTRS
79_mm256_mask_cmpeq_epu32_mask(__mmask8 __u, __m256i __a, __m256i __b) {
80 return (__mmask8)__builtin_ia32_ucmpd256_mask((__v8si)__a, (__v8si)__b, 0,
81 __u);
82}
83
84static __inline__ __mmask8 __DEFAULT_FN_ATTRS
85_mm_cmpeq_epi64_mask(__m128i __a, __m128i __b) {
86 return (__mmask8)__builtin_ia32_pcmpeqq128_mask((__v2di)__a, (__v2di)__b,
87 (__mmask8)-1);
88}
89
90static __inline__ __mmask8 __DEFAULT_FN_ATTRS
91_mm_mask_cmpeq_epi64_mask(__mmask8 __u, __m128i __a, __m128i __b) {
92 return (__mmask8)__builtin_ia32_pcmpeqq128_mask((__v2di)__a, (__v2di)__b,
93 __u);
94}
95
96static __inline__ __mmask8 __DEFAULT_FN_ATTRS
97_mm_cmpeq_epu64_mask(__m128i __a, __m128i __b) {
98 return (__mmask8)__builtin_ia32_ucmpq128_mask((__v2di)__a, (__v2di)__b, 0,
99 (__mmask8)-1);
100}
101
102static __inline__ __mmask8 __DEFAULT_FN_ATTRS
103_mm_mask_cmpeq_epu64_mask(__mmask8 __u, __m128i __a, __m128i __b) {
104 return (__mmask8)__builtin_ia32_ucmpq128_mask((__v2di)__a, (__v2di)__b, 0,
105 __u);
106}
107
108static __inline__ __mmask8 __DEFAULT_FN_ATTRS
109_mm256_cmpeq_epi64_mask(__m256i __a, __m256i __b) {
110 return (__mmask8)__builtin_ia32_pcmpeqq256_mask((__v4di)__a, (__v4di)__b,
111 (__mmask8)-1);
112}
113
114static __inline__ __mmask8 __DEFAULT_FN_ATTRS
115_mm256_mask_cmpeq_epi64_mask(__mmask8 __u, __m256i __a, __m256i __b) {
116 return (__mmask8)__builtin_ia32_pcmpeqq256_mask((__v4di)__a, (__v4di)__b,
117 __u);
118}
119
120static __inline__ __mmask8 __DEFAULT_FN_ATTRS
121_mm256_cmpeq_epu64_mask(__m256i __a, __m256i __b) {
122 return (__mmask8)__builtin_ia32_ucmpq256_mask((__v4di)__a, (__v4di)__b, 0,
123 (__mmask8)-1);
124}
125
126static __inline__ __mmask8 __DEFAULT_FN_ATTRS
127_mm256_mask_cmpeq_epu64_mask(__mmask8 __u, __m256i __a, __m256i __b) {
128 return (__mmask8)__builtin_ia32_ucmpq256_mask((__v4di)__a, (__v4di)__b, 0,
129 __u);
130}
131
132
133static __inline__ __mmask8 __DEFAULT_FN_ATTRS
134_mm_cmpge_epi32_mask(__m128i __a, __m128i __b) {
135 return (__mmask8)__builtin_ia32_cmpd128_mask((__v4si)__a, (__v4si)__b, 5,
136 (__mmask8)-1);
137}
138
139static __inline__ __mmask8 __DEFAULT_FN_ATTRS
140_mm_mask_cmpge_epi32_mask(__mmask8 __u, __m128i __a, __m128i __b) {
141 return (__mmask8)__builtin_ia32_cmpd128_mask((__v4si)__a, (__v4si)__b, 5,
142 __u);
143}
144
145static __inline__ __mmask8 __DEFAULT_FN_ATTRS
146_mm_cmpge_epu32_mask(__m128i __a, __m128i __b) {
147 return (__mmask8)__builtin_ia32_ucmpd128_mask((__v4si)__a, (__v4si)__b, 5,
148 (__mmask8)-1);
149}
150
151static __inline__ __mmask8 __DEFAULT_FN_ATTRS
152_mm_mask_cmpge_epu32_mask(__mmask8 __u, __m128i __a, __m128i __b) {
153 return (__mmask8)__builtin_ia32_ucmpd128_mask((__v4si)__a, (__v4si)__b, 5,
154 __u);
155}
156
157static __inline__ __mmask8 __DEFAULT_FN_ATTRS
158_mm256_cmpge_epi32_mask(__m256i __a, __m256i __b) {
159 return (__mmask8)__builtin_ia32_cmpd256_mask((__v8si)__a, (__v8si)__b, 5,
160 (__mmask8)-1);
161}
162
163static __inline__ __mmask8 __DEFAULT_FN_ATTRS
164_mm256_mask_cmpge_epi32_mask(__mmask8 __u, __m256i __a, __m256i __b) {
165 return (__mmask8)__builtin_ia32_cmpd256_mask((__v8si)__a, (__v8si)__b, 5,
166 __u);
167}
168
169static __inline__ __mmask8 __DEFAULT_FN_ATTRS
170_mm256_cmpge_epu32_mask(__m256i __a, __m256i __b) {
171 return (__mmask8)__builtin_ia32_ucmpd256_mask((__v8si)__a, (__v8si)__b, 5,
172 (__mmask8)-1);
173}
174
175static __inline__ __mmask8 __DEFAULT_FN_ATTRS
176_mm256_mask_cmpge_epu32_mask(__mmask8 __u, __m256i __a, __m256i __b) {
177 return (__mmask8)__builtin_ia32_ucmpd256_mask((__v8si)__a, (__v8si)__b, 5,
178 __u);
179}
180
181static __inline__ __mmask8 __DEFAULT_FN_ATTRS
182_mm_cmpge_epi64_mask(__m128i __a, __m128i __b) {
183 return (__mmask8)__builtin_ia32_cmpq128_mask((__v2di)__a, (__v2di)__b, 5,
184 (__mmask8)-1);
185}
186
187static __inline__ __mmask8 __DEFAULT_FN_ATTRS
188_mm_mask_cmpge_epi64_mask(__mmask8 __u, __m128i __a, __m128i __b) {
189 return (__mmask8)__builtin_ia32_cmpq128_mask((__v2di)__a, (__v2di)__b, 5,
190 __u);
191}
192
193static __inline__ __mmask8 __DEFAULT_FN_ATTRS
194_mm_cmpge_epu64_mask(__m128i __a, __m128i __b) {
195 return (__mmask8)__builtin_ia32_ucmpq128_mask((__v2di)__a, (__v2di)__b, 5,
196 (__mmask8)-1);
197}
198
199static __inline__ __mmask8 __DEFAULT_FN_ATTRS
200_mm_mask_cmpge_epu64_mask(__mmask8 __u, __m128i __a, __m128i __b) {
201 return (__mmask8)__builtin_ia32_ucmpq128_mask((__v2di)__a, (__v2di)__b, 5,
202 __u);
203}
204
205static __inline__ __mmask8 __DEFAULT_FN_ATTRS
206_mm256_cmpge_epi64_mask(__m256i __a, __m256i __b) {
207 return (__mmask8)__builtin_ia32_cmpq256_mask((__v4di)__a, (__v4di)__b, 5,
208 (__mmask8)-1);
209}
210
211static __inline__ __mmask8 __DEFAULT_FN_ATTRS
212_mm256_mask_cmpge_epi64_mask(__mmask8 __u, __m256i __a, __m256i __b) {
213 return (__mmask8)__builtin_ia32_cmpq256_mask((__v4di)__a, (__v4di)__b, 5,
214 __u);
215}
216
217static __inline__ __mmask8 __DEFAULT_FN_ATTRS
218_mm256_cmpge_epu64_mask(__m256i __a, __m256i __b) {
219 return (__mmask8)__builtin_ia32_ucmpq256_mask((__v4di)__a, (__v4di)__b, 5,
220 (__mmask8)-1);
221}
222
223static __inline__ __mmask8 __DEFAULT_FN_ATTRS
224_mm256_mask_cmpge_epu64_mask(__mmask8 __u, __m256i __a, __m256i __b) {
225 return (__mmask8)__builtin_ia32_ucmpq256_mask((__v4di)__a, (__v4di)__b, 5,
226 __u);
227}
228
229
230
231
232static __inline__ __mmask8 __DEFAULT_FN_ATTRS
233_mm_cmpgt_epi32_mask(__m128i __a, __m128i __b) {
234 return (__mmask8)__builtin_ia32_pcmpgtd128_mask((__v4si)__a, (__v4si)__b,
235 (__mmask8)-1);
236}
237
238static __inline__ __mmask8 __DEFAULT_FN_ATTRS
239_mm_mask_cmpgt_epi32_mask(__mmask8 __u, __m128i __a, __m128i __b) {
240 return (__mmask8)__builtin_ia32_pcmpgtd128_mask((__v4si)__a, (__v4si)__b,
241 __u);
242}
243
244static __inline__ __mmask8 __DEFAULT_FN_ATTRS
245_mm_cmpgt_epu32_mask(__m128i __a, __m128i __b) {
246 return (__mmask8)__builtin_ia32_ucmpd128_mask((__v4si)__a, (__v4si)__b, 6,
247 (__mmask8)-1);
248}
249
250static __inline__ __mmask8 __DEFAULT_FN_ATTRS
251_mm_mask_cmpgt_epu32_mask(__mmask8 __u, __m128i __a, __m128i __b) {
252 return (__mmask8)__builtin_ia32_ucmpd128_mask((__v4si)__a, (__v4si)__b, 6,
253 __u);
254}
255
256static __inline__ __mmask8 __DEFAULT_FN_ATTRS
257_mm256_cmpgt_epi32_mask(__m256i __a, __m256i __b) {
258 return (__mmask8)__builtin_ia32_pcmpgtd256_mask((__v8si)__a, (__v8si)__b,
259 (__mmask8)-1);
260}
261
262static __inline__ __mmask8 __DEFAULT_FN_ATTRS
263_mm256_mask_cmpgt_epi32_mask(__mmask8 __u, __m256i __a, __m256i __b) {
264 return (__mmask8)__builtin_ia32_pcmpgtd256_mask((__v8si)__a, (__v8si)__b,
265 __u);
266}
267
268static __inline__ __mmask8 __DEFAULT_FN_ATTRS
269_mm256_cmpgt_epu32_mask(__m256i __a, __m256i __b) {
270 return (__mmask8)__builtin_ia32_ucmpd256_mask((__v8si)__a, (__v8si)__b, 6,
271 (__mmask8)-1);
272}
273
274static __inline__ __mmask8 __DEFAULT_FN_ATTRS
275_mm256_mask_cmpgt_epu32_mask(__mmask8 __u, __m256i __a, __m256i __b) {
276 return (__mmask8)__builtin_ia32_ucmpd256_mask((__v8si)__a, (__v8si)__b, 6,
277 __u);
278}
279
280static __inline__ __mmask8 __DEFAULT_FN_ATTRS
281_mm_cmpgt_epi64_mask(__m128i __a, __m128i __b) {
282 return (__mmask8)__builtin_ia32_pcmpgtq128_mask((__v2di)__a, (__v2di)__b,
283 (__mmask8)-1);
284}
285
286static __inline__ __mmask8 __DEFAULT_FN_ATTRS
287_mm_mask_cmpgt_epi64_mask(__mmask8 __u, __m128i __a, __m128i __b) {
288 return (__mmask8)__builtin_ia32_pcmpgtq128_mask((__v2di)__a, (__v2di)__b,
289 __u);
290}
291
292static __inline__ __mmask8 __DEFAULT_FN_ATTRS
293_mm_cmpgt_epu64_mask(__m128i __a, __m128i __b) {
294 return (__mmask8)__builtin_ia32_ucmpq128_mask((__v2di)__a, (__v2di)__b, 6,
295 (__mmask8)-1);
296}
297
298static __inline__ __mmask8 __DEFAULT_FN_ATTRS
299_mm_mask_cmpgt_epu64_mask(__mmask8 __u, __m128i __a, __m128i __b) {
300 return (__mmask8)__builtin_ia32_ucmpq128_mask((__v2di)__a, (__v2di)__b, 6,
301 __u);
302}
303
304static __inline__ __mmask8 __DEFAULT_FN_ATTRS
305_mm256_cmpgt_epi64_mask(__m256i __a, __m256i __b) {
306 return (__mmask8)__builtin_ia32_pcmpgtq256_mask((__v4di)__a, (__v4di)__b,
307 (__mmask8)-1);
308}
309
310static __inline__ __mmask8 __DEFAULT_FN_ATTRS
311_mm256_mask_cmpgt_epi64_mask(__mmask8 __u, __m256i __a, __m256i __b) {
312 return (__mmask8)__builtin_ia32_pcmpgtq256_mask((__v4di)__a, (__v4di)__b,
313 __u);
314}
315
316static __inline__ __mmask8 __DEFAULT_FN_ATTRS
317_mm256_cmpgt_epu64_mask(__m256i __a, __m256i __b) {
318 return (__mmask8)__builtin_ia32_ucmpq256_mask((__v4di)__a, (__v4di)__b, 6,
319 (__mmask8)-1);
320}
321
322static __inline__ __mmask8 __DEFAULT_FN_ATTRS
323_mm256_mask_cmpgt_epu64_mask(__mmask8 __u, __m256i __a, __m256i __b) {
324 return (__mmask8)__builtin_ia32_ucmpq256_mask((__v4di)__a, (__v4di)__b, 6,
325 __u);
326}
327
328static __inline__ __mmask8 __DEFAULT_FN_ATTRS
329_mm_cmple_epi32_mask(__m128i __a, __m128i __b) {
330 return (__mmask8)__builtin_ia32_cmpd128_mask((__v4si)__a, (__v4si)__b, 2,
331 (__mmask8)-1);
332}
333
334static __inline__ __mmask8 __DEFAULT_FN_ATTRS
335_mm_mask_cmple_epi32_mask(__mmask8 __u, __m128i __a, __m128i __b) {
336 return (__mmask8)__builtin_ia32_cmpd128_mask((__v4si)__a, (__v4si)__b, 2,
337 __u);
338}
339
340static __inline__ __mmask8 __DEFAULT_FN_ATTRS
341_mm_cmple_epu32_mask(__m128i __a, __m128i __b) {
342 return (__mmask8)__builtin_ia32_ucmpd128_mask((__v4si)__a, (__v4si)__b, 2,
343 (__mmask8)-1);
344}
345
346static __inline__ __mmask8 __DEFAULT_FN_ATTRS
347_mm_mask_cmple_epu32_mask(__mmask8 __u, __m128i __a, __m128i __b) {
348 return (__mmask8)__builtin_ia32_ucmpd128_mask((__v4si)__a, (__v4si)__b, 2,
349 __u);
350}
351
352static __inline__ __mmask8 __DEFAULT_FN_ATTRS
353_mm256_cmple_epi32_mask(__m256i __a, __m256i __b) {
354 return (__mmask8)__builtin_ia32_cmpd256_mask((__v8si)__a, (__v8si)__b, 2,
355 (__mmask8)-1);
356}
357
358static __inline__ __mmask8 __DEFAULT_FN_ATTRS
359_mm256_mask_cmple_epi32_mask(__mmask8 __u, __m256i __a, __m256i __b) {
360 return (__mmask8)__builtin_ia32_cmpd256_mask((__v8si)__a, (__v8si)__b, 2,
361 __u);
362}
363
364static __inline__ __mmask8 __DEFAULT_FN_ATTRS
365_mm256_cmple_epu32_mask(__m256i __a, __m256i __b) {
366 return (__mmask8)__builtin_ia32_ucmpd256_mask((__v8si)__a, (__v8si)__b, 2,
367 (__mmask8)-1);
368}
369
370static __inline__ __mmask8 __DEFAULT_FN_ATTRS
371_mm256_mask_cmple_epu32_mask(__mmask8 __u, __m256i __a, __m256i __b) {
372 return (__mmask8)__builtin_ia32_ucmpd256_mask((__v8si)__a, (__v8si)__b, 2,
373 __u);
374}
375
376static __inline__ __mmask8 __DEFAULT_FN_ATTRS
377_mm_cmple_epi64_mask(__m128i __a, __m128i __b) {
378 return (__mmask8)__builtin_ia32_cmpq128_mask((__v2di)__a, (__v2di)__b, 2,
379 (__mmask8)-1);
380}
381
382static __inline__ __mmask8 __DEFAULT_FN_ATTRS
383_mm_mask_cmple_epi64_mask(__mmask8 __u, __m128i __a, __m128i __b) {
384 return (__mmask8)__builtin_ia32_cmpq128_mask((__v2di)__a, (__v2di)__b, 2,
385 __u);
386}
387
388static __inline__ __mmask8 __DEFAULT_FN_ATTRS
389_mm_cmple_epu64_mask(__m128i __a, __m128i __b) {
390 return (__mmask8)__builtin_ia32_ucmpq128_mask((__v2di)__a, (__v2di)__b, 2,
391 (__mmask8)-1);
392}
393
394static __inline__ __mmask8 __DEFAULT_FN_ATTRS
395_mm_mask_cmple_epu64_mask(__mmask8 __u, __m128i __a, __m128i __b) {
396 return (__mmask8)__builtin_ia32_ucmpq128_mask((__v2di)__a, (__v2di)__b, 2,
397 __u);
398}
399
400static __inline__ __mmask8 __DEFAULT_FN_ATTRS
401_mm256_cmple_epi64_mask(__m256i __a, __m256i __b) {
402 return (__mmask8)__builtin_ia32_cmpq256_mask((__v4di)__a, (__v4di)__b, 2,
403 (__mmask8)-1);
404}
405
406static __inline__ __mmask8 __DEFAULT_FN_ATTRS
407_mm256_mask_cmple_epi64_mask(__mmask8 __u, __m256i __a, __m256i __b) {
408 return (__mmask8)__builtin_ia32_cmpq256_mask((__v4di)__a, (__v4di)__b, 2,
409 __u);
410}
411
412static __inline__ __mmask8 __DEFAULT_FN_ATTRS
413_mm256_cmple_epu64_mask(__m256i __a, __m256i __b) {
414 return (__mmask8)__builtin_ia32_ucmpq256_mask((__v4di)__a, (__v4di)__b, 2,
415 (__mmask8)-1);
416}
417
418static __inline__ __mmask8 __DEFAULT_FN_ATTRS
419_mm256_mask_cmple_epu64_mask(__mmask8 __u, __m256i __a, __m256i __b) {
420 return (__mmask8)__builtin_ia32_ucmpq256_mask((__v4di)__a, (__v4di)__b, 2,
421 __u);
422}
423
424static __inline__ __mmask8 __DEFAULT_FN_ATTRS
425_mm_cmplt_epi32_mask(__m128i __a, __m128i __b) {
426 return (__mmask8)__builtin_ia32_cmpd128_mask((__v4si)__a, (__v4si)__b, 1,
427 (__mmask8)-1);
428}
429
430static __inline__ __mmask8 __DEFAULT_FN_ATTRS
431_mm_mask_cmplt_epi32_mask(__mmask8 __u, __m128i __a, __m128i __b) {
432 return (__mmask8)__builtin_ia32_cmpd128_mask((__v4si)__a, (__v4si)__b, 1,
433 __u);
434}
435
436static __inline__ __mmask8 __DEFAULT_FN_ATTRS
437_mm_cmplt_epu32_mask(__m128i __a, __m128i __b) {
438 return (__mmask8)__builtin_ia32_ucmpd128_mask((__v4si)__a, (__v4si)__b, 1,
439 (__mmask8)-1);
440}
441
442static __inline__ __mmask8 __DEFAULT_FN_ATTRS
443_mm_mask_cmplt_epu32_mask(__mmask8 __u, __m128i __a, __m128i __b) {
444 return (__mmask8)__builtin_ia32_ucmpd128_mask((__v4si)__a, (__v4si)__b, 1,
445 __u);
446}
447
448static __inline__ __mmask8 __DEFAULT_FN_ATTRS
449_mm256_cmplt_epi32_mask(__m256i __a, __m256i __b) {
450 return (__mmask8)__builtin_ia32_cmpd256_mask((__v8si)__a, (__v8si)__b, 1,
451 (__mmask8)-1);
452}
453
454static __inline__ __mmask8 __DEFAULT_FN_ATTRS
455_mm256_mask_cmplt_epi32_mask(__mmask8 __u, __m256i __a, __m256i __b) {
456 return (__mmask8)__builtin_ia32_cmpd256_mask((__v8si)__a, (__v8si)__b, 1,
457 __u);
458}
459
460static __inline__ __mmask8 __DEFAULT_FN_ATTRS
461_mm256_cmplt_epu32_mask(__m256i __a, __m256i __b) {
462 return (__mmask8)__builtin_ia32_ucmpd256_mask((__v8si)__a, (__v8si)__b, 1,
463 (__mmask8)-1);
464}
465
466static __inline__ __mmask8 __DEFAULT_FN_ATTRS
467_mm256_mask_cmplt_epu32_mask(__mmask8 __u, __m256i __a, __m256i __b) {
468 return (__mmask8)__builtin_ia32_ucmpd256_mask((__v8si)__a, (__v8si)__b, 1,
469 __u);
470}
471
472static __inline__ __mmask8 __DEFAULT_FN_ATTRS
473_mm_cmplt_epi64_mask(__m128i __a, __m128i __b) {
474 return (__mmask8)__builtin_ia32_cmpq128_mask((__v2di)__a, (__v2di)__b, 1,
475 (__mmask8)-1);
476}
477
478static __inline__ __mmask8 __DEFAULT_FN_ATTRS
479_mm_mask_cmplt_epi64_mask(__mmask8 __u, __m128i __a, __m128i __b) {
480 return (__mmask8)__builtin_ia32_cmpq128_mask((__v2di)__a, (__v2di)__b, 1,
481 __u);
482}
483
484static __inline__ __mmask8 __DEFAULT_FN_ATTRS
485_mm_cmplt_epu64_mask(__m128i __a, __m128i __b) {
486 return (__mmask8)__builtin_ia32_ucmpq128_mask((__v2di)__a, (__v2di)__b, 1,
487 (__mmask8)-1);
488}
489
490static __inline__ __mmask8 __DEFAULT_FN_ATTRS
491_mm_mask_cmplt_epu64_mask(__mmask8 __u, __m128i __a, __m128i __b) {
492 return (__mmask8)__builtin_ia32_ucmpq128_mask((__v2di)__a, (__v2di)__b, 1,
493 __u);
494}
495
496static __inline__ __mmask8 __DEFAULT_FN_ATTRS
497_mm256_cmplt_epi64_mask(__m256i __a, __m256i __b) {
498 return (__mmask8)__builtin_ia32_cmpq256_mask((__v4di)__a, (__v4di)__b, 1,
499 (__mmask8)-1);
500}
501
502static __inline__ __mmask8 __DEFAULT_FN_ATTRS
503_mm256_mask_cmplt_epi64_mask(__mmask8 __u, __m256i __a, __m256i __b) {
504 return (__mmask8)__builtin_ia32_cmpq256_mask((__v4di)__a, (__v4di)__b, 1,
505 __u);
506}
507
508static __inline__ __mmask8 __DEFAULT_FN_ATTRS
509_mm256_cmplt_epu64_mask(__m256i __a, __m256i __b) {
510 return (__mmask8)__builtin_ia32_ucmpq256_mask((__v4di)__a, (__v4di)__b, 1,
511 (__mmask8)-1);
512}
513
514static __inline__ __mmask8 __DEFAULT_FN_ATTRS
515_mm256_mask_cmplt_epu64_mask(__mmask8 __u, __m256i __a, __m256i __b) {
516 return (__mmask8)__builtin_ia32_ucmpq256_mask((__v4di)__a, (__v4di)__b, 1,
517 __u);
518}
519
520static __inline__ __mmask8 __DEFAULT_FN_ATTRS
521_mm_cmpneq_epi32_mask(__m128i __a, __m128i __b) {
522 return (__mmask8)__builtin_ia32_cmpd128_mask((__v4si)__a, (__v4si)__b, 4,
523 (__mmask8)-1);
524}
525
526static __inline__ __mmask8 __DEFAULT_FN_ATTRS
527_mm_mask_cmpneq_epi32_mask(__mmask8 __u, __m128i __a, __m128i __b) {
528 return (__mmask8)__builtin_ia32_cmpd128_mask((__v4si)__a, (__v4si)__b, 4,
529 __u);
530}
531
532static __inline__ __mmask8 __DEFAULT_FN_ATTRS
533_mm_cmpneq_epu32_mask(__m128i __a, __m128i __b) {
534 return (__mmask8)__builtin_ia32_ucmpd128_mask((__v4si)__a, (__v4si)__b, 4,
535 (__mmask8)-1);
536}
537
538static __inline__ __mmask8 __DEFAULT_FN_ATTRS
539_mm_mask_cmpneq_epu32_mask(__mmask8 __u, __m128i __a, __m128i __b) {
540 return (__mmask8)__builtin_ia32_ucmpd128_mask((__v4si)__a, (__v4si)__b, 4,
541 __u);
542}
543
544static __inline__ __mmask8 __DEFAULT_FN_ATTRS
545_mm256_cmpneq_epi32_mask(__m256i __a, __m256i __b) {
546 return (__mmask8)__builtin_ia32_cmpd256_mask((__v8si)__a, (__v8si)__b, 4,
547 (__mmask8)-1);
548}
549
550static __inline__ __mmask8 __DEFAULT_FN_ATTRS
551_mm256_mask_cmpneq_epi32_mask(__mmask8 __u, __m256i __a, __m256i __b) {
552 return (__mmask8)__builtin_ia32_cmpd256_mask((__v8si)__a, (__v8si)__b, 4,
553 __u);
554}
555
556static __inline__ __mmask8 __DEFAULT_FN_ATTRS
557_mm256_cmpneq_epu32_mask(__m256i __a, __m256i __b) {
558 return (__mmask8)__builtin_ia32_ucmpd256_mask((__v8si)__a, (__v8si)__b, 4,
559 (__mmask8)-1);
560}
561
562static __inline__ __mmask8 __DEFAULT_FN_ATTRS
563_mm256_mask_cmpneq_epu32_mask(__mmask8 __u, __m256i __a, __m256i __b) {
564 return (__mmask8)__builtin_ia32_ucmpd256_mask((__v8si)__a, (__v8si)__b, 4,
565 __u);
566}
567
568static __inline__ __mmask8 __DEFAULT_FN_ATTRS
569_mm_cmpneq_epi64_mask(__m128i __a, __m128i __b) {
570 return (__mmask8)__builtin_ia32_cmpq128_mask((__v2di)__a, (__v2di)__b, 4,
571 (__mmask8)-1);
572}
573
574static __inline__ __mmask8 __DEFAULT_FN_ATTRS
575_mm_mask_cmpneq_epi64_mask(__mmask8 __u, __m128i __a, __m128i __b) {
576 return (__mmask8)__builtin_ia32_cmpq128_mask((__v2di)__a, (__v2di)__b, 4,
577 __u);
578}
579
580static __inline__ __mmask8 __DEFAULT_FN_ATTRS
581_mm_cmpneq_epu64_mask(__m128i __a, __m128i __b) {
582 return (__mmask8)__builtin_ia32_ucmpq128_mask((__v2di)__a, (__v2di)__b, 4,
583 (__mmask8)-1);
584}
585
586static __inline__ __mmask8 __DEFAULT_FN_ATTRS
587_mm_mask_cmpneq_epu64_mask(__mmask8 __u, __m128i __a, __m128i __b) {
588 return (__mmask8)__builtin_ia32_ucmpq128_mask((__v2di)__a, (__v2di)__b, 4,
589 __u);
590}
591
592static __inline__ __mmask8 __DEFAULT_FN_ATTRS
593_mm256_cmpneq_epi64_mask(__m256i __a, __m256i __b) {
594 return (__mmask8)__builtin_ia32_cmpq256_mask((__v4di)__a, (__v4di)__b, 4,
595 (__mmask8)-1);
596}
597
598static __inline__ __mmask8 __DEFAULT_FN_ATTRS
599_mm256_mask_cmpneq_epi64_mask(__mmask8 __u, __m256i __a, __m256i __b) {
600 return (__mmask8)__builtin_ia32_cmpq256_mask((__v4di)__a, (__v4di)__b, 4,
601 __u);
602}
603
604static __inline__ __mmask8 __DEFAULT_FN_ATTRS
605_mm256_cmpneq_epu64_mask(__m256i __a, __m256i __b) {
606 return (__mmask8)__builtin_ia32_ucmpq256_mask((__v4di)__a, (__v4di)__b, 4,
607 (__mmask8)-1);
608}
609
610static __inline__ __mmask8 __DEFAULT_FN_ATTRS
611_mm256_mask_cmpneq_epu64_mask(__mmask8 __u, __m256i __a, __m256i __b) {
612 return (__mmask8)__builtin_ia32_ucmpq256_mask((__v4di)__a, (__v4di)__b, 4,
613 __u);
614}
615
616static __inline__ __m256i __DEFAULT_FN_ATTRS
617_mm256_mask_add_epi32 (__m256i __W, __mmask8 __U, __m256i __A,
618 __m256i __B)
619{
620 return (__m256i) __builtin_ia32_paddd256_mask ((__v8si) __A,
621 (__v8si) __B,
622 (__v8si) __W,
623 (__mmask8) __U);
624}
625
626static __inline__ __m256i __DEFAULT_FN_ATTRS
627_mm256_maskz_add_epi32 (__mmask8 __U, __m256i __A, __m256i __B)
628{
629 return (__m256i) __builtin_ia32_paddd256_mask ((__v8si) __A,
630 (__v8si) __B,
631 (__v8si)
632 _mm256_setzero_si256 (),
633 (__mmask8) __U);
634}
635
636static __inline__ __m256i __DEFAULT_FN_ATTRS
637_mm256_mask_add_epi64 (__m256i __W, __mmask8 __U, __m256i __A,
638 __m256i __B)
639{
640 return (__m256i) __builtin_ia32_paddq256_mask ((__v4di) __A,
641 (__v4di) __B,
642 (__v4di) __W,
643 (__mmask8) __U);
644}
645
646static __inline__ __m256i __DEFAULT_FN_ATTRS
647_mm256_maskz_add_epi64 (__mmask8 __U, __m256i __A, __m256i __B)
648{
649 return (__m256i) __builtin_ia32_paddq256_mask ((__v4di) __A,
650 (__v4di) __B,
651 (__v4di)
652 _mm256_setzero_si256 (),
653 (__mmask8) __U);
654}
655
656static __inline__ __m256i __DEFAULT_FN_ATTRS
657_mm256_mask_sub_epi32 (__m256i __W, __mmask8 __U, __m256i __A,
658 __m256i __B)
659{
660 return (__m256i) __builtin_ia32_psubd256_mask ((__v8si) __A,
661 (__v8si) __B,
662 (__v8si) __W,
663 (__mmask8) __U);
664}
665
666static __inline__ __m256i __DEFAULT_FN_ATTRS
667_mm256_maskz_sub_epi32 (__mmask8 __U, __m256i __A, __m256i __B)
668{
669 return (__m256i) __builtin_ia32_psubd256_mask ((__v8si) __A,
670 (__v8si) __B,
671 (__v8si)
672 _mm256_setzero_si256 (),
673 (__mmask8) __U);
674}
675
676static __inline__ __m256i __DEFAULT_FN_ATTRS
677_mm256_mask_sub_epi64 (__m256i __W, __mmask8 __U, __m256i __A,
678 __m256i __B)
679{
680 return (__m256i) __builtin_ia32_psubq256_mask ((__v4di) __A,
681 (__v4di) __B,
682 (__v4di) __W,
683 (__mmask8) __U);
684}
685
686static __inline__ __m256i __DEFAULT_FN_ATTRS
687_mm256_maskz_sub_epi64 (__mmask8 __U, __m256i __A, __m256i __B)
688{
689 return (__m256i) __builtin_ia32_psubq256_mask ((__v4di) __A,
690 (__v4di) __B,
691 (__v4di)
692 _mm256_setzero_si256 (),
693 (__mmask8) __U);
694}
695
696static __inline__ __m128i __DEFAULT_FN_ATTRS
697_mm_mask_add_epi32 (__m128i __W, __mmask8 __U, __m128i __A,
698 __m128i __B)
699{
700 return (__m128i) __builtin_ia32_paddd128_mask ((__v4si) __A,
701 (__v4si) __B,
702 (__v4si) __W,
703 (__mmask8) __U);
704}
705
706static __inline__ __m128i __DEFAULT_FN_ATTRS
707_mm_maskz_add_epi32 (__mmask8 __U, __m128i __A, __m128i __B)
708{
709 return (__m128i) __builtin_ia32_paddd128_mask ((__v4si) __A,
710 (__v4si) __B,
711 (__v4si)
712 _mm_setzero_si128 (),
713 (__mmask8) __U);
714}
715
716static __inline__ __m128i __DEFAULT_FN_ATTRS
717_mm_mask_add_epi64 (__m128i __W, __mmask8 __U, __m128i __A,
718 __m128i __B)
719{
720 return (__m128i) __builtin_ia32_paddq128_mask ((__v2di) __A,
721 (__v2di) __B,
722 (__v2di) __W,
723 (__mmask8) __U);
724}
725
726static __inline__ __m128i __DEFAULT_FN_ATTRS
727_mm_maskz_add_epi64 (__mmask8 __U, __m128i __A, __m128i __B)
728{
729 return (__m128i) __builtin_ia32_paddq128_mask ((__v2di) __A,
730 (__v2di) __B,
731 (__v2di)
732 _mm_setzero_si128 (),
733 (__mmask8) __U);
734}
735
736static __inline__ __m128i __DEFAULT_FN_ATTRS
737_mm_mask_sub_epi32 (__m128i __W, __mmask8 __U, __m128i __A,
738 __m128i __B)
739{
740 return (__m128i) __builtin_ia32_psubd128_mask ((__v4si) __A,
741 (__v4si) __B,
742 (__v4si) __W,
743 (__mmask8) __U);
744}
745
746static __inline__ __m128i __DEFAULT_FN_ATTRS
747_mm_maskz_sub_epi32 (__mmask8 __U, __m128i __A, __m128i __B)
748{
749 return (__m128i) __builtin_ia32_psubd128_mask ((__v4si) __A,
750 (__v4si) __B,
751 (__v4si)
752 _mm_setzero_si128 (),
753 (__mmask8) __U);
754}
755
756static __inline__ __m128i __DEFAULT_FN_ATTRS
757_mm_mask_sub_epi64 (__m128i __W, __mmask8 __U, __m128i __A,
758 __m128i __B)
759{
760 return (__m128i) __builtin_ia32_psubq128_mask ((__v2di) __A,
761 (__v2di) __B,
762 (__v2di) __W,
763 (__mmask8) __U);
764}
765
766static __inline__ __m128i __DEFAULT_FN_ATTRS
767_mm_maskz_sub_epi64 (__mmask8 __U, __m128i __A, __m128i __B)
768{
769 return (__m128i) __builtin_ia32_psubq128_mask ((__v2di) __A,
770 (__v2di) __B,
771 (__v2di)
772 _mm_setzero_si128 (),
773 (__mmask8) __U);
774}
775
776static __inline__ __m256i __DEFAULT_FN_ATTRS
777_mm256_mask_mul_epi32 (__m256i __W, __mmask8 __M, __m256i __X,
778 __m256i __Y)
779{
780 return (__m256i) __builtin_ia32_pmuldq256_mask ((__v8si) __X,
781 (__v8si) __Y,
782 (__v4di) __W, __M);
783}
784
785static __inline__ __m256i __DEFAULT_FN_ATTRS
786_mm256_maskz_mul_epi32 (__mmask8 __M, __m256i __X, __m256i __Y)
787{
788 return (__m256i) __builtin_ia32_pmuldq256_mask ((__v8si) __X,
789 (__v8si) __Y,
790 (__v4di)
791 _mm256_setzero_si256 (),
792 __M);
793}
794
795static __inline__ __m128i __DEFAULT_FN_ATTRS
796_mm_mask_mul_epi32 (__m128i __W, __mmask8 __M, __m128i __X,
797 __m128i __Y)
798{
799 return (__m128i) __builtin_ia32_pmuldq128_mask ((__v4si) __X,
800 (__v4si) __Y,
801 (__v2di) __W, __M);
802}
803
804static __inline__ __m128i __DEFAULT_FN_ATTRS
805_mm_maskz_mul_epi32 (__mmask8 __M, __m128i __X, __m128i __Y)
806{
807 return (__m128i) __builtin_ia32_pmuldq128_mask ((__v4si) __X,
808 (__v4si) __Y,
809 (__v2di)
810 _mm_setzero_si128 (),
811 __M);
812}
813
814static __inline__ __m256i __DEFAULT_FN_ATTRS
815_mm256_mask_mul_epu32 (__m256i __W, __mmask8 __M, __m256i __X,
816 __m256i __Y)
817{
818 return (__m256i) __builtin_ia32_pmuludq256_mask ((__v8si) __X,
819 (__v8si) __Y,
820 (__v4di) __W, __M);
821}
822
823static __inline__ __m256i __DEFAULT_FN_ATTRS
824_mm256_maskz_mul_epu32 (__mmask8 __M, __m256i __X, __m256i __Y)
825{
826 return (__m256i) __builtin_ia32_pmuludq256_mask ((__v8si) __X,
827 (__v8si) __Y,
828 (__v4di)
829 _mm256_setzero_si256 (),
830 __M);
831}
832
833static __inline__ __m128i __DEFAULT_FN_ATTRS
834_mm_mask_mul_epu32 (__m128i __W, __mmask8 __M, __m128i __X,
835 __m128i __Y)
836{
837 return (__m128i) __builtin_ia32_pmuludq128_mask ((__v4si) __X,
838 (__v4si) __Y,
839 (__v2di) __W, __M);
840}
841
842static __inline__ __m128i __DEFAULT_FN_ATTRS
843_mm_maskz_mul_epu32 (__mmask8 __M, __m128i __X, __m128i __Y)
844{
845 return (__m128i) __builtin_ia32_pmuludq128_mask ((__v4si) __X,
846 (__v4si) __Y,
847 (__v2di)
848 _mm_setzero_si128 (),
849 __M);
850}
851
852static __inline__ __m256i __DEFAULT_FN_ATTRS
853_mm256_maskz_mullo_epi32 (__mmask8 __M, __m256i __A, __m256i __B)
854{
855 return (__m256i) __builtin_ia32_pmulld256_mask ((__v8si) __A,
856 (__v8si) __B,
857 (__v8si)
858 _mm256_setzero_si256 (),
859 __M);
860}
861
862static __inline__ __m256i __DEFAULT_FN_ATTRS
863_mm256_mask_mullo_epi32 (__m256i __W, __mmask8 __M, __m256i __A,
864 __m256i __B)
865{
866 return (__m256i) __builtin_ia32_pmulld256_mask ((__v8si) __A,
867 (__v8si) __B,
868 (__v8si) __W, __M);
869}
870
871static __inline__ __m128i __DEFAULT_FN_ATTRS
872_mm_maskz_mullo_epi32 (__mmask8 __M, __m128i __A, __m128i __B)
873{
874 return (__m128i) __builtin_ia32_pmulld128_mask ((__v4si) __A,
875 (__v4si) __B,
876 (__v4si)
877 _mm_setzero_si128 (),
878 __M);
879}
880
881static __inline__ __m128i __DEFAULT_FN_ATTRS
882_mm_mask_mullo_epi32 (__m128i __W, __mmask16 __M, __m128i __A,
883 __m128i __B)
884{
885 return (__m128i) __builtin_ia32_pmulld128_mask ((__v4si) __A,
886 (__v4si) __B,
887 (__v4si) __W, __M);
888}
889
890static __inline__ __m256i __DEFAULT_FN_ATTRS
891_mm256_mask_and_epi32 (__m256i __W, __mmask8 __U, __m256i __A,
892 __m256i __B)
893{
894 return (__m256i) __builtin_ia32_pandd256_mask ((__v8si) __A,
895 (__v8si) __B,
896 (__v8si) __W,
897 (__mmask8) __U);
898}
899
900static __inline__ __m256i __DEFAULT_FN_ATTRS
901_mm256_maskz_and_epi32 (__mmask8 __U, __m256i __A, __m256i __B)
902{
903 return (__m256i) __builtin_ia32_pandd256_mask ((__v8si) __A,
904 (__v8si) __B,
905 (__v8si)
906 _mm256_setzero_si256 (),
907 (__mmask8) __U);
908}
909
910static __inline__ __m128i __DEFAULT_FN_ATTRS
911_mm_mask_and_epi32 (__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
912{
913 return (__m128i) __builtin_ia32_pandd128_mask ((__v4si) __A,
914 (__v4si) __B,
915 (__v4si) __W,
916 (__mmask8) __U);
917}
918
919static __inline__ __m128i __DEFAULT_FN_ATTRS
920_mm_maskz_and_epi32 (__mmask8 __U, __m128i __A, __m128i __B)
921{
922 return (__m128i) __builtin_ia32_pandd128_mask ((__v4si) __A,
923 (__v4si) __B,
924 (__v4si)
925 _mm_setzero_si128 (),
926 (__mmask8) __U);
927}
928
929static __inline__ __m256i __DEFAULT_FN_ATTRS
930_mm256_mask_andnot_epi32 (__m256i __W, __mmask8 __U, __m256i __A,
931 __m256i __B)
932{
933 return (__m256i) __builtin_ia32_pandnd256_mask ((__v8si) __A,
934 (__v8si) __B,
935 (__v8si) __W,
936 (__mmask8) __U);
937}
938
939static __inline__ __m256i __DEFAULT_FN_ATTRS
940_mm256_maskz_andnot_epi32 (__mmask8 __U, __m256i __A, __m256i __B)
941{
942 return (__m256i) __builtin_ia32_pandnd256_mask ((__v8si) __A,
943 (__v8si) __B,
944 (__v8si)
945 _mm256_setzero_si256 (),
946 (__mmask8) __U);
947}
948
949static __inline__ __m128i __DEFAULT_FN_ATTRS
950_mm_mask_andnot_epi32 (__m128i __W, __mmask8 __U, __m128i __A,
951 __m128i __B)
952{
953 return (__m128i) __builtin_ia32_pandnd128_mask ((__v4si) __A,
954 (__v4si) __B,
955 (__v4si) __W,
956 (__mmask8) __U);
957}
958
959static __inline__ __m128i __DEFAULT_FN_ATTRS
960_mm_maskz_andnot_epi32 (__mmask8 __U, __m128i __A, __m128i __B)
961{
962 return (__m128i) __builtin_ia32_pandnd128_mask ((__v4si) __A,
963 (__v4si) __B,
964 (__v4si)
965 _mm_setzero_si128 (),
966 (__mmask8) __U);
967}
968
969static __inline__ __m256i __DEFAULT_FN_ATTRS
970_mm256_mask_or_epi32 (__m256i __W, __mmask8 __U, __m256i __A,
971 __m256i __B)
972{
973 return (__m256i) __builtin_ia32_pord256_mask ((__v8si) __A,
974 (__v8si) __B,
975 (__v8si) __W,
976 (__mmask8) __U);
977}
978
979static __inline__ __m256i __DEFAULT_FN_ATTRS
980_mm256_maskz_or_epi32 (__mmask8 __U, __m256i __A, __m256i __B)
981{
982 return (__m256i) __builtin_ia32_pord256_mask ((__v8si) __A,
983 (__v8si) __B,
984 (__v8si)
985 _mm256_setzero_si256 (),
986 (__mmask8) __U);
987}
988
989static __inline__ __m128i __DEFAULT_FN_ATTRS
990_mm_mask_or_epi32 (__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
991{
992 return (__m128i) __builtin_ia32_pord128_mask ((__v4si) __A,
993 (__v4si) __B,
994 (__v4si) __W,
995 (__mmask8) __U);
996}
997
998static __inline__ __m128i __DEFAULT_FN_ATTRS
999_mm_maskz_or_epi32 (__mmask8 __U, __m128i __A, __m128i __B)
1000{
1001 return (__m128i) __builtin_ia32_pord128_mask ((__v4si) __A,
1002 (__v4si) __B,
1003 (__v4si)
1004 _mm_setzero_si128 (),
1005 (__mmask8) __U);
1006}
1007
1008static __inline__ __m256i __DEFAULT_FN_ATTRS
1009_mm256_mask_xor_epi32 (__m256i __W, __mmask8 __U, __m256i __A,
1010 __m256i __B)
1011{
1012 return (__m256i) __builtin_ia32_pxord256_mask ((__v8si) __A,
1013 (__v8si) __B,
1014 (__v8si) __W,
1015 (__mmask8) __U);
1016}
1017
1018static __inline__ __m256i __DEFAULT_FN_ATTRS
1019_mm256_maskz_xor_epi32 (__mmask8 __U, __m256i __A, __m256i __B)
1020{
1021 return (__m256i) __builtin_ia32_pxord256_mask ((__v8si) __A,
1022 (__v8si) __B,
1023 (__v8si)
1024 _mm256_setzero_si256 (),
1025 (__mmask8) __U);
1026}
1027
1028static __inline__ __m128i __DEFAULT_FN_ATTRS
1029_mm_mask_xor_epi32 (__m128i __W, __mmask8 __U, __m128i __A,
1030 __m128i __B)
1031{
1032 return (__m128i) __builtin_ia32_pxord128_mask ((__v4si) __A,
1033 (__v4si) __B,
1034 (__v4si) __W,
1035 (__mmask8) __U);
1036}
1037
1038static __inline__ __m128i __DEFAULT_FN_ATTRS
1039_mm_maskz_xor_epi32 (__mmask8 __U, __m128i __A, __m128i __B)
1040{
1041 return (__m128i) __builtin_ia32_pxord128_mask ((__v4si) __A,
1042 (__v4si) __B,
1043 (__v4si)
1044 _mm_setzero_si128 (),
1045 (__mmask8) __U);
1046}
1047
1048static __inline__ __m256i __DEFAULT_FN_ATTRS
1049_mm256_mask_and_epi64 (__m256i __W, __mmask8 __U, __m256i __A,
1050 __m256i __B)
1051{
1052 return (__m256i) __builtin_ia32_pandq256_mask ((__v4di) __A,
1053 (__v4di) __B,
1054 (__v4di) __W, __U);
1055}
1056
1057static __inline__ __m256i __DEFAULT_FN_ATTRS
1058_mm256_maskz_and_epi64 (__mmask8 __U, __m256i __A, __m256i __B)
1059{
1060 return (__m256i) __builtin_ia32_pandq256_mask ((__v4di) __A,
1061 (__v4di) __B,
1062 (__v4di)
1063 _mm256_setzero_pd (),
1064 __U);
1065}
1066
1067static __inline__ __m128i __DEFAULT_FN_ATTRS
1068_mm_mask_and_epi64 (__m128i __W, __mmask8 __U, __m128i __A,
1069 __m128i __B)
1070{
1071 return (__m128i) __builtin_ia32_pandq128_mask ((__v2di) __A,
1072 (__v2di) __B,
1073 (__v2di) __W, __U);
1074}
1075
1076static __inline__ __m128i __DEFAULT_FN_ATTRS
1077_mm_maskz_and_epi64 (__mmask8 __U, __m128i __A, __m128i __B)
1078{
1079 return (__m128i) __builtin_ia32_pandq128_mask ((__v2di) __A,
1080 (__v2di) __B,
1081 (__v2di)
1082 _mm_setzero_pd (),
1083 __U);
1084}
1085
1086static __inline__ __m256i __DEFAULT_FN_ATTRS
1087_mm256_mask_andnot_epi64 (__m256i __W, __mmask8 __U, __m256i __A,
1088 __m256i __B)
1089{
1090 return (__m256i) __builtin_ia32_pandnq256_mask ((__v4di) __A,
1091 (__v4di) __B,
1092 (__v4di) __W, __U);
1093}
1094
1095static __inline__ __m256i __DEFAULT_FN_ATTRS
1096_mm256_maskz_andnot_epi64 (__mmask8 __U, __m256i __A, __m256i __B)
1097{
1098 return (__m256i) __builtin_ia32_pandnq256_mask ((__v4di) __A,
1099 (__v4di) __B,
1100 (__v4di)
1101 _mm256_setzero_pd (),
1102 __U);
1103}
1104
1105static __inline__ __m128i __DEFAULT_FN_ATTRS
1106_mm_mask_andnot_epi64 (__m128i __W, __mmask8 __U, __m128i __A,
1107 __m128i __B)
1108{
1109 return (__m128i) __builtin_ia32_pandnq128_mask ((__v2di) __A,
1110 (__v2di) __B,
1111 (__v2di) __W, __U);
1112}
1113
1114static __inline__ __m128i __DEFAULT_FN_ATTRS
1115_mm_maskz_andnot_epi64 (__mmask8 __U, __m128i __A, __m128i __B)
1116{
1117 return (__m128i) __builtin_ia32_pandnq128_mask ((__v2di) __A,
1118 (__v2di) __B,
1119 (__v2di)
1120 _mm_setzero_pd (),
1121 __U);
1122}
1123
1124static __inline__ __m256i __DEFAULT_FN_ATTRS
1125_mm256_mask_or_epi64 (__m256i __W, __mmask8 __U, __m256i __A,
1126 __m256i __B)
1127{
1128 return (__m256i) __builtin_ia32_porq256_mask ((__v4di) __A,
1129 (__v4di) __B,
1130 (__v4di) __W,
1131 (__mmask8) __U);
1132}
1133
1134static __inline__ __m256i __DEFAULT_FN_ATTRS
1135_mm256_maskz_or_epi64 (__mmask8 __U, __m256i __A, __m256i __B)
1136{
1137 return (__m256i) __builtin_ia32_porq256_mask ((__v4di) __A,
1138 (__v4di) __B,
1139 (__v4di)
1140 _mm256_setzero_si256 (),
1141 (__mmask8) __U);
1142}
1143
1144static __inline__ __m128i __DEFAULT_FN_ATTRS
1145_mm_mask_or_epi64 (__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
1146{
1147 return (__m128i) __builtin_ia32_porq128_mask ((__v2di) __A,
1148 (__v2di) __B,
1149 (__v2di) __W,
1150 (__mmask8) __U);
1151}
1152
1153static __inline__ __m128i __DEFAULT_FN_ATTRS
1154_mm_maskz_or_epi64 (__mmask8 __U, __m128i __A, __m128i __B)
1155{
1156 return (__m128i) __builtin_ia32_porq128_mask ((__v2di) __A,
1157 (__v2di) __B,
1158 (__v2di)
1159 _mm_setzero_si128 (),
1160 (__mmask8) __U);
1161}
1162
1163static __inline__ __m256i __DEFAULT_FN_ATTRS
1164_mm256_mask_xor_epi64 (__m256i __W, __mmask8 __U, __m256i __A,
1165 __m256i __B)
1166{
1167 return (__m256i) __builtin_ia32_pxorq256_mask ((__v4di) __A,
1168 (__v4di) __B,
1169 (__v4di) __W,
1170 (__mmask8) __U);
1171}
1172
1173static __inline__ __m256i __DEFAULT_FN_ATTRS
1174_mm256_maskz_xor_epi64 (__mmask8 __U, __m256i __A, __m256i __B)
1175{
1176 return (__m256i) __builtin_ia32_pxorq256_mask ((__v4di) __A,
1177 (__v4di) __B,
1178 (__v4di)
1179 _mm256_setzero_si256 (),
1180 (__mmask8) __U);
1181}
1182
1183static __inline__ __m128i __DEFAULT_FN_ATTRS
1184_mm_mask_xor_epi64 (__m128i __W, __mmask8 __U, __m128i __A,
1185 __m128i __B)
1186{
1187 return (__m128i) __builtin_ia32_pxorq128_mask ((__v2di) __A,
1188 (__v2di) __B,
1189 (__v2di) __W,
1190 (__mmask8) __U);
1191}
1192
1193static __inline__ __m128i __DEFAULT_FN_ATTRS
1194_mm_maskz_xor_epi64 (__mmask8 __U, __m128i __A, __m128i __B)
1195{
1196 return (__m128i) __builtin_ia32_pxorq128_mask ((__v2di) __A,
1197 (__v2di) __B,
1198 (__v2di)
1199 _mm_setzero_si128 (),
1200 (__mmask8) __U);
1201}
1202
1203#define _mm_cmp_epi32_mask(a, b, p) __extension__ ({ \
1204 (__mmask8)__builtin_ia32_cmpd128_mask((__v4si)(__m128i)(a), \
1205 (__v4si)(__m128i)(b), \
1206 (p), (__mmask8)-1); })
1207
1208#define _mm_mask_cmp_epi32_mask(m, a, b, p) __extension__ ({ \
1209 (__mmask8)__builtin_ia32_cmpd128_mask((__v4si)(__m128i)(a), \
1210 (__v4si)(__m128i)(b), \
1211 (p), (__mmask8)(m)); })
1212
1213#define _mm_cmp_epu32_mask(a, b, p) __extension__ ({ \
1214 (__mmask8)__builtin_ia32_ucmpd128_mask((__v4si)(__m128i)(a), \
1215 (__v4si)(__m128i)(b), \
1216 (p), (__mmask8)-1); })
1217
1218#define _mm_mask_cmp_epu32_mask(m, a, b, p) __extension__ ({ \
1219 (__mmask8)__builtin_ia32_ucmpd128_mask((__v4si)(__m128i)(a), \
1220 (__v4si)(__m128i)(b), \
1221 (p), (__mmask8)(m)); })
1222
1223#define _mm256_cmp_epi32_mask(a, b, p) __extension__ ({ \
1224 (__mmask8)__builtin_ia32_cmpd256_mask((__v8si)(__m256i)(a), \
1225 (__v8si)(__m256i)(b), \
1226 (p), (__mmask8)-1); })
1227
1228#define _mm256_mask_cmp_epi32_mask(m, a, b, p) __extension__ ({ \
1229 (__mmask8)__builtin_ia32_cmpd256_mask((__v8si)(__m256i)(a), \
1230 (__v8si)(__m256i)(b), \
1231 (p), (__mmask8)(m)); })
1232
1233#define _mm256_cmp_epu32_mask(a, b, p) __extension__ ({ \
1234 (__mmask8)__builtin_ia32_ucmpd256_mask((__v8si)(__m256i)(a), \
1235 (__v8si)(__m256i)(b), \
1236 (p), (__mmask8)-1); })
1237
1238#define _mm256_mask_cmp_epu32_mask(m, a, b, p) __extension__ ({ \
1239 (__mmask8)__builtin_ia32_ucmpd256_mask((__v8si)(__m256i)(a), \
1240 (__v8si)(__m256i)(b), \
1241 (p), (__mmask8)(m)); })
1242
1243#define _mm_cmp_epi64_mask(a, b, p) __extension__ ({ \
1244 (__mmask8)__builtin_ia32_cmpq128_mask((__v2di)(__m128i)(a), \
1245 (__v2di)(__m128i)(b), \
1246 (p), (__mmask8)-1); })
1247
1248#define _mm_mask_cmp_epi64_mask(m, a, b, p) __extension__ ({ \
1249 (__mmask8)__builtin_ia32_cmpq128_mask((__v2di)(__m128i)(a), \
1250 (__v2di)(__m128i)(b), \
1251 (p), (__mmask8)(m)); })
1252
1253#define _mm_cmp_epu64_mask(a, b, p) __extension__ ({ \
1254 (__mmask8)__builtin_ia32_ucmpq128_mask((__v2di)(__m128i)(a), \
1255 (__v2di)(__m128i)(b), \
1256 (p), (__mmask8)-1); })
1257
1258#define _mm_mask_cmp_epu64_mask(m, a, b, p) __extension__ ({ \
1259 (__mmask8)__builtin_ia32_ucmpq128_mask((__v2di)(__m128i)(a), \
1260 (__v2di)(__m128i)(b), \
1261 (p), (__mmask8)(m)); })
1262
1263#define _mm256_cmp_epi64_mask(a, b, p) __extension__ ({ \
1264 (__mmask8)__builtin_ia32_cmpq256_mask((__v4di)(__m256i)(a), \
1265 (__v4di)(__m256i)(b), \
1266 (p), (__mmask8)-1); })
1267
1268#define _mm256_mask_cmp_epi64_mask(m, a, b, p) __extension__ ({ \
1269 (__mmask8)__builtin_ia32_cmpq256_mask((__v4di)(__m256i)(a), \
1270 (__v4di)(__m256i)(b), \
1271 (p), (__mmask8)(m)); })
1272
1273#define _mm256_cmp_epu64_mask(a, b, p) __extension__ ({ \
1274 (__mmask8)__builtin_ia32_ucmpq256_mask((__v4di)(__m256i)(a), \
1275 (__v4di)(__m256i)(b), \
1276 (p), (__mmask8)-1); })
1277
1278#define _mm256_mask_cmp_epu64_mask(m, a, b, p) __extension__ ({ \
1279 (__mmask8)__builtin_ia32_ucmpq256_mask((__v4di)(__m256i)(a), \
1280 (__v4di)(__m256i)(b), \
1281 (p), (__mmask8)(m)); })
1282
1283#define _mm256_cmp_ps_mask(a, b, p) __extension__ ({ \
1284 (__mmask8)__builtin_ia32_cmpps256_mask((__v8sf)(__m256)(a), \
1285 (__v8sf)(__m256)(b), \
1286 (p), (__mmask8)-1); })
1287
1288#define _mm256_mask_cmp_ps_mask(m, a, b, p) __extension__ ({ \
1289 (__mmask8)__builtin_ia32_cmpps256_mask((__v8sf)(__m256)(a), \
1290 (__v8sf)(__m256)(b), \
1291 (p), (__mmask8)(m)); })
1292
1293#define _mm256_cmp_pd_mask(a, b, p) __extension__ ({ \
1294 (__mmask8)__builtin_ia32_cmppd256_mask((__v4df)(__m256)(a), \
1295 (__v4df)(__m256)(b), \
1296 (p), (__mmask8)-1); })
1297
1298#define _mm256_mask_cmp_pd_mask(m, a, b, p) __extension__ ({ \
1299 (__mmask8)__builtin_ia32_cmppd256_mask((__v4df)(__m256)(a), \
1300 (__v4df)(__m256)(b), \
1301 (p), (__mmask8)(m)); })
1302
1303#define _mm128_cmp_ps_mask(a, b, p) __extension__ ({ \
1304 (__mmask8)__builtin_ia32_cmpps128_mask((__v4sf)(__m128)(a), \
1305 (__v4sf)(__m128)(b), \
1306 (p), (__mmask8)-1); })
1307
1308#define _mm128_mask_cmp_ps_mask(m, a, b, p) __extension__ ({ \
1309 (__mmask8)__builtin_ia32_cmpps128_mask((__v4sf)(__m128)(a), \
1310 (__v4sf)(__m128)(b), \
1311 (p), (__mmask8)(m)); })
1312
1313#define _mm128_cmp_pd_mask(a, b, p) __extension__ ({ \
1314 (__mmask8)__builtin_ia32_cmppd128_mask((__v2df)(__m128)(a), \
1315 (__v2df)(__m128)(b), \
1316 (p), (__mmask8)-1); })
1317
1318#define _mm128_mask_cmp_pd_mask(m, a, b, p) __extension__ ({ \
1319 (__mmask8)__builtin_ia32_cmppd128_mask((__v2df)(__m128)(a), \
1320 (__v2df)(__m128)(b), \
1321 (p), (__mmask8)(m)); })
1322
1323static __inline__ __m128d __DEFAULT_FN_ATTRS
1324_mm_mask_fmadd_pd(__m128d __A, __mmask8 __U, __m128d __B, __m128d __C)
1325{
1326 return (__m128d) __builtin_ia32_vfmaddpd128_mask ((__v2df) __A,
1327 (__v2df) __B,
1328 (__v2df) __C,
1329 (__mmask8) __U);
1330}
1331
1332static __inline__ __m128d __DEFAULT_FN_ATTRS
1333_mm_mask3_fmadd_pd(__m128d __A, __m128d __B, __m128d __C, __mmask8 __U)
1334{
1335 return (__m128d) __builtin_ia32_vfmaddpd128_mask3 ((__v2df) __A,
1336 (__v2df) __B,
1337 (__v2df) __C,
1338 (__mmask8) __U);
1339}
1340
1341static __inline__ __m128d __DEFAULT_FN_ATTRS
1342_mm_maskz_fmadd_pd(__mmask8 __U, __m128d __A, __m128d __B, __m128d __C)
1343{
1344 return (__m128d) __builtin_ia32_vfmaddpd128_maskz ((__v2df) __A,
1345 (__v2df) __B,
1346 (__v2df) __C,
1347 (__mmask8) __U);
1348}
1349
1350static __inline__ __m128d __DEFAULT_FN_ATTRS
1351_mm_mask_fmsub_pd(__m128d __A, __mmask8 __U, __m128d __B, __m128d __C)
1352{
1353 return (__m128d) __builtin_ia32_vfmaddpd128_mask ((__v2df) __A,
1354 (__v2df) __B,
1355 -(__v2df) __C,
1356 (__mmask8) __U);
1357}
1358
1359static __inline__ __m128d __DEFAULT_FN_ATTRS
1360_mm_maskz_fmsub_pd(__mmask8 __U, __m128d __A, __m128d __B, __m128d __C)
1361{
1362 return (__m128d) __builtin_ia32_vfmaddpd128_maskz ((__v2df) __A,
1363 (__v2df) __B,
1364 -(__v2df) __C,
1365 (__mmask8) __U);
1366}
1367
1368static __inline__ __m128d __DEFAULT_FN_ATTRS
1369_mm_mask3_fnmadd_pd(__m128d __A, __m128d __B, __m128d __C, __mmask8 __U)
1370{
1371 return (__m128d) __builtin_ia32_vfmaddpd128_mask3 (-(__v2df) __A,
1372 (__v2df) __B,
1373 (__v2df) __C,
1374 (__mmask8) __U);
1375}
1376
1377static __inline__ __m128d __DEFAULT_FN_ATTRS
1378_mm_maskz_fnmadd_pd(__mmask8 __U, __m128d __A, __m128d __B, __m128d __C)
1379{
1380 return (__m128d) __builtin_ia32_vfmaddpd128_maskz (-(__v2df) __A,
1381 (__v2df) __B,
1382 (__v2df) __C,
1383 (__mmask8) __U);
1384}
1385
1386static __inline__ __m128d __DEFAULT_FN_ATTRS
1387_mm_maskz_fnmsub_pd(__mmask8 __U, __m128d __A, __m128d __B, __m128d __C)
1388{
1389 return (__m128d) __builtin_ia32_vfmaddpd128_maskz (-(__v2df) __A,
1390 (__v2df) __B,
1391 -(__v2df) __C,
1392 (__mmask8) __U);
1393}
1394
1395static __inline__ __m256d __DEFAULT_FN_ATTRS
1396_mm256_mask_fmadd_pd(__m256d __A, __mmask8 __U, __m256d __B, __m256d __C)
1397{
1398 return (__m256d) __builtin_ia32_vfmaddpd256_mask ((__v4df) __A,
1399 (__v4df) __B,
1400 (__v4df) __C,
1401 (__mmask8) __U);
1402}
1403
1404static __inline__ __m256d __DEFAULT_FN_ATTRS
1405_mm256_mask3_fmadd_pd(__m256d __A, __m256d __B, __m256d __C, __mmask8 __U)
1406{
1407 return (__m256d) __builtin_ia32_vfmaddpd256_mask3 ((__v4df) __A,
1408 (__v4df) __B,
1409 (__v4df) __C,
1410 (__mmask8) __U);
1411}
1412
1413static __inline__ __m256d __DEFAULT_FN_ATTRS
1414_mm256_maskz_fmadd_pd(__mmask8 __U, __m256d __A, __m256d __B, __m256d __C)
1415{
1416 return (__m256d) __builtin_ia32_vfmaddpd256_maskz ((__v4df) __A,
1417 (__v4df) __B,
1418 (__v4df) __C,
1419 (__mmask8) __U);
1420}
1421
1422static __inline__ __m256d __DEFAULT_FN_ATTRS
1423_mm256_mask_fmsub_pd(__m256d __A, __mmask8 __U, __m256d __B, __m256d __C)
1424{
1425 return (__m256d) __builtin_ia32_vfmaddpd256_mask ((__v4df) __A,
1426 (__v4df) __B,
1427 -(__v4df) __C,
1428 (__mmask8) __U);
1429}
1430
1431static __inline__ __m256d __DEFAULT_FN_ATTRS
1432_mm256_maskz_fmsub_pd(__mmask8 __U, __m256d __A, __m256d __B, __m256d __C)
1433{
1434 return (__m256d) __builtin_ia32_vfmaddpd256_maskz ((__v4df) __A,
1435 (__v4df) __B,
1436 -(__v4df) __C,
1437 (__mmask8) __U);
1438}
1439
1440static __inline__ __m256d __DEFAULT_FN_ATTRS
1441_mm256_mask3_fnmadd_pd(__m256d __A, __m256d __B, __m256d __C, __mmask8 __U)
1442{
1443 return (__m256d) __builtin_ia32_vfmaddpd256_mask3 (-(__v4df) __A,
1444 (__v4df) __B,
1445 (__v4df) __C,
1446 (__mmask8) __U);
1447}
1448
1449static __inline__ __m256d __DEFAULT_FN_ATTRS
1450_mm256_maskz_fnmadd_pd(__mmask8 __U, __m256d __A, __m256d __B, __m256d __C)
1451{
1452 return (__m256d) __builtin_ia32_vfmaddpd256_maskz (-(__v4df) __A,
1453 (__v4df) __B,
1454 (__v4df) __C,
1455 (__mmask8) __U);
1456}
1457
1458static __inline__ __m256d __DEFAULT_FN_ATTRS
1459_mm256_maskz_fnmsub_pd(__mmask8 __U, __m256d __A, __m256d __B, __m256d __C)
1460{
1461 return (__m256d) __builtin_ia32_vfmaddpd256_maskz (-(__v4df) __A,
1462 (__v4df) __B,
1463 -(__v4df) __C,
1464 (__mmask8) __U);
1465}
1466
1467static __inline__ __m128 __DEFAULT_FN_ATTRS
1468_mm_mask_fmadd_ps(__m128 __A, __mmask8 __U, __m128 __B, __m128 __C)
1469{
1470 return (__m128) __builtin_ia32_vfmaddps128_mask ((__v4sf) __A,
1471 (__v4sf) __B,
1472 (__v4sf) __C,
1473 (__mmask8) __U);
1474}
1475
1476static __inline__ __m128 __DEFAULT_FN_ATTRS
1477_mm_mask3_fmadd_ps(__m128 __A, __m128 __B, __m128 __C, __mmask8 __U)
1478{
1479 return (__m128) __builtin_ia32_vfmaddps128_mask3 ((__v4sf) __A,
1480 (__v4sf) __B,
1481 (__v4sf) __C,
1482 (__mmask8) __U);
1483}
1484
1485static __inline__ __m128 __DEFAULT_FN_ATTRS
1486_mm_maskz_fmadd_ps(__mmask8 __U, __m128 __A, __m128 __B, __m128 __C)
1487{
1488 return (__m128) __builtin_ia32_vfmaddps128_maskz ((__v4sf) __A,
1489 (__v4sf) __B,
1490 (__v4sf) __C,
1491 (__mmask8) __U);
1492}
1493
1494static __inline__ __m128 __DEFAULT_FN_ATTRS
1495_mm_mask_fmsub_ps(__m128 __A, __mmask8 __U, __m128 __B, __m128 __C)
1496{
1497 return (__m128) __builtin_ia32_vfmaddps128_mask ((__v4sf) __A,
1498 (__v4sf) __B,
1499 -(__v4sf) __C,
1500 (__mmask8) __U);
1501}
1502
1503static __inline__ __m128 __DEFAULT_FN_ATTRS
1504_mm_maskz_fmsub_ps(__mmask8 __U, __m128 __A, __m128 __B, __m128 __C)
1505{
1506 return (__m128) __builtin_ia32_vfmaddps128_maskz ((__v4sf) __A,
1507 (__v4sf) __B,
1508 -(__v4sf) __C,
1509 (__mmask8) __U);
1510}
1511
1512static __inline__ __m128 __DEFAULT_FN_ATTRS
1513_mm_mask3_fnmadd_ps(__m128 __A, __m128 __B, __m128 __C, __mmask8 __U)
1514{
1515 return (__m128) __builtin_ia32_vfmaddps128_mask3 (-(__v4sf) __A,
1516 (__v4sf) __B,
1517 (__v4sf) __C,
1518 (__mmask8) __U);
1519}
1520
1521static __inline__ __m128 __DEFAULT_FN_ATTRS
1522_mm_maskz_fnmadd_ps(__mmask8 __U, __m128 __A, __m128 __B, __m128 __C)
1523{
1524 return (__m128) __builtin_ia32_vfmaddps128_maskz (-(__v4sf) __A,
1525 (__v4sf) __B,
1526 (__v4sf) __C,
1527 (__mmask8) __U);
1528}
1529
1530static __inline__ __m128 __DEFAULT_FN_ATTRS
1531_mm_maskz_fnmsub_ps(__mmask8 __U, __m128 __A, __m128 __B, __m128 __C)
1532{
1533 return (__m128) __builtin_ia32_vfmaddps128_maskz (-(__v4sf) __A,
1534 (__v4sf) __B,
1535 -(__v4sf) __C,
1536 (__mmask8) __U);
1537}
1538
1539static __inline__ __m256 __DEFAULT_FN_ATTRS
1540_mm256_mask_fmadd_ps(__m256 __A, __mmask8 __U, __m256 __B, __m256 __C)
1541{
1542 return (__m256) __builtin_ia32_vfmaddps256_mask ((__v8sf) __A,
1543 (__v8sf) __B,
1544 (__v8sf) __C,
1545 (__mmask8) __U);
1546}
1547
1548static __inline__ __m256 __DEFAULT_FN_ATTRS
1549_mm256_mask3_fmadd_ps(__m256 __A, __m256 __B, __m256 __C, __mmask8 __U)
1550{
1551 return (__m256) __builtin_ia32_vfmaddps256_mask3 ((__v8sf) __A,
1552 (__v8sf) __B,
1553 (__v8sf) __C,
1554 (__mmask8) __U);
1555}
1556
1557static __inline__ __m256 __DEFAULT_FN_ATTRS
1558_mm256_maskz_fmadd_ps(__mmask8 __U, __m256 __A, __m256 __B, __m256 __C)
1559{
1560 return (__m256) __builtin_ia32_vfmaddps256_maskz ((__v8sf) __A,
1561 (__v8sf) __B,
1562 (__v8sf) __C,
1563 (__mmask8) __U);
1564}
1565
1566static __inline__ __m256 __DEFAULT_FN_ATTRS
1567_mm256_mask_fmsub_ps(__m256 __A, __mmask8 __U, __m256 __B, __m256 __C)
1568{
1569 return (__m256) __builtin_ia32_vfmaddps256_mask ((__v8sf) __A,
1570 (__v8sf) __B,
1571 -(__v8sf) __C,
1572 (__mmask8) __U);
1573}
1574
1575static __inline__ __m256 __DEFAULT_FN_ATTRS
1576_mm256_maskz_fmsub_ps(__mmask8 __U, __m256 __A, __m256 __B, __m256 __C)
1577{
1578 return (__m256) __builtin_ia32_vfmaddps256_maskz ((__v8sf) __A,
1579 (__v8sf) __B,
1580 -(__v8sf) __C,
1581 (__mmask8) __U);
1582}
1583
1584static __inline__ __m256 __DEFAULT_FN_ATTRS
1585_mm256_mask3_fnmadd_ps(__m256 __A, __m256 __B, __m256 __C, __mmask8 __U)
1586{
1587 return (__m256) __builtin_ia32_vfmaddps256_mask3 (-(__v8sf) __A,
1588 (__v8sf) __B,
1589 (__v8sf) __C,
1590 (__mmask8) __U);
1591}
1592
1593static __inline__ __m256 __DEFAULT_FN_ATTRS
1594_mm256_maskz_fnmadd_ps(__mmask8 __U, __m256 __A, __m256 __B, __m256 __C)
1595{
1596 return (__m256) __builtin_ia32_vfmaddps256_maskz (-(__v8sf) __A,
1597 (__v8sf) __B,
1598 (__v8sf) __C,
1599 (__mmask8) __U);
1600}
1601
1602static __inline__ __m256 __DEFAULT_FN_ATTRS
1603_mm256_maskz_fnmsub_ps(__mmask8 __U, __m256 __A, __m256 __B, __m256 __C)
1604{
1605 return (__m256) __builtin_ia32_vfmaddps256_maskz (-(__v8sf) __A,
1606 (__v8sf) __B,
1607 -(__v8sf) __C,
1608 (__mmask8) __U);
1609}
1610
1611static __inline__ __m128d __DEFAULT_FN_ATTRS
1612_mm_mask_fmaddsub_pd(__m128d __A, __mmask8 __U, __m128d __B, __m128d __C)
1613{
1614 return (__m128d) __builtin_ia32_vfmaddsubpd128_mask ((__v2df) __A,
1615 (__v2df) __B,
1616 (__v2df) __C,
1617 (__mmask8) __U);
1618}
1619
1620static __inline__ __m128d __DEFAULT_FN_ATTRS
1621_mm_mask3_fmaddsub_pd(__m128d __A, __m128d __B, __m128d __C, __mmask8 __U)
1622{
1623 return (__m128d) __builtin_ia32_vfmaddsubpd128_mask3 ((__v2df) __A,
1624 (__v2df) __B,
1625 (__v2df) __C,
1626 (__mmask8)
1627 __U);
1628}
1629
1630static __inline__ __m128d __DEFAULT_FN_ATTRS
1631_mm_maskz_fmaddsub_pd(__mmask8 __U, __m128d __A, __m128d __B, __m128d __C)
1632{
1633 return (__m128d) __builtin_ia32_vfmaddsubpd128_maskz ((__v2df) __A,
1634 (__v2df) __B,
1635 (__v2df) __C,
1636 (__mmask8)
1637 __U);
1638}
1639
1640static __inline__ __m128d __DEFAULT_FN_ATTRS
1641_mm_mask_fmsubadd_pd(__m128d __A, __mmask8 __U, __m128d __B, __m128d __C)
1642{
1643 return (__m128d) __builtin_ia32_vfmaddsubpd128_mask ((__v2df) __A,
1644 (__v2df) __B,
1645 -(__v2df) __C,
1646 (__mmask8) __U);
1647}
1648
1649static __inline__ __m128d __DEFAULT_FN_ATTRS
1650_mm_maskz_fmsubadd_pd(__mmask8 __U, __m128d __A, __m128d __B, __m128d __C)
1651{
1652 return (__m128d) __builtin_ia32_vfmaddsubpd128_maskz ((__v2df) __A,
1653 (__v2df) __B,
1654 -(__v2df) __C,
1655 (__mmask8)
1656 __U);
1657}
1658
1659static __inline__ __m256d __DEFAULT_FN_ATTRS
1660_mm256_mask_fmaddsub_pd(__m256d __A, __mmask8 __U, __m256d __B, __m256d __C)
1661{
1662 return (__m256d) __builtin_ia32_vfmaddsubpd256_mask ((__v4df) __A,
1663 (__v4df) __B,
1664 (__v4df) __C,
1665 (__mmask8) __U);
1666}
1667
1668static __inline__ __m256d __DEFAULT_FN_ATTRS
1669_mm256_mask3_fmaddsub_pd(__m256d __A, __m256d __B, __m256d __C, __mmask8 __U)
1670{
1671 return (__m256d) __builtin_ia32_vfmaddsubpd256_mask3 ((__v4df) __A,
1672 (__v4df) __B,
1673 (__v4df) __C,
1674 (__mmask8)
1675 __U);
1676}
1677
1678static __inline__ __m256d __DEFAULT_FN_ATTRS
1679_mm256_maskz_fmaddsub_pd(__mmask8 __U, __m256d __A, __m256d __B, __m256d __C)
1680{
1681 return (__m256d) __builtin_ia32_vfmaddsubpd256_maskz ((__v4df) __A,
1682 (__v4df) __B,
1683 (__v4df) __C,
1684 (__mmask8)
1685 __U);
1686}
1687
1688static __inline__ __m256d __DEFAULT_FN_ATTRS
1689_mm256_mask_fmsubadd_pd(__m256d __A, __mmask8 __U, __m256d __B, __m256d __C)
1690{
1691 return (__m256d) __builtin_ia32_vfmaddsubpd256_mask ((__v4df) __A,
1692 (__v4df) __B,
1693 -(__v4df) __C,
1694 (__mmask8) __U);
1695}
1696
1697static __inline__ __m256d __DEFAULT_FN_ATTRS
1698_mm256_maskz_fmsubadd_pd(__mmask8 __U, __m256d __A, __m256d __B, __m256d __C)
1699{
1700 return (__m256d) __builtin_ia32_vfmaddsubpd256_maskz ((__v4df) __A,
1701 (__v4df) __B,
1702 -(__v4df) __C,
1703 (__mmask8)
1704 __U);
1705}
1706
1707static __inline__ __m128 __DEFAULT_FN_ATTRS
1708_mm_mask_fmaddsub_ps(__m128 __A, __mmask8 __U, __m128 __B, __m128 __C)
1709{
1710 return (__m128) __builtin_ia32_vfmaddsubps128_mask ((__v4sf) __A,
1711 (__v4sf) __B,
1712 (__v4sf) __C,
1713 (__mmask8) __U);
1714}
1715
1716static __inline__ __m128 __DEFAULT_FN_ATTRS
1717_mm_mask3_fmaddsub_ps(__m128 __A, __m128 __B, __m128 __C, __mmask8 __U)
1718{
1719 return (__m128) __builtin_ia32_vfmaddsubps128_mask3 ((__v4sf) __A,
1720 (__v4sf) __B,
1721 (__v4sf) __C,
1722 (__mmask8) __U);
1723}
1724
1725static __inline__ __m128 __DEFAULT_FN_ATTRS
1726_mm_maskz_fmaddsub_ps(__mmask8 __U, __m128 __A, __m128 __B, __m128 __C)
1727{
1728 return (__m128) __builtin_ia32_vfmaddsubps128_maskz ((__v4sf) __A,
1729 (__v4sf) __B,
1730 (__v4sf) __C,
1731 (__mmask8) __U);
1732}
1733
1734static __inline__ __m128 __DEFAULT_FN_ATTRS
1735_mm_mask_fmsubadd_ps(__m128 __A, __mmask8 __U, __m128 __B, __m128 __C)
1736{
1737 return (__m128) __builtin_ia32_vfmaddsubps128_mask ((__v4sf) __A,
1738 (__v4sf) __B,
1739 -(__v4sf) __C,
1740 (__mmask8) __U);
1741}
1742
1743static __inline__ __m128 __DEFAULT_FN_ATTRS
1744_mm_maskz_fmsubadd_ps(__mmask8 __U, __m128 __A, __m128 __B, __m128 __C)
1745{
1746 return (__m128) __builtin_ia32_vfmaddsubps128_maskz ((__v4sf) __A,
1747 (__v4sf) __B,
1748 -(__v4sf) __C,
1749 (__mmask8) __U);
1750}
1751
1752static __inline__ __m256 __DEFAULT_FN_ATTRS
1753_mm256_mask_fmaddsub_ps(__m256 __A, __mmask8 __U, __m256 __B,
1754 __m256 __C)
1755{
1756 return (__m256) __builtin_ia32_vfmaddsubps256_mask ((__v8sf) __A,
1757 (__v8sf) __B,
1758 (__v8sf) __C,
1759 (__mmask8) __U);
1760}
1761
1762static __inline__ __m256 __DEFAULT_FN_ATTRS
1763_mm256_mask3_fmaddsub_ps(__m256 __A, __m256 __B, __m256 __C, __mmask8 __U)
1764{
1765 return (__m256) __builtin_ia32_vfmaddsubps256_mask3 ((__v8sf) __A,
1766 (__v8sf) __B,
1767 (__v8sf) __C,
1768 (__mmask8) __U);
1769}
1770
1771static __inline__ __m256 __DEFAULT_FN_ATTRS
1772_mm256_maskz_fmaddsub_ps(__mmask8 __U, __m256 __A, __m256 __B, __m256 __C)
1773{
1774 return (__m256) __builtin_ia32_vfmaddsubps256_maskz ((__v8sf) __A,
1775 (__v8sf) __B,
1776 (__v8sf) __C,
1777 (__mmask8) __U);
1778}
1779
1780static __inline__ __m256 __DEFAULT_FN_ATTRS
1781_mm256_mask_fmsubadd_ps(__m256 __A, __mmask8 __U, __m256 __B, __m256 __C)
1782{
1783 return (__m256) __builtin_ia32_vfmaddsubps256_mask ((__v8sf) __A,
1784 (__v8sf) __B,
1785 -(__v8sf) __C,
1786 (__mmask8) __U);
1787}
1788
1789static __inline__ __m256 __DEFAULT_FN_ATTRS
1790_mm256_maskz_fmsubadd_ps(__mmask8 __U, __m256 __A, __m256 __B, __m256 __C)
1791{
1792 return (__m256) __builtin_ia32_vfmaddsubps256_maskz ((__v8sf) __A,
1793 (__v8sf) __B,
1794 -(__v8sf) __C,
1795 (__mmask8) __U);
1796}
1797
1798static __inline__ __m128d __DEFAULT_FN_ATTRS
1799_mm_mask3_fmsub_pd(__m128d __A, __m128d __B, __m128d __C, __mmask8 __U)
1800{
1801 return (__m128d) __builtin_ia32_vfmsubpd128_mask3 ((__v2df) __A,
1802 (__v2df) __B,
1803 (__v2df) __C,
1804 (__mmask8) __U);
1805}
1806
1807static __inline__ __m256d __DEFAULT_FN_ATTRS
1808_mm256_mask3_fmsub_pd(__m256d __A, __m256d __B, __m256d __C, __mmask8 __U)
1809{
1810 return (__m256d) __builtin_ia32_vfmsubpd256_mask3 ((__v4df) __A,
1811 (__v4df) __B,
1812 (__v4df) __C,
1813 (__mmask8) __U);
1814}
1815
1816static __inline__ __m128 __DEFAULT_FN_ATTRS
1817_mm_mask3_fmsub_ps(__m128 __A, __m128 __B, __m128 __C, __mmask8 __U)
1818{
1819 return (__m128) __builtin_ia32_vfmsubps128_mask3 ((__v4sf) __A,
1820 (__v4sf) __B,
1821 (__v4sf) __C,
1822 (__mmask8) __U);
1823}
1824
1825static __inline__ __m256 __DEFAULT_FN_ATTRS
1826_mm256_mask3_fmsub_ps(__m256 __A, __m256 __B, __m256 __C, __mmask8 __U)
1827{
1828 return (__m256) __builtin_ia32_vfmsubps256_mask3 ((__v8sf) __A,
1829 (__v8sf) __B,
1830 (__v8sf) __C,
1831 (__mmask8) __U);
1832}
1833
1834static __inline__ __m128d __DEFAULT_FN_ATTRS
1835_mm_mask3_fmsubadd_pd(__m128d __A, __m128d __B, __m128d __C, __mmask8 __U)
1836{
1837 return (__m128d) __builtin_ia32_vfmsubaddpd128_mask3 ((__v2df) __A,
1838 (__v2df) __B,
1839 (__v2df) __C,
1840 (__mmask8)
1841 __U);
1842}
1843
1844static __inline__ __m256d __DEFAULT_FN_ATTRS
1845_mm256_mask3_fmsubadd_pd(__m256d __A, __m256d __B, __m256d __C, __mmask8 __U)
1846{
1847 return (__m256d) __builtin_ia32_vfmsubaddpd256_mask3 ((__v4df) __A,
1848 (__v4df) __B,
1849 (__v4df) __C,
1850 (__mmask8)
1851 __U);
1852}
1853
1854static __inline__ __m128 __DEFAULT_FN_ATTRS
1855_mm_mask3_fmsubadd_ps(__m128 __A, __m128 __B, __m128 __C, __mmask8 __U)
1856{
1857 return (__m128) __builtin_ia32_vfmsubaddps128_mask3 ((__v4sf) __A,
1858 (__v4sf) __B,
1859 (__v4sf) __C,
1860 (__mmask8) __U);
1861}
1862
1863static __inline__ __m256 __DEFAULT_FN_ATTRS
1864_mm256_mask3_fmsubadd_ps(__m256 __A, __m256 __B, __m256 __C, __mmask8 __U)
1865{
1866 return (__m256) __builtin_ia32_vfmsubaddps256_mask3 ((__v8sf) __A,
1867 (__v8sf) __B,
1868 (__v8sf) __C,
1869 (__mmask8) __U);
1870}
1871
1872static __inline__ __m128d __DEFAULT_FN_ATTRS
1873_mm_mask_fnmadd_pd(__m128d __A, __mmask8 __U, __m128d __B, __m128d __C)
1874{
1875 return (__m128d) __builtin_ia32_vfnmaddpd128_mask ((__v2df) __A,
1876 (__v2df) __B,
1877 (__v2df) __C,
1878 (__mmask8) __U);
1879}
1880
1881static __inline__ __m256d __DEFAULT_FN_ATTRS
1882_mm256_mask_fnmadd_pd(__m256d __A, __mmask8 __U, __m256d __B, __m256d __C)
1883{
1884 return (__m256d) __builtin_ia32_vfnmaddpd256_mask ((__v4df) __A,
1885 (__v4df) __B,
1886 (__v4df) __C,
1887 (__mmask8) __U);
1888}
1889
1890static __inline__ __m128 __DEFAULT_FN_ATTRS
1891_mm_mask_fnmadd_ps(__m128 __A, __mmask8 __U, __m128 __B, __m128 __C)
1892{
1893 return (__m128) __builtin_ia32_vfnmaddps128_mask ((__v4sf) __A,
1894 (__v4sf) __B,
1895 (__v4sf) __C,
1896 (__mmask8) __U);
1897}
1898
1899static __inline__ __m256 __DEFAULT_FN_ATTRS
1900_mm256_mask_fnmadd_ps(__m256 __A, __mmask8 __U, __m256 __B, __m256 __C)
1901{
1902 return (__m256) __builtin_ia32_vfnmaddps256_mask ((__v8sf) __A,
1903 (__v8sf) __B,
1904 (__v8sf) __C,
1905 (__mmask8) __U);
1906}
1907
1908static __inline__ __m128d __DEFAULT_FN_ATTRS
1909_mm_mask_fnmsub_pd(__m128d __A, __mmask8 __U, __m128d __B, __m128d __C)
1910{
1911 return (__m128d) __builtin_ia32_vfnmsubpd128_mask ((__v2df) __A,
1912 (__v2df) __B,
1913 (__v2df) __C,
1914 (__mmask8) __U);
1915}
1916
1917static __inline__ __m128d __DEFAULT_FN_ATTRS
1918_mm_mask3_fnmsub_pd(__m128d __A, __m128d __B, __m128d __C, __mmask8 __U)
1919{
1920 return (__m128d) __builtin_ia32_vfnmsubpd128_mask3 ((__v2df) __A,
1921 (__v2df) __B,
1922 (__v2df) __C,
1923 (__mmask8) __U);
1924}
1925
1926static __inline__ __m256d __DEFAULT_FN_ATTRS
1927_mm256_mask_fnmsub_pd(__m256d __A, __mmask8 __U, __m256d __B, __m256d __C)
1928{
1929 return (__m256d) __builtin_ia32_vfnmsubpd256_mask ((__v4df) __A,
1930 (__v4df) __B,
1931 (__v4df) __C,
1932 (__mmask8) __U);
1933}
1934
1935static __inline__ __m256d __DEFAULT_FN_ATTRS
1936_mm256_mask3_fnmsub_pd(__m256d __A, __m256d __B, __m256d __C, __mmask8 __U)
1937{
1938 return (__m256d) __builtin_ia32_vfnmsubpd256_mask3 ((__v4df) __A,
1939 (__v4df) __B,
1940 (__v4df) __C,
1941 (__mmask8) __U);
1942}
1943
1944static __inline__ __m128 __DEFAULT_FN_ATTRS
1945_mm_mask_fnmsub_ps(__m128 __A, __mmask8 __U, __m128 __B, __m128 __C)
1946{
1947 return (__m128) __builtin_ia32_vfnmsubps128_mask ((__v4sf) __A,
1948 (__v4sf) __B,
1949 (__v4sf) __C,
1950 (__mmask8) __U);
1951}
1952
1953static __inline__ __m128 __DEFAULT_FN_ATTRS
1954_mm_mask3_fnmsub_ps(__m128 __A, __m128 __B, __m128 __C, __mmask8 __U)
1955{
1956 return (__m128) __builtin_ia32_vfnmsubps128_mask3 ((__v4sf) __A,
1957 (__v4sf) __B,
1958 (__v4sf) __C,
1959 (__mmask8) __U);
1960}
1961
1962static __inline__ __m256 __DEFAULT_FN_ATTRS
1963_mm256_mask_fnmsub_ps(__m256 __A, __mmask8 __U, __m256 __B, __m256 __C)
1964{
1965 return (__m256) __builtin_ia32_vfnmsubps256_mask ((__v8sf) __A,
1966 (__v8sf) __B,
1967 (__v8sf) __C,
1968 (__mmask8) __U);
1969}
1970
1971static __inline__ __m256 __DEFAULT_FN_ATTRS
1972_mm256_mask3_fnmsub_ps(__m256 __A, __m256 __B, __m256 __C, __mmask8 __U)
1973{
1974 return (__m256) __builtin_ia32_vfnmsubps256_mask3 ((__v8sf) __A,
1975 (__v8sf) __B,
1976 (__v8sf) __C,
1977 (__mmask8) __U);
1978}
1979
1980#undef __DEFAULT_FN_ATTRS
1981
1982#endif /* __AVX512VLINTRIN_H */
c_headers/avxintrin.h created+1308
......@@ -0,0 +1,1308 @@
1/*===---- avxintrin.h - AVX intrinsics -------------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __IMMINTRIN_H
25#error "Never use <avxintrin.h> directly; include <immintrin.h> instead."
26#endif
27
28#ifndef __AVXINTRIN_H
29#define __AVXINTRIN_H
30
31typedef double __v4df __attribute__ ((__vector_size__ (32)));
32typedef float __v8sf __attribute__ ((__vector_size__ (32)));
33typedef long long __v4di __attribute__ ((__vector_size__ (32)));
34typedef int __v8si __attribute__ ((__vector_size__ (32)));
35typedef short __v16hi __attribute__ ((__vector_size__ (32)));
36typedef char __v32qi __attribute__ ((__vector_size__ (32)));
37
38typedef float __m256 __attribute__ ((__vector_size__ (32)));
39typedef double __m256d __attribute__((__vector_size__(32)));
40typedef long long __m256i __attribute__((__vector_size__(32)));
41
42/* Define the default attributes for the functions in this file. */
43#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
44
45/* Arithmetic */
46static __inline __m256d __DEFAULT_FN_ATTRS
47_mm256_add_pd(__m256d __a, __m256d __b)
48{
49 return __a+__b;
50}
51
52static __inline __m256 __DEFAULT_FN_ATTRS
53_mm256_add_ps(__m256 __a, __m256 __b)
54{
55 return __a+__b;
56}
57
58static __inline __m256d __DEFAULT_FN_ATTRS
59_mm256_sub_pd(__m256d __a, __m256d __b)
60{
61 return __a-__b;
62}
63
64static __inline __m256 __DEFAULT_FN_ATTRS
65_mm256_sub_ps(__m256 __a, __m256 __b)
66{
67 return __a-__b;
68}
69
70static __inline __m256d __DEFAULT_FN_ATTRS
71_mm256_addsub_pd(__m256d __a, __m256d __b)
72{
73 return (__m256d)__builtin_ia32_addsubpd256((__v4df)__a, (__v4df)__b);
74}
75
76static __inline __m256 __DEFAULT_FN_ATTRS
77_mm256_addsub_ps(__m256 __a, __m256 __b)
78{
79 return (__m256)__builtin_ia32_addsubps256((__v8sf)__a, (__v8sf)__b);
80}
81
82static __inline __m256d __DEFAULT_FN_ATTRS
83_mm256_div_pd(__m256d __a, __m256d __b)
84{
85 return __a / __b;
86}
87
88static __inline __m256 __DEFAULT_FN_ATTRS
89_mm256_div_ps(__m256 __a, __m256 __b)
90{
91 return __a / __b;
92}
93
94static __inline __m256d __DEFAULT_FN_ATTRS
95_mm256_max_pd(__m256d __a, __m256d __b)
96{
97 return (__m256d)__builtin_ia32_maxpd256((__v4df)__a, (__v4df)__b);
98}
99
100static __inline __m256 __DEFAULT_FN_ATTRS
101_mm256_max_ps(__m256 __a, __m256 __b)
102{
103 return (__m256)__builtin_ia32_maxps256((__v8sf)__a, (__v8sf)__b);
104}
105
106static __inline __m256d __DEFAULT_FN_ATTRS
107_mm256_min_pd(__m256d __a, __m256d __b)
108{
109 return (__m256d)__builtin_ia32_minpd256((__v4df)__a, (__v4df)__b);
110}
111
112static __inline __m256 __DEFAULT_FN_ATTRS
113_mm256_min_ps(__m256 __a, __m256 __b)
114{
115 return (__m256)__builtin_ia32_minps256((__v8sf)__a, (__v8sf)__b);
116}
117
118static __inline __m256d __DEFAULT_FN_ATTRS
119_mm256_mul_pd(__m256d __a, __m256d __b)
120{
121 return __a * __b;
122}
123
124static __inline __m256 __DEFAULT_FN_ATTRS
125_mm256_mul_ps(__m256 __a, __m256 __b)
126{
127 return __a * __b;
128}
129
130static __inline __m256d __DEFAULT_FN_ATTRS
131_mm256_sqrt_pd(__m256d __a)
132{
133 return (__m256d)__builtin_ia32_sqrtpd256((__v4df)__a);
134}
135
136static __inline __m256 __DEFAULT_FN_ATTRS
137_mm256_sqrt_ps(__m256 __a)
138{
139 return (__m256)__builtin_ia32_sqrtps256((__v8sf)__a);
140}
141
142static __inline __m256 __DEFAULT_FN_ATTRS
143_mm256_rsqrt_ps(__m256 __a)
144{
145 return (__m256)__builtin_ia32_rsqrtps256((__v8sf)__a);
146}
147
148static __inline __m256 __DEFAULT_FN_ATTRS
149_mm256_rcp_ps(__m256 __a)
150{
151 return (__m256)__builtin_ia32_rcpps256((__v8sf)__a);
152}
153
154#define _mm256_round_pd(V, M) __extension__ ({ \
155 __m256d __V = (V); \
156 (__m256d)__builtin_ia32_roundpd256((__v4df)__V, (M)); })
157
158#define _mm256_round_ps(V, M) __extension__ ({ \
159 __m256 __V = (V); \
160 (__m256)__builtin_ia32_roundps256((__v8sf)__V, (M)); })
161
162#define _mm256_ceil_pd(V) _mm256_round_pd((V), _MM_FROUND_CEIL)
163#define _mm256_floor_pd(V) _mm256_round_pd((V), _MM_FROUND_FLOOR)
164#define _mm256_ceil_ps(V) _mm256_round_ps((V), _MM_FROUND_CEIL)
165#define _mm256_floor_ps(V) _mm256_round_ps((V), _MM_FROUND_FLOOR)
166
167/* Logical */
168static __inline __m256d __DEFAULT_FN_ATTRS
169_mm256_and_pd(__m256d __a, __m256d __b)
170{
171 return (__m256d)((__v4di)__a & (__v4di)__b);
172}
173
174static __inline __m256 __DEFAULT_FN_ATTRS
175_mm256_and_ps(__m256 __a, __m256 __b)
176{
177 return (__m256)((__v8si)__a & (__v8si)__b);
178}
179
180static __inline __m256d __DEFAULT_FN_ATTRS
181_mm256_andnot_pd(__m256d __a, __m256d __b)
182{
183 return (__m256d)(~(__v4di)__a & (__v4di)__b);
184}
185
186static __inline __m256 __DEFAULT_FN_ATTRS
187_mm256_andnot_ps(__m256 __a, __m256 __b)
188{
189 return (__m256)(~(__v8si)__a & (__v8si)__b);
190}
191
192static __inline __m256d __DEFAULT_FN_ATTRS
193_mm256_or_pd(__m256d __a, __m256d __b)
194{
195 return (__m256d)((__v4di)__a | (__v4di)__b);
196}
197
198static __inline __m256 __DEFAULT_FN_ATTRS
199_mm256_or_ps(__m256 __a, __m256 __b)
200{
201 return (__m256)((__v8si)__a | (__v8si)__b);
202}
203
204static __inline __m256d __DEFAULT_FN_ATTRS
205_mm256_xor_pd(__m256d __a, __m256d __b)
206{
207 return (__m256d)((__v4di)__a ^ (__v4di)__b);
208}
209
210static __inline __m256 __DEFAULT_FN_ATTRS
211_mm256_xor_ps(__m256 __a, __m256 __b)
212{
213 return (__m256)((__v8si)__a ^ (__v8si)__b);
214}
215
216/* Horizontal arithmetic */
217static __inline __m256d __DEFAULT_FN_ATTRS
218_mm256_hadd_pd(__m256d __a, __m256d __b)
219{
220 return (__m256d)__builtin_ia32_haddpd256((__v4df)__a, (__v4df)__b);
221}
222
223static __inline __m256 __DEFAULT_FN_ATTRS
224_mm256_hadd_ps(__m256 __a, __m256 __b)
225{
226 return (__m256)__builtin_ia32_haddps256((__v8sf)__a, (__v8sf)__b);
227}
228
229static __inline __m256d __DEFAULT_FN_ATTRS
230_mm256_hsub_pd(__m256d __a, __m256d __b)
231{
232 return (__m256d)__builtin_ia32_hsubpd256((__v4df)__a, (__v4df)__b);
233}
234
235static __inline __m256 __DEFAULT_FN_ATTRS
236_mm256_hsub_ps(__m256 __a, __m256 __b)
237{
238 return (__m256)__builtin_ia32_hsubps256((__v8sf)__a, (__v8sf)__b);
239}
240
241/* Vector permutations */
242static __inline __m128d __DEFAULT_FN_ATTRS
243_mm_permutevar_pd(__m128d __a, __m128i __c)
244{
245 return (__m128d)__builtin_ia32_vpermilvarpd((__v2df)__a, (__v2di)__c);
246}
247
248static __inline __m256d __DEFAULT_FN_ATTRS
249_mm256_permutevar_pd(__m256d __a, __m256i __c)
250{
251 return (__m256d)__builtin_ia32_vpermilvarpd256((__v4df)__a, (__v4di)__c);
252}
253
254static __inline __m128 __DEFAULT_FN_ATTRS
255_mm_permutevar_ps(__m128 __a, __m128i __c)
256{
257 return (__m128)__builtin_ia32_vpermilvarps((__v4sf)__a, (__v4si)__c);
258}
259
260static __inline __m256 __DEFAULT_FN_ATTRS
261_mm256_permutevar_ps(__m256 __a, __m256i __c)
262{
263 return (__m256)__builtin_ia32_vpermilvarps256((__v8sf)__a, (__v8si)__c);
264}
265
266#define _mm_permute_pd(A, C) __extension__ ({ \
267 __m128d __A = (A); \
268 (__m128d)__builtin_shufflevector((__v2df)__A, (__v2df) _mm_setzero_pd(), \
269 (C) & 0x1, ((C) & 0x2) >> 1); })
270
271#define _mm256_permute_pd(A, C) __extension__ ({ \
272 __m256d __A = (A); \
273 (__m256d)__builtin_shufflevector((__v4df)__A, (__v4df) _mm256_setzero_pd(), \
274 (C) & 0x1, ((C) & 0x2) >> 1, \
275 2 + (((C) & 0x4) >> 2), \
276 2 + (((C) & 0x8) >> 3)); })
277
278#define _mm_permute_ps(A, C) __extension__ ({ \
279 __m128 __A = (A); \
280 (__m128)__builtin_shufflevector((__v4sf)__A, (__v4sf) _mm_setzero_ps(), \
281 (C) & 0x3, ((C) & 0xc) >> 2, \
282 ((C) & 0x30) >> 4, ((C) & 0xc0) >> 6); })
283
284#define _mm256_permute_ps(A, C) __extension__ ({ \
285 __m256 __A = (A); \
286 (__m256)__builtin_shufflevector((__v8sf)__A, (__v8sf) _mm256_setzero_ps(), \
287 (C) & 0x3, ((C) & 0xc) >> 2, \
288 ((C) & 0x30) >> 4, ((C) & 0xc0) >> 6, \
289 4 + (((C) & 0x03) >> 0), \
290 4 + (((C) & 0x0c) >> 2), \
291 4 + (((C) & 0x30) >> 4), \
292 4 + (((C) & 0xc0) >> 6)); })
293
294#define _mm256_permute2f128_pd(V1, V2, M) __extension__ ({ \
295 __m256d __V1 = (V1); \
296 __m256d __V2 = (V2); \
297 (__m256d)__builtin_ia32_vperm2f128_pd256((__v4df)__V1, (__v4df)__V2, (M)); })
298
299#define _mm256_permute2f128_ps(V1, V2, M) __extension__ ({ \
300 __m256 __V1 = (V1); \
301 __m256 __V2 = (V2); \
302 (__m256)__builtin_ia32_vperm2f128_ps256((__v8sf)__V1, (__v8sf)__V2, (M)); })
303
304#define _mm256_permute2f128_si256(V1, V2, M) __extension__ ({ \
305 __m256i __V1 = (V1); \
306 __m256i __V2 = (V2); \
307 (__m256i)__builtin_ia32_vperm2f128_si256((__v8si)__V1, (__v8si)__V2, (M)); })
308
309/* Vector Blend */
310#define _mm256_blend_pd(V1, V2, M) __extension__ ({ \
311 __m256d __V1 = (V1); \
312 __m256d __V2 = (V2); \
313 (__m256d)__builtin_shufflevector((__v4df)__V1, (__v4df)__V2, \
314 (((M) & 0x01) ? 4 : 0), \
315 (((M) & 0x02) ? 5 : 1), \
316 (((M) & 0x04) ? 6 : 2), \
317 (((M) & 0x08) ? 7 : 3)); })
318
319#define _mm256_blend_ps(V1, V2, M) __extension__ ({ \
320 __m256 __V1 = (V1); \
321 __m256 __V2 = (V2); \
322 (__m256)__builtin_shufflevector((__v8sf)__V1, (__v8sf)__V2, \
323 (((M) & 0x01) ? 8 : 0), \
324 (((M) & 0x02) ? 9 : 1), \
325 (((M) & 0x04) ? 10 : 2), \
326 (((M) & 0x08) ? 11 : 3), \
327 (((M) & 0x10) ? 12 : 4), \
328 (((M) & 0x20) ? 13 : 5), \
329 (((M) & 0x40) ? 14 : 6), \
330 (((M) & 0x80) ? 15 : 7)); })
331
332static __inline __m256d __DEFAULT_FN_ATTRS
333_mm256_blendv_pd(__m256d __a, __m256d __b, __m256d __c)
334{
335 return (__m256d)__builtin_ia32_blendvpd256(
336 (__v4df)__a, (__v4df)__b, (__v4df)__c);
337}
338
339static __inline __m256 __DEFAULT_FN_ATTRS
340_mm256_blendv_ps(__m256 __a, __m256 __b, __m256 __c)
341{
342 return (__m256)__builtin_ia32_blendvps256(
343 (__v8sf)__a, (__v8sf)__b, (__v8sf)__c);
344}
345
346/* Vector Dot Product */
347#define _mm256_dp_ps(V1, V2, M) __extension__ ({ \
348 __m256 __V1 = (V1); \
349 __m256 __V2 = (V2); \
350 (__m256)__builtin_ia32_dpps256((__v8sf)__V1, (__v8sf)__V2, (M)); })
351
352/* Vector shuffle */
353#define _mm256_shuffle_ps(a, b, mask) __extension__ ({ \
354 __m256 __a = (a); \
355 __m256 __b = (b); \
356 (__m256)__builtin_shufflevector((__v8sf)__a, (__v8sf)__b, \
357 (mask) & 0x3, ((mask) & 0xc) >> 2, \
358 (((mask) & 0x30) >> 4) + 8, (((mask) & 0xc0) >> 6) + 8, \
359 ((mask) & 0x3) + 4, (((mask) & 0xc) >> 2) + 4, \
360 (((mask) & 0x30) >> 4) + 12, (((mask) & 0xc0) >> 6) + 12); })
361
362#define _mm256_shuffle_pd(a, b, mask) __extension__ ({ \
363 __m256d __a = (a); \
364 __m256d __b = (b); \
365 (__m256d)__builtin_shufflevector((__v4df)__a, (__v4df)__b, \
366 (mask) & 0x1, \
367 (((mask) & 0x2) >> 1) + 4, \
368 (((mask) & 0x4) >> 2) + 2, \
369 (((mask) & 0x8) >> 3) + 6); })
370
371/* Compare */
372#define _CMP_EQ_OQ 0x00 /* Equal (ordered, non-signaling) */
373#define _CMP_LT_OS 0x01 /* Less-than (ordered, signaling) */
374#define _CMP_LE_OS 0x02 /* Less-than-or-equal (ordered, signaling) */
375#define _CMP_UNORD_Q 0x03 /* Unordered (non-signaling) */
376#define _CMP_NEQ_UQ 0x04 /* Not-equal (unordered, non-signaling) */
377#define _CMP_NLT_US 0x05 /* Not-less-than (unordered, signaling) */
378#define _CMP_NLE_US 0x06 /* Not-less-than-or-equal (unordered, signaling) */
379#define _CMP_ORD_Q 0x07 /* Ordered (nonsignaling) */
380#define _CMP_EQ_UQ 0x08 /* Equal (unordered, non-signaling) */
381#define _CMP_NGE_US 0x09 /* Not-greater-than-or-equal (unord, signaling) */
382#define _CMP_NGT_US 0x0a /* Not-greater-than (unordered, signaling) */
383#define _CMP_FALSE_OQ 0x0b /* False (ordered, non-signaling) */
384#define _CMP_NEQ_OQ 0x0c /* Not-equal (ordered, non-signaling) */
385#define _CMP_GE_OS 0x0d /* Greater-than-or-equal (ordered, signaling) */
386#define _CMP_GT_OS 0x0e /* Greater-than (ordered, signaling) */
387#define _CMP_TRUE_UQ 0x0f /* True (unordered, non-signaling) */
388#define _CMP_EQ_OS 0x10 /* Equal (ordered, signaling) */
389#define _CMP_LT_OQ 0x11 /* Less-than (ordered, non-signaling) */
390#define _CMP_LE_OQ 0x12 /* Less-than-or-equal (ordered, non-signaling) */
391#define _CMP_UNORD_S 0x13 /* Unordered (signaling) */
392#define _CMP_NEQ_US 0x14 /* Not-equal (unordered, signaling) */
393#define _CMP_NLT_UQ 0x15 /* Not-less-than (unordered, non-signaling) */
394#define _CMP_NLE_UQ 0x16 /* Not-less-than-or-equal (unord, non-signaling) */
395#define _CMP_ORD_S 0x17 /* Ordered (signaling) */
396#define _CMP_EQ_US 0x18 /* Equal (unordered, signaling) */
397#define _CMP_NGE_UQ 0x19 /* Not-greater-than-or-equal (unord, non-sign) */
398#define _CMP_NGT_UQ 0x1a /* Not-greater-than (unordered, non-signaling) */
399#define _CMP_FALSE_OS 0x1b /* False (ordered, signaling) */
400#define _CMP_NEQ_OS 0x1c /* Not-equal (ordered, signaling) */
401#define _CMP_GE_OQ 0x1d /* Greater-than-or-equal (ordered, non-signaling) */
402#define _CMP_GT_OQ 0x1e /* Greater-than (ordered, non-signaling) */
403#define _CMP_TRUE_US 0x1f /* True (unordered, signaling) */
404
405#define _mm_cmp_pd(a, b, c) __extension__ ({ \
406 __m128d __a = (a); \
407 __m128d __b = (b); \
408 (__m128d)__builtin_ia32_cmppd((__v2df)__a, (__v2df)__b, (c)); })
409
410#define _mm_cmp_ps(a, b, c) __extension__ ({ \
411 __m128 __a = (a); \
412 __m128 __b = (b); \
413 (__m128)__builtin_ia32_cmpps((__v4sf)__a, (__v4sf)__b, (c)); })
414
415#define _mm256_cmp_pd(a, b, c) __extension__ ({ \
416 __m256d __a = (a); \
417 __m256d __b = (b); \
418 (__m256d)__builtin_ia32_cmppd256((__v4df)__a, (__v4df)__b, (c)); })
419
420#define _mm256_cmp_ps(a, b, c) __extension__ ({ \
421 __m256 __a = (a); \
422 __m256 __b = (b); \
423 (__m256)__builtin_ia32_cmpps256((__v8sf)__a, (__v8sf)__b, (c)); })
424
425#define _mm_cmp_sd(a, b, c) __extension__ ({ \
426 __m128d __a = (a); \
427 __m128d __b = (b); \
428 (__m128d)__builtin_ia32_cmpsd((__v2df)__a, (__v2df)__b, (c)); })
429
430#define _mm_cmp_ss(a, b, c) __extension__ ({ \
431 __m128 __a = (a); \
432 __m128 __b = (b); \
433 (__m128)__builtin_ia32_cmpss((__v4sf)__a, (__v4sf)__b, (c)); })
434
435static __inline int __DEFAULT_FN_ATTRS
436_mm256_extract_epi32(__m256i __a, const int __imm)
437{
438 __v8si __b = (__v8si)__a;
439 return __b[__imm & 7];
440}
441
442static __inline int __DEFAULT_FN_ATTRS
443_mm256_extract_epi16(__m256i __a, const int __imm)
444{
445 __v16hi __b = (__v16hi)__a;
446 return __b[__imm & 15];
447}
448
449static __inline int __DEFAULT_FN_ATTRS
450_mm256_extract_epi8(__m256i __a, const int __imm)
451{
452 __v32qi __b = (__v32qi)__a;
453 return __b[__imm & 31];
454}
455
456#ifdef __x86_64__
457static __inline long long __DEFAULT_FN_ATTRS
458_mm256_extract_epi64(__m256i __a, const int __imm)
459{
460 __v4di __b = (__v4di)__a;
461 return __b[__imm & 3];
462}
463#endif
464
465static __inline __m256i __DEFAULT_FN_ATTRS
466_mm256_insert_epi32(__m256i __a, int __b, int const __imm)
467{
468 __v8si __c = (__v8si)__a;
469 __c[__imm & 7] = __b;
470 return (__m256i)__c;
471}
472
473static __inline __m256i __DEFAULT_FN_ATTRS
474_mm256_insert_epi16(__m256i __a, int __b, int const __imm)
475{
476 __v16hi __c = (__v16hi)__a;
477 __c[__imm & 15] = __b;
478 return (__m256i)__c;
479}
480
481static __inline __m256i __DEFAULT_FN_ATTRS
482_mm256_insert_epi8(__m256i __a, int __b, int const __imm)
483{
484 __v32qi __c = (__v32qi)__a;
485 __c[__imm & 31] = __b;
486 return (__m256i)__c;
487}
488
489#ifdef __x86_64__
490static __inline __m256i __DEFAULT_FN_ATTRS
491_mm256_insert_epi64(__m256i __a, long long __b, int const __imm)
492{
493 __v4di __c = (__v4di)__a;
494 __c[__imm & 3] = __b;
495 return (__m256i)__c;
496}
497#endif
498
499/* Conversion */
500static __inline __m256d __DEFAULT_FN_ATTRS
501_mm256_cvtepi32_pd(__m128i __a)
502{
503 return (__m256d)__builtin_ia32_cvtdq2pd256((__v4si) __a);
504}
505
506static __inline __m256 __DEFAULT_FN_ATTRS
507_mm256_cvtepi32_ps(__m256i __a)
508{
509 return (__m256)__builtin_ia32_cvtdq2ps256((__v8si) __a);
510}
511
512static __inline __m128 __DEFAULT_FN_ATTRS
513_mm256_cvtpd_ps(__m256d __a)
514{
515 return (__m128)__builtin_ia32_cvtpd2ps256((__v4df) __a);
516}
517
518static __inline __m256i __DEFAULT_FN_ATTRS
519_mm256_cvtps_epi32(__m256 __a)
520{
521 return (__m256i)__builtin_ia32_cvtps2dq256((__v8sf) __a);
522}
523
524static __inline __m256d __DEFAULT_FN_ATTRS
525_mm256_cvtps_pd(__m128 __a)
526{
527 return (__m256d)__builtin_ia32_cvtps2pd256((__v4sf) __a);
528}
529
530static __inline __m128i __DEFAULT_FN_ATTRS
531_mm256_cvttpd_epi32(__m256d __a)
532{
533 return (__m128i)__builtin_ia32_cvttpd2dq256((__v4df) __a);
534}
535
536static __inline __m128i __DEFAULT_FN_ATTRS
537_mm256_cvtpd_epi32(__m256d __a)
538{
539 return (__m128i)__builtin_ia32_cvtpd2dq256((__v4df) __a);
540}
541
542static __inline __m256i __DEFAULT_FN_ATTRS
543_mm256_cvttps_epi32(__m256 __a)
544{
545 return (__m256i)__builtin_ia32_cvttps2dq256((__v8sf) __a);
546}
547
548/* Vector replicate */
549static __inline __m256 __DEFAULT_FN_ATTRS
550_mm256_movehdup_ps(__m256 __a)
551{
552 return __builtin_shufflevector(__a, __a, 1, 1, 3, 3, 5, 5, 7, 7);
553}
554
555static __inline __m256 __DEFAULT_FN_ATTRS
556_mm256_moveldup_ps(__m256 __a)
557{
558 return __builtin_shufflevector(__a, __a, 0, 0, 2, 2, 4, 4, 6, 6);
559}
560
561static __inline __m256d __DEFAULT_FN_ATTRS
562_mm256_movedup_pd(__m256d __a)
563{
564 return __builtin_shufflevector(__a, __a, 0, 0, 2, 2);
565}
566
567/* Unpack and Interleave */
568static __inline __m256d __DEFAULT_FN_ATTRS
569_mm256_unpackhi_pd(__m256d __a, __m256d __b)
570{
571 return __builtin_shufflevector(__a, __b, 1, 5, 1+2, 5+2);
572}
573
574static __inline __m256d __DEFAULT_FN_ATTRS
575_mm256_unpacklo_pd(__m256d __a, __m256d __b)
576{
577 return __builtin_shufflevector(__a, __b, 0, 4, 0+2, 4+2);
578}
579
580static __inline __m256 __DEFAULT_FN_ATTRS
581_mm256_unpackhi_ps(__m256 __a, __m256 __b)
582{
583 return __builtin_shufflevector(__a, __b, 2, 10, 2+1, 10+1, 6, 14, 6+1, 14+1);
584}
585
586static __inline __m256 __DEFAULT_FN_ATTRS
587_mm256_unpacklo_ps(__m256 __a, __m256 __b)
588{
589 return __builtin_shufflevector(__a, __b, 0, 8, 0+1, 8+1, 4, 12, 4+1, 12+1);
590}
591
592/* Bit Test */
593static __inline int __DEFAULT_FN_ATTRS
594_mm_testz_pd(__m128d __a, __m128d __b)
595{
596 return __builtin_ia32_vtestzpd((__v2df)__a, (__v2df)__b);
597}
598
599static __inline int __DEFAULT_FN_ATTRS
600_mm_testc_pd(__m128d __a, __m128d __b)
601{
602 return __builtin_ia32_vtestcpd((__v2df)__a, (__v2df)__b);
603}
604
605static __inline int __DEFAULT_FN_ATTRS
606_mm_testnzc_pd(__m128d __a, __m128d __b)
607{
608 return __builtin_ia32_vtestnzcpd((__v2df)__a, (__v2df)__b);
609}
610
611static __inline int __DEFAULT_FN_ATTRS
612_mm_testz_ps(__m128 __a, __m128 __b)
613{
614 return __builtin_ia32_vtestzps((__v4sf)__a, (__v4sf)__b);
615}
616
617static __inline int __DEFAULT_FN_ATTRS
618_mm_testc_ps(__m128 __a, __m128 __b)
619{
620 return __builtin_ia32_vtestcps((__v4sf)__a, (__v4sf)__b);
621}
622
623static __inline int __DEFAULT_FN_ATTRS
624_mm_testnzc_ps(__m128 __a, __m128 __b)
625{
626 return __builtin_ia32_vtestnzcps((__v4sf)__a, (__v4sf)__b);
627}
628
629static __inline int __DEFAULT_FN_ATTRS
630_mm256_testz_pd(__m256d __a, __m256d __b)
631{
632 return __builtin_ia32_vtestzpd256((__v4df)__a, (__v4df)__b);
633}
634
635static __inline int __DEFAULT_FN_ATTRS
636_mm256_testc_pd(__m256d __a, __m256d __b)
637{
638 return __builtin_ia32_vtestcpd256((__v4df)__a, (__v4df)__b);
639}
640
641static __inline int __DEFAULT_FN_ATTRS
642_mm256_testnzc_pd(__m256d __a, __m256d __b)
643{
644 return __builtin_ia32_vtestnzcpd256((__v4df)__a, (__v4df)__b);
645}
646
647static __inline int __DEFAULT_FN_ATTRS
648_mm256_testz_ps(__m256 __a, __m256 __b)
649{
650 return __builtin_ia32_vtestzps256((__v8sf)__a, (__v8sf)__b);
651}
652
653static __inline int __DEFAULT_FN_ATTRS
654_mm256_testc_ps(__m256 __a, __m256 __b)
655{
656 return __builtin_ia32_vtestcps256((__v8sf)__a, (__v8sf)__b);
657}
658
659static __inline int __DEFAULT_FN_ATTRS
660_mm256_testnzc_ps(__m256 __a, __m256 __b)
661{
662 return __builtin_ia32_vtestnzcps256((__v8sf)__a, (__v8sf)__b);
663}
664
665static __inline int __DEFAULT_FN_ATTRS
666_mm256_testz_si256(__m256i __a, __m256i __b)
667{
668 return __builtin_ia32_ptestz256((__v4di)__a, (__v4di)__b);
669}
670
671static __inline int __DEFAULT_FN_ATTRS
672_mm256_testc_si256(__m256i __a, __m256i __b)
673{
674 return __builtin_ia32_ptestc256((__v4di)__a, (__v4di)__b);
675}
676
677static __inline int __DEFAULT_FN_ATTRS
678_mm256_testnzc_si256(__m256i __a, __m256i __b)
679{
680 return __builtin_ia32_ptestnzc256((__v4di)__a, (__v4di)__b);
681}
682
683/* Vector extract sign mask */
684static __inline int __DEFAULT_FN_ATTRS
685_mm256_movemask_pd(__m256d __a)
686{
687 return __builtin_ia32_movmskpd256((__v4df)__a);
688}
689
690static __inline int __DEFAULT_FN_ATTRS
691_mm256_movemask_ps(__m256 __a)
692{
693 return __builtin_ia32_movmskps256((__v8sf)__a);
694}
695
696/* Vector __zero */
697static __inline void __DEFAULT_FN_ATTRS
698_mm256_zeroall(void)
699{
700 __builtin_ia32_vzeroall();
701}
702
703static __inline void __DEFAULT_FN_ATTRS
704_mm256_zeroupper(void)
705{
706 __builtin_ia32_vzeroupper();
707}
708
709/* Vector load with broadcast */
710static __inline __m128 __DEFAULT_FN_ATTRS
711_mm_broadcast_ss(float const *__a)
712{
713 float __f = *__a;
714 return (__m128)(__v4sf){ __f, __f, __f, __f };
715}
716
717static __inline __m256d __DEFAULT_FN_ATTRS
718_mm256_broadcast_sd(double const *__a)
719{
720 double __d = *__a;
721 return (__m256d)(__v4df){ __d, __d, __d, __d };
722}
723
724static __inline __m256 __DEFAULT_FN_ATTRS
725_mm256_broadcast_ss(float const *__a)
726{
727 float __f = *__a;
728 return (__m256)(__v8sf){ __f, __f, __f, __f, __f, __f, __f, __f };
729}
730
731static __inline __m256d __DEFAULT_FN_ATTRS
732_mm256_broadcast_pd(__m128d const *__a)
733{
734 return (__m256d)__builtin_ia32_vbroadcastf128_pd256(__a);
735}
736
737static __inline __m256 __DEFAULT_FN_ATTRS
738_mm256_broadcast_ps(__m128 const *__a)
739{
740 return (__m256)__builtin_ia32_vbroadcastf128_ps256(__a);
741}
742
743/* SIMD load ops */
744static __inline __m256d __DEFAULT_FN_ATTRS
745_mm256_load_pd(double const *__p)
746{
747 return *(__m256d *)__p;
748}
749
750static __inline __m256 __DEFAULT_FN_ATTRS
751_mm256_load_ps(float const *__p)
752{
753 return *(__m256 *)__p;
754}
755
756static __inline __m256d __DEFAULT_FN_ATTRS
757_mm256_loadu_pd(double const *__p)
758{
759 struct __loadu_pd {
760 __m256d __v;
761 } __attribute__((__packed__, __may_alias__));
762 return ((struct __loadu_pd*)__p)->__v;
763}
764
765static __inline __m256 __DEFAULT_FN_ATTRS
766_mm256_loadu_ps(float const *__p)
767{
768 struct __loadu_ps {
769 __m256 __v;
770 } __attribute__((__packed__, __may_alias__));
771 return ((struct __loadu_ps*)__p)->__v;
772}
773
774static __inline __m256i __DEFAULT_FN_ATTRS
775_mm256_load_si256(__m256i const *__p)
776{
777 return *__p;
778}
779
780static __inline __m256i __DEFAULT_FN_ATTRS
781_mm256_loadu_si256(__m256i const *__p)
782{
783 struct __loadu_si256 {
784 __m256i __v;
785 } __attribute__((__packed__, __may_alias__));
786 return ((struct __loadu_si256*)__p)->__v;
787}
788
789static __inline __m256i __DEFAULT_FN_ATTRS
790_mm256_lddqu_si256(__m256i const *__p)
791{
792 return (__m256i)__builtin_ia32_lddqu256((char const *)__p);
793}
794
795/* SIMD store ops */
796static __inline void __DEFAULT_FN_ATTRS
797_mm256_store_pd(double *__p, __m256d __a)
798{
799 *(__m256d *)__p = __a;
800}
801
802static __inline void __DEFAULT_FN_ATTRS
803_mm256_store_ps(float *__p, __m256 __a)
804{
805 *(__m256 *)__p = __a;
806}
807
808static __inline void __DEFAULT_FN_ATTRS
809_mm256_storeu_pd(double *__p, __m256d __a)
810{
811 __builtin_ia32_storeupd256(__p, (__v4df)__a);
812}
813
814static __inline void __DEFAULT_FN_ATTRS
815_mm256_storeu_ps(float *__p, __m256 __a)
816{
817 __builtin_ia32_storeups256(__p, (__v8sf)__a);
818}
819
820static __inline void __DEFAULT_FN_ATTRS
821_mm256_store_si256(__m256i *__p, __m256i __a)
822{
823 *__p = __a;
824}
825
826static __inline void __DEFAULT_FN_ATTRS
827_mm256_storeu_si256(__m256i *__p, __m256i __a)
828{
829 __builtin_ia32_storedqu256((char *)__p, (__v32qi)__a);
830}
831
832/* Conditional load ops */
833static __inline __m128d __DEFAULT_FN_ATTRS
834_mm_maskload_pd(double const *__p, __m128d __m)
835{
836 return (__m128d)__builtin_ia32_maskloadpd((const __v2df *)__p, (__v2df)__m);
837}
838
839static __inline __m256d __DEFAULT_FN_ATTRS
840_mm256_maskload_pd(double const *__p, __m256d __m)
841{
842 return (__m256d)__builtin_ia32_maskloadpd256((const __v4df *)__p,
843 (__v4df)__m);
844}
845
846static __inline __m128 __DEFAULT_FN_ATTRS
847_mm_maskload_ps(float const *__p, __m128 __m)
848{
849 return (__m128)__builtin_ia32_maskloadps((const __v4sf *)__p, (__v4sf)__m);
850}
851
852static __inline __m256 __DEFAULT_FN_ATTRS
853_mm256_maskload_ps(float const *__p, __m256 __m)
854{
855 return (__m256)__builtin_ia32_maskloadps256((const __v8sf *)__p, (__v8sf)__m);
856}
857
858/* Conditional store ops */
859static __inline void __DEFAULT_FN_ATTRS
860_mm256_maskstore_ps(float *__p, __m256 __m, __m256 __a)
861{
862 __builtin_ia32_maskstoreps256((__v8sf *)__p, (__v8sf)__m, (__v8sf)__a);
863}
864
865static __inline void __DEFAULT_FN_ATTRS
866_mm_maskstore_pd(double *__p, __m128d __m, __m128d __a)
867{
868 __builtin_ia32_maskstorepd((__v2df *)__p, (__v2df)__m, (__v2df)__a);
869}
870
871static __inline void __DEFAULT_FN_ATTRS
872_mm256_maskstore_pd(double *__p, __m256d __m, __m256d __a)
873{
874 __builtin_ia32_maskstorepd256((__v4df *)__p, (__v4df)__m, (__v4df)__a);
875}
876
877static __inline void __DEFAULT_FN_ATTRS
878_mm_maskstore_ps(float *__p, __m128 __m, __m128 __a)
879{
880 __builtin_ia32_maskstoreps((__v4sf *)__p, (__v4sf)__m, (__v4sf)__a);
881}
882
883/* Cacheability support ops */
884static __inline void __DEFAULT_FN_ATTRS
885_mm256_stream_si256(__m256i *__a, __m256i __b)
886{
887 __builtin_ia32_movntdq256((__v4di *)__a, (__v4di)__b);
888}
889
890static __inline void __DEFAULT_FN_ATTRS
891_mm256_stream_pd(double *__a, __m256d __b)
892{
893 __builtin_ia32_movntpd256(__a, (__v4df)__b);
894}
895
896static __inline void __DEFAULT_FN_ATTRS
897_mm256_stream_ps(float *__p, __m256 __a)
898{
899 __builtin_ia32_movntps256(__p, (__v8sf)__a);
900}
901
902/* Create vectors */
903static __inline __m256d __DEFAULT_FN_ATTRS
904_mm256_set_pd(double __a, double __b, double __c, double __d)
905{
906 return (__m256d){ __d, __c, __b, __a };
907}
908
909static __inline __m256 __DEFAULT_FN_ATTRS
910_mm256_set_ps(float __a, float __b, float __c, float __d,
911 float __e, float __f, float __g, float __h)
912{
913 return (__m256){ __h, __g, __f, __e, __d, __c, __b, __a };
914}
915
916static __inline __m256i __DEFAULT_FN_ATTRS
917_mm256_set_epi32(int __i0, int __i1, int __i2, int __i3,
918 int __i4, int __i5, int __i6, int __i7)
919{
920 return (__m256i)(__v8si){ __i7, __i6, __i5, __i4, __i3, __i2, __i1, __i0 };
921}
922
923static __inline __m256i __DEFAULT_FN_ATTRS
924_mm256_set_epi16(short __w15, short __w14, short __w13, short __w12,
925 short __w11, short __w10, short __w09, short __w08,
926 short __w07, short __w06, short __w05, short __w04,
927 short __w03, short __w02, short __w01, short __w00)
928{
929 return (__m256i)(__v16hi){ __w00, __w01, __w02, __w03, __w04, __w05, __w06,
930 __w07, __w08, __w09, __w10, __w11, __w12, __w13, __w14, __w15 };
931}
932
933static __inline __m256i __DEFAULT_FN_ATTRS
934_mm256_set_epi8(char __b31, char __b30, char __b29, char __b28,
935 char __b27, char __b26, char __b25, char __b24,
936 char __b23, char __b22, char __b21, char __b20,
937 char __b19, char __b18, char __b17, char __b16,
938 char __b15, char __b14, char __b13, char __b12,
939 char __b11, char __b10, char __b09, char __b08,
940 char __b07, char __b06, char __b05, char __b04,
941 char __b03, char __b02, char __b01, char __b00)
942{
943 return (__m256i)(__v32qi){
944 __b00, __b01, __b02, __b03, __b04, __b05, __b06, __b07,
945 __b08, __b09, __b10, __b11, __b12, __b13, __b14, __b15,
946 __b16, __b17, __b18, __b19, __b20, __b21, __b22, __b23,
947 __b24, __b25, __b26, __b27, __b28, __b29, __b30, __b31
948 };
949}
950
951static __inline __m256i __DEFAULT_FN_ATTRS
952_mm256_set_epi64x(long long __a, long long __b, long long __c, long long __d)
953{
954 return (__m256i)(__v4di){ __d, __c, __b, __a };
955}
956
957/* Create vectors with elements in reverse order */
958static __inline __m256d __DEFAULT_FN_ATTRS
959_mm256_setr_pd(double __a, double __b, double __c, double __d)
960{
961 return (__m256d){ __a, __b, __c, __d };
962}
963
964static __inline __m256 __DEFAULT_FN_ATTRS
965_mm256_setr_ps(float __a, float __b, float __c, float __d,
966 float __e, float __f, float __g, float __h)
967{
968 return (__m256){ __a, __b, __c, __d, __e, __f, __g, __h };
969}
970
971static __inline __m256i __DEFAULT_FN_ATTRS
972_mm256_setr_epi32(int __i0, int __i1, int __i2, int __i3,
973 int __i4, int __i5, int __i6, int __i7)
974{
975 return (__m256i)(__v8si){ __i0, __i1, __i2, __i3, __i4, __i5, __i6, __i7 };
976}
977
978static __inline __m256i __DEFAULT_FN_ATTRS
979_mm256_setr_epi16(short __w15, short __w14, short __w13, short __w12,
980 short __w11, short __w10, short __w09, short __w08,
981 short __w07, short __w06, short __w05, short __w04,
982 short __w03, short __w02, short __w01, short __w00)
983{
984 return (__m256i)(__v16hi){ __w15, __w14, __w13, __w12, __w11, __w10, __w09,
985 __w08, __w07, __w06, __w05, __w04, __w03, __w02, __w01, __w00 };
986}
987
988static __inline __m256i __DEFAULT_FN_ATTRS
989_mm256_setr_epi8(char __b31, char __b30, char __b29, char __b28,
990 char __b27, char __b26, char __b25, char __b24,
991 char __b23, char __b22, char __b21, char __b20,
992 char __b19, char __b18, char __b17, char __b16,
993 char __b15, char __b14, char __b13, char __b12,
994 char __b11, char __b10, char __b09, char __b08,
995 char __b07, char __b06, char __b05, char __b04,
996 char __b03, char __b02, char __b01, char __b00)
997{
998 return (__m256i)(__v32qi){
999 __b31, __b30, __b29, __b28, __b27, __b26, __b25, __b24,
1000 __b23, __b22, __b21, __b20, __b19, __b18, __b17, __b16,
1001 __b15, __b14, __b13, __b12, __b11, __b10, __b09, __b08,
1002 __b07, __b06, __b05, __b04, __b03, __b02, __b01, __b00 };
1003}
1004
1005static __inline __m256i __DEFAULT_FN_ATTRS
1006_mm256_setr_epi64x(long long __a, long long __b, long long __c, long long __d)
1007{
1008 return (__m256i)(__v4di){ __a, __b, __c, __d };
1009}
1010
1011/* Create vectors with repeated elements */
1012static __inline __m256d __DEFAULT_FN_ATTRS
1013_mm256_set1_pd(double __w)
1014{
1015 return (__m256d){ __w, __w, __w, __w };
1016}
1017
1018static __inline __m256 __DEFAULT_FN_ATTRS
1019_mm256_set1_ps(float __w)
1020{
1021 return (__m256){ __w, __w, __w, __w, __w, __w, __w, __w };
1022}
1023
1024static __inline __m256i __DEFAULT_FN_ATTRS
1025_mm256_set1_epi32(int __i)
1026{
1027 return (__m256i)(__v8si){ __i, __i, __i, __i, __i, __i, __i, __i };
1028}
1029
1030static __inline __m256i __DEFAULT_FN_ATTRS
1031_mm256_set1_epi16(short __w)
1032{
1033 return (__m256i)(__v16hi){ __w, __w, __w, __w, __w, __w, __w, __w, __w, __w,
1034 __w, __w, __w, __w, __w, __w };
1035}
1036
1037static __inline __m256i __DEFAULT_FN_ATTRS
1038_mm256_set1_epi8(char __b)
1039{
1040 return (__m256i)(__v32qi){ __b, __b, __b, __b, __b, __b, __b, __b, __b, __b,
1041 __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b,
1042 __b, __b, __b, __b, __b, __b, __b };
1043}
1044
1045static __inline __m256i __DEFAULT_FN_ATTRS
1046_mm256_set1_epi64x(long long __q)
1047{
1048 return (__m256i)(__v4di){ __q, __q, __q, __q };
1049}
1050
1051/* Create __zeroed vectors */
1052static __inline __m256d __DEFAULT_FN_ATTRS
1053_mm256_setzero_pd(void)
1054{
1055 return (__m256d){ 0, 0, 0, 0 };
1056}
1057
1058static __inline __m256 __DEFAULT_FN_ATTRS
1059_mm256_setzero_ps(void)
1060{
1061 return (__m256){ 0, 0, 0, 0, 0, 0, 0, 0 };
1062}
1063
1064static __inline __m256i __DEFAULT_FN_ATTRS
1065_mm256_setzero_si256(void)
1066{
1067 return (__m256i){ 0LL, 0LL, 0LL, 0LL };
1068}
1069
1070/* Cast between vector types */
1071static __inline __m256 __DEFAULT_FN_ATTRS
1072_mm256_castpd_ps(__m256d __a)
1073{
1074 return (__m256)__a;
1075}
1076
1077static __inline __m256i __DEFAULT_FN_ATTRS
1078_mm256_castpd_si256(__m256d __a)
1079{
1080 return (__m256i)__a;
1081}
1082
1083static __inline __m256d __DEFAULT_FN_ATTRS
1084_mm256_castps_pd(__m256 __a)
1085{
1086 return (__m256d)__a;
1087}
1088
1089static __inline __m256i __DEFAULT_FN_ATTRS
1090_mm256_castps_si256(__m256 __a)
1091{
1092 return (__m256i)__a;
1093}
1094
1095static __inline __m256 __DEFAULT_FN_ATTRS
1096_mm256_castsi256_ps(__m256i __a)
1097{
1098 return (__m256)__a;
1099}
1100
1101static __inline __m256d __DEFAULT_FN_ATTRS
1102_mm256_castsi256_pd(__m256i __a)
1103{
1104 return (__m256d)__a;
1105}
1106
1107static __inline __m128d __DEFAULT_FN_ATTRS
1108_mm256_castpd256_pd128(__m256d __a)
1109{
1110 return __builtin_shufflevector(__a, __a, 0, 1);
1111}
1112
1113static __inline __m128 __DEFAULT_FN_ATTRS
1114_mm256_castps256_ps128(__m256 __a)
1115{
1116 return __builtin_shufflevector(__a, __a, 0, 1, 2, 3);
1117}
1118
1119static __inline __m128i __DEFAULT_FN_ATTRS
1120_mm256_castsi256_si128(__m256i __a)
1121{
1122 return __builtin_shufflevector(__a, __a, 0, 1);
1123}
1124
1125static __inline __m256d __DEFAULT_FN_ATTRS
1126_mm256_castpd128_pd256(__m128d __a)
1127{
1128 return __builtin_shufflevector(__a, __a, 0, 1, -1, -1);
1129}
1130
1131static __inline __m256 __DEFAULT_FN_ATTRS
1132_mm256_castps128_ps256(__m128 __a)
1133{
1134 return __builtin_shufflevector(__a, __a, 0, 1, 2, 3, -1, -1, -1, -1);
1135}
1136
1137static __inline __m256i __DEFAULT_FN_ATTRS
1138_mm256_castsi128_si256(__m128i __a)
1139{
1140 return __builtin_shufflevector(__a, __a, 0, 1, -1, -1);
1141}
1142
1143/*
1144 Vector insert.
1145 We use macros rather than inlines because we only want to accept
1146 invocations where the immediate M is a constant expression.
1147*/
1148#define _mm256_insertf128_ps(V1, V2, M) __extension__ ({ \
1149 (__m256)__builtin_shufflevector( \
1150 (__v8sf)(V1), \
1151 (__v8sf)_mm256_castps128_ps256((__m128)(V2)), \
1152 (((M) & 1) ? 0 : 8), \
1153 (((M) & 1) ? 1 : 9), \
1154 (((M) & 1) ? 2 : 10), \
1155 (((M) & 1) ? 3 : 11), \
1156 (((M) & 1) ? 8 : 4), \
1157 (((M) & 1) ? 9 : 5), \
1158 (((M) & 1) ? 10 : 6), \
1159 (((M) & 1) ? 11 : 7) );})
1160
1161#define _mm256_insertf128_pd(V1, V2, M) __extension__ ({ \
1162 (__m256d)__builtin_shufflevector( \
1163 (__v4df)(V1), \
1164 (__v4df)_mm256_castpd128_pd256((__m128d)(V2)), \
1165 (((M) & 1) ? 0 : 4), \
1166 (((M) & 1) ? 1 : 5), \
1167 (((M) & 1) ? 4 : 2), \
1168 (((M) & 1) ? 5 : 3) );})
1169
1170#define _mm256_insertf128_si256(V1, V2, M) __extension__ ({ \
1171 (__m256i)__builtin_shufflevector( \
1172 (__v4di)(V1), \
1173 (__v4di)_mm256_castsi128_si256((__m128i)(V2)), \
1174 (((M) & 1) ? 0 : 4), \
1175 (((M) & 1) ? 1 : 5), \
1176 (((M) & 1) ? 4 : 2), \
1177 (((M) & 1) ? 5 : 3) );})
1178
1179/*
1180 Vector extract.
1181 We use macros rather than inlines because we only want to accept
1182 invocations where the immediate M is a constant expression.
1183*/
1184#define _mm256_extractf128_ps(V, M) __extension__ ({ \
1185 (__m128)__builtin_shufflevector( \
1186 (__v8sf)(V), \
1187 (__v8sf)(_mm256_setzero_ps()), \
1188 (((M) & 1) ? 4 : 0), \
1189 (((M) & 1) ? 5 : 1), \
1190 (((M) & 1) ? 6 : 2), \
1191 (((M) & 1) ? 7 : 3) );})
1192
1193#define _mm256_extractf128_pd(V, M) __extension__ ({ \
1194 (__m128d)__builtin_shufflevector( \
1195 (__v4df)(V), \
1196 (__v4df)(_mm256_setzero_pd()), \
1197 (((M) & 1) ? 2 : 0), \
1198 (((M) & 1) ? 3 : 1) );})
1199
1200#define _mm256_extractf128_si256(V, M) __extension__ ({ \
1201 (__m128i)__builtin_shufflevector( \
1202 (__v4di)(V), \
1203 (__v4di)(_mm256_setzero_si256()), \
1204 (((M) & 1) ? 2 : 0), \
1205 (((M) & 1) ? 3 : 1) );})
1206
1207/* SIMD load ops (unaligned) */
1208static __inline __m256 __DEFAULT_FN_ATTRS
1209_mm256_loadu2_m128(float const *__addr_hi, float const *__addr_lo)
1210{
1211 struct __loadu_ps {
1212 __m128 __v;
1213 } __attribute__((__packed__, __may_alias__));
1214
1215 __m256 __v256 = _mm256_castps128_ps256(((struct __loadu_ps*)__addr_lo)->__v);
1216 return _mm256_insertf128_ps(__v256, ((struct __loadu_ps*)__addr_hi)->__v, 1);
1217}
1218
1219static __inline __m256d __DEFAULT_FN_ATTRS
1220_mm256_loadu2_m128d(double const *__addr_hi, double const *__addr_lo)
1221{
1222 struct __loadu_pd {
1223 __m128d __v;
1224 } __attribute__((__packed__, __may_alias__));
1225
1226 __m256d __v256 = _mm256_castpd128_pd256(((struct __loadu_pd*)__addr_lo)->__v);
1227 return _mm256_insertf128_pd(__v256, ((struct __loadu_pd*)__addr_hi)->__v, 1);
1228}
1229
1230static __inline __m256i __DEFAULT_FN_ATTRS
1231_mm256_loadu2_m128i(__m128i const *__addr_hi, __m128i const *__addr_lo)
1232{
1233 struct __loadu_si128 {
1234 __m128i __v;
1235 } __attribute__((__packed__, __may_alias__));
1236 __m256i __v256 = _mm256_castsi128_si256(
1237 ((struct __loadu_si128*)__addr_lo)->__v);
1238 return _mm256_insertf128_si256(__v256,
1239 ((struct __loadu_si128*)__addr_hi)->__v, 1);
1240}
1241
1242/* SIMD store ops (unaligned) */
1243static __inline void __DEFAULT_FN_ATTRS
1244_mm256_storeu2_m128(float *__addr_hi, float *__addr_lo, __m256 __a)
1245{
1246 __m128 __v128;
1247
1248 __v128 = _mm256_castps256_ps128(__a);
1249 __builtin_ia32_storeups(__addr_lo, __v128);
1250 __v128 = _mm256_extractf128_ps(__a, 1);
1251 __builtin_ia32_storeups(__addr_hi, __v128);
1252}
1253
1254static __inline void __DEFAULT_FN_ATTRS
1255_mm256_storeu2_m128d(double *__addr_hi, double *__addr_lo, __m256d __a)
1256{
1257 __m128d __v128;
1258
1259 __v128 = _mm256_castpd256_pd128(__a);
1260 __builtin_ia32_storeupd(__addr_lo, __v128);
1261 __v128 = _mm256_extractf128_pd(__a, 1);
1262 __builtin_ia32_storeupd(__addr_hi, __v128);
1263}
1264
1265static __inline void __DEFAULT_FN_ATTRS
1266_mm256_storeu2_m128i(__m128i *__addr_hi, __m128i *__addr_lo, __m256i __a)
1267{
1268 __m128i __v128;
1269
1270 __v128 = _mm256_castsi256_si128(__a);
1271 __builtin_ia32_storedqu((char *)__addr_lo, (__v16qi)__v128);
1272 __v128 = _mm256_extractf128_si256(__a, 1);
1273 __builtin_ia32_storedqu((char *)__addr_hi, (__v16qi)__v128);
1274}
1275
1276static __inline __m256 __DEFAULT_FN_ATTRS
1277_mm256_set_m128 (__m128 __hi, __m128 __lo) {
1278 return (__m256) __builtin_shufflevector(__lo, __hi, 0, 1, 2, 3, 4, 5, 6, 7);
1279}
1280
1281static __inline __m256d __DEFAULT_FN_ATTRS
1282_mm256_set_m128d (__m128d __hi, __m128d __lo) {
1283 return (__m256d)_mm256_set_m128((__m128)__hi, (__m128)__lo);
1284}
1285
1286static __inline __m256i __DEFAULT_FN_ATTRS
1287_mm256_set_m128i (__m128i __hi, __m128i __lo) {
1288 return (__m256i)_mm256_set_m128((__m128)__hi, (__m128)__lo);
1289}
1290
1291static __inline __m256 __DEFAULT_FN_ATTRS
1292_mm256_setr_m128 (__m128 __lo, __m128 __hi) {
1293 return _mm256_set_m128(__hi, __lo);
1294}
1295
1296static __inline __m256d __DEFAULT_FN_ATTRS
1297_mm256_setr_m128d (__m128d __lo, __m128d __hi) {
1298 return (__m256d)_mm256_set_m128((__m128)__hi, (__m128)__lo);
1299}
1300
1301static __inline __m256i __DEFAULT_FN_ATTRS
1302_mm256_setr_m128i (__m128i __lo, __m128i __hi) {
1303 return (__m256i)_mm256_set_m128((__m128)__hi, (__m128)__lo);
1304}
1305
1306#undef __DEFAULT_FN_ATTRS
1307
1308#endif /* __AVXINTRIN_H */
c_headers/bmi2intrin.h created+99
......@@ -0,0 +1,99 @@
1/*===---- bmi2intrin.h - BMI2 intrinsics -----------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
25#error "Never use <bmi2intrin.h> directly; include <x86intrin.h> instead."
26#endif
27
28#ifndef __BMI2__
29# error "BMI2 instruction set not enabled"
30#endif /* __BMI2__ */
31
32#ifndef __BMI2INTRIN_H
33#define __BMI2INTRIN_H
34
35/* Define the default attributes for the functions in this file. */
36#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
37
38static __inline__ unsigned int __DEFAULT_FN_ATTRS
39_bzhi_u32(unsigned int __X, unsigned int __Y)
40{
41 return __builtin_ia32_bzhi_si(__X, __Y);
42}
43
44static __inline__ unsigned int __DEFAULT_FN_ATTRS
45_pdep_u32(unsigned int __X, unsigned int __Y)
46{
47 return __builtin_ia32_pdep_si(__X, __Y);
48}
49
50static __inline__ unsigned int __DEFAULT_FN_ATTRS
51_pext_u32(unsigned int __X, unsigned int __Y)
52{
53 return __builtin_ia32_pext_si(__X, __Y);
54}
55
56#ifdef __x86_64__
57
58static __inline__ unsigned long long __DEFAULT_FN_ATTRS
59_bzhi_u64(unsigned long long __X, unsigned long long __Y)
60{
61 return __builtin_ia32_bzhi_di(__X, __Y);
62}
63
64static __inline__ unsigned long long __DEFAULT_FN_ATTRS
65_pdep_u64(unsigned long long __X, unsigned long long __Y)
66{
67 return __builtin_ia32_pdep_di(__X, __Y);
68}
69
70static __inline__ unsigned long long __DEFAULT_FN_ATTRS
71_pext_u64(unsigned long long __X, unsigned long long __Y)
72{
73 return __builtin_ia32_pext_di(__X, __Y);
74}
75
76static __inline__ unsigned long long __DEFAULT_FN_ATTRS
77_mulx_u64 (unsigned long long __X, unsigned long long __Y,
78 unsigned long long *__P)
79{
80 unsigned __int128 __res = (unsigned __int128) __X * __Y;
81 *__P = (unsigned long long) (__res >> 64);
82 return (unsigned long long) __res;
83}
84
85#else /* !__x86_64__ */
86
87static __inline__ unsigned int __DEFAULT_FN_ATTRS
88_mulx_u32 (unsigned int __X, unsigned int __Y, unsigned int *__P)
89{
90 unsigned long long __res = (unsigned long long) __X * __Y;
91 *__P = (unsigned int) (__res >> 32);
92 return (unsigned int) __res;
93}
94
95#endif /* !__x86_64__ */
96
97#undef __DEFAULT_FN_ATTRS
98
99#endif /* __BMI2INTRIN_H */
c_headers/bmiintrin.h created+153
......@@ -0,0 +1,153 @@
1/*===---- bmiintrin.h - BMI intrinsics -------------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
25#error "Never use <bmiintrin.h> directly; include <x86intrin.h> instead."
26#endif
27
28#ifndef __BMI__
29# error "BMI instruction set not enabled"
30#endif /* __BMI__ */
31
32#ifndef __BMIINTRIN_H
33#define __BMIINTRIN_H
34
35#define _tzcnt_u16(a) (__tzcnt_u16((a)))
36#define _andn_u32(a, b) (__andn_u32((a), (b)))
37/* _bextr_u32 != __bextr_u32 */
38#define _blsi_u32(a) (__blsi_u32((a)))
39#define _blsmsk_u32(a) (__blsmsk_u32((a)))
40#define _blsr_u32(a) (__blsr_u32((a)))
41#define _tzcnt_u32(a) (__tzcnt_u32((a)))
42
43/* Define the default attributes for the functions in this file. */
44#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
45
46static __inline__ unsigned short __DEFAULT_FN_ATTRS
47__tzcnt_u16(unsigned short __X)
48{
49 return __X ? __builtin_ctzs(__X) : 16;
50}
51
52static __inline__ unsigned int __DEFAULT_FN_ATTRS
53__andn_u32(unsigned int __X, unsigned int __Y)
54{
55 return ~__X & __Y;
56}
57
58/* AMD-specified, double-leading-underscore version of BEXTR */
59static __inline__ unsigned int __DEFAULT_FN_ATTRS
60__bextr_u32(unsigned int __X, unsigned int __Y)
61{
62 return __builtin_ia32_bextr_u32(__X, __Y);
63}
64
65/* Intel-specified, single-leading-underscore version of BEXTR */
66static __inline__ unsigned int __DEFAULT_FN_ATTRS
67_bextr_u32(unsigned int __X, unsigned int __Y, unsigned int __Z)
68{
69 return __builtin_ia32_bextr_u32 (__X, ((__Y & 0xff) | ((__Z & 0xff) << 8)));
70}
71
72static __inline__ unsigned int __DEFAULT_FN_ATTRS
73__blsi_u32(unsigned int __X)
74{
75 return __X & -__X;
76}
77
78static __inline__ unsigned int __DEFAULT_FN_ATTRS
79__blsmsk_u32(unsigned int __X)
80{
81 return __X ^ (__X - 1);
82}
83
84static __inline__ unsigned int __DEFAULT_FN_ATTRS
85__blsr_u32(unsigned int __X)
86{
87 return __X & (__X - 1);
88}
89
90static __inline__ unsigned int __DEFAULT_FN_ATTRS
91__tzcnt_u32(unsigned int __X)
92{
93 return __X ? __builtin_ctz(__X) : 32;
94}
95
96#ifdef __x86_64__
97
98#define _andn_u64(a, b) (__andn_u64((a), (b)))
99/* _bextr_u64 != __bextr_u64 */
100#define _blsi_u64(a) (__blsi_u64((a)))
101#define _blsmsk_u64(a) (__blsmsk_u64((a)))
102#define _blsr_u64(a) (__blsr_u64((a)))
103#define _tzcnt_u64(a) (__tzcnt_u64((a)))
104
105static __inline__ unsigned long long __DEFAULT_FN_ATTRS
106__andn_u64 (unsigned long long __X, unsigned long long __Y)
107{
108 return ~__X & __Y;
109}
110
111/* AMD-specified, double-leading-underscore version of BEXTR */
112static __inline__ unsigned long long __DEFAULT_FN_ATTRS
113__bextr_u64(unsigned long long __X, unsigned long long __Y)
114{
115 return __builtin_ia32_bextr_u64(__X, __Y);
116}
117
118/* Intel-specified, single-leading-underscore version of BEXTR */
119static __inline__ unsigned long long __DEFAULT_FN_ATTRS
120_bextr_u64(unsigned long long __X, unsigned int __Y, unsigned int __Z)
121{
122 return __builtin_ia32_bextr_u64 (__X, ((__Y & 0xff) | ((__Z & 0xff) << 8)));
123}
124
125static __inline__ unsigned long long __DEFAULT_FN_ATTRS
126__blsi_u64(unsigned long long __X)
127{
128 return __X & -__X;
129}
130
131static __inline__ unsigned long long __DEFAULT_FN_ATTRS
132__blsmsk_u64(unsigned long long __X)
133{
134 return __X ^ (__X - 1);
135}
136
137static __inline__ unsigned long long __DEFAULT_FN_ATTRS
138__blsr_u64(unsigned long long __X)
139{
140 return __X & (__X - 1);
141}
142
143static __inline__ unsigned long long __DEFAULT_FN_ATTRS
144__tzcnt_u64(unsigned long long __X)
145{
146 return __X ? __builtin_ctzll(__X) : 64;
147}
148
149#endif /* __x86_64__ */
150
151#undef __DEFAULT_FN_ATTRS
152
153#endif /* __BMIINTRIN_H */
c_headers/cpuid.h created+209
......@@ -0,0 +1,209 @@
1/*===---- cpuid.h - X86 cpu model detection --------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#if !(__x86_64__ || __i386__)
25#error this header is for x86 only
26#endif
27
28/* Responses identification request with %eax 0 */
29/* AMD: "AuthenticAMD" */
30#define signature_AMD_ebx 0x68747541
31#define signature_AMD_edx 0x69746e65
32#define signature_AMD_ecx 0x444d4163
33/* CENTAUR: "CentaurHauls" */
34#define signature_CENTAUR_ebx 0x746e6543
35#define signature_CENTAUR_edx 0x48727561
36#define signature_CENTAUR_ecx 0x736c7561
37/* CYRIX: "CyrixInstead" */
38#define signature_CYRIX_ebx 0x69727943
39#define signature_CYRIX_edx 0x736e4978
40#define signature_CYRIX_ecx 0x64616574
41/* INTEL: "GenuineIntel" */
42#define signature_INTEL_ebx 0x756e6547
43#define signature_INTEL_edx 0x49656e69
44#define signature_INTEL_ecx 0x6c65746e
45/* TM1: "TransmetaCPU" */
46#define signature_TM1_ebx 0x6e617254
47#define signature_TM1_edx 0x74656d73
48#define signature_TM1_ecx 0x55504361
49/* TM2: "GenuineTMx86" */
50#define signature_TM2_ebx 0x756e6547
51#define signature_TM2_edx 0x54656e69
52#define signature_TM2_ecx 0x3638784d
53/* NSC: "Geode by NSC" */
54#define signature_NSC_ebx 0x646f6547
55#define signature_NSC_edx 0x43534e20
56#define signature_NSC_ecx 0x79622065
57/* NEXGEN: "NexGenDriven" */
58#define signature_NEXGEN_ebx 0x4778654e
59#define signature_NEXGEN_edx 0x72446e65
60#define signature_NEXGEN_ecx 0x6e657669
61/* RISE: "RiseRiseRise" */
62#define signature_RISE_ebx 0x65736952
63#define signature_RISE_edx 0x65736952
64#define signature_RISE_ecx 0x65736952
65/* SIS: "SiS SiS SiS " */
66#define signature_SIS_ebx 0x20536953
67#define signature_SIS_edx 0x20536953
68#define signature_SIS_ecx 0x20536953
69/* UMC: "UMC UMC UMC " */
70#define signature_UMC_ebx 0x20434d55
71#define signature_UMC_edx 0x20434d55
72#define signature_UMC_ecx 0x20434d55
73/* VIA: "VIA VIA VIA " */
74#define signature_VIA_ebx 0x20414956
75#define signature_VIA_edx 0x20414956
76#define signature_VIA_ecx 0x20414956
77/* VORTEX: "Vortex86 SoC" */
78#define signature_VORTEX_ebx 0x74726f56
79#define signature_VORTEX_edx 0x36387865
80#define signature_VORTEX_ecx 0x436f5320
81
82/* Features in %ecx for level 1 */
83#define bit_SSE3 0x00000001
84#define bit_PCLMULQDQ 0x00000002
85#define bit_DTES64 0x00000004
86#define bit_MONITOR 0x00000008
87#define bit_DSCPL 0x00000010
88#define bit_VMX 0x00000020
89#define bit_SMX 0x00000040
90#define bit_EIST 0x00000080
91#define bit_TM2 0x00000100
92#define bit_SSSE3 0x00000200
93#define bit_CNXTID 0x00000400
94#define bit_FMA 0x00001000
95#define bit_CMPXCHG16B 0x00002000
96#define bit_xTPR 0x00004000
97#define bit_PDCM 0x00008000
98#define bit_PCID 0x00020000
99#define bit_DCA 0x00040000
100#define bit_SSE41 0x00080000
101#define bit_SSE42 0x00100000
102#define bit_x2APIC 0x00200000
103#define bit_MOVBE 0x00400000
104#define bit_POPCNT 0x00800000
105#define bit_TSCDeadline 0x01000000
106#define bit_AESNI 0x02000000
107#define bit_XSAVE 0x04000000
108#define bit_OSXSAVE 0x08000000
109#define bit_AVX 0x10000000
110#define bit_RDRND 0x40000000
111
112/* Features in %edx for level 1 */
113#define bit_FPU 0x00000001
114#define bit_VME 0x00000002
115#define bit_DE 0x00000004
116#define bit_PSE 0x00000008
117#define bit_TSC 0x00000010
118#define bit_MSR 0x00000020
119#define bit_PAE 0x00000040
120#define bit_MCE 0x00000080
121#define bit_CX8 0x00000100
122#define bit_APIC 0x00000200
123#define bit_SEP 0x00000800
124#define bit_MTRR 0x00001000
125#define bit_PGE 0x00002000
126#define bit_MCA 0x00004000
127#define bit_CMOV 0x00008000
128#define bit_PAT 0x00010000
129#define bit_PSE36 0x00020000
130#define bit_PSN 0x00040000
131#define bit_CLFSH 0x00080000
132#define bit_DS 0x00200000
133#define bit_ACPI 0x00400000
134#define bit_MMX 0x00800000
135#define bit_FXSR 0x01000000
136#define bit_FXSAVE bit_FXSR /* for gcc compat */
137#define bit_SSE 0x02000000
138#define bit_SSE2 0x04000000
139#define bit_SS 0x08000000
140#define bit_HTT 0x10000000
141#define bit_TM 0x20000000
142#define bit_PBE 0x80000000
143
144/* Features in %ebx for level 7 sub-leaf 0 */
145#define bit_FSGSBASE 0x00000001
146#define bit_SMEP 0x00000080
147#define bit_ENH_MOVSB 0x00000200
148
149#if __i386__
150#define __cpuid(__level, __eax, __ebx, __ecx, __edx) \
151 __asm("cpuid" : "=a"(__eax), "=b" (__ebx), "=c"(__ecx), "=d"(__edx) \
152 : "0"(__level))
153
154#define __cpuid_count(__level, __count, __eax, __ebx, __ecx, __edx) \
155 __asm("cpuid" : "=a"(__eax), "=b" (__ebx), "=c"(__ecx), "=d"(__edx) \
156 : "0"(__level), "2"(__count))
157#else
158/* x86-64 uses %rbx as the base register, so preserve it. */
159#define __cpuid(__level, __eax, __ebx, __ecx, __edx) \
160 __asm(" xchgq %%rbx,%q1\n" \
161 " cpuid\n" \
162 " xchgq %%rbx,%q1" \
163 : "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \
164 : "0"(__level))
165
166#define __cpuid_count(__level, __count, __eax, __ebx, __ecx, __edx) \
167 __asm(" xchgq %%rbx,%q1\n" \
168 " cpuid\n" \
169 " xchgq %%rbx,%q1" \
170 : "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \
171 : "0"(__level), "2"(__count))
172#endif
173
174static __inline int __get_cpuid (unsigned int __level, unsigned int *__eax,
175 unsigned int *__ebx, unsigned int *__ecx,
176 unsigned int *__edx) {
177 __cpuid(__level, *__eax, *__ebx, *__ecx, *__edx);
178 return 1;
179}
180
181static __inline int __get_cpuid_max (unsigned int __level, unsigned int *__sig)
182{
183 unsigned int __eax, __ebx, __ecx, __edx;
184#if __i386__
185 int __cpuid_supported;
186
187 __asm(" pushfl\n"
188 " popl %%eax\n"
189 " movl %%eax,%%ecx\n"
190 " xorl $0x00200000,%%eax\n"
191 " pushl %%eax\n"
192 " popfl\n"
193 " pushfl\n"
194 " popl %%eax\n"
195 " movl $0,%0\n"
196 " cmpl %%eax,%%ecx\n"
197 " je 1f\n"
198 " movl $1,%0\n"
199 "1:"
200 : "=r" (__cpuid_supported) : : "eax", "ecx");
201 if (!__cpuid_supported)
202 return 0;
203#endif
204
205 __cpuid(__level, __eax, __ebx, __ecx, __edx);
206 if (__sig)
207 *__sig = __ebx;
208 return __eax;
209}
c_headers/cuda_builtin_vars.h created+110
......@@ -0,0 +1,110 @@
1/*===---- cuda_builtin_vars.h - CUDA built-in variables ---------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __CUDA_BUILTIN_VARS_H
25#define __CUDA_BUILTIN_VARS_H
26
27// The file implements built-in CUDA variables using __declspec(property).
28// https://msdn.microsoft.com/en-us/library/yhfk0thd.aspx
29// All read accesses of built-in variable fields get converted into calls to a
30// getter function which in turn would call appropriate builtin to fetch the
31// value.
32//
33// Example:
34// int x = threadIdx.x;
35// IR output:
36// %0 = call i32 @llvm.ptx.read.tid.x() #3
37// PTX output:
38// mov.u32 %r2, %tid.x;
39
40#define __CUDA_DEVICE_BUILTIN(FIELD, INTRINSIC) \
41 __declspec(property(get = __fetch_builtin_##FIELD)) unsigned int FIELD; \
42 static inline __attribute__((always_inline)) \
43 __attribute__((device)) unsigned int __fetch_builtin_##FIELD(void) { \
44 return INTRINSIC; \
45 }
46
47#if __cplusplus >= 201103L
48#define __DELETE =delete
49#else
50#define __DELETE
51#endif
52
53// Make sure nobody can create instances of the special varible types. nvcc
54// also disallows taking address of special variables, so we disable address-of
55// operator as well.
56#define __CUDA_DISALLOW_BUILTINVAR_ACCESS(TypeName) \
57 __attribute__((device)) TypeName() __DELETE; \
58 __attribute__((device)) TypeName(const TypeName &) __DELETE; \
59 __attribute__((device)) void operator=(const TypeName &) const __DELETE; \
60 __attribute__((device)) TypeName *operator&() const __DELETE
61
62struct __cuda_builtin_threadIdx_t {
63 __CUDA_DEVICE_BUILTIN(x,__builtin_ptx_read_tid_x());
64 __CUDA_DEVICE_BUILTIN(y,__builtin_ptx_read_tid_y());
65 __CUDA_DEVICE_BUILTIN(z,__builtin_ptx_read_tid_z());
66private:
67 __CUDA_DISALLOW_BUILTINVAR_ACCESS(__cuda_builtin_threadIdx_t);
68};
69
70struct __cuda_builtin_blockIdx_t {
71 __CUDA_DEVICE_BUILTIN(x,__builtin_ptx_read_ctaid_x());
72 __CUDA_DEVICE_BUILTIN(y,__builtin_ptx_read_ctaid_y());
73 __CUDA_DEVICE_BUILTIN(z,__builtin_ptx_read_ctaid_z());
74private:
75 __CUDA_DISALLOW_BUILTINVAR_ACCESS(__cuda_builtin_blockIdx_t);
76};
77
78struct __cuda_builtin_blockDim_t {
79 __CUDA_DEVICE_BUILTIN(x,__builtin_ptx_read_ntid_x());
80 __CUDA_DEVICE_BUILTIN(y,__builtin_ptx_read_ntid_y());
81 __CUDA_DEVICE_BUILTIN(z,__builtin_ptx_read_ntid_z());
82private:
83 __CUDA_DISALLOW_BUILTINVAR_ACCESS(__cuda_builtin_blockDim_t);
84};
85
86struct __cuda_builtin_gridDim_t {
87 __CUDA_DEVICE_BUILTIN(x,__builtin_ptx_read_nctaid_x());
88 __CUDA_DEVICE_BUILTIN(y,__builtin_ptx_read_nctaid_y());
89 __CUDA_DEVICE_BUILTIN(z,__builtin_ptx_read_nctaid_z());
90private:
91 __CUDA_DISALLOW_BUILTINVAR_ACCESS(__cuda_builtin_gridDim_t);
92};
93
94#define __CUDA_BUILTIN_VAR \
95 extern const __attribute__((device)) __attribute__((weak))
96__CUDA_BUILTIN_VAR __cuda_builtin_threadIdx_t threadIdx;
97__CUDA_BUILTIN_VAR __cuda_builtin_blockIdx_t blockIdx;
98__CUDA_BUILTIN_VAR __cuda_builtin_blockDim_t blockDim;
99__CUDA_BUILTIN_VAR __cuda_builtin_gridDim_t gridDim;
100
101// warpSize should translate to read of %WARP_SZ but there's currently no
102// builtin to do so. According to PTX v4.2 docs 'to date, all target
103// architectures have a WARP_SZ value of 32'.
104__attribute__((device)) const int warpSize = 32;
105
106#undef __CUDA_DEVICE_BUILTIN
107#undef __CUDA_BUILTIN_VAR
108#undef __CUDA_DISALLOW_BUILTINVAR_ACCESS
109
110#endif /* __CUDA_BUILTIN_VARS_H */
c_headers/emmintrin.h created+1480
......@@ -0,0 +1,1480 @@
1/*===---- emmintrin.h - SSE2 intrinsics ------------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __EMMINTRIN_H
25#define __EMMINTRIN_H
26
27#ifndef __SSE2__
28#error "SSE2 instruction set not enabled"
29#else
30
31#include <xmmintrin.h>
32
33typedef double __m128d __attribute__((__vector_size__(16)));
34typedef long long __m128i __attribute__((__vector_size__(16)));
35
36/* Type defines. */
37typedef double __v2df __attribute__ ((__vector_size__ (16)));
38typedef long long __v2di __attribute__ ((__vector_size__ (16)));
39typedef short __v8hi __attribute__((__vector_size__(16)));
40typedef char __v16qi __attribute__((__vector_size__(16)));
41
42/* Define the default attributes for the functions in this file. */
43#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
44
45static __inline__ __m128d __DEFAULT_FN_ATTRS
46_mm_add_sd(__m128d __a, __m128d __b)
47{
48 __a[0] += __b[0];
49 return __a;
50}
51
52static __inline__ __m128d __DEFAULT_FN_ATTRS
53_mm_add_pd(__m128d __a, __m128d __b)
54{
55 return __a + __b;
56}
57
58static __inline__ __m128d __DEFAULT_FN_ATTRS
59_mm_sub_sd(__m128d __a, __m128d __b)
60{
61 __a[0] -= __b[0];
62 return __a;
63}
64
65static __inline__ __m128d __DEFAULT_FN_ATTRS
66_mm_sub_pd(__m128d __a, __m128d __b)
67{
68 return __a - __b;
69}
70
71static __inline__ __m128d __DEFAULT_FN_ATTRS
72_mm_mul_sd(__m128d __a, __m128d __b)
73{
74 __a[0] *= __b[0];
75 return __a;
76}
77
78static __inline__ __m128d __DEFAULT_FN_ATTRS
79_mm_mul_pd(__m128d __a, __m128d __b)
80{
81 return __a * __b;
82}
83
84static __inline__ __m128d __DEFAULT_FN_ATTRS
85_mm_div_sd(__m128d __a, __m128d __b)
86{
87 __a[0] /= __b[0];
88 return __a;
89}
90
91static __inline__ __m128d __DEFAULT_FN_ATTRS
92_mm_div_pd(__m128d __a, __m128d __b)
93{
94 return __a / __b;
95}
96
97static __inline__ __m128d __DEFAULT_FN_ATTRS
98_mm_sqrt_sd(__m128d __a, __m128d __b)
99{
100 __m128d __c = __builtin_ia32_sqrtsd(__b);
101 return (__m128d) { __c[0], __a[1] };
102}
103
104static __inline__ __m128d __DEFAULT_FN_ATTRS
105_mm_sqrt_pd(__m128d __a)
106{
107 return __builtin_ia32_sqrtpd(__a);
108}
109
110static __inline__ __m128d __DEFAULT_FN_ATTRS
111_mm_min_sd(__m128d __a, __m128d __b)
112{
113 return __builtin_ia32_minsd(__a, __b);
114}
115
116static __inline__ __m128d __DEFAULT_FN_ATTRS
117_mm_min_pd(__m128d __a, __m128d __b)
118{
119 return __builtin_ia32_minpd(__a, __b);
120}
121
122static __inline__ __m128d __DEFAULT_FN_ATTRS
123_mm_max_sd(__m128d __a, __m128d __b)
124{
125 return __builtin_ia32_maxsd(__a, __b);
126}
127
128static __inline__ __m128d __DEFAULT_FN_ATTRS
129_mm_max_pd(__m128d __a, __m128d __b)
130{
131 return __builtin_ia32_maxpd(__a, __b);
132}
133
134static __inline__ __m128d __DEFAULT_FN_ATTRS
135_mm_and_pd(__m128d __a, __m128d __b)
136{
137 return (__m128d)((__v4si)__a & (__v4si)__b);
138}
139
140static __inline__ __m128d __DEFAULT_FN_ATTRS
141_mm_andnot_pd(__m128d __a, __m128d __b)
142{
143 return (__m128d)(~(__v4si)__a & (__v4si)__b);
144}
145
146static __inline__ __m128d __DEFAULT_FN_ATTRS
147_mm_or_pd(__m128d __a, __m128d __b)
148{
149 return (__m128d)((__v4si)__a | (__v4si)__b);
150}
151
152static __inline__ __m128d __DEFAULT_FN_ATTRS
153_mm_xor_pd(__m128d __a, __m128d __b)
154{
155 return (__m128d)((__v4si)__a ^ (__v4si)__b);
156}
157
158static __inline__ __m128d __DEFAULT_FN_ATTRS
159_mm_cmpeq_pd(__m128d __a, __m128d __b)
160{
161 return (__m128d)__builtin_ia32_cmpeqpd(__a, __b);
162}
163
164static __inline__ __m128d __DEFAULT_FN_ATTRS
165_mm_cmplt_pd(__m128d __a, __m128d __b)
166{
167 return (__m128d)__builtin_ia32_cmpltpd(__a, __b);
168}
169
170static __inline__ __m128d __DEFAULT_FN_ATTRS
171_mm_cmple_pd(__m128d __a, __m128d __b)
172{
173 return (__m128d)__builtin_ia32_cmplepd(__a, __b);
174}
175
176static __inline__ __m128d __DEFAULT_FN_ATTRS
177_mm_cmpgt_pd(__m128d __a, __m128d __b)
178{
179 return (__m128d)__builtin_ia32_cmpltpd(__b, __a);
180}
181
182static __inline__ __m128d __DEFAULT_FN_ATTRS
183_mm_cmpge_pd(__m128d __a, __m128d __b)
184{
185 return (__m128d)__builtin_ia32_cmplepd(__b, __a);
186}
187
188static __inline__ __m128d __DEFAULT_FN_ATTRS
189_mm_cmpord_pd(__m128d __a, __m128d __b)
190{
191 return (__m128d)__builtin_ia32_cmpordpd(__a, __b);
192}
193
194static __inline__ __m128d __DEFAULT_FN_ATTRS
195_mm_cmpunord_pd(__m128d __a, __m128d __b)
196{
197 return (__m128d)__builtin_ia32_cmpunordpd(__a, __b);
198}
199
200static __inline__ __m128d __DEFAULT_FN_ATTRS
201_mm_cmpneq_pd(__m128d __a, __m128d __b)
202{
203 return (__m128d)__builtin_ia32_cmpneqpd(__a, __b);
204}
205
206static __inline__ __m128d __DEFAULT_FN_ATTRS
207_mm_cmpnlt_pd(__m128d __a, __m128d __b)
208{
209 return (__m128d)__builtin_ia32_cmpnltpd(__a, __b);
210}
211
212static __inline__ __m128d __DEFAULT_FN_ATTRS
213_mm_cmpnle_pd(__m128d __a, __m128d __b)
214{
215 return (__m128d)__builtin_ia32_cmpnlepd(__a, __b);
216}
217
218static __inline__ __m128d __DEFAULT_FN_ATTRS
219_mm_cmpngt_pd(__m128d __a, __m128d __b)
220{
221 return (__m128d)__builtin_ia32_cmpnltpd(__b, __a);
222}
223
224static __inline__ __m128d __DEFAULT_FN_ATTRS
225_mm_cmpnge_pd(__m128d __a, __m128d __b)
226{
227 return (__m128d)__builtin_ia32_cmpnlepd(__b, __a);
228}
229
230static __inline__ __m128d __DEFAULT_FN_ATTRS
231_mm_cmpeq_sd(__m128d __a, __m128d __b)
232{
233 return (__m128d)__builtin_ia32_cmpeqsd(__a, __b);
234}
235
236static __inline__ __m128d __DEFAULT_FN_ATTRS
237_mm_cmplt_sd(__m128d __a, __m128d __b)
238{
239 return (__m128d)__builtin_ia32_cmpltsd(__a, __b);
240}
241
242static __inline__ __m128d __DEFAULT_FN_ATTRS
243_mm_cmple_sd(__m128d __a, __m128d __b)
244{
245 return (__m128d)__builtin_ia32_cmplesd(__a, __b);
246}
247
248static __inline__ __m128d __DEFAULT_FN_ATTRS
249_mm_cmpgt_sd(__m128d __a, __m128d __b)
250{
251 __m128d __c = __builtin_ia32_cmpltsd(__b, __a);
252 return (__m128d) { __c[0], __a[1] };
253}
254
255static __inline__ __m128d __DEFAULT_FN_ATTRS
256_mm_cmpge_sd(__m128d __a, __m128d __b)
257{
258 __m128d __c = __builtin_ia32_cmplesd(__b, __a);
259 return (__m128d) { __c[0], __a[1] };
260}
261
262static __inline__ __m128d __DEFAULT_FN_ATTRS
263_mm_cmpord_sd(__m128d __a, __m128d __b)
264{
265 return (__m128d)__builtin_ia32_cmpordsd(__a, __b);
266}
267
268static __inline__ __m128d __DEFAULT_FN_ATTRS
269_mm_cmpunord_sd(__m128d __a, __m128d __b)
270{
271 return (__m128d)__builtin_ia32_cmpunordsd(__a, __b);
272}
273
274static __inline__ __m128d __DEFAULT_FN_ATTRS
275_mm_cmpneq_sd(__m128d __a, __m128d __b)
276{
277 return (__m128d)__builtin_ia32_cmpneqsd(__a, __b);
278}
279
280static __inline__ __m128d __DEFAULT_FN_ATTRS
281_mm_cmpnlt_sd(__m128d __a, __m128d __b)
282{
283 return (__m128d)__builtin_ia32_cmpnltsd(__a, __b);
284}
285
286static __inline__ __m128d __DEFAULT_FN_ATTRS
287_mm_cmpnle_sd(__m128d __a, __m128d __b)
288{
289 return (__m128d)__builtin_ia32_cmpnlesd(__a, __b);
290}
291
292static __inline__ __m128d __DEFAULT_FN_ATTRS
293_mm_cmpngt_sd(__m128d __a, __m128d __b)
294{
295 __m128d __c = __builtin_ia32_cmpnltsd(__b, __a);
296 return (__m128d) { __c[0], __a[1] };
297}
298
299static __inline__ __m128d __DEFAULT_FN_ATTRS
300_mm_cmpnge_sd(__m128d __a, __m128d __b)
301{
302 __m128d __c = __builtin_ia32_cmpnlesd(__b, __a);
303 return (__m128d) { __c[0], __a[1] };
304}
305
306static __inline__ int __DEFAULT_FN_ATTRS
307_mm_comieq_sd(__m128d __a, __m128d __b)
308{
309 return __builtin_ia32_comisdeq(__a, __b);
310}
311
312static __inline__ int __DEFAULT_FN_ATTRS
313_mm_comilt_sd(__m128d __a, __m128d __b)
314{
315 return __builtin_ia32_comisdlt(__a, __b);
316}
317
318static __inline__ int __DEFAULT_FN_ATTRS
319_mm_comile_sd(__m128d __a, __m128d __b)
320{
321 return __builtin_ia32_comisdle(__a, __b);
322}
323
324static __inline__ int __DEFAULT_FN_ATTRS
325_mm_comigt_sd(__m128d __a, __m128d __b)
326{
327 return __builtin_ia32_comisdgt(__a, __b);
328}
329
330static __inline__ int __DEFAULT_FN_ATTRS
331_mm_comige_sd(__m128d __a, __m128d __b)
332{
333 return __builtin_ia32_comisdge(__a, __b);
334}
335
336static __inline__ int __DEFAULT_FN_ATTRS
337_mm_comineq_sd(__m128d __a, __m128d __b)
338{
339 return __builtin_ia32_comisdneq(__a, __b);
340}
341
342static __inline__ int __DEFAULT_FN_ATTRS
343_mm_ucomieq_sd(__m128d __a, __m128d __b)
344{
345 return __builtin_ia32_ucomisdeq(__a, __b);
346}
347
348static __inline__ int __DEFAULT_FN_ATTRS
349_mm_ucomilt_sd(__m128d __a, __m128d __b)
350{
351 return __builtin_ia32_ucomisdlt(__a, __b);
352}
353
354static __inline__ int __DEFAULT_FN_ATTRS
355_mm_ucomile_sd(__m128d __a, __m128d __b)
356{
357 return __builtin_ia32_ucomisdle(__a, __b);
358}
359
360static __inline__ int __DEFAULT_FN_ATTRS
361_mm_ucomigt_sd(__m128d __a, __m128d __b)
362{
363 return __builtin_ia32_ucomisdgt(__a, __b);
364}
365
366static __inline__ int __DEFAULT_FN_ATTRS
367_mm_ucomige_sd(__m128d __a, __m128d __b)
368{
369 return __builtin_ia32_ucomisdge(__a, __b);
370}
371
372static __inline__ int __DEFAULT_FN_ATTRS
373_mm_ucomineq_sd(__m128d __a, __m128d __b)
374{
375 return __builtin_ia32_ucomisdneq(__a, __b);
376}
377
378static __inline__ __m128 __DEFAULT_FN_ATTRS
379_mm_cvtpd_ps(__m128d __a)
380{
381 return __builtin_ia32_cvtpd2ps(__a);
382}
383
384static __inline__ __m128d __DEFAULT_FN_ATTRS
385_mm_cvtps_pd(__m128 __a)
386{
387 return __builtin_ia32_cvtps2pd(__a);
388}
389
390static __inline__ __m128d __DEFAULT_FN_ATTRS
391_mm_cvtepi32_pd(__m128i __a)
392{
393 return __builtin_ia32_cvtdq2pd((__v4si)__a);
394}
395
396static __inline__ __m128i __DEFAULT_FN_ATTRS
397_mm_cvtpd_epi32(__m128d __a)
398{
399 return __builtin_ia32_cvtpd2dq(__a);
400}
401
402static __inline__ int __DEFAULT_FN_ATTRS
403_mm_cvtsd_si32(__m128d __a)
404{
405 return __builtin_ia32_cvtsd2si(__a);
406}
407
408static __inline__ __m128 __DEFAULT_FN_ATTRS
409_mm_cvtsd_ss(__m128 __a, __m128d __b)
410{
411 __a[0] = __b[0];
412 return __a;
413}
414
415static __inline__ __m128d __DEFAULT_FN_ATTRS
416_mm_cvtsi32_sd(__m128d __a, int __b)
417{
418 __a[0] = __b;
419 return __a;
420}
421
422static __inline__ __m128d __DEFAULT_FN_ATTRS
423_mm_cvtss_sd(__m128d __a, __m128 __b)
424{
425 __a[0] = __b[0];
426 return __a;
427}
428
429static __inline__ __m128i __DEFAULT_FN_ATTRS
430_mm_cvttpd_epi32(__m128d __a)
431{
432 return (__m128i)__builtin_ia32_cvttpd2dq(__a);
433}
434
435static __inline__ int __DEFAULT_FN_ATTRS
436_mm_cvttsd_si32(__m128d __a)
437{
438 return __a[0];
439}
440
441static __inline__ __m64 __DEFAULT_FN_ATTRS
442_mm_cvtpd_pi32(__m128d __a)
443{
444 return (__m64)__builtin_ia32_cvtpd2pi(__a);
445}
446
447static __inline__ __m64 __DEFAULT_FN_ATTRS
448_mm_cvttpd_pi32(__m128d __a)
449{
450 return (__m64)__builtin_ia32_cvttpd2pi(__a);
451}
452
453static __inline__ __m128d __DEFAULT_FN_ATTRS
454_mm_cvtpi32_pd(__m64 __a)
455{
456 return __builtin_ia32_cvtpi2pd((__v2si)__a);
457}
458
459static __inline__ double __DEFAULT_FN_ATTRS
460_mm_cvtsd_f64(__m128d __a)
461{
462 return __a[0];
463}
464
465static __inline__ __m128d __DEFAULT_FN_ATTRS
466_mm_load_pd(double const *__dp)
467{
468 return *(__m128d*)__dp;
469}
470
471static __inline__ __m128d __DEFAULT_FN_ATTRS
472_mm_load1_pd(double const *__dp)
473{
474 struct __mm_load1_pd_struct {
475 double __u;
476 } __attribute__((__packed__, __may_alias__));
477 double __u = ((struct __mm_load1_pd_struct*)__dp)->__u;
478 return (__m128d){ __u, __u };
479}
480
481#define _mm_load_pd1(dp) _mm_load1_pd(dp)
482
483static __inline__ __m128d __DEFAULT_FN_ATTRS
484_mm_loadr_pd(double const *__dp)
485{
486 __m128d __u = *(__m128d*)__dp;
487 return __builtin_shufflevector(__u, __u, 1, 0);
488}
489
490static __inline__ __m128d __DEFAULT_FN_ATTRS
491_mm_loadu_pd(double const *__dp)
492{
493 struct __loadu_pd {
494 __m128d __v;
495 } __attribute__((__packed__, __may_alias__));
496 return ((struct __loadu_pd*)__dp)->__v;
497}
498
499static __inline__ __m128d __DEFAULT_FN_ATTRS
500_mm_load_sd(double const *__dp)
501{
502 struct __mm_load_sd_struct {
503 double __u;
504 } __attribute__((__packed__, __may_alias__));
505 double __u = ((struct __mm_load_sd_struct*)__dp)->__u;
506 return (__m128d){ __u, 0 };
507}
508
509static __inline__ __m128d __DEFAULT_FN_ATTRS
510_mm_loadh_pd(__m128d __a, double const *__dp)
511{
512 struct __mm_loadh_pd_struct {
513 double __u;
514 } __attribute__((__packed__, __may_alias__));
515 double __u = ((struct __mm_loadh_pd_struct*)__dp)->__u;
516 return (__m128d){ __a[0], __u };
517}
518
519static __inline__ __m128d __DEFAULT_FN_ATTRS
520_mm_loadl_pd(__m128d __a, double const *__dp)
521{
522 struct __mm_loadl_pd_struct {
523 double __u;
524 } __attribute__((__packed__, __may_alias__));
525 double __u = ((struct __mm_loadl_pd_struct*)__dp)->__u;
526 return (__m128d){ __u, __a[1] };
527}
528
529static __inline__ __m128d __DEFAULT_FN_ATTRS
530_mm_set_sd(double __w)
531{
532 return (__m128d){ __w, 0 };
533}
534
535static __inline__ __m128d __DEFAULT_FN_ATTRS
536_mm_set1_pd(double __w)
537{
538 return (__m128d){ __w, __w };
539}
540
541static __inline__ __m128d __DEFAULT_FN_ATTRS
542_mm_set_pd(double __w, double __x)
543{
544 return (__m128d){ __x, __w };
545}
546
547static __inline__ __m128d __DEFAULT_FN_ATTRS
548_mm_setr_pd(double __w, double __x)
549{
550 return (__m128d){ __w, __x };
551}
552
553static __inline__ __m128d __DEFAULT_FN_ATTRS
554_mm_setzero_pd(void)
555{
556 return (__m128d){ 0, 0 };
557}
558
559static __inline__ __m128d __DEFAULT_FN_ATTRS
560_mm_move_sd(__m128d __a, __m128d __b)
561{
562 return (__m128d){ __b[0], __a[1] };
563}
564
565static __inline__ void __DEFAULT_FN_ATTRS
566_mm_store_sd(double *__dp, __m128d __a)
567{
568 struct __mm_store_sd_struct {
569 double __u;
570 } __attribute__((__packed__, __may_alias__));
571 ((struct __mm_store_sd_struct*)__dp)->__u = __a[0];
572}
573
574static __inline__ void __DEFAULT_FN_ATTRS
575_mm_store1_pd(double *__dp, __m128d __a)
576{
577 struct __mm_store1_pd_struct {
578 double __u[2];
579 } __attribute__((__packed__, __may_alias__));
580 ((struct __mm_store1_pd_struct*)__dp)->__u[0] = __a[0];
581 ((struct __mm_store1_pd_struct*)__dp)->__u[1] = __a[0];
582}
583
584static __inline__ void __DEFAULT_FN_ATTRS
585_mm_store_pd(double *__dp, __m128d __a)
586{
587 *(__m128d *)__dp = __a;
588}
589
590static __inline__ void __DEFAULT_FN_ATTRS
591_mm_storeu_pd(double *__dp, __m128d __a)
592{
593 __builtin_ia32_storeupd(__dp, __a);
594}
595
596static __inline__ void __DEFAULT_FN_ATTRS
597_mm_storer_pd(double *__dp, __m128d __a)
598{
599 __a = __builtin_shufflevector(__a, __a, 1, 0);
600 *(__m128d *)__dp = __a;
601}
602
603static __inline__ void __DEFAULT_FN_ATTRS
604_mm_storeh_pd(double *__dp, __m128d __a)
605{
606 struct __mm_storeh_pd_struct {
607 double __u;
608 } __attribute__((__packed__, __may_alias__));
609 ((struct __mm_storeh_pd_struct*)__dp)->__u = __a[1];
610}
611
612static __inline__ void __DEFAULT_FN_ATTRS
613_mm_storel_pd(double *__dp, __m128d __a)
614{
615 struct __mm_storeh_pd_struct {
616 double __u;
617 } __attribute__((__packed__, __may_alias__));
618 ((struct __mm_storeh_pd_struct*)__dp)->__u = __a[0];
619}
620
621static __inline__ __m128i __DEFAULT_FN_ATTRS
622_mm_add_epi8(__m128i __a, __m128i __b)
623{
624 return (__m128i)((__v16qi)__a + (__v16qi)__b);
625}
626
627static __inline__ __m128i __DEFAULT_FN_ATTRS
628_mm_add_epi16(__m128i __a, __m128i __b)
629{
630 return (__m128i)((__v8hi)__a + (__v8hi)__b);
631}
632
633static __inline__ __m128i __DEFAULT_FN_ATTRS
634_mm_add_epi32(__m128i __a, __m128i __b)
635{
636 return (__m128i)((__v4si)__a + (__v4si)__b);
637}
638
639static __inline__ __m64 __DEFAULT_FN_ATTRS
640_mm_add_si64(__m64 __a, __m64 __b)
641{
642 return __a + __b;
643}
644
645static __inline__ __m128i __DEFAULT_FN_ATTRS
646_mm_add_epi64(__m128i __a, __m128i __b)
647{
648 return __a + __b;
649}
650
651static __inline__ __m128i __DEFAULT_FN_ATTRS
652_mm_adds_epi8(__m128i __a, __m128i __b)
653{
654 return (__m128i)__builtin_ia32_paddsb128((__v16qi)__a, (__v16qi)__b);
655}
656
657static __inline__ __m128i __DEFAULT_FN_ATTRS
658_mm_adds_epi16(__m128i __a, __m128i __b)
659{
660 return (__m128i)__builtin_ia32_paddsw128((__v8hi)__a, (__v8hi)__b);
661}
662
663static __inline__ __m128i __DEFAULT_FN_ATTRS
664_mm_adds_epu8(__m128i __a, __m128i __b)
665{
666 return (__m128i)__builtin_ia32_paddusb128((__v16qi)__a, (__v16qi)__b);
667}
668
669static __inline__ __m128i __DEFAULT_FN_ATTRS
670_mm_adds_epu16(__m128i __a, __m128i __b)
671{
672 return (__m128i)__builtin_ia32_paddusw128((__v8hi)__a, (__v8hi)__b);
673}
674
675static __inline__ __m128i __DEFAULT_FN_ATTRS
676_mm_avg_epu8(__m128i __a, __m128i __b)
677{
678 return (__m128i)__builtin_ia32_pavgb128((__v16qi)__a, (__v16qi)__b);
679}
680
681static __inline__ __m128i __DEFAULT_FN_ATTRS
682_mm_avg_epu16(__m128i __a, __m128i __b)
683{
684 return (__m128i)__builtin_ia32_pavgw128((__v8hi)__a, (__v8hi)__b);
685}
686
687static __inline__ __m128i __DEFAULT_FN_ATTRS
688_mm_madd_epi16(__m128i __a, __m128i __b)
689{
690 return (__m128i)__builtin_ia32_pmaddwd128((__v8hi)__a, (__v8hi)__b);
691}
692
693static __inline__ __m128i __DEFAULT_FN_ATTRS
694_mm_max_epi16(__m128i __a, __m128i __b)
695{
696 return (__m128i)__builtin_ia32_pmaxsw128((__v8hi)__a, (__v8hi)__b);
697}
698
699static __inline__ __m128i __DEFAULT_FN_ATTRS
700_mm_max_epu8(__m128i __a, __m128i __b)
701{
702 return (__m128i)__builtin_ia32_pmaxub128((__v16qi)__a, (__v16qi)__b);
703}
704
705static __inline__ __m128i __DEFAULT_FN_ATTRS
706_mm_min_epi16(__m128i __a, __m128i __b)
707{
708 return (__m128i)__builtin_ia32_pminsw128((__v8hi)__a, (__v8hi)__b);
709}
710
711static __inline__ __m128i __DEFAULT_FN_ATTRS
712_mm_min_epu8(__m128i __a, __m128i __b)
713{
714 return (__m128i)__builtin_ia32_pminub128((__v16qi)__a, (__v16qi)__b);
715}
716
717static __inline__ __m128i __DEFAULT_FN_ATTRS
718_mm_mulhi_epi16(__m128i __a, __m128i __b)
719{
720 return (__m128i)__builtin_ia32_pmulhw128((__v8hi)__a, (__v8hi)__b);
721}
722
723static __inline__ __m128i __DEFAULT_FN_ATTRS
724_mm_mulhi_epu16(__m128i __a, __m128i __b)
725{
726 return (__m128i)__builtin_ia32_pmulhuw128((__v8hi)__a, (__v8hi)__b);
727}
728
729static __inline__ __m128i __DEFAULT_FN_ATTRS
730_mm_mullo_epi16(__m128i __a, __m128i __b)
731{
732 return (__m128i)((__v8hi)__a * (__v8hi)__b);
733}
734
735static __inline__ __m64 __DEFAULT_FN_ATTRS
736_mm_mul_su32(__m64 __a, __m64 __b)
737{
738 return __builtin_ia32_pmuludq((__v2si)__a, (__v2si)__b);
739}
740
741static __inline__ __m128i __DEFAULT_FN_ATTRS
742_mm_mul_epu32(__m128i __a, __m128i __b)
743{
744 return __builtin_ia32_pmuludq128((__v4si)__a, (__v4si)__b);
745}
746
747static __inline__ __m128i __DEFAULT_FN_ATTRS
748_mm_sad_epu8(__m128i __a, __m128i __b)
749{
750 return __builtin_ia32_psadbw128((__v16qi)__a, (__v16qi)__b);
751}
752
753static __inline__ __m128i __DEFAULT_FN_ATTRS
754_mm_sub_epi8(__m128i __a, __m128i __b)
755{
756 return (__m128i)((__v16qi)__a - (__v16qi)__b);
757}
758
759static __inline__ __m128i __DEFAULT_FN_ATTRS
760_mm_sub_epi16(__m128i __a, __m128i __b)
761{
762 return (__m128i)((__v8hi)__a - (__v8hi)__b);
763}
764
765static __inline__ __m128i __DEFAULT_FN_ATTRS
766_mm_sub_epi32(__m128i __a, __m128i __b)
767{
768 return (__m128i)((__v4si)__a - (__v4si)__b);
769}
770
771static __inline__ __m64 __DEFAULT_FN_ATTRS
772_mm_sub_si64(__m64 __a, __m64 __b)
773{
774 return __a - __b;
775}
776
777static __inline__ __m128i __DEFAULT_FN_ATTRS
778_mm_sub_epi64(__m128i __a, __m128i __b)
779{
780 return __a - __b;
781}
782
783static __inline__ __m128i __DEFAULT_FN_ATTRS
784_mm_subs_epi8(__m128i __a, __m128i __b)
785{
786 return (__m128i)__builtin_ia32_psubsb128((__v16qi)__a, (__v16qi)__b);
787}
788
789static __inline__ __m128i __DEFAULT_FN_ATTRS
790_mm_subs_epi16(__m128i __a, __m128i __b)
791{
792 return (__m128i)__builtin_ia32_psubsw128((__v8hi)__a, (__v8hi)__b);
793}
794
795static __inline__ __m128i __DEFAULT_FN_ATTRS
796_mm_subs_epu8(__m128i __a, __m128i __b)
797{
798 return (__m128i)__builtin_ia32_psubusb128((__v16qi)__a, (__v16qi)__b);
799}
800
801static __inline__ __m128i __DEFAULT_FN_ATTRS
802_mm_subs_epu16(__m128i __a, __m128i __b)
803{
804 return (__m128i)__builtin_ia32_psubusw128((__v8hi)__a, (__v8hi)__b);
805}
806
807static __inline__ __m128i __DEFAULT_FN_ATTRS
808_mm_and_si128(__m128i __a, __m128i __b)
809{
810 return __a & __b;
811}
812
813static __inline__ __m128i __DEFAULT_FN_ATTRS
814_mm_andnot_si128(__m128i __a, __m128i __b)
815{
816 return ~__a & __b;
817}
818
819static __inline__ __m128i __DEFAULT_FN_ATTRS
820_mm_or_si128(__m128i __a, __m128i __b)
821{
822 return __a | __b;
823}
824
825static __inline__ __m128i __DEFAULT_FN_ATTRS
826_mm_xor_si128(__m128i __a, __m128i __b)
827{
828 return __a ^ __b;
829}
830
831#define _mm_slli_si128(a, imm) __extension__ ({ \
832 (__m128i)__builtin_shufflevector((__v16qi)_mm_setzero_si128(), \
833 (__v16qi)(__m128i)(a), \
834 ((imm)&0xF0) ? 0 : 16 - ((imm)&0xF), \
835 ((imm)&0xF0) ? 0 : 17 - ((imm)&0xF), \
836 ((imm)&0xF0) ? 0 : 18 - ((imm)&0xF), \
837 ((imm)&0xF0) ? 0 : 19 - ((imm)&0xF), \
838 ((imm)&0xF0) ? 0 : 20 - ((imm)&0xF), \
839 ((imm)&0xF0) ? 0 : 21 - ((imm)&0xF), \
840 ((imm)&0xF0) ? 0 : 22 - ((imm)&0xF), \
841 ((imm)&0xF0) ? 0 : 23 - ((imm)&0xF), \
842 ((imm)&0xF0) ? 0 : 24 - ((imm)&0xF), \
843 ((imm)&0xF0) ? 0 : 25 - ((imm)&0xF), \
844 ((imm)&0xF0) ? 0 : 26 - ((imm)&0xF), \
845 ((imm)&0xF0) ? 0 : 27 - ((imm)&0xF), \
846 ((imm)&0xF0) ? 0 : 28 - ((imm)&0xF), \
847 ((imm)&0xF0) ? 0 : 29 - ((imm)&0xF), \
848 ((imm)&0xF0) ? 0 : 30 - ((imm)&0xF), \
849 ((imm)&0xF0) ? 0 : 31 - ((imm)&0xF)); })
850
851#define _mm_bslli_si128(a, imm) \
852 _mm_slli_si128((a), (imm))
853
854static __inline__ __m128i __DEFAULT_FN_ATTRS
855_mm_slli_epi16(__m128i __a, int __count)
856{
857 return (__m128i)__builtin_ia32_psllwi128((__v8hi)__a, __count);
858}
859
860static __inline__ __m128i __DEFAULT_FN_ATTRS
861_mm_sll_epi16(__m128i __a, __m128i __count)
862{
863 return (__m128i)__builtin_ia32_psllw128((__v8hi)__a, (__v8hi)__count);
864}
865
866static __inline__ __m128i __DEFAULT_FN_ATTRS
867_mm_slli_epi32(__m128i __a, int __count)
868{
869 return (__m128i)__builtin_ia32_pslldi128((__v4si)__a, __count);
870}
871
872static __inline__ __m128i __DEFAULT_FN_ATTRS
873_mm_sll_epi32(__m128i __a, __m128i __count)
874{
875 return (__m128i)__builtin_ia32_pslld128((__v4si)__a, (__v4si)__count);
876}
877
878static __inline__ __m128i __DEFAULT_FN_ATTRS
879_mm_slli_epi64(__m128i __a, int __count)
880{
881 return __builtin_ia32_psllqi128(__a, __count);
882}
883
884static __inline__ __m128i __DEFAULT_FN_ATTRS
885_mm_sll_epi64(__m128i __a, __m128i __count)
886{
887 return __builtin_ia32_psllq128(__a, __count);
888}
889
890static __inline__ __m128i __DEFAULT_FN_ATTRS
891_mm_srai_epi16(__m128i __a, int __count)
892{
893 return (__m128i)__builtin_ia32_psrawi128((__v8hi)__a, __count);
894}
895
896static __inline__ __m128i __DEFAULT_FN_ATTRS
897_mm_sra_epi16(__m128i __a, __m128i __count)
898{
899 return (__m128i)__builtin_ia32_psraw128((__v8hi)__a, (__v8hi)__count);
900}
901
902static __inline__ __m128i __DEFAULT_FN_ATTRS
903_mm_srai_epi32(__m128i __a, int __count)
904{
905 return (__m128i)__builtin_ia32_psradi128((__v4si)__a, __count);
906}
907
908static __inline__ __m128i __DEFAULT_FN_ATTRS
909_mm_sra_epi32(__m128i __a, __m128i __count)
910{
911 return (__m128i)__builtin_ia32_psrad128((__v4si)__a, (__v4si)__count);
912}
913
914#define _mm_srli_si128(a, imm) __extension__ ({ \
915 (__m128i)__builtin_shufflevector((__v16qi)(__m128i)(a), \
916 (__v16qi)_mm_setzero_si128(), \
917 ((imm)&0xF0) ? 16 : ((imm)&0xF) + 0, \
918 ((imm)&0xF0) ? 16 : ((imm)&0xF) + 1, \
919 ((imm)&0xF0) ? 16 : ((imm)&0xF) + 2, \
920 ((imm)&0xF0) ? 16 : ((imm)&0xF) + 3, \
921 ((imm)&0xF0) ? 16 : ((imm)&0xF) + 4, \
922 ((imm)&0xF0) ? 16 : ((imm)&0xF) + 5, \
923 ((imm)&0xF0) ? 16 : ((imm)&0xF) + 6, \
924 ((imm)&0xF0) ? 16 : ((imm)&0xF) + 7, \
925 ((imm)&0xF0) ? 16 : ((imm)&0xF) + 8, \
926 ((imm)&0xF0) ? 16 : ((imm)&0xF) + 9, \
927 ((imm)&0xF0) ? 16 : ((imm)&0xF) + 10, \
928 ((imm)&0xF0) ? 16 : ((imm)&0xF) + 11, \
929 ((imm)&0xF0) ? 16 : ((imm)&0xF) + 12, \
930 ((imm)&0xF0) ? 16 : ((imm)&0xF) + 13, \
931 ((imm)&0xF0) ? 16 : ((imm)&0xF) + 14, \
932 ((imm)&0xF0) ? 16 : ((imm)&0xF) + 15); })
933
934#define _mm_bsrli_si128(a, imm) \
935 _mm_srli_si128((a), (imm))
936
937static __inline__ __m128i __DEFAULT_FN_ATTRS
938_mm_srli_epi16(__m128i __a, int __count)
939{
940 return (__m128i)__builtin_ia32_psrlwi128((__v8hi)__a, __count);
941}
942
943static __inline__ __m128i __DEFAULT_FN_ATTRS
944_mm_srl_epi16(__m128i __a, __m128i __count)
945{
946 return (__m128i)__builtin_ia32_psrlw128((__v8hi)__a, (__v8hi)__count);
947}
948
949static __inline__ __m128i __DEFAULT_FN_ATTRS
950_mm_srli_epi32(__m128i __a, int __count)
951{
952 return (__m128i)__builtin_ia32_psrldi128((__v4si)__a, __count);
953}
954
955static __inline__ __m128i __DEFAULT_FN_ATTRS
956_mm_srl_epi32(__m128i __a, __m128i __count)
957{
958 return (__m128i)__builtin_ia32_psrld128((__v4si)__a, (__v4si)__count);
959}
960
961static __inline__ __m128i __DEFAULT_FN_ATTRS
962_mm_srli_epi64(__m128i __a, int __count)
963{
964 return __builtin_ia32_psrlqi128(__a, __count);
965}
966
967static __inline__ __m128i __DEFAULT_FN_ATTRS
968_mm_srl_epi64(__m128i __a, __m128i __count)
969{
970 return __builtin_ia32_psrlq128(__a, __count);
971}
972
973static __inline__ __m128i __DEFAULT_FN_ATTRS
974_mm_cmpeq_epi8(__m128i __a, __m128i __b)
975{
976 return (__m128i)((__v16qi)__a == (__v16qi)__b);
977}
978
979static __inline__ __m128i __DEFAULT_FN_ATTRS
980_mm_cmpeq_epi16(__m128i __a, __m128i __b)
981{
982 return (__m128i)((__v8hi)__a == (__v8hi)__b);
983}
984
985static __inline__ __m128i __DEFAULT_FN_ATTRS
986_mm_cmpeq_epi32(__m128i __a, __m128i __b)
987{
988 return (__m128i)((__v4si)__a == (__v4si)__b);
989}
990
991static __inline__ __m128i __DEFAULT_FN_ATTRS
992_mm_cmpgt_epi8(__m128i __a, __m128i __b)
993{
994 /* This function always performs a signed comparison, but __v16qi is a char
995 which may be signed or unsigned. */
996 typedef signed char __v16qs __attribute__((__vector_size__(16)));
997 return (__m128i)((__v16qs)__a > (__v16qs)__b);
998}
999
1000static __inline__ __m128i __DEFAULT_FN_ATTRS
1001_mm_cmpgt_epi16(__m128i __a, __m128i __b)
1002{
1003 return (__m128i)((__v8hi)__a > (__v8hi)__b);
1004}
1005
1006static __inline__ __m128i __DEFAULT_FN_ATTRS
1007_mm_cmpgt_epi32(__m128i __a, __m128i __b)
1008{
1009 return (__m128i)((__v4si)__a > (__v4si)__b);
1010}
1011
1012static __inline__ __m128i __DEFAULT_FN_ATTRS
1013_mm_cmplt_epi8(__m128i __a, __m128i __b)
1014{
1015 return _mm_cmpgt_epi8(__b, __a);
1016}
1017
1018static __inline__ __m128i __DEFAULT_FN_ATTRS
1019_mm_cmplt_epi16(__m128i __a, __m128i __b)
1020{
1021 return _mm_cmpgt_epi16(__b, __a);
1022}
1023
1024static __inline__ __m128i __DEFAULT_FN_ATTRS
1025_mm_cmplt_epi32(__m128i __a, __m128i __b)
1026{
1027 return _mm_cmpgt_epi32(__b, __a);
1028}
1029
1030#ifdef __x86_64__
1031static __inline__ __m128d __DEFAULT_FN_ATTRS
1032_mm_cvtsi64_sd(__m128d __a, long long __b)
1033{
1034 __a[0] = __b;
1035 return __a;
1036}
1037
1038static __inline__ long long __DEFAULT_FN_ATTRS
1039_mm_cvtsd_si64(__m128d __a)
1040{
1041 return __builtin_ia32_cvtsd2si64(__a);
1042}
1043
1044static __inline__ long long __DEFAULT_FN_ATTRS
1045_mm_cvttsd_si64(__m128d __a)
1046{
1047 return __a[0];
1048}
1049#endif
1050
1051static __inline__ __m128 __DEFAULT_FN_ATTRS
1052_mm_cvtepi32_ps(__m128i __a)
1053{
1054 return __builtin_ia32_cvtdq2ps((__v4si)__a);
1055}
1056
1057static __inline__ __m128i __DEFAULT_FN_ATTRS
1058_mm_cvtps_epi32(__m128 __a)
1059{
1060 return (__m128i)__builtin_ia32_cvtps2dq(__a);
1061}
1062
1063static __inline__ __m128i __DEFAULT_FN_ATTRS
1064_mm_cvttps_epi32(__m128 __a)
1065{
1066 return (__m128i)__builtin_ia32_cvttps2dq(__a);
1067}
1068
1069static __inline__ __m128i __DEFAULT_FN_ATTRS
1070_mm_cvtsi32_si128(int __a)
1071{
1072 return (__m128i)(__v4si){ __a, 0, 0, 0 };
1073}
1074
1075#ifdef __x86_64__
1076static __inline__ __m128i __DEFAULT_FN_ATTRS
1077_mm_cvtsi64_si128(long long __a)
1078{
1079 return (__m128i){ __a, 0 };
1080}
1081#endif
1082
1083static __inline__ int __DEFAULT_FN_ATTRS
1084_mm_cvtsi128_si32(__m128i __a)
1085{
1086 __v4si __b = (__v4si)__a;
1087 return __b[0];
1088}
1089
1090#ifdef __x86_64__
1091static __inline__ long long __DEFAULT_FN_ATTRS
1092_mm_cvtsi128_si64(__m128i __a)
1093{
1094 return __a[0];
1095}
1096#endif
1097
1098static __inline__ __m128i __DEFAULT_FN_ATTRS
1099_mm_load_si128(__m128i const *__p)
1100{
1101 return *__p;
1102}
1103
1104static __inline__ __m128i __DEFAULT_FN_ATTRS
1105_mm_loadu_si128(__m128i const *__p)
1106{
1107 struct __loadu_si128 {
1108 __m128i __v;
1109 } __attribute__((__packed__, __may_alias__));
1110 return ((struct __loadu_si128*)__p)->__v;
1111}
1112
1113static __inline__ __m128i __DEFAULT_FN_ATTRS
1114_mm_loadl_epi64(__m128i const *__p)
1115{
1116 struct __mm_loadl_epi64_struct {
1117 long long __u;
1118 } __attribute__((__packed__, __may_alias__));
1119 return (__m128i) { ((struct __mm_loadl_epi64_struct*)__p)->__u, 0};
1120}
1121
1122static __inline__ __m128i __DEFAULT_FN_ATTRS
1123_mm_set_epi64x(long long q1, long long q0)
1124{
1125 return (__m128i){ q0, q1 };
1126}
1127
1128static __inline__ __m128i __DEFAULT_FN_ATTRS
1129_mm_set_epi64(__m64 q1, __m64 q0)
1130{
1131 return (__m128i){ (long long)q0, (long long)q1 };
1132}
1133
1134static __inline__ __m128i __DEFAULT_FN_ATTRS
1135_mm_set_epi32(int i3, int i2, int i1, int i0)
1136{
1137 return (__m128i)(__v4si){ i0, i1, i2, i3};
1138}
1139
1140static __inline__ __m128i __DEFAULT_FN_ATTRS
1141_mm_set_epi16(short w7, short w6, short w5, short w4, short w3, short w2, short w1, short w0)
1142{
1143 return (__m128i)(__v8hi){ w0, w1, w2, w3, w4, w5, w6, w7 };
1144}
1145
1146static __inline__ __m128i __DEFAULT_FN_ATTRS
1147_mm_set_epi8(char b15, char b14, char b13, char b12, char b11, char b10, char b9, char b8, char b7, char b6, char b5, char b4, char b3, char b2, char b1, char b0)
1148{
1149 return (__m128i)(__v16qi){ b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15 };
1150}
1151
1152static __inline__ __m128i __DEFAULT_FN_ATTRS
1153_mm_set1_epi64x(long long __q)
1154{
1155 return (__m128i){ __q, __q };
1156}
1157
1158static __inline__ __m128i __DEFAULT_FN_ATTRS
1159_mm_set1_epi64(__m64 __q)
1160{
1161 return (__m128i){ (long long)__q, (long long)__q };
1162}
1163
1164static __inline__ __m128i __DEFAULT_FN_ATTRS
1165_mm_set1_epi32(int __i)
1166{
1167 return (__m128i)(__v4si){ __i, __i, __i, __i };
1168}
1169
1170static __inline__ __m128i __DEFAULT_FN_ATTRS
1171_mm_set1_epi16(short __w)
1172{
1173 return (__m128i)(__v8hi){ __w, __w, __w, __w, __w, __w, __w, __w };
1174}
1175
1176static __inline__ __m128i __DEFAULT_FN_ATTRS
1177_mm_set1_epi8(char __b)
1178{
1179 return (__m128i)(__v16qi){ __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b, __b };
1180}
1181
1182static __inline__ __m128i __DEFAULT_FN_ATTRS
1183_mm_setr_epi64(__m64 q0, __m64 q1)
1184{
1185 return (__m128i){ (long long)q0, (long long)q1 };
1186}
1187
1188static __inline__ __m128i __DEFAULT_FN_ATTRS
1189_mm_setr_epi32(int i0, int i1, int i2, int i3)
1190{
1191 return (__m128i)(__v4si){ i0, i1, i2, i3};
1192}
1193
1194static __inline__ __m128i __DEFAULT_FN_ATTRS
1195_mm_setr_epi16(short w0, short w1, short w2, short w3, short w4, short w5, short w6, short w7)
1196{
1197 return (__m128i)(__v8hi){ w0, w1, w2, w3, w4, w5, w6, w7 };
1198}
1199
1200static __inline__ __m128i __DEFAULT_FN_ATTRS
1201_mm_setr_epi8(char b0, char b1, char b2, char b3, char b4, char b5, char b6, char b7, char b8, char b9, char b10, char b11, char b12, char b13, char b14, char b15)
1202{
1203 return (__m128i)(__v16qi){ b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15 };
1204}
1205
1206static __inline__ __m128i __DEFAULT_FN_ATTRS
1207_mm_setzero_si128(void)
1208{
1209 return (__m128i){ 0LL, 0LL };
1210}
1211
1212static __inline__ void __DEFAULT_FN_ATTRS
1213_mm_store_si128(__m128i *__p, __m128i __b)
1214{
1215 *__p = __b;
1216}
1217
1218static __inline__ void __DEFAULT_FN_ATTRS
1219_mm_storeu_si128(__m128i *__p, __m128i __b)
1220{
1221 __builtin_ia32_storedqu((char *)__p, (__v16qi)__b);
1222}
1223
1224static __inline__ void __DEFAULT_FN_ATTRS
1225_mm_maskmoveu_si128(__m128i __d, __m128i __n, char *__p)
1226{
1227 __builtin_ia32_maskmovdqu((__v16qi)__d, (__v16qi)__n, __p);
1228}
1229
1230static __inline__ void __DEFAULT_FN_ATTRS
1231_mm_storel_epi64(__m128i *__p, __m128i __a)
1232{
1233 struct __mm_storel_epi64_struct {
1234 long long __u;
1235 } __attribute__((__packed__, __may_alias__));
1236 ((struct __mm_storel_epi64_struct*)__p)->__u = __a[0];
1237}
1238
1239static __inline__ void __DEFAULT_FN_ATTRS
1240_mm_stream_pd(double *__p, __m128d __a)
1241{
1242 __builtin_ia32_movntpd(__p, __a);
1243}
1244
1245static __inline__ void __DEFAULT_FN_ATTRS
1246_mm_stream_si128(__m128i *__p, __m128i __a)
1247{
1248 __builtin_ia32_movntdq(__p, __a);
1249}
1250
1251static __inline__ void __DEFAULT_FN_ATTRS
1252_mm_stream_si32(int *__p, int __a)
1253{
1254 __builtin_ia32_movnti(__p, __a);
1255}
1256
1257#ifdef __x86_64__
1258static __inline__ void __DEFAULT_FN_ATTRS
1259_mm_stream_si64(long long *__p, long long __a)
1260{
1261 __builtin_ia32_movnti64(__p, __a);
1262}
1263#endif
1264
1265static __inline__ void __DEFAULT_FN_ATTRS
1266_mm_clflush(void const *__p)
1267{
1268 __builtin_ia32_clflush(__p);
1269}
1270
1271static __inline__ void __DEFAULT_FN_ATTRS
1272_mm_lfence(void)
1273{
1274 __builtin_ia32_lfence();
1275}
1276
1277static __inline__ void __DEFAULT_FN_ATTRS
1278_mm_mfence(void)
1279{
1280 __builtin_ia32_mfence();
1281}
1282
1283static __inline__ __m128i __DEFAULT_FN_ATTRS
1284_mm_packs_epi16(__m128i __a, __m128i __b)
1285{
1286 return (__m128i)__builtin_ia32_packsswb128((__v8hi)__a, (__v8hi)__b);
1287}
1288
1289static __inline__ __m128i __DEFAULT_FN_ATTRS
1290_mm_packs_epi32(__m128i __a, __m128i __b)
1291{
1292 return (__m128i)__builtin_ia32_packssdw128((__v4si)__a, (__v4si)__b);
1293}
1294
1295static __inline__ __m128i __DEFAULT_FN_ATTRS
1296_mm_packus_epi16(__m128i __a, __m128i __b)
1297{
1298 return (__m128i)__builtin_ia32_packuswb128((__v8hi)__a, (__v8hi)__b);
1299}
1300
1301static __inline__ int __DEFAULT_FN_ATTRS
1302_mm_extract_epi16(__m128i __a, int __imm)
1303{
1304 __v8hi __b = (__v8hi)__a;
1305 return (unsigned short)__b[__imm & 7];
1306}
1307
1308static __inline__ __m128i __DEFAULT_FN_ATTRS
1309_mm_insert_epi16(__m128i __a, int __b, int __imm)
1310{
1311 __v8hi __c = (__v8hi)__a;
1312 __c[__imm & 7] = __b;
1313 return (__m128i)__c;
1314}
1315
1316static __inline__ int __DEFAULT_FN_ATTRS
1317_mm_movemask_epi8(__m128i __a)
1318{
1319 return __builtin_ia32_pmovmskb128((__v16qi)__a);
1320}
1321
1322#define _mm_shuffle_epi32(a, imm) __extension__ ({ \
1323 (__m128i)__builtin_shufflevector((__v4si)(__m128i)(a), \
1324 (__v4si)_mm_set1_epi32(0), \
1325 (imm) & 0x3, ((imm) & 0xc) >> 2, \
1326 ((imm) & 0x30) >> 4, ((imm) & 0xc0) >> 6); })
1327
1328#define _mm_shufflelo_epi16(a, imm) __extension__ ({ \
1329 (__m128i)__builtin_shufflevector((__v8hi)(__m128i)(a), \
1330 (__v8hi)_mm_set1_epi16(0), \
1331 (imm) & 0x3, ((imm) & 0xc) >> 2, \
1332 ((imm) & 0x30) >> 4, ((imm) & 0xc0) >> 6, \
1333 4, 5, 6, 7); })
1334
1335#define _mm_shufflehi_epi16(a, imm) __extension__ ({ \
1336 (__m128i)__builtin_shufflevector((__v8hi)(__m128i)(a), \
1337 (__v8hi)_mm_set1_epi16(0), \
1338 0, 1, 2, 3, \
1339 4 + (((imm) & 0x03) >> 0), \
1340 4 + (((imm) & 0x0c) >> 2), \
1341 4 + (((imm) & 0x30) >> 4), \
1342 4 + (((imm) & 0xc0) >> 6)); })
1343
1344static __inline__ __m128i __DEFAULT_FN_ATTRS
1345_mm_unpackhi_epi8(__m128i __a, __m128i __b)
1346{
1347 return (__m128i)__builtin_shufflevector((__v16qi)__a, (__v16qi)__b, 8, 16+8, 9, 16+9, 10, 16+10, 11, 16+11, 12, 16+12, 13, 16+13, 14, 16+14, 15, 16+15);
1348}
1349
1350static __inline__ __m128i __DEFAULT_FN_ATTRS
1351_mm_unpackhi_epi16(__m128i __a, __m128i __b)
1352{
1353 return (__m128i)__builtin_shufflevector((__v8hi)__a, (__v8hi)__b, 4, 8+4, 5, 8+5, 6, 8+6, 7, 8+7);
1354}
1355
1356static __inline__ __m128i __DEFAULT_FN_ATTRS
1357_mm_unpackhi_epi32(__m128i __a, __m128i __b)
1358{
1359 return (__m128i)__builtin_shufflevector((__v4si)__a, (__v4si)__b, 2, 4+2, 3, 4+3);
1360}
1361
1362static __inline__ __m128i __DEFAULT_FN_ATTRS
1363_mm_unpackhi_epi64(__m128i __a, __m128i __b)
1364{
1365 return (__m128i)__builtin_shufflevector(__a, __b, 1, 2+1);
1366}
1367
1368static __inline__ __m128i __DEFAULT_FN_ATTRS
1369_mm_unpacklo_epi8(__m128i __a, __m128i __b)
1370{
1371 return (__m128i)__builtin_shufflevector((__v16qi)__a, (__v16qi)__b, 0, 16+0, 1, 16+1, 2, 16+2, 3, 16+3, 4, 16+4, 5, 16+5, 6, 16+6, 7, 16+7);
1372}
1373
1374static __inline__ __m128i __DEFAULT_FN_ATTRS
1375_mm_unpacklo_epi16(__m128i __a, __m128i __b)
1376{
1377 return (__m128i)__builtin_shufflevector((__v8hi)__a, (__v8hi)__b, 0, 8+0, 1, 8+1, 2, 8+2, 3, 8+3);
1378}
1379
1380static __inline__ __m128i __DEFAULT_FN_ATTRS
1381_mm_unpacklo_epi32(__m128i __a, __m128i __b)
1382{
1383 return (__m128i)__builtin_shufflevector((__v4si)__a, (__v4si)__b, 0, 4+0, 1, 4+1);
1384}
1385
1386static __inline__ __m128i __DEFAULT_FN_ATTRS
1387_mm_unpacklo_epi64(__m128i __a, __m128i __b)
1388{
1389 return (__m128i)__builtin_shufflevector(__a, __b, 0, 2+0);
1390}
1391
1392static __inline__ __m64 __DEFAULT_FN_ATTRS
1393_mm_movepi64_pi64(__m128i __a)
1394{
1395 return (__m64)__a[0];
1396}
1397
1398static __inline__ __m128i __DEFAULT_FN_ATTRS
1399_mm_movpi64_epi64(__m64 __a)
1400{
1401 return (__m128i){ (long long)__a, 0 };
1402}
1403
1404static __inline__ __m128i __DEFAULT_FN_ATTRS
1405_mm_move_epi64(__m128i __a)
1406{
1407 return __builtin_shufflevector(__a, (__m128i){ 0 }, 0, 2);
1408}
1409
1410static __inline__ __m128d __DEFAULT_FN_ATTRS
1411_mm_unpackhi_pd(__m128d __a, __m128d __b)
1412{
1413 return __builtin_shufflevector(__a, __b, 1, 2+1);
1414}
1415
1416static __inline__ __m128d __DEFAULT_FN_ATTRS
1417_mm_unpacklo_pd(__m128d __a, __m128d __b)
1418{
1419 return __builtin_shufflevector(__a, __b, 0, 2+0);
1420}
1421
1422static __inline__ int __DEFAULT_FN_ATTRS
1423_mm_movemask_pd(__m128d __a)
1424{
1425 return __builtin_ia32_movmskpd(__a);
1426}
1427
1428#define _mm_shuffle_pd(a, b, i) __extension__ ({ \
1429 __builtin_shufflevector((__m128d)(a), (__m128d)(b), \
1430 (i) & 1, (((i) & 2) >> 1) + 2); })
1431
1432static __inline__ __m128 __DEFAULT_FN_ATTRS
1433_mm_castpd_ps(__m128d __a)
1434{
1435 return (__m128)__a;
1436}
1437
1438static __inline__ __m128i __DEFAULT_FN_ATTRS
1439_mm_castpd_si128(__m128d __a)
1440{
1441 return (__m128i)__a;
1442}
1443
1444static __inline__ __m128d __DEFAULT_FN_ATTRS
1445_mm_castps_pd(__m128 __a)
1446{
1447 return (__m128d)__a;
1448}
1449
1450static __inline__ __m128i __DEFAULT_FN_ATTRS
1451_mm_castps_si128(__m128 __a)
1452{
1453 return (__m128i)__a;
1454}
1455
1456static __inline__ __m128 __DEFAULT_FN_ATTRS
1457_mm_castsi128_ps(__m128i __a)
1458{
1459 return (__m128)__a;
1460}
1461
1462static __inline__ __m128d __DEFAULT_FN_ATTRS
1463_mm_castsi128_pd(__m128i __a)
1464{
1465 return (__m128d)__a;
1466}
1467
1468static __inline__ void __DEFAULT_FN_ATTRS
1469_mm_pause(void)
1470{
1471 __asm__ volatile ("pause");
1472}
1473
1474#undef __DEFAULT_FN_ATTRS
1475
1476#define _MM_SHUFFLE2(x, y) (((x) << 1) | (y))
1477
1478#endif /* __SSE2__ */
1479
1480#endif /* __EMMINTRIN_H */
c_headers/f16cintrin.h created+63
......@@ -0,0 +1,63 @@
1/*===---- f16cintrin.h - F16C intrinsics -----------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
25#error "Never use <f16cintrin.h> directly; include <x86intrin.h> instead."
26#endif
27
28#ifndef __F16C__
29# error "F16C instruction is not enabled"
30#endif /* __F16C__ */
31
32#ifndef __F16CINTRIN_H
33#define __F16CINTRIN_H
34
35typedef float __v8sf __attribute__ ((__vector_size__ (32)));
36typedef float __m256 __attribute__ ((__vector_size__ (32)));
37
38/* Define the default attributes for the functions in this file. */
39#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
40
41#define _mm_cvtps_ph(a, imm) __extension__ ({ \
42 __m128 __a = (a); \
43 (__m128i)__builtin_ia32_vcvtps2ph((__v4sf)__a, (imm)); })
44
45#define _mm256_cvtps_ph(a, imm) __extension__ ({ \
46 __m256 __a = (a); \
47 (__m128i)__builtin_ia32_vcvtps2ph256((__v8sf)__a, (imm)); })
48
49static __inline __m128 __DEFAULT_FN_ATTRS
50_mm_cvtph_ps(__m128i __a)
51{
52 return (__m128)__builtin_ia32_vcvtph2ps((__v8hi)__a);
53}
54
55static __inline __m256 __DEFAULT_FN_ATTRS
56_mm256_cvtph_ps(__m128i __a)
57{
58 return (__m256)__builtin_ia32_vcvtph2ps256((__v8hi)__a);
59}
60
61#undef __DEFAULT_FN_ATTRS
62
63#endif /* __F16CINTRIN_H */
c_headers/float.h created+124
......@@ -0,0 +1,124 @@
1/*===---- float.h - Characteristics of floating point types ----------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __FLOAT_H
25#define __FLOAT_H
26
27/* If we're on MinGW, fall back to the system's float.h, which might have
28 * additional definitions provided for Windows.
29 * For more details see http://msdn.microsoft.com/en-us/library/y0ybw9fy.aspx
30 */
31#if (defined(__MINGW32__) || defined(_MSC_VER)) && __STDC_HOSTED__ && \
32 __has_include_next(<float.h>)
33# include_next <float.h>
34
35/* Undefine anything that we'll be redefining below. */
36# undef FLT_EVAL_METHOD
37# undef FLT_ROUNDS
38# undef FLT_RADIX
39# undef FLT_MANT_DIG
40# undef DBL_MANT_DIG
41# undef LDBL_MANT_DIG
42# undef DECIMAL_DIG
43# undef FLT_DIG
44# undef DBL_DIG
45# undef LDBL_DIG
46# undef FLT_MIN_EXP
47# undef DBL_MIN_EXP
48# undef LDBL_MIN_EXP
49# undef FLT_MIN_10_EXP
50# undef DBL_MIN_10_EXP
51# undef LDBL_MIN_10_EXP
52# undef FLT_MAX_EXP
53# undef DBL_MAX_EXP
54# undef LDBL_MAX_EXP
55# undef FLT_MAX_10_EXP
56# undef DBL_MAX_10_EXP
57# undef LDBL_MAX_10_EXP
58# undef FLT_MAX
59# undef DBL_MAX
60# undef LDBL_MAX
61# undef FLT_EPSILON
62# undef DBL_EPSILON
63# undef LDBL_EPSILON
64# undef FLT_MIN
65# undef DBL_MIN
66# undef LDBL_MIN
67# if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__)
68# undef FLT_TRUE_MIN
69# undef DBL_TRUE_MIN
70# undef LDBL_TRUE_MIN
71# endif
72#endif
73
74/* Characteristics of floating point types, C99 5.2.4.2.2 */
75
76#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
77#define FLT_ROUNDS (__builtin_flt_rounds())
78#define FLT_RADIX __FLT_RADIX__
79
80#define FLT_MANT_DIG __FLT_MANT_DIG__
81#define DBL_MANT_DIG __DBL_MANT_DIG__
82#define LDBL_MANT_DIG __LDBL_MANT_DIG__
83
84#define DECIMAL_DIG __DECIMAL_DIG__
85
86#define FLT_DIG __FLT_DIG__
87#define DBL_DIG __DBL_DIG__
88#define LDBL_DIG __LDBL_DIG__
89
90#define FLT_MIN_EXP __FLT_MIN_EXP__
91#define DBL_MIN_EXP __DBL_MIN_EXP__
92#define LDBL_MIN_EXP __LDBL_MIN_EXP__
93
94#define FLT_MIN_10_EXP __FLT_MIN_10_EXP__
95#define DBL_MIN_10_EXP __DBL_MIN_10_EXP__
96#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__
97
98#define FLT_MAX_EXP __FLT_MAX_EXP__
99#define DBL_MAX_EXP __DBL_MAX_EXP__
100#define LDBL_MAX_EXP __LDBL_MAX_EXP__
101
102#define FLT_MAX_10_EXP __FLT_MAX_10_EXP__
103#define DBL_MAX_10_EXP __DBL_MAX_10_EXP__
104#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__
105
106#define FLT_MAX __FLT_MAX__
107#define DBL_MAX __DBL_MAX__
108#define LDBL_MAX __LDBL_MAX__
109
110#define FLT_EPSILON __FLT_EPSILON__
111#define DBL_EPSILON __DBL_EPSILON__
112#define LDBL_EPSILON __LDBL_EPSILON__
113
114#define FLT_MIN __FLT_MIN__
115#define DBL_MIN __DBL_MIN__
116#define LDBL_MIN __LDBL_MIN__
117
118#if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__)
119# define FLT_TRUE_MIN __FLT_DENORM_MIN__
120# define DBL_TRUE_MIN __DBL_DENORM_MIN__
121# define LDBL_TRUE_MIN __LDBL_DENORM_MIN__
122#endif
123
124#endif /* __FLOAT_H */
c_headers/fma4intrin.h created+236
......@@ -0,0 +1,236 @@
1/*===---- fma4intrin.h - FMA4 intrinsics -----------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __X86INTRIN_H
25#error "Never use <fma4intrin.h> directly; include <x86intrin.h> instead."
26#endif
27
28#ifndef __FMA4INTRIN_H
29#define __FMA4INTRIN_H
30
31#ifndef __FMA4__
32# error "FMA4 instruction set is not enabled"
33#else
34
35#include <pmmintrin.h>
36
37/* Define the default attributes for the functions in this file. */
38#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
39
40static __inline__ __m128 __DEFAULT_FN_ATTRS
41_mm_macc_ps(__m128 __A, __m128 __B, __m128 __C)
42{
43 return (__m128)__builtin_ia32_vfmaddps(__A, __B, __C);
44}
45
46static __inline__ __m128d __DEFAULT_FN_ATTRS
47_mm_macc_pd(__m128d __A, __m128d __B, __m128d __C)
48{
49 return (__m128d)__builtin_ia32_vfmaddpd(__A, __B, __C);
50}
51
52static __inline__ __m128 __DEFAULT_FN_ATTRS
53_mm_macc_ss(__m128 __A, __m128 __B, __m128 __C)
54{
55 return (__m128)__builtin_ia32_vfmaddss(__A, __B, __C);
56}
57
58static __inline__ __m128d __DEFAULT_FN_ATTRS
59_mm_macc_sd(__m128d __A, __m128d __B, __m128d __C)
60{
61 return (__m128d)__builtin_ia32_vfmaddsd(__A, __B, __C);
62}
63
64static __inline__ __m128 __DEFAULT_FN_ATTRS
65_mm_msub_ps(__m128 __A, __m128 __B, __m128 __C)
66{
67 return (__m128)__builtin_ia32_vfmsubps(__A, __B, __C);
68}
69
70static __inline__ __m128d __DEFAULT_FN_ATTRS
71_mm_msub_pd(__m128d __A, __m128d __B, __m128d __C)
72{
73 return (__m128d)__builtin_ia32_vfmsubpd(__A, __B, __C);
74}
75
76static __inline__ __m128 __DEFAULT_FN_ATTRS
77_mm_msub_ss(__m128 __A, __m128 __B, __m128 __C)
78{
79 return (__m128)__builtin_ia32_vfmsubss(__A, __B, __C);
80}
81
82static __inline__ __m128d __DEFAULT_FN_ATTRS
83_mm_msub_sd(__m128d __A, __m128d __B, __m128d __C)
84{
85 return (__m128d)__builtin_ia32_vfmsubsd(__A, __B, __C);
86}
87
88static __inline__ __m128 __DEFAULT_FN_ATTRS
89_mm_nmacc_ps(__m128 __A, __m128 __B, __m128 __C)
90{
91 return (__m128)__builtin_ia32_vfnmaddps(__A, __B, __C);
92}
93
94static __inline__ __m128d __DEFAULT_FN_ATTRS
95_mm_nmacc_pd(__m128d __A, __m128d __B, __m128d __C)
96{
97 return (__m128d)__builtin_ia32_vfnmaddpd(__A, __B, __C);
98}
99
100static __inline__ __m128 __DEFAULT_FN_ATTRS
101_mm_nmacc_ss(__m128 __A, __m128 __B, __m128 __C)
102{
103 return (__m128)__builtin_ia32_vfnmaddss(__A, __B, __C);
104}
105
106static __inline__ __m128d __DEFAULT_FN_ATTRS
107_mm_nmacc_sd(__m128d __A, __m128d __B, __m128d __C)
108{
109 return (__m128d)__builtin_ia32_vfnmaddsd(__A, __B, __C);
110}
111
112static __inline__ __m128 __DEFAULT_FN_ATTRS
113_mm_nmsub_ps(__m128 __A, __m128 __B, __m128 __C)
114{
115 return (__m128)__builtin_ia32_vfnmsubps(__A, __B, __C);
116}
117
118static __inline__ __m128d __DEFAULT_FN_ATTRS
119_mm_nmsub_pd(__m128d __A, __m128d __B, __m128d __C)
120{
121 return (__m128d)__builtin_ia32_vfnmsubpd(__A, __B, __C);
122}
123
124static __inline__ __m128 __DEFAULT_FN_ATTRS
125_mm_nmsub_ss(__m128 __A, __m128 __B, __m128 __C)
126{
127 return (__m128)__builtin_ia32_vfnmsubss(__A, __B, __C);
128}
129
130static __inline__ __m128d __DEFAULT_FN_ATTRS
131_mm_nmsub_sd(__m128d __A, __m128d __B, __m128d __C)
132{
133 return (__m128d)__builtin_ia32_vfnmsubsd(__A, __B, __C);
134}
135
136static __inline__ __m128 __DEFAULT_FN_ATTRS
137_mm_maddsub_ps(__m128 __A, __m128 __B, __m128 __C)
138{
139 return (__m128)__builtin_ia32_vfmaddsubps(__A, __B, __C);
140}
141
142static __inline__ __m128d __DEFAULT_FN_ATTRS
143_mm_maddsub_pd(__m128d __A, __m128d __B, __m128d __C)
144{
145 return (__m128d)__builtin_ia32_vfmaddsubpd(__A, __B, __C);
146}
147
148static __inline__ __m128 __DEFAULT_FN_ATTRS
149_mm_msubadd_ps(__m128 __A, __m128 __B, __m128 __C)
150{
151 return (__m128)__builtin_ia32_vfmsubaddps(__A, __B, __C);
152}
153
154static __inline__ __m128d __DEFAULT_FN_ATTRS
155_mm_msubadd_pd(__m128d __A, __m128d __B, __m128d __C)
156{
157 return (__m128d)__builtin_ia32_vfmsubaddpd(__A, __B, __C);
158}
159
160static __inline__ __m256 __DEFAULT_FN_ATTRS
161_mm256_macc_ps(__m256 __A, __m256 __B, __m256 __C)
162{
163 return (__m256)__builtin_ia32_vfmaddps256(__A, __B, __C);
164}
165
166static __inline__ __m256d __DEFAULT_FN_ATTRS
167_mm256_macc_pd(__m256d __A, __m256d __B, __m256d __C)
168{
169 return (__m256d)__builtin_ia32_vfmaddpd256(__A, __B, __C);
170}
171
172static __inline__ __m256 __DEFAULT_FN_ATTRS
173_mm256_msub_ps(__m256 __A, __m256 __B, __m256 __C)
174{
175 return (__m256)__builtin_ia32_vfmsubps256(__A, __B, __C);
176}
177
178static __inline__ __m256d __DEFAULT_FN_ATTRS
179_mm256_msub_pd(__m256d __A, __m256d __B, __m256d __C)
180{
181 return (__m256d)__builtin_ia32_vfmsubpd256(__A, __B, __C);
182}
183
184static __inline__ __m256 __DEFAULT_FN_ATTRS
185_mm256_nmacc_ps(__m256 __A, __m256 __B, __m256 __C)
186{
187 return (__m256)__builtin_ia32_vfnmaddps256(__A, __B, __C);
188}
189
190static __inline__ __m256d __DEFAULT_FN_ATTRS
191_mm256_nmacc_pd(__m256d __A, __m256d __B, __m256d __C)
192{
193 return (__m256d)__builtin_ia32_vfnmaddpd256(__A, __B, __C);
194}
195
196static __inline__ __m256 __DEFAULT_FN_ATTRS
197_mm256_nmsub_ps(__m256 __A, __m256 __B, __m256 __C)
198{
199 return (__m256)__builtin_ia32_vfnmsubps256(__A, __B, __C);
200}
201
202static __inline__ __m256d __DEFAULT_FN_ATTRS
203_mm256_nmsub_pd(__m256d __A, __m256d __B, __m256d __C)
204{
205 return (__m256d)__builtin_ia32_vfnmsubpd256(__A, __B, __C);
206}
207
208static __inline__ __m256 __DEFAULT_FN_ATTRS
209_mm256_maddsub_ps(__m256 __A, __m256 __B, __m256 __C)
210{
211 return (__m256)__builtin_ia32_vfmaddsubps256(__A, __B, __C);
212}
213
214static __inline__ __m256d __DEFAULT_FN_ATTRS
215_mm256_maddsub_pd(__m256d __A, __m256d __B, __m256d __C)
216{
217 return (__m256d)__builtin_ia32_vfmaddsubpd256(__A, __B, __C);
218}
219
220static __inline__ __m256 __DEFAULT_FN_ATTRS
221_mm256_msubadd_ps(__m256 __A, __m256 __B, __m256 __C)
222{
223 return (__m256)__builtin_ia32_vfmsubaddps256(__A, __B, __C);
224}
225
226static __inline__ __m256d __DEFAULT_FN_ATTRS
227_mm256_msubadd_pd(__m256d __A, __m256d __B, __m256d __C)
228{
229 return (__m256d)__builtin_ia32_vfmsubaddpd256(__A, __B, __C);
230}
231
232#undef __DEFAULT_FN_ATTRS
233
234#endif /* __FMA4__ */
235
236#endif /* __FMA4INTRIN_H */
c_headers/fmaintrin.h created+234
......@@ -0,0 +1,234 @@
1/*===---- fma4intrin.h - FMA4 intrinsics -----------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __IMMINTRIN_H
25#error "Never use <fmaintrin.h> directly; include <immintrin.h> instead."
26#endif
27
28#ifndef __FMAINTRIN_H
29#define __FMAINTRIN_H
30
31#ifndef __FMA__
32# error "FMA instruction set is not enabled"
33#else
34
35/* Define the default attributes for the functions in this file. */
36#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
37
38static __inline__ __m128 __DEFAULT_FN_ATTRS
39_mm_fmadd_ps(__m128 __A, __m128 __B, __m128 __C)
40{
41 return (__m128)__builtin_ia32_vfmaddps(__A, __B, __C);
42}
43
44static __inline__ __m128d __DEFAULT_FN_ATTRS
45_mm_fmadd_pd(__m128d __A, __m128d __B, __m128d __C)
46{
47 return (__m128d)__builtin_ia32_vfmaddpd(__A, __B, __C);
48}
49
50static __inline__ __m128 __DEFAULT_FN_ATTRS
51_mm_fmadd_ss(__m128 __A, __m128 __B, __m128 __C)
52{
53 return (__m128)__builtin_ia32_vfmaddss(__A, __B, __C);
54}
55
56static __inline__ __m128d __DEFAULT_FN_ATTRS
57_mm_fmadd_sd(__m128d __A, __m128d __B, __m128d __C)
58{
59 return (__m128d)__builtin_ia32_vfmaddsd(__A, __B, __C);
60}
61
62static __inline__ __m128 __DEFAULT_FN_ATTRS
63_mm_fmsub_ps(__m128 __A, __m128 __B, __m128 __C)
64{
65 return (__m128)__builtin_ia32_vfmsubps(__A, __B, __C);
66}
67
68static __inline__ __m128d __DEFAULT_FN_ATTRS
69_mm_fmsub_pd(__m128d __A, __m128d __B, __m128d __C)
70{
71 return (__m128d)__builtin_ia32_vfmsubpd(__A, __B, __C);
72}
73
74static __inline__ __m128 __DEFAULT_FN_ATTRS
75_mm_fmsub_ss(__m128 __A, __m128 __B, __m128 __C)
76{
77 return (__m128)__builtin_ia32_vfmsubss(__A, __B, __C);
78}
79
80static __inline__ __m128d __DEFAULT_FN_ATTRS
81_mm_fmsub_sd(__m128d __A, __m128d __B, __m128d __C)
82{
83 return (__m128d)__builtin_ia32_vfmsubsd(__A, __B, __C);
84}
85
86static __inline__ __m128 __DEFAULT_FN_ATTRS
87_mm_fnmadd_ps(__m128 __A, __m128 __B, __m128 __C)
88{
89 return (__m128)__builtin_ia32_vfnmaddps(__A, __B, __C);
90}
91
92static __inline__ __m128d __DEFAULT_FN_ATTRS
93_mm_fnmadd_pd(__m128d __A, __m128d __B, __m128d __C)
94{
95 return (__m128d)__builtin_ia32_vfnmaddpd(__A, __B, __C);
96}
97
98static __inline__ __m128 __DEFAULT_FN_ATTRS
99_mm_fnmadd_ss(__m128 __A, __m128 __B, __m128 __C)
100{
101 return (__m128)__builtin_ia32_vfnmaddss(__A, __B, __C);
102}
103
104static __inline__ __m128d __DEFAULT_FN_ATTRS
105_mm_fnmadd_sd(__m128d __A, __m128d __B, __m128d __C)
106{
107 return (__m128d)__builtin_ia32_vfnmaddsd(__A, __B, __C);
108}
109
110static __inline__ __m128 __DEFAULT_FN_ATTRS
111_mm_fnmsub_ps(__m128 __A, __m128 __B, __m128 __C)
112{
113 return (__m128)__builtin_ia32_vfnmsubps(__A, __B, __C);
114}
115
116static __inline__ __m128d __DEFAULT_FN_ATTRS
117_mm_fnmsub_pd(__m128d __A, __m128d __B, __m128d __C)
118{
119 return (__m128d)__builtin_ia32_vfnmsubpd(__A, __B, __C);
120}
121
122static __inline__ __m128 __DEFAULT_FN_ATTRS
123_mm_fnmsub_ss(__m128 __A, __m128 __B, __m128 __C)
124{
125 return (__m128)__builtin_ia32_vfnmsubss(__A, __B, __C);
126}
127
128static __inline__ __m128d __DEFAULT_FN_ATTRS
129_mm_fnmsub_sd(__m128d __A, __m128d __B, __m128d __C)
130{
131 return (__m128d)__builtin_ia32_vfnmsubsd(__A, __B, __C);
132}
133
134static __inline__ __m128 __DEFAULT_FN_ATTRS
135_mm_fmaddsub_ps(__m128 __A, __m128 __B, __m128 __C)
136{
137 return (__m128)__builtin_ia32_vfmaddsubps(__A, __B, __C);
138}
139
140static __inline__ __m128d __DEFAULT_FN_ATTRS
141_mm_fmaddsub_pd(__m128d __A, __m128d __B, __m128d __C)
142{
143 return (__m128d)__builtin_ia32_vfmaddsubpd(__A, __B, __C);
144}
145
146static __inline__ __m128 __DEFAULT_FN_ATTRS
147_mm_fmsubadd_ps(__m128 __A, __m128 __B, __m128 __C)
148{
149 return (__m128)__builtin_ia32_vfmsubaddps(__A, __B, __C);
150}
151
152static __inline__ __m128d __DEFAULT_FN_ATTRS
153_mm_fmsubadd_pd(__m128d __A, __m128d __B, __m128d __C)
154{
155 return (__m128d)__builtin_ia32_vfmsubaddpd(__A, __B, __C);
156}
157
158static __inline__ __m256 __DEFAULT_FN_ATTRS
159_mm256_fmadd_ps(__m256 __A, __m256 __B, __m256 __C)
160{
161 return (__m256)__builtin_ia32_vfmaddps256(__A, __B, __C);
162}
163
164static __inline__ __m256d __DEFAULT_FN_ATTRS
165_mm256_fmadd_pd(__m256d __A, __m256d __B, __m256d __C)
166{
167 return (__m256d)__builtin_ia32_vfmaddpd256(__A, __B, __C);
168}
169
170static __inline__ __m256 __DEFAULT_FN_ATTRS
171_mm256_fmsub_ps(__m256 __A, __m256 __B, __m256 __C)
172{
173 return (__m256)__builtin_ia32_vfmsubps256(__A, __B, __C);
174}
175
176static __inline__ __m256d __DEFAULT_FN_ATTRS
177_mm256_fmsub_pd(__m256d __A, __m256d __B, __m256d __C)
178{
179 return (__m256d)__builtin_ia32_vfmsubpd256(__A, __B, __C);
180}
181
182static __inline__ __m256 __DEFAULT_FN_ATTRS
183_mm256_fnmadd_ps(__m256 __A, __m256 __B, __m256 __C)
184{
185 return (__m256)__builtin_ia32_vfnmaddps256(__A, __B, __C);
186}
187
188static __inline__ __m256d __DEFAULT_FN_ATTRS
189_mm256_fnmadd_pd(__m256d __A, __m256d __B, __m256d __C)
190{
191 return (__m256d)__builtin_ia32_vfnmaddpd256(__A, __B, __C);
192}
193
194static __inline__ __m256 __DEFAULT_FN_ATTRS
195_mm256_fnmsub_ps(__m256 __A, __m256 __B, __m256 __C)
196{
197 return (__m256)__builtin_ia32_vfnmsubps256(__A, __B, __C);
198}
199
200static __inline__ __m256d __DEFAULT_FN_ATTRS
201_mm256_fnmsub_pd(__m256d __A, __m256d __B, __m256d __C)
202{
203 return (__m256d)__builtin_ia32_vfnmsubpd256(__A, __B, __C);
204}
205
206static __inline__ __m256 __DEFAULT_FN_ATTRS
207_mm256_fmaddsub_ps(__m256 __A, __m256 __B, __m256 __C)
208{
209 return (__m256)__builtin_ia32_vfmaddsubps256(__A, __B, __C);
210}
211
212static __inline__ __m256d __DEFAULT_FN_ATTRS
213_mm256_fmaddsub_pd(__m256d __A, __m256d __B, __m256d __C)
214{
215 return (__m256d)__builtin_ia32_vfmaddsubpd256(__A, __B, __C);
216}
217
218static __inline__ __m256 __DEFAULT_FN_ATTRS
219_mm256_fmsubadd_ps(__m256 __A, __m256 __B, __m256 __C)
220{
221 return (__m256)__builtin_ia32_vfmsubaddps256(__A, __B, __C);
222}
223
224static __inline__ __m256d __DEFAULT_FN_ATTRS
225_mm256_fmsubadd_pd(__m256d __A, __m256d __B, __m256d __C)
226{
227 return (__m256d)__builtin_ia32_vfmsubaddpd256(__A, __B, __C);
228}
229
230#undef __DEFAULT_FN_ATTRS
231
232#endif /* __FMA__ */
233
234#endif /* __FMAINTRIN_H */
c_headers/fxsrintrin.h created+55
......@@ -0,0 +1,55 @@
1/*===---- fxsrintrin.h - FXSR intrinsic ------------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __IMMINTRIN_H
25#error "Never use <fxsrintrin.h> directly; include <immintrin.h> instead."
26#endif
27
28#ifndef __FXSRINTRIN_H
29#define __FXSRINTRIN_H
30
31#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
32
33static __inline__ void __DEFAULT_FN_ATTRS
34_fxsave(void *__p) {
35 return __builtin_ia32_fxsave(__p);
36}
37
38static __inline__ void __DEFAULT_FN_ATTRS
39_fxsave64(void *__p) {
40 return __builtin_ia32_fxsave64(__p);
41}
42
43static __inline__ void __DEFAULT_FN_ATTRS
44_fxrstor(void *__p) {
45 return __builtin_ia32_fxrstor(__p);
46}
47
48static __inline__ void __DEFAULT_FN_ATTRS
49_fxrstor64(void *__p) {
50 return __builtin_ia32_fxrstor64(__p);
51}
52
53#undef __DEFAULT_FN_ATTRS
54
55#endif
c_headers/htmintrin.h created+226
......@@ -0,0 +1,226 @@
1/*===---- htmintrin.h - Standard header for PowerPC HTM ---------------===*\
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21\*===----------------------------------------------------------------------===*/
22
23#ifndef __HTMINTRIN_H
24#define __HTMINTRIN_H
25
26#ifndef __HTM__
27#error "HTM instruction set not enabled"
28#endif
29
30#ifdef __powerpc__
31
32#include <stdint.h>
33
34typedef uint64_t texasr_t;
35typedef uint32_t texasru_t;
36typedef uint32_t texasrl_t;
37typedef uintptr_t tfiar_t;
38typedef uintptr_t tfhar_t;
39
40#define _HTM_STATE(CR0) ((CR0 >> 1) & 0x3)
41#define _HTM_NONTRANSACTIONAL 0x0
42#define _HTM_SUSPENDED 0x1
43#define _HTM_TRANSACTIONAL 0x2
44
45#define _TEXASR_EXTRACT_BITS(TEXASR,BITNUM,SIZE) \
46 (((TEXASR) >> (63-(BITNUM))) & ((1<<(SIZE))-1))
47#define _TEXASRU_EXTRACT_BITS(TEXASR,BITNUM,SIZE) \
48 (((TEXASR) >> (31-(BITNUM))) & ((1<<(SIZE))-1))
49
50#define _TEXASR_FAILURE_CODE(TEXASR) \
51 _TEXASR_EXTRACT_BITS(TEXASR, 7, 8)
52#define _TEXASRU_FAILURE_CODE(TEXASRU) \
53 _TEXASRU_EXTRACT_BITS(TEXASRU, 7, 8)
54
55#define _TEXASR_FAILURE_PERSISTENT(TEXASR) \
56 _TEXASR_EXTRACT_BITS(TEXASR, 7, 1)
57#define _TEXASRU_FAILURE_PERSISTENT(TEXASRU) \
58 _TEXASRU_EXTRACT_BITS(TEXASRU, 7, 1)
59
60#define _TEXASR_DISALLOWED(TEXASR) \
61 _TEXASR_EXTRACT_BITS(TEXASR, 8, 1)
62#define _TEXASRU_DISALLOWED(TEXASRU) \
63 _TEXASRU_EXTRACT_BITS(TEXASRU, 8, 1)
64
65#define _TEXASR_NESTING_OVERFLOW(TEXASR) \
66 _TEXASR_EXTRACT_BITS(TEXASR, 9, 1)
67#define _TEXASRU_NESTING_OVERFLOW(TEXASRU) \
68 _TEXASRU_EXTRACT_BITS(TEXASRU, 9, 1)
69
70#define _TEXASR_FOOTPRINT_OVERFLOW(TEXASR) \
71 _TEXASR_EXTRACT_BITS(TEXASR, 10, 1)
72#define _TEXASRU_FOOTPRINT_OVERFLOW(TEXASRU) \
73 _TEXASRU_EXTRACT_BITS(TEXASRU, 10, 1)
74
75#define _TEXASR_SELF_INDUCED_CONFLICT(TEXASR) \
76 _TEXASR_EXTRACT_BITS(TEXASR, 11, 1)
77#define _TEXASRU_SELF_INDUCED_CONFLICT(TEXASRU) \
78 _TEXASRU_EXTRACT_BITS(TEXASRU, 11, 1)
79
80#define _TEXASR_NON_TRANSACTIONAL_CONFLICT(TEXASR) \
81 _TEXASR_EXTRACT_BITS(TEXASR, 12, 1)
82#define _TEXASRU_NON_TRANSACTIONAL_CONFLICT(TEXASRU) \
83 _TEXASRU_EXTRACT_BITS(TEXASRU, 12, 1)
84
85#define _TEXASR_TRANSACTION_CONFLICT(TEXASR) \
86 _TEXASR_EXTRACT_BITS(TEXASR, 13, 1)
87#define _TEXASRU_TRANSACTION_CONFLICT(TEXASRU) \
88 _TEXASRU_EXTRACT_BITS(TEXASRU, 13, 1)
89
90#define _TEXASR_TRANSLATION_INVALIDATION_CONFLICT(TEXASR) \
91 _TEXASR_EXTRACT_BITS(TEXASR, 14, 1)
92#define _TEXASRU_TRANSLATION_INVALIDATION_CONFLICT(TEXASRU) \
93 _TEXASRU_EXTRACT_BITS(TEXASRU, 14, 1)
94
95#define _TEXASR_IMPLEMENTAION_SPECIFIC(TEXASR) \
96 _TEXASR_EXTRACT_BITS(TEXASR, 15, 1)
97#define _TEXASRU_IMPLEMENTAION_SPECIFIC(TEXASRU) \
98 _TEXASRU_EXTRACT_BITS(TEXASRU, 15, 1)
99
100#define _TEXASR_INSTRUCTION_FETCH_CONFLICT(TEXASR) \
101 _TEXASR_EXTRACT_BITS(TEXASR, 16, 1)
102#define _TEXASRU_INSTRUCTION_FETCH_CONFLICT(TEXASRU) \
103 _TEXASRU_EXTRACT_BITS(TEXASRU, 16, 1)
104
105#define _TEXASR_ABORT(TEXASR) \
106 _TEXASR_EXTRACT_BITS(TEXASR, 31, 1)
107#define _TEXASRU_ABORT(TEXASRU) \
108 _TEXASRU_EXTRACT_BITS(TEXASRU, 31, 1)
109
110
111#define _TEXASR_SUSPENDED(TEXASR) \
112 _TEXASR_EXTRACT_BITS(TEXASR, 32, 1)
113
114#define _TEXASR_PRIVILEGE(TEXASR) \
115 _TEXASR_EXTRACT_BITS(TEXASR, 35, 2)
116
117#define _TEXASR_FAILURE_SUMMARY(TEXASR) \
118 _TEXASR_EXTRACT_BITS(TEXASR, 36, 1)
119
120#define _TEXASR_TFIAR_EXACT(TEXASR) \
121 _TEXASR_EXTRACT_BITS(TEXASR, 37, 1)
122
123#define _TEXASR_ROT(TEXASR) \
124 _TEXASR_EXTRACT_BITS(TEXASR, 38, 1)
125
126#define _TEXASR_TRANSACTION_LEVEL(TEXASR) \
127 _TEXASR_EXTRACT_BITS(TEXASR, 63, 12)
128
129#endif /* __powerpc */
130
131#ifdef __s390__
132
133/* Condition codes generated by tbegin */
134#define _HTM_TBEGIN_STARTED 0
135#define _HTM_TBEGIN_INDETERMINATE 1
136#define _HTM_TBEGIN_TRANSIENT 2
137#define _HTM_TBEGIN_PERSISTENT 3
138
139/* The abort codes below this threshold are reserved for machine use. */
140#define _HTM_FIRST_USER_ABORT_CODE 256
141
142/* The transaction diagnostic block is it is defined in the Principles
143 of Operation chapter 5-91. */
144
145struct __htm_tdb {
146 unsigned char format; /* 0 */
147 unsigned char flags;
148 unsigned char reserved1[4];
149 unsigned short nesting_depth;
150 unsigned long long abort_code; /* 8 */
151 unsigned long long conflict_token; /* 16 */
152 unsigned long long atia; /* 24 */
153 unsigned char eaid; /* 32 */
154 unsigned char dxc;
155 unsigned char reserved2[2];
156 unsigned int program_int_id;
157 unsigned long long exception_id; /* 40 */
158 unsigned long long bea; /* 48 */
159 unsigned char reserved3[72]; /* 56 */
160 unsigned long long gprs[16]; /* 128 */
161} __attribute__((__packed__, __aligned__ (8)));
162
163
164/* Helper intrinsics to retry tbegin in case of transient failure. */
165
166static __inline int __attribute__((__always_inline__, __nodebug__))
167__builtin_tbegin_retry_null (int retry)
168{
169 int cc, i = 0;
170
171 while ((cc = __builtin_tbegin(0)) == _HTM_TBEGIN_TRANSIENT
172 && i++ < retry)
173 __builtin_tx_assist(i);
174
175 return cc;
176}
177
178static __inline int __attribute__((__always_inline__, __nodebug__))
179__builtin_tbegin_retry_tdb (void *tdb, int retry)
180{
181 int cc, i = 0;
182
183 while ((cc = __builtin_tbegin(tdb)) == _HTM_TBEGIN_TRANSIENT
184 && i++ < retry)
185 __builtin_tx_assist(i);
186
187 return cc;
188}
189
190#define __builtin_tbegin_retry(tdb, retry) \
191 (__builtin_constant_p(tdb == 0) && tdb == 0 ? \
192 __builtin_tbegin_retry_null(retry) : \
193 __builtin_tbegin_retry_tdb(tdb, retry))
194
195static __inline int __attribute__((__always_inline__, __nodebug__))
196__builtin_tbegin_retry_nofloat_null (int retry)
197{
198 int cc, i = 0;
199
200 while ((cc = __builtin_tbegin_nofloat(0)) == _HTM_TBEGIN_TRANSIENT
201 && i++ < retry)
202 __builtin_tx_assist(i);
203
204 return cc;
205}
206
207static __inline int __attribute__((__always_inline__, __nodebug__))
208__builtin_tbegin_retry_nofloat_tdb (void *tdb, int retry)
209{
210 int cc, i = 0;
211
212 while ((cc = __builtin_tbegin_nofloat(tdb)) == _HTM_TBEGIN_TRANSIENT
213 && i++ < retry)
214 __builtin_tx_assist(i);
215
216 return cc;
217}
218
219#define __builtin_tbegin_retry_nofloat(tdb, retry) \
220 (__builtin_constant_p(tdb == 0) && tdb == 0 ? \
221 __builtin_tbegin_retry_nofloat_null(retry) : \
222 __builtin_tbegin_retry_nofloat_tdb(tdb, retry))
223
224#endif /* __s390__ */
225
226#endif /* __HTMINTRIN_H */
c_headers/htmxlintrin.h created+363
......@@ -0,0 +1,363 @@
1/*===---- htmxlintrin.h - XL compiler HTM execution intrinsics-------------===*\
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21\*===----------------------------------------------------------------------===*/
22
23#ifndef __HTMXLINTRIN_H
24#define __HTMXLINTRIN_H
25
26#ifndef __HTM__
27#error "HTM instruction set not enabled"
28#endif
29
30#include <htmintrin.h>
31
32#ifdef __powerpc__
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38#define _TEXASR_PTR(TM_BUF) \
39 ((texasr_t *)((TM_BUF)+0))
40#define _TEXASRU_PTR(TM_BUF) \
41 ((texasru_t *)((TM_BUF)+0))
42#define _TEXASRL_PTR(TM_BUF) \
43 ((texasrl_t *)((TM_BUF)+4))
44#define _TFIAR_PTR(TM_BUF) \
45 ((tfiar_t *)((TM_BUF)+8))
46
47typedef char TM_buff_type[16];
48
49/* This macro can be used to determine whether a transaction was successfully
50 started from the __TM_begin() and __TM_simple_begin() intrinsic functions
51 below. */
52#define _HTM_TBEGIN_STARTED 1
53
54extern __inline long
55__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
56__TM_simple_begin (void)
57{
58 if (__builtin_expect (__builtin_tbegin (0), 1))
59 return _HTM_TBEGIN_STARTED;
60 return 0;
61}
62
63extern __inline long
64__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
65__TM_begin (void* const TM_buff)
66{
67 *_TEXASRL_PTR (TM_buff) = 0;
68 if (__builtin_expect (__builtin_tbegin (0), 1))
69 return _HTM_TBEGIN_STARTED;
70#ifdef __powerpc64__
71 *_TEXASR_PTR (TM_buff) = __builtin_get_texasr ();
72#else
73 *_TEXASRU_PTR (TM_buff) = __builtin_get_texasru ();
74 *_TEXASRL_PTR (TM_buff) = __builtin_get_texasr ();
75#endif
76 *_TFIAR_PTR (TM_buff) = __builtin_get_tfiar ();
77 return 0;
78}
79
80extern __inline long
81__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
82__TM_end (void)
83{
84 if (__builtin_expect (__builtin_tend (0), 1))
85 return 1;
86 return 0;
87}
88
89extern __inline void
90__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
91__TM_abort (void)
92{
93 __builtin_tabort (0);
94}
95
96extern __inline void
97__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
98__TM_named_abort (unsigned char const code)
99{
100 __builtin_tabort (code);
101}
102
103extern __inline void
104__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
105__TM_resume (void)
106{
107 __builtin_tresume ();
108}
109
110extern __inline void
111__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
112__TM_suspend (void)
113{
114 __builtin_tsuspend ();
115}
116
117extern __inline long
118__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
119__TM_is_user_abort (void* const TM_buff)
120{
121 texasru_t texasru = *_TEXASRU_PTR (TM_buff);
122 return _TEXASRU_ABORT (texasru);
123}
124
125extern __inline long
126__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
127__TM_is_named_user_abort (void* const TM_buff, unsigned char *code)
128{
129 texasru_t texasru = *_TEXASRU_PTR (TM_buff);
130
131 *code = _TEXASRU_FAILURE_CODE (texasru);
132 return _TEXASRU_ABORT (texasru);
133}
134
135extern __inline long
136__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
137__TM_is_illegal (void* const TM_buff)
138{
139 texasru_t texasru = *_TEXASRU_PTR (TM_buff);
140 return _TEXASRU_DISALLOWED (texasru);
141}
142
143extern __inline long
144__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
145__TM_is_footprint_exceeded (void* const TM_buff)
146{
147 texasru_t texasru = *_TEXASRU_PTR (TM_buff);
148 return _TEXASRU_FOOTPRINT_OVERFLOW (texasru);
149}
150
151extern __inline long
152__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
153__TM_nesting_depth (void* const TM_buff)
154{
155 texasrl_t texasrl;
156
157 if (_HTM_STATE (__builtin_ttest ()) == _HTM_NONTRANSACTIONAL)
158 {
159 texasrl = *_TEXASRL_PTR (TM_buff);
160 if (!_TEXASR_FAILURE_SUMMARY (texasrl))
161 texasrl = 0;
162 }
163 else
164 texasrl = (texasrl_t) __builtin_get_texasr ();
165
166 return _TEXASR_TRANSACTION_LEVEL (texasrl);
167}
168
169extern __inline long
170__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
171__TM_is_nested_too_deep(void* const TM_buff)
172{
173 texasru_t texasru = *_TEXASRU_PTR (TM_buff);
174 return _TEXASRU_NESTING_OVERFLOW (texasru);
175}
176
177extern __inline long
178__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
179__TM_is_conflict(void* const TM_buff)
180{
181 texasru_t texasru = *_TEXASRU_PTR (TM_buff);
182 /* Return TEXASR bits 11 (Self-Induced Conflict) through
183 14 (Translation Invalidation Conflict). */
184 return (_TEXASRU_EXTRACT_BITS (texasru, 14, 4)) ? 1 : 0;
185}
186
187extern __inline long
188__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
189__TM_is_failure_persistent(void* const TM_buff)
190{
191 texasru_t texasru = *_TEXASRU_PTR (TM_buff);
192 return _TEXASRU_FAILURE_PERSISTENT (texasru);
193}
194
195extern __inline long
196__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
197__TM_failure_address(void* const TM_buff)
198{
199 return *_TFIAR_PTR (TM_buff);
200}
201
202extern __inline long long
203__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
204__TM_failure_code(void* const TM_buff)
205{
206 return *_TEXASR_PTR (TM_buff);
207}
208
209#ifdef __cplusplus
210}
211#endif
212
213#endif /* __powerpc__ */
214
215#ifdef __s390__
216
217#include <stdint.h>
218
219/* These intrinsics are being made available for compatibility with
220 the IBM XL compiler. For documentation please see the "z/OS XL
221 C/C++ Programming Guide" publically available on the web. */
222
223static __inline long __attribute__((__always_inline__, __nodebug__))
224__TM_simple_begin ()
225{
226 return __builtin_tbegin_nofloat (0);
227}
228
229static __inline long __attribute__((__always_inline__, __nodebug__))
230__TM_begin (void* const tdb)
231{
232 return __builtin_tbegin_nofloat (tdb);
233}
234
235static __inline long __attribute__((__always_inline__, __nodebug__))
236__TM_end ()
237{
238 return __builtin_tend ();
239}
240
241static __inline void __attribute__((__always_inline__))
242__TM_abort ()
243{
244 return __builtin_tabort (_HTM_FIRST_USER_ABORT_CODE);
245}
246
247static __inline void __attribute__((__always_inline__, __nodebug__))
248__TM_named_abort (unsigned char const code)
249{
250 return __builtin_tabort ((int)_HTM_FIRST_USER_ABORT_CODE + code);
251}
252
253static __inline void __attribute__((__always_inline__, __nodebug__))
254__TM_non_transactional_store (void* const addr, long long const value)
255{
256 __builtin_non_tx_store ((uint64_t*)addr, (uint64_t)value);
257}
258
259static __inline long __attribute__((__always_inline__, __nodebug__))
260__TM_nesting_depth (void* const tdb_ptr)
261{
262 int depth = __builtin_tx_nesting_depth ();
263 struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
264
265 if (depth != 0)
266 return depth;
267
268 if (tdb->format != 1)
269 return 0;
270 return tdb->nesting_depth;
271}
272
273/* Transaction failure diagnostics */
274
275static __inline long __attribute__((__always_inline__, __nodebug__))
276__TM_is_user_abort (void* const tdb_ptr)
277{
278 struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
279
280 if (tdb->format != 1)
281 return 0;
282
283 return !!(tdb->abort_code >= _HTM_FIRST_USER_ABORT_CODE);
284}
285
286static __inline long __attribute__((__always_inline__, __nodebug__))
287__TM_is_named_user_abort (void* const tdb_ptr, unsigned char* code)
288{
289 struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
290
291 if (tdb->format != 1)
292 return 0;
293
294 if (tdb->abort_code >= _HTM_FIRST_USER_ABORT_CODE)
295 {
296 *code = tdb->abort_code - _HTM_FIRST_USER_ABORT_CODE;
297 return 1;
298 }
299 return 0;
300}
301
302static __inline long __attribute__((__always_inline__, __nodebug__))
303__TM_is_illegal (void* const tdb_ptr)
304{
305 struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
306
307 return (tdb->format == 1
308 && (tdb->abort_code == 4 /* unfiltered program interruption */
309 || tdb->abort_code == 11 /* restricted instruction */));
310}
311
312static __inline long __attribute__((__always_inline__, __nodebug__))
313__TM_is_footprint_exceeded (void* const tdb_ptr)
314{
315 struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
316
317 return (tdb->format == 1
318 && (tdb->abort_code == 7 /* fetch overflow */
319 || tdb->abort_code == 8 /* store overflow */));
320}
321
322static __inline long __attribute__((__always_inline__, __nodebug__))
323__TM_is_nested_too_deep (void* const tdb_ptr)
324{
325 struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
326
327 return tdb->format == 1 && tdb->abort_code == 13; /* depth exceeded */
328}
329
330static __inline long __attribute__((__always_inline__, __nodebug__))
331__TM_is_conflict (void* const tdb_ptr)
332{
333 struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
334
335 return (tdb->format == 1
336 && (tdb->abort_code == 9 /* fetch conflict */
337 || tdb->abort_code == 10 /* store conflict */));
338}
339
340static __inline long __attribute__((__always_inline__, __nodebug__))
341__TM_is_failure_persistent (long const result)
342{
343 return result == _HTM_TBEGIN_PERSISTENT;
344}
345
346static __inline long __attribute__((__always_inline__, __nodebug__))
347__TM_failure_address (void* const tdb_ptr)
348{
349 struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
350 return tdb->atia;
351}
352
353static __inline long __attribute__((__always_inline__, __nodebug__))
354__TM_failure_code (void* const tdb_ptr)
355{
356 struct __htm_tdb *tdb = (struct __htm_tdb*)tdb_ptr;
357
358 return tdb->abort_code;
359}
360
361#endif /* __s390__ */
362
363#endif /* __HTMXLINTRIN_H */
c_headers/ia32intrin.h created+101
......@@ -0,0 +1,101 @@
1/* ===-------- ia32intrin.h ---------------------------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __X86INTRIN_H
25#error "Never use <ia32intrin.h> directly; include <x86intrin.h> instead."
26#endif
27
28#ifndef __IA32INTRIN_H
29#define __IA32INTRIN_H
30
31#ifdef __x86_64__
32static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
33__readeflags(void)
34{
35 unsigned long long __res = 0;
36 __asm__ __volatile__ ("pushf\n\t"
37 "popq %0\n"
38 :"=r"(__res)
39 :
40 :
41 );
42 return __res;
43}
44
45static __inline__ void __attribute__((__always_inline__, __nodebug__))
46__writeeflags(unsigned long long __f)
47{
48 __asm__ __volatile__ ("pushq %0\n\t"
49 "popf\n"
50 :
51 :"r"(__f)
52 :"flags"
53 );
54}
55
56#else /* !__x86_64__ */
57static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
58__readeflags(void)
59{
60 unsigned int __res = 0;
61 __asm__ __volatile__ ("pushf\n\t"
62 "popl %0\n"
63 :"=r"(__res)
64 :
65 :
66 );
67 return __res;
68}
69
70static __inline__ void __attribute__((__always_inline__, __nodebug__))
71__writeeflags(unsigned int __f)
72{
73 __asm__ __volatile__ ("pushl %0\n\t"
74 "popf\n"
75 :
76 :"r"(__f)
77 :"flags"
78 );
79}
80#endif /* !__x86_64__ */
81
82static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
83__rdpmc(int __A) {
84 return __builtin_ia32_rdpmc(__A);
85}
86
87/* __rdtsc */
88static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
89__rdtsc(void) {
90 return __builtin_ia32_rdtsc();
91}
92
93/* __rdtscp */
94static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
95__rdtscp(unsigned int *__A) {
96 return __builtin_ia32_rdtscp(__A);
97}
98
99#define _rdtsc() __rdtsc()
100
101#endif /* __IA32INTRIN_H */
c_headers/immintrin.h created+203
......@@ -0,0 +1,203 @@
1/*===---- immintrin.h - Intel intrinsics -----------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __IMMINTRIN_H
25#define __IMMINTRIN_H
26
27#ifdef __MMX__
28#include <mmintrin.h>
29#endif
30
31#ifdef __SSE__
32#include <xmmintrin.h>
33#endif
34
35#ifdef __SSE2__
36#include <emmintrin.h>
37#endif
38
39#ifdef __SSE3__
40#include <pmmintrin.h>
41#endif
42
43#ifdef __SSSE3__
44#include <tmmintrin.h>
45#endif
46
47#if defined (__SSE4_2__) || defined (__SSE4_1__)
48#include <smmintrin.h>
49#endif
50
51#if defined (__AES__) || defined (__PCLMUL__)
52#include <wmmintrin.h>
53#endif
54
55#ifdef __AVX__
56#include <avxintrin.h>
57#endif
58
59#ifdef __AVX2__
60#include <avx2intrin.h>
61#endif
62
63#ifdef __BMI__
64#include <bmiintrin.h>
65#endif
66
67#ifdef __BMI2__
68#include <bmi2intrin.h>
69#endif
70
71#ifdef __LZCNT__
72#include <lzcntintrin.h>
73#endif
74
75#ifdef __FMA__
76#include <fmaintrin.h>
77#endif
78
79#ifdef __AVX512F__
80#include <avx512fintrin.h>
81#endif
82
83#ifdef __AVX512VL__
84#include <avx512vlintrin.h>
85#endif
86
87#ifdef __AVX512BW__
88#include <avx512bwintrin.h>
89#endif
90
91#ifdef __AVX512CD__
92#include <avx512cdintrin.h>
93#endif
94
95#ifdef __AVX512DQ__
96#include <avx512dqintrin.h>
97#endif
98
99#if defined (__AVX512VL__) && defined (__AVX512BW__)
100#include <avx512vlbwintrin.h>
101#endif
102
103#if defined (__AVX512VL__) && defined (__AVX512DQ__)
104#include <avx512vldqintrin.h>
105#endif
106
107#ifdef __AVX512ER__
108#include <avx512erintrin.h>
109#endif
110
111#ifdef __RDRND__
112static __inline__ int __attribute__((__always_inline__, __nodebug__))
113_rdrand16_step(unsigned short *__p)
114{
115 return __builtin_ia32_rdrand16_step(__p);
116}
117
118static __inline__ int __attribute__((__always_inline__, __nodebug__))
119_rdrand32_step(unsigned int *__p)
120{
121 return __builtin_ia32_rdrand32_step(__p);
122}
123
124#ifdef __x86_64__
125static __inline__ int __attribute__((__always_inline__, __nodebug__))
126_rdrand64_step(unsigned long long *__p)
127{
128 return __builtin_ia32_rdrand64_step(__p);
129}
130#endif
131#endif /* __RDRND__ */
132
133#ifdef __FSGSBASE__
134#ifdef __x86_64__
135static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
136_readfsbase_u32(void)
137{
138 return __builtin_ia32_rdfsbase32();
139}
140
141static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
142_readfsbase_u64(void)
143{
144 return __builtin_ia32_rdfsbase64();
145}
146
147static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))
148_readgsbase_u32(void)
149{
150 return __builtin_ia32_rdgsbase32();
151}
152
153static __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))
154_readgsbase_u64(void)
155{
156 return __builtin_ia32_rdgsbase64();
157}
158
159static __inline__ void __attribute__((__always_inline__, __nodebug__))
160_writefsbase_u32(unsigned int __V)
161{
162 return __builtin_ia32_wrfsbase32(__V);
163}
164
165static __inline__ void __attribute__((__always_inline__, __nodebug__))
166_writefsbase_u64(unsigned long long __V)
167{
168 return __builtin_ia32_wrfsbase64(__V);
169}
170
171static __inline__ void __attribute__((__always_inline__, __nodebug__))
172_writegsbase_u32(unsigned int __V)
173{
174 return __builtin_ia32_wrgsbase32(__V);
175}
176
177static __inline__ void __attribute__((__always_inline__, __nodebug__))
178_writegsbase_u64(unsigned long long __V)
179{
180 return __builtin_ia32_wrgsbase64(__V);
181}
182#endif
183#endif /* __FSGSBASE__ */
184
185#ifdef __RTM__
186#include <rtmintrin.h>
187#endif
188
189#ifdef __RTM__
190#include <xtestintrin.h>
191#endif
192
193#ifdef __SHA__
194#include <shaintrin.h>
195#endif
196
197#include <fxsrintrin.h>
198
199/* Some intrinsics inside adxintrin.h are available only on processors with ADX,
200 * whereas others are also available at all times. */
201#include <adxintrin.h>
202
203#endif /* __IMMINTRIN_H */
c_headers/inttypes.h created+102
......@@ -0,0 +1,102 @@
1/*===---- inttypes.h - Standard header for integer printf macros ----------===*\
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21\*===----------------------------------------------------------------------===*/
22
23#ifndef __CLANG_INTTYPES_H
24#define __CLANG_INTTYPES_H
25
26#include_next <inttypes.h>
27
28#if defined(_MSC_VER) && _MSC_VER < 1900
29/* MSVC headers define int32_t as int, but PRIx32 as "lx" instead of "x".
30 * This triggers format warnings, so fix it up here. */
31#undef PRId32
32#undef PRIdLEAST32
33#undef PRIdFAST32
34#undef PRIi32
35#undef PRIiLEAST32
36#undef PRIiFAST32
37#undef PRIo32
38#undef PRIoLEAST32
39#undef PRIoFAST32
40#undef PRIu32
41#undef PRIuLEAST32
42#undef PRIuFAST32
43#undef PRIx32
44#undef PRIxLEAST32
45#undef PRIxFAST32
46#undef PRIX32
47#undef PRIXLEAST32
48#undef PRIXFAST32
49
50#undef SCNd32
51#undef SCNdLEAST32
52#undef SCNdFAST32
53#undef SCNi32
54#undef SCNiLEAST32
55#undef SCNiFAST32
56#undef SCNo32
57#undef SCNoLEAST32
58#undef SCNoFAST32
59#undef SCNu32
60#undef SCNuLEAST32
61#undef SCNuFAST32
62#undef SCNx32
63#undef SCNxLEAST32
64#undef SCNxFAST32
65
66#define PRId32 "d"
67#define PRIdLEAST32 "d"
68#define PRIdFAST32 "d"
69#define PRIi32 "i"
70#define PRIiLEAST32 "i"
71#define PRIiFAST32 "i"
72#define PRIo32 "o"
73#define PRIoLEAST32 "o"
74#define PRIoFAST32 "o"
75#define PRIu32 "u"
76#define PRIuLEAST32 "u"
77#define PRIuFAST32 "u"
78#define PRIx32 "x"
79#define PRIxLEAST32 "x"
80#define PRIxFAST32 "x"
81#define PRIX32 "X"
82#define PRIXLEAST32 "X"
83#define PRIXFAST32 "X"
84
85#define SCNd32 "d"
86#define SCNdLEAST32 "d"
87#define SCNdFAST32 "d"
88#define SCNi32 "i"
89#define SCNiLEAST32 "i"
90#define SCNiFAST32 "i"
91#define SCNo32 "o"
92#define SCNoLEAST32 "o"
93#define SCNoFAST32 "o"
94#define SCNu32 "u"
95#define SCNuLEAST32 "u"
96#define SCNuFAST32 "u"
97#define SCNx32 "x"
98#define SCNxLEAST32 "x"
99#define SCNxFAST32 "x"
100#endif
101
102#endif /* __CLANG_INTTYPES_H */
c_headers/iso646.h created+43
......@@ -0,0 +1,43 @@
1/*===---- iso646.h - Standard header for alternate spellings of operators---===
2 *
3 * Copyright (c) 2008 Eli Friedman
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 * THE SOFTWARE.
22 *
23 *===-----------------------------------------------------------------------===
24 */
25
26#ifndef __ISO646_H
27#define __ISO646_H
28
29#ifndef __cplusplus
30#define and &&
31#define and_eq &=
32#define bitand &
33#define bitor |
34#define compl ~
35#define not !
36#define not_eq !=
37#define or ||
38#define or_eq |=
39#define xor ^
40#define xor_eq ^=
41#endif
42
43#endif /* __ISO646_H */
c_headers/limits.h created+118
......@@ -0,0 +1,118 @@
1/*===---- limits.h - Standard header for integer sizes --------------------===*\
2 *
3 * Copyright (c) 2009 Chris Lattner
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 * THE SOFTWARE.
22 *
23\*===----------------------------------------------------------------------===*/
24
25#ifndef __CLANG_LIMITS_H
26#define __CLANG_LIMITS_H
27
28/* The system's limits.h may, in turn, try to #include_next GCC's limits.h.
29 Avert this #include_next madness. */
30#if defined __GNUC__ && !defined _GCC_LIMITS_H_
31#define _GCC_LIMITS_H_
32#endif
33
34/* System headers include a number of constants from POSIX in <limits.h>.
35 Include it if we're hosted. */
36#if __STDC_HOSTED__ && __has_include_next(<limits.h>)
37#include_next <limits.h>
38#endif
39
40/* Many system headers try to "help us out" by defining these. No really, we
41 know how big each datatype is. */
42#undef SCHAR_MIN
43#undef SCHAR_MAX
44#undef UCHAR_MAX
45#undef SHRT_MIN
46#undef SHRT_MAX
47#undef USHRT_MAX
48#undef INT_MIN
49#undef INT_MAX
50#undef UINT_MAX
51#undef LONG_MIN
52#undef LONG_MAX
53#undef ULONG_MAX
54
55#undef CHAR_BIT
56#undef CHAR_MIN
57#undef CHAR_MAX
58
59/* C90/99 5.2.4.2.1 */
60#define SCHAR_MAX __SCHAR_MAX__
61#define SHRT_MAX __SHRT_MAX__
62#define INT_MAX __INT_MAX__
63#define LONG_MAX __LONG_MAX__
64
65#define SCHAR_MIN (-__SCHAR_MAX__-1)
66#define SHRT_MIN (-__SHRT_MAX__ -1)
67#define INT_MIN (-__INT_MAX__ -1)
68#define LONG_MIN (-__LONG_MAX__ -1L)
69
70#define UCHAR_MAX (__SCHAR_MAX__*2 +1)
71#define USHRT_MAX (__SHRT_MAX__ *2 +1)
72#define UINT_MAX (__INT_MAX__ *2U +1U)
73#define ULONG_MAX (__LONG_MAX__ *2UL+1UL)
74
75#ifndef MB_LEN_MAX
76#define MB_LEN_MAX 1
77#endif
78
79#define CHAR_BIT __CHAR_BIT__
80
81#ifdef __CHAR_UNSIGNED__ /* -funsigned-char */
82#define CHAR_MIN 0
83#define CHAR_MAX UCHAR_MAX
84#else
85#define CHAR_MIN SCHAR_MIN
86#define CHAR_MAX __SCHAR_MAX__
87#endif
88
89/* C99 5.2.4.2.1: Added long long.
90 C++11 18.3.3.2: same contents as the Standard C Library header <limits.h>.
91 */
92#if __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L
93
94#undef LLONG_MIN
95#undef LLONG_MAX
96#undef ULLONG_MAX
97
98#define LLONG_MAX __LONG_LONG_MAX__
99#define LLONG_MIN (-__LONG_LONG_MAX__-1LL)
100#define ULLONG_MAX (__LONG_LONG_MAX__*2ULL+1ULL)
101#endif
102
103/* LONG_LONG_MIN/LONG_LONG_MAX/ULONG_LONG_MAX are a GNU extension. It's too bad
104 that we don't have something like #pragma poison that could be used to
105 deprecate a macro - the code should just use LLONG_MAX and friends.
106 */
107#if defined(__GNU_LIBRARY__) ? defined(__USE_GNU) : !defined(__STRICT_ANSI__)
108
109#undef LONG_LONG_MIN
110#undef LONG_LONG_MAX
111#undef ULONG_LONG_MAX
112
113#define LONG_LONG_MAX __LONG_LONG_MAX__
114#define LONG_LONG_MIN (-__LONG_LONG_MAX__-1LL)
115#define ULONG_LONG_MAX (__LONG_LONG_MAX__*2ULL+1ULL)
116#endif
117
118#endif /* __CLANG_LIMITS_H */
c_headers/lzcntintrin.h created+72
......@@ -0,0 +1,72 @@
1/*===---- lzcntintrin.h - LZCNT intrinsics ---------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#if !defined __X86INTRIN_H && !defined __IMMINTRIN_H
25#error "Never use <lzcntintrin.h> directly; include <x86intrin.h> instead."
26#endif
27
28#ifndef __LZCNT__
29# error "LZCNT instruction is not enabled"
30#endif /* __LZCNT__ */
31
32#ifndef __LZCNTINTRIN_H
33#define __LZCNTINTRIN_H
34
35/* Define the default attributes for the functions in this file. */
36#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
37
38static __inline__ unsigned short __DEFAULT_FN_ATTRS
39__lzcnt16(unsigned short __X)
40{
41 return __X ? __builtin_clzs(__X) : 16;
42}
43
44static __inline__ unsigned int __DEFAULT_FN_ATTRS
45__lzcnt32(unsigned int __X)
46{
47 return __X ? __builtin_clz(__X) : 32;
48}
49
50static __inline__ unsigned int __DEFAULT_FN_ATTRS
51_lzcnt_u32(unsigned int __X)
52{
53 return __X ? __builtin_clz(__X) : 32;
54}
55
56#ifdef __x86_64__
57static __inline__ unsigned long long __DEFAULT_FN_ATTRS
58__lzcnt64(unsigned long long __X)
59{
60 return __X ? __builtin_clzll(__X) : 64;
61}
62
63static __inline__ unsigned long long __DEFAULT_FN_ATTRS
64_lzcnt_u64(unsigned long long __X)
65{
66 return __X ? __builtin_clzll(__X) : 64;
67}
68#endif
69
70#undef __DEFAULT_FN_ATTRS
71
72#endif /* __LZCNTINTRIN_H */
c_headers/mm3dnow.h created+167
......@@ -0,0 +1,167 @@
1/*===---- mm3dnow.h - 3DNow! intrinsics ------------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef _MM3DNOW_H_INCLUDED
25#define _MM3DNOW_H_INCLUDED
26
27#include <mmintrin.h>
28#include <prfchwintrin.h>
29
30typedef float __v2sf __attribute__((__vector_size__(8)));
31
32/* Define the default attributes for the functions in this file. */
33#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
34
35static __inline__ void __DEFAULT_FN_ATTRS
36_m_femms() {
37 __builtin_ia32_femms();
38}
39
40static __inline__ __m64 __DEFAULT_FN_ATTRS
41_m_pavgusb(__m64 __m1, __m64 __m2) {
42 return (__m64)__builtin_ia32_pavgusb((__v8qi)__m1, (__v8qi)__m2);
43}
44
45static __inline__ __m64 __DEFAULT_FN_ATTRS
46_m_pf2id(__m64 __m) {
47 return (__m64)__builtin_ia32_pf2id((__v2sf)__m);
48}
49
50static __inline__ __m64 __DEFAULT_FN_ATTRS
51_m_pfacc(__m64 __m1, __m64 __m2) {
52 return (__m64)__builtin_ia32_pfacc((__v2sf)__m1, (__v2sf)__m2);
53}
54
55static __inline__ __m64 __DEFAULT_FN_ATTRS
56_m_pfadd(__m64 __m1, __m64 __m2) {
57 return (__m64)__builtin_ia32_pfadd((__v2sf)__m1, (__v2sf)__m2);
58}
59
60static __inline__ __m64 __DEFAULT_FN_ATTRS
61_m_pfcmpeq(__m64 __m1, __m64 __m2) {
62 return (__m64)__builtin_ia32_pfcmpeq((__v2sf)__m1, (__v2sf)__m2);
63}
64
65static __inline__ __m64 __DEFAULT_FN_ATTRS
66_m_pfcmpge(__m64 __m1, __m64 __m2) {
67 return (__m64)__builtin_ia32_pfcmpge((__v2sf)__m1, (__v2sf)__m2);
68}
69
70static __inline__ __m64 __DEFAULT_FN_ATTRS
71_m_pfcmpgt(__m64 __m1, __m64 __m2) {
72 return (__m64)__builtin_ia32_pfcmpgt((__v2sf)__m1, (__v2sf)__m2);
73}
74
75static __inline__ __m64 __DEFAULT_FN_ATTRS
76_m_pfmax(__m64 __m1, __m64 __m2) {
77 return (__m64)__builtin_ia32_pfmax((__v2sf)__m1, (__v2sf)__m2);
78}
79
80static __inline__ __m64 __DEFAULT_FN_ATTRS
81_m_pfmin(__m64 __m1, __m64 __m2) {
82 return (__m64)__builtin_ia32_pfmin((__v2sf)__m1, (__v2sf)__m2);
83}
84
85static __inline__ __m64 __DEFAULT_FN_ATTRS
86_m_pfmul(__m64 __m1, __m64 __m2) {
87 return (__m64)__builtin_ia32_pfmul((__v2sf)__m1, (__v2sf)__m2);
88}
89
90static __inline__ __m64 __DEFAULT_FN_ATTRS
91_m_pfrcp(__m64 __m) {
92 return (__m64)__builtin_ia32_pfrcp((__v2sf)__m);
93}
94
95static __inline__ __m64 __DEFAULT_FN_ATTRS
96_m_pfrcpit1(__m64 __m1, __m64 __m2) {
97 return (__m64)__builtin_ia32_pfrcpit1((__v2sf)__m1, (__v2sf)__m2);
98}
99
100static __inline__ __m64 __DEFAULT_FN_ATTRS
101_m_pfrcpit2(__m64 __m1, __m64 __m2) {
102 return (__m64)__builtin_ia32_pfrcpit2((__v2sf)__m1, (__v2sf)__m2);
103}
104
105static __inline__ __m64 __DEFAULT_FN_ATTRS
106_m_pfrsqrt(__m64 __m) {
107 return (__m64)__builtin_ia32_pfrsqrt((__v2sf)__m);
108}
109
110static __inline__ __m64 __DEFAULT_FN_ATTRS
111_m_pfrsqrtit1(__m64 __m1, __m64 __m2) {
112 return (__m64)__builtin_ia32_pfrsqit1((__v2sf)__m1, (__v2sf)__m2);
113}
114
115static __inline__ __m64 __DEFAULT_FN_ATTRS
116_m_pfsub(__m64 __m1, __m64 __m2) {
117 return (__m64)__builtin_ia32_pfsub((__v2sf)__m1, (__v2sf)__m2);
118}
119
120static __inline__ __m64 __DEFAULT_FN_ATTRS
121_m_pfsubr(__m64 __m1, __m64 __m2) {
122 return (__m64)__builtin_ia32_pfsubr((__v2sf)__m1, (__v2sf)__m2);
123}
124
125static __inline__ __m64 __DEFAULT_FN_ATTRS
126_m_pi2fd(__m64 __m) {
127 return (__m64)__builtin_ia32_pi2fd((__v2si)__m);
128}
129
130static __inline__ __m64 __DEFAULT_FN_ATTRS
131_m_pmulhrw(__m64 __m1, __m64 __m2) {
132 return (__m64)__builtin_ia32_pmulhrw((__v4hi)__m1, (__v4hi)__m2);
133}
134
135static __inline__ __m64 __DEFAULT_FN_ATTRS
136_m_pf2iw(__m64 __m) {
137 return (__m64)__builtin_ia32_pf2iw((__v2sf)__m);
138}
139
140static __inline__ __m64 __DEFAULT_FN_ATTRS
141_m_pfnacc(__m64 __m1, __m64 __m2) {
142 return (__m64)__builtin_ia32_pfnacc((__v2sf)__m1, (__v2sf)__m2);
143}
144
145static __inline__ __m64 __DEFAULT_FN_ATTRS
146_m_pfpnacc(__m64 __m1, __m64 __m2) {
147 return (__m64)__builtin_ia32_pfpnacc((__v2sf)__m1, (__v2sf)__m2);
148}
149
150static __inline__ __m64 __DEFAULT_FN_ATTRS
151_m_pi2fw(__m64 __m) {
152 return (__m64)__builtin_ia32_pi2fw((__v2si)__m);
153}
154
155static __inline__ __m64 __DEFAULT_FN_ATTRS
156_m_pswapdsf(__m64 __m) {
157 return (__m64)__builtin_ia32_pswapdsf((__v2sf)__m);
158}
159
160static __inline__ __m64 __DEFAULT_FN_ATTRS
161_m_pswapdsi(__m64 __m) {
162 return (__m64)__builtin_ia32_pswapdsi((__v2si)__m);
163}
164
165#undef __DEFAULT_FN_ATTRS
166
167#endif
c_headers/mm_malloc.h created+75
......@@ -0,0 +1,75 @@
1/*===---- mm_malloc.h - Allocating and Freeing Aligned Memory Blocks -------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __MM_MALLOC_H
25#define __MM_MALLOC_H
26
27#include <stdlib.h>
28
29#ifdef _WIN32
30#include <malloc.h>
31#else
32#ifndef __cplusplus
33extern int posix_memalign(void **__memptr, size_t __alignment, size_t __size);
34#else
35// Some systems (e.g. those with GNU libc) declare posix_memalign with an
36// exception specifier. Via an "egregious workaround" in
37// Sema::CheckEquivalentExceptionSpec, Clang accepts the following as a valid
38// redeclaration of glibc's declaration.
39extern "C" int posix_memalign(void **__memptr, size_t __alignment, size_t __size);
40#endif
41#endif
42
43#if !(defined(_WIN32) && defined(_mm_malloc))
44static __inline__ void *__attribute__((__always_inline__, __nodebug__,
45 __malloc__))
46_mm_malloc(size_t __size, size_t __align)
47{
48 if (__align == 1) {
49 return malloc(__size);
50 }
51
52 if (!(__align & (__align - 1)) && __align < sizeof(void *))
53 __align = sizeof(void *);
54
55 void *__mallocedMemory;
56#if defined(__MINGW32__)
57 __mallocedMemory = __mingw_aligned_malloc(__size, __align);
58#elif defined(_WIN32)
59 __mallocedMemory = _aligned_malloc(__size, __align);
60#else
61 if (posix_memalign(&__mallocedMemory, __align, __size))
62 return 0;
63#endif
64
65 return __mallocedMemory;
66}
67
68static __inline__ void __attribute__((__always_inline__, __nodebug__))
69_mm_free(void *__p)
70{
71 free(__p);
72}
73#endif
74
75#endif /* __MM_MALLOC_H */
c_headers/mmintrin.h created+507
......@@ -0,0 +1,507 @@
1/*===---- mmintrin.h - MMX intrinsics --------------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __MMINTRIN_H
25#define __MMINTRIN_H
26
27#ifndef __MMX__
28#error "MMX instruction set not enabled"
29#else
30
31typedef long long __m64 __attribute__((__vector_size__(8)));
32
33typedef int __v2si __attribute__((__vector_size__(8)));
34typedef short __v4hi __attribute__((__vector_size__(8)));
35typedef char __v8qi __attribute__((__vector_size__(8)));
36
37/* Define the default attributes for the functions in this file. */
38#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
39
40static __inline__ void __DEFAULT_FN_ATTRS
41_mm_empty(void)
42{
43 __builtin_ia32_emms();
44}
45
46static __inline__ __m64 __DEFAULT_FN_ATTRS
47_mm_cvtsi32_si64(int __i)
48{
49 return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
50}
51
52static __inline__ int __DEFAULT_FN_ATTRS
53_mm_cvtsi64_si32(__m64 __m)
54{
55 return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
56}
57
58static __inline__ __m64 __DEFAULT_FN_ATTRS
59_mm_cvtsi64_m64(long long __i)
60{
61 return (__m64)__i;
62}
63
64static __inline__ long long __DEFAULT_FN_ATTRS
65_mm_cvtm64_si64(__m64 __m)
66{
67 return (long long)__m;
68}
69
70static __inline__ __m64 __DEFAULT_FN_ATTRS
71_mm_packs_pi16(__m64 __m1, __m64 __m2)
72{
73 return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
74}
75
76static __inline__ __m64 __DEFAULT_FN_ATTRS
77_mm_packs_pi32(__m64 __m1, __m64 __m2)
78{
79 return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
80}
81
82static __inline__ __m64 __DEFAULT_FN_ATTRS
83_mm_packs_pu16(__m64 __m1, __m64 __m2)
84{
85 return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
86}
87
88static __inline__ __m64 __DEFAULT_FN_ATTRS
89_mm_unpackhi_pi8(__m64 __m1, __m64 __m2)
90{
91 return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
92}
93
94static __inline__ __m64 __DEFAULT_FN_ATTRS
95_mm_unpackhi_pi16(__m64 __m1, __m64 __m2)
96{
97 return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
98}
99
100static __inline__ __m64 __DEFAULT_FN_ATTRS
101_mm_unpackhi_pi32(__m64 __m1, __m64 __m2)
102{
103 return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
104}
105
106static __inline__ __m64 __DEFAULT_FN_ATTRS
107_mm_unpacklo_pi8(__m64 __m1, __m64 __m2)
108{
109 return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
110}
111
112static __inline__ __m64 __DEFAULT_FN_ATTRS
113_mm_unpacklo_pi16(__m64 __m1, __m64 __m2)
114{
115 return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
116}
117
118static __inline__ __m64 __DEFAULT_FN_ATTRS
119_mm_unpacklo_pi32(__m64 __m1, __m64 __m2)
120{
121 return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
122}
123
124static __inline__ __m64 __DEFAULT_FN_ATTRS
125_mm_add_pi8(__m64 __m1, __m64 __m2)
126{
127 return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
128}
129
130static __inline__ __m64 __DEFAULT_FN_ATTRS
131_mm_add_pi16(__m64 __m1, __m64 __m2)
132{
133 return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
134}
135
136static __inline__ __m64 __DEFAULT_FN_ATTRS
137_mm_add_pi32(__m64 __m1, __m64 __m2)
138{
139 return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
140}
141
142static __inline__ __m64 __DEFAULT_FN_ATTRS
143_mm_adds_pi8(__m64 __m1, __m64 __m2)
144{
145 return (__m64)__builtin_ia32_paddsb((__v8qi)__m1, (__v8qi)__m2);
146}
147
148static __inline__ __m64 __DEFAULT_FN_ATTRS
149_mm_adds_pi16(__m64 __m1, __m64 __m2)
150{
151 return (__m64)__builtin_ia32_paddsw((__v4hi)__m1, (__v4hi)__m2);
152}
153
154static __inline__ __m64 __DEFAULT_FN_ATTRS
155_mm_adds_pu8(__m64 __m1, __m64 __m2)
156{
157 return (__m64)__builtin_ia32_paddusb((__v8qi)__m1, (__v8qi)__m2);
158}
159
160static __inline__ __m64 __DEFAULT_FN_ATTRS
161_mm_adds_pu16(__m64 __m1, __m64 __m2)
162{
163 return (__m64)__builtin_ia32_paddusw((__v4hi)__m1, (__v4hi)__m2);
164}
165
166static __inline__ __m64 __DEFAULT_FN_ATTRS
167_mm_sub_pi8(__m64 __m1, __m64 __m2)
168{
169 return (__m64)__builtin_ia32_psubb((__v8qi)__m1, (__v8qi)__m2);
170}
171
172static __inline__ __m64 __DEFAULT_FN_ATTRS
173_mm_sub_pi16(__m64 __m1, __m64 __m2)
174{
175 return (__m64)__builtin_ia32_psubw((__v4hi)__m1, (__v4hi)__m2);
176}
177
178static __inline__ __m64 __DEFAULT_FN_ATTRS
179_mm_sub_pi32(__m64 __m1, __m64 __m2)
180{
181 return (__m64)__builtin_ia32_psubd((__v2si)__m1, (__v2si)__m2);
182}
183
184static __inline__ __m64 __DEFAULT_FN_ATTRS
185_mm_subs_pi8(__m64 __m1, __m64 __m2)
186{
187 return (__m64)__builtin_ia32_psubsb((__v8qi)__m1, (__v8qi)__m2);
188}
189
190static __inline__ __m64 __DEFAULT_FN_ATTRS
191_mm_subs_pi16(__m64 __m1, __m64 __m2)
192{
193 return (__m64)__builtin_ia32_psubsw((__v4hi)__m1, (__v4hi)__m2);
194}
195
196static __inline__ __m64 __DEFAULT_FN_ATTRS
197_mm_subs_pu8(__m64 __m1, __m64 __m2)
198{
199 return (__m64)__builtin_ia32_psubusb((__v8qi)__m1, (__v8qi)__m2);
200}
201
202static __inline__ __m64 __DEFAULT_FN_ATTRS
203_mm_subs_pu16(__m64 __m1, __m64 __m2)
204{
205 return (__m64)__builtin_ia32_psubusw((__v4hi)__m1, (__v4hi)__m2);
206}
207
208static __inline__ __m64 __DEFAULT_FN_ATTRS
209_mm_madd_pi16(__m64 __m1, __m64 __m2)
210{
211 return (__m64)__builtin_ia32_pmaddwd((__v4hi)__m1, (__v4hi)__m2);
212}
213
214static __inline__ __m64 __DEFAULT_FN_ATTRS
215_mm_mulhi_pi16(__m64 __m1, __m64 __m2)
216{
217 return (__m64)__builtin_ia32_pmulhw((__v4hi)__m1, (__v4hi)__m2);
218}
219
220static __inline__ __m64 __DEFAULT_FN_ATTRS
221_mm_mullo_pi16(__m64 __m1, __m64 __m2)
222{
223 return (__m64)__builtin_ia32_pmullw((__v4hi)__m1, (__v4hi)__m2);
224}
225
226static __inline__ __m64 __DEFAULT_FN_ATTRS
227_mm_sll_pi16(__m64 __m, __m64 __count)
228{
229 return (__m64)__builtin_ia32_psllw((__v4hi)__m, __count);
230}
231
232static __inline__ __m64 __DEFAULT_FN_ATTRS
233_mm_slli_pi16(__m64 __m, int __count)
234{
235 return (__m64)__builtin_ia32_psllwi((__v4hi)__m, __count);
236}
237
238static __inline__ __m64 __DEFAULT_FN_ATTRS
239_mm_sll_pi32(__m64 __m, __m64 __count)
240{
241 return (__m64)__builtin_ia32_pslld((__v2si)__m, __count);
242}
243
244static __inline__ __m64 __DEFAULT_FN_ATTRS
245_mm_slli_pi32(__m64 __m, int __count)
246{
247 return (__m64)__builtin_ia32_pslldi((__v2si)__m, __count);
248}
249
250static __inline__ __m64 __DEFAULT_FN_ATTRS
251_mm_sll_si64(__m64 __m, __m64 __count)
252{
253 return (__m64)__builtin_ia32_psllq(__m, __count);
254}
255
256static __inline__ __m64 __DEFAULT_FN_ATTRS
257_mm_slli_si64(__m64 __m, int __count)
258{
259 return (__m64)__builtin_ia32_psllqi(__m, __count);
260}
261
262static __inline__ __m64 __DEFAULT_FN_ATTRS
263_mm_sra_pi16(__m64 __m, __m64 __count)
264{
265 return (__m64)__builtin_ia32_psraw((__v4hi)__m, __count);
266}
267
268static __inline__ __m64 __DEFAULT_FN_ATTRS
269_mm_srai_pi16(__m64 __m, int __count)
270{
271 return (__m64)__builtin_ia32_psrawi((__v4hi)__m, __count);
272}
273
274static __inline__ __m64 __DEFAULT_FN_ATTRS
275_mm_sra_pi32(__m64 __m, __m64 __count)
276{
277 return (__m64)__builtin_ia32_psrad((__v2si)__m, __count);
278}
279
280static __inline__ __m64 __DEFAULT_FN_ATTRS
281_mm_srai_pi32(__m64 __m, int __count)
282{
283 return (__m64)__builtin_ia32_psradi((__v2si)__m, __count);
284}
285
286static __inline__ __m64 __DEFAULT_FN_ATTRS
287_mm_srl_pi16(__m64 __m, __m64 __count)
288{
289 return (__m64)__builtin_ia32_psrlw((__v4hi)__m, __count);
290}
291
292static __inline__ __m64 __DEFAULT_FN_ATTRS
293_mm_srli_pi16(__m64 __m, int __count)
294{
295 return (__m64)__builtin_ia32_psrlwi((__v4hi)__m, __count);
296}
297
298static __inline__ __m64 __DEFAULT_FN_ATTRS
299_mm_srl_pi32(__m64 __m, __m64 __count)
300{
301 return (__m64)__builtin_ia32_psrld((__v2si)__m, __count);
302}
303
304static __inline__ __m64 __DEFAULT_FN_ATTRS
305_mm_srli_pi32(__m64 __m, int __count)
306{
307 return (__m64)__builtin_ia32_psrldi((__v2si)__m, __count);
308}
309
310static __inline__ __m64 __DEFAULT_FN_ATTRS
311_mm_srl_si64(__m64 __m, __m64 __count)
312{
313 return (__m64)__builtin_ia32_psrlq(__m, __count);
314}
315
316static __inline__ __m64 __DEFAULT_FN_ATTRS
317_mm_srli_si64(__m64 __m, int __count)
318{
319 return (__m64)__builtin_ia32_psrlqi(__m, __count);
320}
321
322static __inline__ __m64 __DEFAULT_FN_ATTRS
323_mm_and_si64(__m64 __m1, __m64 __m2)
324{
325 return __builtin_ia32_pand(__m1, __m2);
326}
327
328static __inline__ __m64 __DEFAULT_FN_ATTRS
329_mm_andnot_si64(__m64 __m1, __m64 __m2)
330{
331 return __builtin_ia32_pandn(__m1, __m2);
332}
333
334static __inline__ __m64 __DEFAULT_FN_ATTRS
335_mm_or_si64(__m64 __m1, __m64 __m2)
336{
337 return __builtin_ia32_por(__m1, __m2);
338}
339
340static __inline__ __m64 __DEFAULT_FN_ATTRS
341_mm_xor_si64(__m64 __m1, __m64 __m2)
342{
343 return __builtin_ia32_pxor(__m1, __m2);
344}
345
346static __inline__ __m64 __DEFAULT_FN_ATTRS
347_mm_cmpeq_pi8(__m64 __m1, __m64 __m2)
348{
349 return (__m64)__builtin_ia32_pcmpeqb((__v8qi)__m1, (__v8qi)__m2);
350}
351
352static __inline__ __m64 __DEFAULT_FN_ATTRS
353_mm_cmpeq_pi16(__m64 __m1, __m64 __m2)
354{
355 return (__m64)__builtin_ia32_pcmpeqw((__v4hi)__m1, (__v4hi)__m2);
356}
357
358static __inline__ __m64 __DEFAULT_FN_ATTRS
359_mm_cmpeq_pi32(__m64 __m1, __m64 __m2)
360{
361 return (__m64)__builtin_ia32_pcmpeqd((__v2si)__m1, (__v2si)__m2);
362}
363
364static __inline__ __m64 __DEFAULT_FN_ATTRS
365_mm_cmpgt_pi8(__m64 __m1, __m64 __m2)
366{
367 return (__m64)__builtin_ia32_pcmpgtb((__v8qi)__m1, (__v8qi)__m2);
368}
369
370static __inline__ __m64 __DEFAULT_FN_ATTRS
371_mm_cmpgt_pi16(__m64 __m1, __m64 __m2)
372{
373 return (__m64)__builtin_ia32_pcmpgtw((__v4hi)__m1, (__v4hi)__m2);
374}
375
376static __inline__ __m64 __DEFAULT_FN_ATTRS
377_mm_cmpgt_pi32(__m64 __m1, __m64 __m2)
378{
379 return (__m64)__builtin_ia32_pcmpgtd((__v2si)__m1, (__v2si)__m2);
380}
381
382static __inline__ __m64 __DEFAULT_FN_ATTRS
383_mm_setzero_si64(void)
384{
385 return (__m64){ 0LL };
386}
387
388static __inline__ __m64 __DEFAULT_FN_ATTRS
389_mm_set_pi32(int __i1, int __i0)
390{
391 return (__m64)__builtin_ia32_vec_init_v2si(__i0, __i1);
392}
393
394static __inline__ __m64 __DEFAULT_FN_ATTRS
395_mm_set_pi16(short __s3, short __s2, short __s1, short __s0)
396{
397 return (__m64)__builtin_ia32_vec_init_v4hi(__s0, __s1, __s2, __s3);
398}
399
400static __inline__ __m64 __DEFAULT_FN_ATTRS
401_mm_set_pi8(char __b7, char __b6, char __b5, char __b4, char __b3, char __b2,
402 char __b1, char __b0)
403{
404 return (__m64)__builtin_ia32_vec_init_v8qi(__b0, __b1, __b2, __b3,
405 __b4, __b5, __b6, __b7);
406}
407
408static __inline__ __m64 __DEFAULT_FN_ATTRS
409_mm_set1_pi32(int __i)
410{
411 return _mm_set_pi32(__i, __i);
412}
413
414static __inline__ __m64 __DEFAULT_FN_ATTRS
415_mm_set1_pi16(short __w)
416{
417 return _mm_set_pi16(__w, __w, __w, __w);
418}
419
420static __inline__ __m64 __DEFAULT_FN_ATTRS
421_mm_set1_pi8(char __b)
422{
423 return _mm_set_pi8(__b, __b, __b, __b, __b, __b, __b, __b);
424}
425
426static __inline__ __m64 __DEFAULT_FN_ATTRS
427_mm_setr_pi32(int __i0, int __i1)
428{
429 return _mm_set_pi32(__i1, __i0);
430}
431
432static __inline__ __m64 __DEFAULT_FN_ATTRS
433_mm_setr_pi16(short __w0, short __w1, short __w2, short __w3)
434{
435 return _mm_set_pi16(__w3, __w2, __w1, __w0);
436}
437
438static __inline__ __m64 __DEFAULT_FN_ATTRS
439_mm_setr_pi8(char __b0, char __b1, char __b2, char __b3, char __b4, char __b5,
440 char __b6, char __b7)
441{
442 return _mm_set_pi8(__b7, __b6, __b5, __b4, __b3, __b2, __b1, __b0);
443}
444
445#undef __DEFAULT_FN_ATTRS
446
447/* Aliases for compatibility. */
448#define _m_empty _mm_empty
449#define _m_from_int _mm_cvtsi32_si64
450#define _m_to_int _mm_cvtsi64_si32
451#define _m_packsswb _mm_packs_pi16
452#define _m_packssdw _mm_packs_pi32
453#define _m_packuswb _mm_packs_pu16
454#define _m_punpckhbw _mm_unpackhi_pi8
455#define _m_punpckhwd _mm_unpackhi_pi16
456#define _m_punpckhdq _mm_unpackhi_pi32
457#define _m_punpcklbw _mm_unpacklo_pi8
458#define _m_punpcklwd _mm_unpacklo_pi16
459#define _m_punpckldq _mm_unpacklo_pi32
460#define _m_paddb _mm_add_pi8
461#define _m_paddw _mm_add_pi16
462#define _m_paddd _mm_add_pi32
463#define _m_paddsb _mm_adds_pi8
464#define _m_paddsw _mm_adds_pi16
465#define _m_paddusb _mm_adds_pu8
466#define _m_paddusw _mm_adds_pu16
467#define _m_psubb _mm_sub_pi8
468#define _m_psubw _mm_sub_pi16
469#define _m_psubd _mm_sub_pi32
470#define _m_psubsb _mm_subs_pi8
471#define _m_psubsw _mm_subs_pi16
472#define _m_psubusb _mm_subs_pu8
473#define _m_psubusw _mm_subs_pu16
474#define _m_pmaddwd _mm_madd_pi16
475#define _m_pmulhw _mm_mulhi_pi16
476#define _m_pmullw _mm_mullo_pi16
477#define _m_psllw _mm_sll_pi16
478#define _m_psllwi _mm_slli_pi16
479#define _m_pslld _mm_sll_pi32
480#define _m_pslldi _mm_slli_pi32
481#define _m_psllq _mm_sll_si64
482#define _m_psllqi _mm_slli_si64
483#define _m_psraw _mm_sra_pi16
484#define _m_psrawi _mm_srai_pi16
485#define _m_psrad _mm_sra_pi32
486#define _m_psradi _mm_srai_pi32
487#define _m_psrlw _mm_srl_pi16
488#define _m_psrlwi _mm_srli_pi16
489#define _m_psrld _mm_srl_pi32
490#define _m_psrldi _mm_srli_pi32
491#define _m_psrlq _mm_srl_si64
492#define _m_psrlqi _mm_srli_si64
493#define _m_pand _mm_and_si64
494#define _m_pandn _mm_andnot_si64
495#define _m_por _mm_or_si64
496#define _m_pxor _mm_xor_si64
497#define _m_pcmpeqb _mm_cmpeq_pi8
498#define _m_pcmpeqw _mm_cmpeq_pi16
499#define _m_pcmpeqd _mm_cmpeq_pi32
500#define _m_pcmpgtb _mm_cmpgt_pi8
501#define _m_pcmpgtw _mm_cmpgt_pi16
502#define _m_pcmpgtd _mm_cmpgt_pi32
503
504#endif /* __MMX__ */
505
506#endif /* __MMINTRIN_H */
507
c_headers/nmmintrin.h created+35
......@@ -0,0 +1,35 @@
1/*===---- nmmintrin.h - SSE4 intrinsics ------------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef _NMMINTRIN_H
25#define _NMMINTRIN_H
26
27#ifndef __SSE4_2__
28#error "SSE4.2 instruction set not enabled"
29#else
30
31/* To match expectations of gcc we put the sse4.2 definitions into smmintrin.h,
32 just include it now then. */
33#include <smmintrin.h>
34#endif /* __SSE4_2__ */
35#endif /* _NMMINTRIN_H */
c_headers/pmmintrin.h created+122
......@@ -0,0 +1,122 @@
1/*===---- pmmintrin.h - SSE3 intrinsics ------------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __PMMINTRIN_H
25#define __PMMINTRIN_H
26
27#ifndef __SSE3__
28#error "SSE3 instruction set not enabled"
29#else
30
31#include <emmintrin.h>
32
33/* Define the default attributes for the functions in this file. */
34#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
35
36static __inline__ __m128i __DEFAULT_FN_ATTRS
37_mm_lddqu_si128(__m128i const *__p)
38{
39 return (__m128i)__builtin_ia32_lddqu((char const *)__p);
40}
41
42static __inline__ __m128 __DEFAULT_FN_ATTRS
43_mm_addsub_ps(__m128 __a, __m128 __b)
44{
45 return __builtin_ia32_addsubps(__a, __b);
46}
47
48static __inline__ __m128 __DEFAULT_FN_ATTRS
49_mm_hadd_ps(__m128 __a, __m128 __b)
50{
51 return __builtin_ia32_haddps(__a, __b);
52}
53
54static __inline__ __m128 __DEFAULT_FN_ATTRS
55_mm_hsub_ps(__m128 __a, __m128 __b)
56{
57 return __builtin_ia32_hsubps(__a, __b);
58}
59
60static __inline__ __m128 __DEFAULT_FN_ATTRS
61_mm_movehdup_ps(__m128 __a)
62{
63 return __builtin_shufflevector(__a, __a, 1, 1, 3, 3);
64}
65
66static __inline__ __m128 __DEFAULT_FN_ATTRS
67_mm_moveldup_ps(__m128 __a)
68{
69 return __builtin_shufflevector(__a, __a, 0, 0, 2, 2);
70}
71
72static __inline__ __m128d __DEFAULT_FN_ATTRS
73_mm_addsub_pd(__m128d __a, __m128d __b)
74{
75 return __builtin_ia32_addsubpd(__a, __b);
76}
77
78static __inline__ __m128d __DEFAULT_FN_ATTRS
79_mm_hadd_pd(__m128d __a, __m128d __b)
80{
81 return __builtin_ia32_haddpd(__a, __b);
82}
83
84static __inline__ __m128d __DEFAULT_FN_ATTRS
85_mm_hsub_pd(__m128d __a, __m128d __b)
86{
87 return __builtin_ia32_hsubpd(__a, __b);
88}
89
90#define _mm_loaddup_pd(dp) _mm_load1_pd(dp)
91
92static __inline__ __m128d __DEFAULT_FN_ATTRS
93_mm_movedup_pd(__m128d __a)
94{
95 return __builtin_shufflevector(__a, __a, 0, 0);
96}
97
98#define _MM_DENORMALS_ZERO_ON (0x0040)
99#define _MM_DENORMALS_ZERO_OFF (0x0000)
100
101#define _MM_DENORMALS_ZERO_MASK (0x0040)
102
103#define _MM_GET_DENORMALS_ZERO_MODE() (_mm_getcsr() & _MM_DENORMALS_ZERO_MASK)
104#define _MM_SET_DENORMALS_ZERO_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_DENORMALS_ZERO_MASK) | (x)))
105
106static __inline__ void __DEFAULT_FN_ATTRS
107_mm_monitor(void const *__p, unsigned __extensions, unsigned __hints)
108{
109 __builtin_ia32_monitor((void *)__p, __extensions, __hints);
110}
111
112static __inline__ void __DEFAULT_FN_ATTRS
113_mm_mwait(unsigned __extensions, unsigned __hints)
114{
115 __builtin_ia32_mwait(__extensions, __hints);
116}
117
118#undef __DEFAULT_FN_ATTRS
119
120#endif /* __SSE3__ */
121
122#endif /* __PMMINTRIN_H */
c_headers/popcntintrin.h created+50
......@@ -0,0 +1,50 @@
1/*===---- popcntintrin.h - POPCNT intrinsics -------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __POPCNT__
25#error "POPCNT instruction set not enabled"
26#endif
27
28#ifndef _POPCNTINTRIN_H
29#define _POPCNTINTRIN_H
30
31/* Define the default attributes for the functions in this file. */
32#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
33
34static __inline__ int __DEFAULT_FN_ATTRS
35_mm_popcnt_u32(unsigned int __A)
36{
37 return __builtin_popcount(__A);
38}
39
40#ifdef __x86_64__
41static __inline__ long long __DEFAULT_FN_ATTRS
42_mm_popcnt_u64(unsigned long long __A)
43{
44 return __builtin_popcountll(__A);
45}
46#endif /* __x86_64__ */
47
48#undef __DEFAULT_FN_ATTRS
49
50#endif /* _POPCNTINTRIN_H */
c_headers/prfchwintrin.h created+39
......@@ -0,0 +1,39 @@
1/*===---- prfchwintrin.h - PREFETCHW intrinsic -----------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#if !defined(__X86INTRIN_H) && !defined(_MM3DNOW_H_INCLUDED)
25#error "Never use <prfchwintrin.h> directly; include <x86intrin.h> or <mm3dnow.h> instead."
26#endif
27
28#ifndef __PRFCHWINTRIN_H
29#define __PRFCHWINTRIN_H
30
31#if defined(__PRFCHW__) || defined(__3dNOW__)
32static __inline__ void __attribute__((__always_inline__, __nodebug__))
33_m_prefetchw(void *__P)
34{
35 __builtin_prefetch (__P, 1, 3 /* _MM_HINT_T0 */);
36}
37#endif
38
39#endif /* __PRFCHWINTRIN_H */
c_headers/rdseedintrin.h created+59
......@@ -0,0 +1,59 @@
1/*===---- rdseedintrin.h - RDSEED intrinsics -------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __X86INTRIN_H
25#error "Never use <rdseedintrin.h> directly; include <x86intrin.h> instead."
26#endif
27
28#ifndef __RDSEEDINTRIN_H
29#define __RDSEEDINTRIN_H
30
31#ifdef __RDSEED__
32
33/* Define the default attributes for the functions in this file. */
34#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
35
36static __inline__ int __DEFAULT_FN_ATTRS
37_rdseed16_step(unsigned short *__p)
38{
39 return __builtin_ia32_rdseed16_step(__p);
40}
41
42static __inline__ int __DEFAULT_FN_ATTRS
43_rdseed32_step(unsigned int *__p)
44{
45 return __builtin_ia32_rdseed32_step(__p);
46}
47
48#ifdef __x86_64__
49static __inline__ int __DEFAULT_FN_ATTRS
50_rdseed64_step(unsigned long long *__p)
51{
52 return __builtin_ia32_rdseed64_step(__p);
53}
54#endif
55
56#undef __DEFAULT_FN_ATTRS
57
58#endif /* __RDSEED__ */
59#endif /* __RDSEEDINTRIN_H */
c_headers/rtmintrin.h created+59
......@@ -0,0 +1,59 @@
1/*===---- rtmintrin.h - RTM intrinsics -------------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __IMMINTRIN_H
25#error "Never use <rtmintrin.h> directly; include <immintrin.h> instead."
26#endif
27
28#ifndef __RTMINTRIN_H
29#define __RTMINTRIN_H
30
31#define _XBEGIN_STARTED (~0u)
32#define _XABORT_EXPLICIT (1 << 0)
33#define _XABORT_RETRY (1 << 1)
34#define _XABORT_CONFLICT (1 << 2)
35#define _XABORT_CAPACITY (1 << 3)
36#define _XABORT_DEBUG (1 << 4)
37#define _XABORT_NESTED (1 << 5)
38#define _XABORT_CODE(x) (((x) >> 24) & 0xFF)
39
40/* Define the default attributes for the functions in this file. */
41#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
42
43static __inline__ unsigned int __DEFAULT_FN_ATTRS
44_xbegin(void)
45{
46 return __builtin_ia32_xbegin();
47}
48
49static __inline__ void __DEFAULT_FN_ATTRS
50_xend(void)
51{
52 __builtin_ia32_xend();
53}
54
55#define _xabort(imm) __builtin_ia32_xabort((imm))
56
57#undef __DEFAULT_FN_ATTRS
58
59#endif /* __RTMINTRIN_H */
c_headers/s390intrin.h created+39
......@@ -0,0 +1,39 @@
1/*===---- s390intrin.h - SystemZ intrinsics --------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __S390INTRIN_H
25#define __S390INTRIN_H
26
27#ifndef __s390__
28#error "<s390intrin.h> is for s390 only"
29#endif
30
31#ifdef __HTM__
32#include <htmintrin.h>
33#endif
34
35#ifdef __VEC__
36#include <vecintrin.h>
37#endif
38
39#endif /* __S390INTRIN_H*/
c_headers/shaintrin.h created+79
......@@ -0,0 +1,79 @@
1/*===---- shaintrin.h - SHA intrinsics -------------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __IMMINTRIN_H
25#error "Never use <shaintrin.h> directly; include <immintrin.h> instead."
26#endif
27
28#ifndef __SHAINTRIN_H
29#define __SHAINTRIN_H
30
31#if !defined (__SHA__)
32# error "SHA instructions not enabled"
33#endif
34
35/* Define the default attributes for the functions in this file. */
36#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
37
38#define _mm_sha1rnds4_epu32(V1, V2, M) __extension__ ({ \
39 __builtin_ia32_sha1rnds4((V1), (V2), (M)); })
40
41static __inline__ __m128i __DEFAULT_FN_ATTRS
42_mm_sha1nexte_epu32(__m128i __X, __m128i __Y)
43{
44 return (__m128i)__builtin_ia32_sha1nexte((__v4si)__X, (__v4si)__Y);
45}
46
47static __inline__ __m128i __DEFAULT_FN_ATTRS
48_mm_sha1msg1_epu32(__m128i __X, __m128i __Y)
49{
50 return (__m128i)__builtin_ia32_sha1msg1((__v4si)__X, (__v4si)__Y);
51}
52
53static __inline__ __m128i __DEFAULT_FN_ATTRS
54_mm_sha1msg2_epu32(__m128i __X, __m128i __Y)
55{
56 return (__m128i)__builtin_ia32_sha1msg2((__v4si)__X, (__v4si)__Y);
57}
58
59static __inline__ __m128i __DEFAULT_FN_ATTRS
60_mm_sha256rnds2_epu32(__m128i __X, __m128i __Y, __m128i __Z)
61{
62 return (__m128i)__builtin_ia32_sha256rnds2((__v4si)__X, (__v4si)__Y, (__v4si)__Z);
63}
64
65static __inline__ __m128i __DEFAULT_FN_ATTRS
66_mm_sha256msg1_epu32(__m128i __X, __m128i __Y)
67{
68 return (__m128i)__builtin_ia32_sha256msg1((__v4si)__X, (__v4si)__Y);
69}
70
71static __inline__ __m128i __DEFAULT_FN_ATTRS
72_mm_sha256msg2_epu32(__m128i __X, __m128i __Y)
73{
74 return (__m128i)__builtin_ia32_sha256msg2((__v4si)__X, (__v4si)__Y);
75}
76
77#undef __DEFAULT_FN_ATTRS
78
79#endif /* __SHAINTRIN_H */
c_headers/smmintrin.h created+487
......@@ -0,0 +1,487 @@
1/*===---- smmintrin.h - SSE4 intrinsics ------------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef _SMMINTRIN_H
25#define _SMMINTRIN_H
26
27#ifndef __SSE4_1__
28#error "SSE4.1 instruction set not enabled"
29#else
30
31#include <tmmintrin.h>
32
33/* Define the default attributes for the functions in this file. */
34#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
35
36/* SSE4 Rounding macros. */
37#define _MM_FROUND_TO_NEAREST_INT 0x00
38#define _MM_FROUND_TO_NEG_INF 0x01
39#define _MM_FROUND_TO_POS_INF 0x02
40#define _MM_FROUND_TO_ZERO 0x03
41#define _MM_FROUND_CUR_DIRECTION 0x04
42
43#define _MM_FROUND_RAISE_EXC 0x00
44#define _MM_FROUND_NO_EXC 0x08
45
46#define _MM_FROUND_NINT (_MM_FROUND_RAISE_EXC | _MM_FROUND_TO_NEAREST_INT)
47#define _MM_FROUND_FLOOR (_MM_FROUND_RAISE_EXC | _MM_FROUND_TO_NEG_INF)
48#define _MM_FROUND_CEIL (_MM_FROUND_RAISE_EXC | _MM_FROUND_TO_POS_INF)
49#define _MM_FROUND_TRUNC (_MM_FROUND_RAISE_EXC | _MM_FROUND_TO_ZERO)
50#define _MM_FROUND_RINT (_MM_FROUND_RAISE_EXC | _MM_FROUND_CUR_DIRECTION)
51#define _MM_FROUND_NEARBYINT (_MM_FROUND_NO_EXC | _MM_FROUND_CUR_DIRECTION)
52
53#define _mm_ceil_ps(X) _mm_round_ps((X), _MM_FROUND_CEIL)
54#define _mm_ceil_pd(X) _mm_round_pd((X), _MM_FROUND_CEIL)
55#define _mm_ceil_ss(X, Y) _mm_round_ss((X), (Y), _MM_FROUND_CEIL)
56#define _mm_ceil_sd(X, Y) _mm_round_sd((X), (Y), _MM_FROUND_CEIL)
57
58#define _mm_floor_ps(X) _mm_round_ps((X), _MM_FROUND_FLOOR)
59#define _mm_floor_pd(X) _mm_round_pd((X), _MM_FROUND_FLOOR)
60#define _mm_floor_ss(X, Y) _mm_round_ss((X), (Y), _MM_FROUND_FLOOR)
61#define _mm_floor_sd(X, Y) _mm_round_sd((X), (Y), _MM_FROUND_FLOOR)
62
63#define _mm_round_ps(X, M) __extension__ ({ \
64 __m128 __X = (X); \
65 (__m128) __builtin_ia32_roundps((__v4sf)__X, (M)); })
66
67#define _mm_round_ss(X, Y, M) __extension__ ({ \
68 __m128 __X = (X); \
69 __m128 __Y = (Y); \
70 (__m128) __builtin_ia32_roundss((__v4sf)__X, (__v4sf)__Y, (M)); })
71
72#define _mm_round_pd(X, M) __extension__ ({ \
73 __m128d __X = (X); \
74 (__m128d) __builtin_ia32_roundpd((__v2df)__X, (M)); })
75
76#define _mm_round_sd(X, Y, M) __extension__ ({ \
77 __m128d __X = (X); \
78 __m128d __Y = (Y); \
79 (__m128d) __builtin_ia32_roundsd((__v2df)__X, (__v2df)__Y, (M)); })
80
81/* SSE4 Packed Blending Intrinsics. */
82#define _mm_blend_pd(V1, V2, M) __extension__ ({ \
83 __m128d __V1 = (V1); \
84 __m128d __V2 = (V2); \
85 (__m128d)__builtin_shufflevector((__v2df)__V1, (__v2df)__V2, \
86 (((M) & 0x01) ? 2 : 0), \
87 (((M) & 0x02) ? 3 : 1)); })
88
89#define _mm_blend_ps(V1, V2, M) __extension__ ({ \
90 __m128 __V1 = (V1); \
91 __m128 __V2 = (V2); \
92 (__m128)__builtin_shufflevector((__v4sf)__V1, (__v4sf)__V2, \
93 (((M) & 0x01) ? 4 : 0), \
94 (((M) & 0x02) ? 5 : 1), \
95 (((M) & 0x04) ? 6 : 2), \
96 (((M) & 0x08) ? 7 : 3)); })
97
98static __inline__ __m128d __DEFAULT_FN_ATTRS
99_mm_blendv_pd (__m128d __V1, __m128d __V2, __m128d __M)
100{
101 return (__m128d) __builtin_ia32_blendvpd ((__v2df)__V1, (__v2df)__V2,
102 (__v2df)__M);
103}
104
105static __inline__ __m128 __DEFAULT_FN_ATTRS
106_mm_blendv_ps (__m128 __V1, __m128 __V2, __m128 __M)
107{
108 return (__m128) __builtin_ia32_blendvps ((__v4sf)__V1, (__v4sf)__V2,
109 (__v4sf)__M);
110}
111
112static __inline__ __m128i __DEFAULT_FN_ATTRS
113_mm_blendv_epi8 (__m128i __V1, __m128i __V2, __m128i __M)
114{
115 return (__m128i) __builtin_ia32_pblendvb128 ((__v16qi)__V1, (__v16qi)__V2,
116 (__v16qi)__M);
117}
118
119#define _mm_blend_epi16(V1, V2, M) __extension__ ({ \
120 __m128i __V1 = (V1); \
121 __m128i __V2 = (V2); \
122 (__m128i)__builtin_shufflevector((__v8hi)__V1, (__v8hi)__V2, \
123 (((M) & 0x01) ? 8 : 0), \
124 (((M) & 0x02) ? 9 : 1), \
125 (((M) & 0x04) ? 10 : 2), \
126 (((M) & 0x08) ? 11 : 3), \
127 (((M) & 0x10) ? 12 : 4), \
128 (((M) & 0x20) ? 13 : 5), \
129 (((M) & 0x40) ? 14 : 6), \
130 (((M) & 0x80) ? 15 : 7)); })
131
132/* SSE4 Dword Multiply Instructions. */
133static __inline__ __m128i __DEFAULT_FN_ATTRS
134_mm_mullo_epi32 (__m128i __V1, __m128i __V2)
135{
136 return (__m128i) ((__v4si)__V1 * (__v4si)__V2);
137}
138
139static __inline__ __m128i __DEFAULT_FN_ATTRS
140_mm_mul_epi32 (__m128i __V1, __m128i __V2)
141{
142 return (__m128i) __builtin_ia32_pmuldq128 ((__v4si)__V1, (__v4si)__V2);
143}
144
145/* SSE4 Floating Point Dot Product Instructions. */
146#define _mm_dp_ps(X, Y, M) __extension__ ({ \
147 __m128 __X = (X); \
148 __m128 __Y = (Y); \
149 (__m128) __builtin_ia32_dpps((__v4sf)__X, (__v4sf)__Y, (M)); })
150
151#define _mm_dp_pd(X, Y, M) __extension__ ({\
152 __m128d __X = (X); \
153 __m128d __Y = (Y); \
154 (__m128d) __builtin_ia32_dppd((__v2df)__X, (__v2df)__Y, (M)); })
155
156/* SSE4 Streaming Load Hint Instruction. */
157static __inline__ __m128i __DEFAULT_FN_ATTRS
158_mm_stream_load_si128 (__m128i *__V)
159{
160 return (__m128i) __builtin_ia32_movntdqa ((__v2di *) __V);
161}
162
163/* SSE4 Packed Integer Min/Max Instructions. */
164static __inline__ __m128i __DEFAULT_FN_ATTRS
165_mm_min_epi8 (__m128i __V1, __m128i __V2)
166{
167 return (__m128i) __builtin_ia32_pminsb128 ((__v16qi) __V1, (__v16qi) __V2);
168}
169
170static __inline__ __m128i __DEFAULT_FN_ATTRS
171_mm_max_epi8 (__m128i __V1, __m128i __V2)
172{
173 return (__m128i) __builtin_ia32_pmaxsb128 ((__v16qi) __V1, (__v16qi) __V2);
174}
175
176static __inline__ __m128i __DEFAULT_FN_ATTRS
177_mm_min_epu16 (__m128i __V1, __m128i __V2)
178{
179 return (__m128i) __builtin_ia32_pminuw128 ((__v8hi) __V1, (__v8hi) __V2);
180}
181
182static __inline__ __m128i __DEFAULT_FN_ATTRS
183_mm_max_epu16 (__m128i __V1, __m128i __V2)
184{
185 return (__m128i) __builtin_ia32_pmaxuw128 ((__v8hi) __V1, (__v8hi) __V2);
186}
187
188static __inline__ __m128i __DEFAULT_FN_ATTRS
189_mm_min_epi32 (__m128i __V1, __m128i __V2)
190{
191 return (__m128i) __builtin_ia32_pminsd128 ((__v4si) __V1, (__v4si) __V2);
192}
193
194static __inline__ __m128i __DEFAULT_FN_ATTRS
195_mm_max_epi32 (__m128i __V1, __m128i __V2)
196{
197 return (__m128i) __builtin_ia32_pmaxsd128 ((__v4si) __V1, (__v4si) __V2);
198}
199
200static __inline__ __m128i __DEFAULT_FN_ATTRS
201_mm_min_epu32 (__m128i __V1, __m128i __V2)
202{
203 return (__m128i) __builtin_ia32_pminud128((__v4si) __V1, (__v4si) __V2);
204}
205
206static __inline__ __m128i __DEFAULT_FN_ATTRS
207_mm_max_epu32 (__m128i __V1, __m128i __V2)
208{
209 return (__m128i) __builtin_ia32_pmaxud128((__v4si) __V1, (__v4si) __V2);
210}
211
212/* SSE4 Insertion and Extraction from XMM Register Instructions. */
213#define _mm_insert_ps(X, Y, N) __builtin_ia32_insertps128((X), (Y), (N))
214#define _mm_extract_ps(X, N) (__extension__ \
215 ({ union { int __i; float __f; } __t; \
216 __v4sf __a = (__v4sf)(X); \
217 __t.__f = __a[(N) & 3]; \
218 __t.__i;}))
219
220/* Miscellaneous insert and extract macros. */
221/* Extract a single-precision float from X at index N into D. */
222#define _MM_EXTRACT_FLOAT(D, X, N) (__extension__ ({ __v4sf __a = (__v4sf)(X); \
223 (D) = __a[N]; }))
224
225/* Or together 2 sets of indexes (X and Y) with the zeroing bits (Z) to create
226 an index suitable for _mm_insert_ps. */
227#define _MM_MK_INSERTPS_NDX(X, Y, Z) (((X) << 6) | ((Y) << 4) | (Z))
228
229/* Extract a float from X at index N into the first index of the return. */
230#define _MM_PICK_OUT_PS(X, N) _mm_insert_ps (_mm_setzero_ps(), (X), \
231 _MM_MK_INSERTPS_NDX((N), 0, 0x0e))
232
233/* Insert int into packed integer array at index. */
234#define _mm_insert_epi8(X, I, N) (__extension__ ({ __v16qi __a = (__v16qi)(X); \
235 __a[(N) & 15] = (I); \
236 __a;}))
237#define _mm_insert_epi32(X, I, N) (__extension__ ({ __v4si __a = (__v4si)(X); \
238 __a[(N) & 3] = (I); \
239 __a;}))
240#ifdef __x86_64__
241#define _mm_insert_epi64(X, I, N) (__extension__ ({ __v2di __a = (__v2di)(X); \
242 __a[(N) & 1] = (I); \
243 __a;}))
244#endif /* __x86_64__ */
245
246/* Extract int from packed integer array at index. This returns the element
247 * as a zero extended value, so it is unsigned.
248 */
249#define _mm_extract_epi8(X, N) (__extension__ ({ __v16qi __a = (__v16qi)(X); \
250 (int)(unsigned char) \
251 __a[(N) & 15];}))
252#define _mm_extract_epi32(X, N) (__extension__ ({ __v4si __a = (__v4si)(X); \
253 __a[(N) & 3];}))
254#ifdef __x86_64__
255#define _mm_extract_epi64(X, N) (__extension__ ({ __v2di __a = (__v2di)(X); \
256 __a[(N) & 1];}))
257#endif /* __x86_64 */
258
259/* SSE4 128-bit Packed Integer Comparisons. */
260static __inline__ int __DEFAULT_FN_ATTRS
261_mm_testz_si128(__m128i __M, __m128i __V)
262{
263 return __builtin_ia32_ptestz128((__v2di)__M, (__v2di)__V);
264}
265
266static __inline__ int __DEFAULT_FN_ATTRS
267_mm_testc_si128(__m128i __M, __m128i __V)
268{
269 return __builtin_ia32_ptestc128((__v2di)__M, (__v2di)__V);
270}
271
272static __inline__ int __DEFAULT_FN_ATTRS
273_mm_testnzc_si128(__m128i __M, __m128i __V)
274{
275 return __builtin_ia32_ptestnzc128((__v2di)__M, (__v2di)__V);
276}
277
278#define _mm_test_all_ones(V) _mm_testc_si128((V), _mm_cmpeq_epi32((V), (V)))
279#define _mm_test_mix_ones_zeros(M, V) _mm_testnzc_si128((M), (V))
280#define _mm_test_all_zeros(M, V) _mm_testz_si128 ((M), (V))
281
282/* SSE4 64-bit Packed Integer Comparisons. */
283static __inline__ __m128i __DEFAULT_FN_ATTRS
284_mm_cmpeq_epi64(__m128i __V1, __m128i __V2)
285{
286 return (__m128i)((__v2di)__V1 == (__v2di)__V2);
287}
288
289/* SSE4 Packed Integer Sign-Extension. */
290static __inline__ __m128i __DEFAULT_FN_ATTRS
291_mm_cvtepi8_epi16(__m128i __V)
292{
293 return (__m128i) __builtin_ia32_pmovsxbw128((__v16qi) __V);
294}
295
296static __inline__ __m128i __DEFAULT_FN_ATTRS
297_mm_cvtepi8_epi32(__m128i __V)
298{
299 return (__m128i) __builtin_ia32_pmovsxbd128((__v16qi) __V);
300}
301
302static __inline__ __m128i __DEFAULT_FN_ATTRS
303_mm_cvtepi8_epi64(__m128i __V)
304{
305 return (__m128i) __builtin_ia32_pmovsxbq128((__v16qi) __V);
306}
307
308static __inline__ __m128i __DEFAULT_FN_ATTRS
309_mm_cvtepi16_epi32(__m128i __V)
310{
311 return (__m128i) __builtin_ia32_pmovsxwd128((__v8hi) __V);
312}
313
314static __inline__ __m128i __DEFAULT_FN_ATTRS
315_mm_cvtepi16_epi64(__m128i __V)
316{
317 return (__m128i) __builtin_ia32_pmovsxwq128((__v8hi)__V);
318}
319
320static __inline__ __m128i __DEFAULT_FN_ATTRS
321_mm_cvtepi32_epi64(__m128i __V)
322{
323 return (__m128i) __builtin_ia32_pmovsxdq128((__v4si)__V);
324}
325
326/* SSE4 Packed Integer Zero-Extension. */
327static __inline__ __m128i __DEFAULT_FN_ATTRS
328_mm_cvtepu8_epi16(__m128i __V)
329{
330 return (__m128i) __builtin_ia32_pmovzxbw128((__v16qi) __V);
331}
332
333static __inline__ __m128i __DEFAULT_FN_ATTRS
334_mm_cvtepu8_epi32(__m128i __V)
335{
336 return (__m128i) __builtin_ia32_pmovzxbd128((__v16qi)__V);
337}
338
339static __inline__ __m128i __DEFAULT_FN_ATTRS
340_mm_cvtepu8_epi64(__m128i __V)
341{
342 return (__m128i) __builtin_ia32_pmovzxbq128((__v16qi)__V);
343}
344
345static __inline__ __m128i __DEFAULT_FN_ATTRS
346_mm_cvtepu16_epi32(__m128i __V)
347{
348 return (__m128i) __builtin_ia32_pmovzxwd128((__v8hi)__V);
349}
350
351static __inline__ __m128i __DEFAULT_FN_ATTRS
352_mm_cvtepu16_epi64(__m128i __V)
353{
354 return (__m128i) __builtin_ia32_pmovzxwq128((__v8hi)__V);
355}
356
357static __inline__ __m128i __DEFAULT_FN_ATTRS
358_mm_cvtepu32_epi64(__m128i __V)
359{
360 return (__m128i) __builtin_ia32_pmovzxdq128((__v4si)__V);
361}
362
363/* SSE4 Pack with Unsigned Saturation. */
364static __inline__ __m128i __DEFAULT_FN_ATTRS
365_mm_packus_epi32(__m128i __V1, __m128i __V2)
366{
367 return (__m128i) __builtin_ia32_packusdw128((__v4si)__V1, (__v4si)__V2);
368}
369
370/* SSE4 Multiple Packed Sums of Absolute Difference. */
371#define _mm_mpsadbw_epu8(X, Y, M) __extension__ ({ \
372 __m128i __X = (X); \
373 __m128i __Y = (Y); \
374 (__m128i) __builtin_ia32_mpsadbw128((__v16qi)__X, (__v16qi)__Y, (M)); })
375
376static __inline__ __m128i __DEFAULT_FN_ATTRS
377_mm_minpos_epu16(__m128i __V)
378{
379 return (__m128i) __builtin_ia32_phminposuw128((__v8hi)__V);
380}
381
382/* These definitions are normally in nmmintrin.h, but gcc puts them in here
383 so we'll do the same. */
384#ifdef __SSE4_2__
385
386/* These specify the type of data that we're comparing. */
387#define _SIDD_UBYTE_OPS 0x00
388#define _SIDD_UWORD_OPS 0x01
389#define _SIDD_SBYTE_OPS 0x02
390#define _SIDD_SWORD_OPS 0x03
391
392/* These specify the type of comparison operation. */
393#define _SIDD_CMP_EQUAL_ANY 0x00
394#define _SIDD_CMP_RANGES 0x04
395#define _SIDD_CMP_EQUAL_EACH 0x08
396#define _SIDD_CMP_EQUAL_ORDERED 0x0c
397
398/* These macros specify the polarity of the operation. */
399#define _SIDD_POSITIVE_POLARITY 0x00
400#define _SIDD_NEGATIVE_POLARITY 0x10
401#define _SIDD_MASKED_POSITIVE_POLARITY 0x20
402#define _SIDD_MASKED_NEGATIVE_POLARITY 0x30
403
404/* These macros are used in _mm_cmpXstri() to specify the return. */
405#define _SIDD_LEAST_SIGNIFICANT 0x00
406#define _SIDD_MOST_SIGNIFICANT 0x40
407
408/* These macros are used in _mm_cmpXstri() to specify the return. */
409#define _SIDD_BIT_MASK 0x00
410#define _SIDD_UNIT_MASK 0x40
411
412/* SSE4.2 Packed Comparison Intrinsics. */
413#define _mm_cmpistrm(A, B, M) __builtin_ia32_pcmpistrm128((A), (B), (M))
414#define _mm_cmpistri(A, B, M) __builtin_ia32_pcmpistri128((A), (B), (M))
415
416#define _mm_cmpestrm(A, LA, B, LB, M) \
417 __builtin_ia32_pcmpestrm128((A), (LA), (B), (LB), (M))
418#define _mm_cmpestri(A, LA, B, LB, M) \
419 __builtin_ia32_pcmpestri128((A), (LA), (B), (LB), (M))
420
421/* SSE4.2 Packed Comparison Intrinsics and EFlag Reading. */
422#define _mm_cmpistra(A, B, M) \
423 __builtin_ia32_pcmpistria128((A), (B), (M))
424#define _mm_cmpistrc(A, B, M) \
425 __builtin_ia32_pcmpistric128((A), (B), (M))
426#define _mm_cmpistro(A, B, M) \
427 __builtin_ia32_pcmpistrio128((A), (B), (M))
428#define _mm_cmpistrs(A, B, M) \
429 __builtin_ia32_pcmpistris128((A), (B), (M))
430#define _mm_cmpistrz(A, B, M) \
431 __builtin_ia32_pcmpistriz128((A), (B), (M))
432
433#define _mm_cmpestra(A, LA, B, LB, M) \
434 __builtin_ia32_pcmpestria128((A), (LA), (B), (LB), (M))
435#define _mm_cmpestrc(A, LA, B, LB, M) \
436 __builtin_ia32_pcmpestric128((A), (LA), (B), (LB), (M))
437#define _mm_cmpestro(A, LA, B, LB, M) \
438 __builtin_ia32_pcmpestrio128((A), (LA), (B), (LB), (M))
439#define _mm_cmpestrs(A, LA, B, LB, M) \
440 __builtin_ia32_pcmpestris128((A), (LA), (B), (LB), (M))
441#define _mm_cmpestrz(A, LA, B, LB, M) \
442 __builtin_ia32_pcmpestriz128((A), (LA), (B), (LB), (M))
443
444/* SSE4.2 Compare Packed Data -- Greater Than. */
445static __inline__ __m128i __DEFAULT_FN_ATTRS
446_mm_cmpgt_epi64(__m128i __V1, __m128i __V2)
447{
448 return (__m128i)((__v2di)__V1 > (__v2di)__V2);
449}
450
451/* SSE4.2 Accumulate CRC32. */
452static __inline__ unsigned int __DEFAULT_FN_ATTRS
453_mm_crc32_u8(unsigned int __C, unsigned char __D)
454{
455 return __builtin_ia32_crc32qi(__C, __D);
456}
457
458static __inline__ unsigned int __DEFAULT_FN_ATTRS
459_mm_crc32_u16(unsigned int __C, unsigned short __D)
460{
461 return __builtin_ia32_crc32hi(__C, __D);
462}
463
464static __inline__ unsigned int __DEFAULT_FN_ATTRS
465_mm_crc32_u32(unsigned int __C, unsigned int __D)
466{
467 return __builtin_ia32_crc32si(__C, __D);
468}
469
470#ifdef __x86_64__
471static __inline__ unsigned long long __DEFAULT_FN_ATTRS
472_mm_crc32_u64(unsigned long long __C, unsigned long long __D)
473{
474 return __builtin_ia32_crc32di(__C, __D);
475}
476#endif /* __x86_64__ */
477
478#undef __DEFAULT_FN_ATTRS
479
480#ifdef __POPCNT__
481#include <popcntintrin.h>
482#endif
483
484#endif /* __SSE4_2__ */
485#endif /* __SSE4_1__ */
486
487#endif /* _SMMINTRIN_H */
c_headers/stdalign.h created+35
......@@ -0,0 +1,35 @@
1/*===---- stdalign.h - Standard header for alignment ------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __STDALIGN_H
25#define __STDALIGN_H
26
27#ifndef __cplusplus
28#define alignas _Alignas
29#define alignof _Alignof
30#endif
31
32#define __alignas_is_defined 1
33#define __alignof_is_defined 1
34
35#endif /* __STDALIGN_H */
c_headers/stdarg.h created+52
......@@ -0,0 +1,52 @@
1/*===---- stdarg.h - Variable argument handling ----------------------------===
2 *
3 * Copyright (c) 2008 Eli Friedman
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 * THE SOFTWARE.
22 *
23 *===-----------------------------------------------------------------------===
24 */
25
26#ifndef __STDARG_H
27#define __STDARG_H
28
29#ifndef _VA_LIST
30typedef __builtin_va_list va_list;
31#define _VA_LIST
32#endif
33#define va_start(ap, param) __builtin_va_start(ap, param)
34#define va_end(ap) __builtin_va_end(ap)
35#define va_arg(ap, type) __builtin_va_arg(ap, type)
36
37/* GCC always defines __va_copy, but does not define va_copy unless in c99 mode
38 * or -ansi is not specified, since it was not part of C90.
39 */
40#define __va_copy(d,s) __builtin_va_copy(d,s)
41
42#if __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L || !defined(__STRICT_ANSI__)
43#define va_copy(dest, src) __builtin_va_copy(dest, src)
44#endif
45
46/* Hack required to make standard headers work, at least on Ubuntu */
47#ifndef __GNUC_VA_LIST
48#define __GNUC_VA_LIST 1
49#endif
50typedef __builtin_va_list __gnuc_va_list;
51
52#endif /* __STDARG_H */
c_headers/stdatomic.h created+190
......@@ -0,0 +1,190 @@
1/*===---- stdatomic.h - Standard header for atomic types and operations -----===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __CLANG_STDATOMIC_H
25#define __CLANG_STDATOMIC_H
26
27/* If we're hosted, fall back to the system's stdatomic.h. FreeBSD, for
28 * example, already has a Clang-compatible stdatomic.h header.
29 */
30#if __STDC_HOSTED__ && __has_include_next(<stdatomic.h>)
31# include_next <stdatomic.h>
32#else
33
34#include <stddef.h>
35#include <stdint.h>
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41/* 7.17.1 Introduction */
42
43#define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE
44#define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE
45#define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE
46#define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE
47#define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE
48#define ATOMIC_SHORT_T_LOCK_FREE __GCC_ATOMIC_SHORT_T_LOCK_FREE
49#define ATOMIC_INT_T_LOCK_FREE __GCC_ATOMIC_INT_T_LOCK_FREE
50#define ATOMIC_LONG_T_LOCK_FREE __GCC_ATOMIC_LONG_T_LOCK_FREE
51#define ATOMIC_LLONG_T_LOCK_FREE __GCC_ATOMIC_LLONG_T_LOCK_FREE
52#define ATOMIC_POINTER_T_LOCK_FREE __GCC_ATOMIC_POINTER_T_LOCK_FREE
53
54/* 7.17.2 Initialization */
55
56#define ATOMIC_VAR_INIT(value) (value)
57#define atomic_init __c11_atomic_init
58
59/* 7.17.3 Order and consistency */
60
61typedef enum memory_order {
62 memory_order_relaxed = __ATOMIC_RELAXED,
63 memory_order_consume = __ATOMIC_CONSUME,
64 memory_order_acquire = __ATOMIC_ACQUIRE,
65 memory_order_release = __ATOMIC_RELEASE,
66 memory_order_acq_rel = __ATOMIC_ACQ_REL,
67 memory_order_seq_cst = __ATOMIC_SEQ_CST
68} memory_order;
69
70#define kill_dependency(y) (y)
71
72/* 7.17.4 Fences */
73
74/* These should be provided by the libc implementation. */
75void atomic_thread_fence(memory_order);
76void atomic_signal_fence(memory_order);
77
78#define atomic_thread_fence(order) __c11_atomic_thread_fence(order)
79#define atomic_signal_fence(order) __c11_atomic_signal_fence(order)
80
81/* 7.17.5 Lock-free property */
82
83#define atomic_is_lock_free(obj) __c11_atomic_is_lock_free(sizeof(*(obj)))
84
85/* 7.17.6 Atomic integer types */
86
87#ifdef __cplusplus
88typedef _Atomic(bool) atomic_bool;
89#else
90typedef _Atomic(_Bool) atomic_bool;
91#endif
92typedef _Atomic(char) atomic_char;
93typedef _Atomic(signed char) atomic_schar;
94typedef _Atomic(unsigned char) atomic_uchar;
95typedef _Atomic(short) atomic_short;
96typedef _Atomic(unsigned short) atomic_ushort;
97typedef _Atomic(int) atomic_int;
98typedef _Atomic(unsigned int) atomic_uint;
99typedef _Atomic(long) atomic_long;
100typedef _Atomic(unsigned long) atomic_ulong;
101typedef _Atomic(long long) atomic_llong;
102typedef _Atomic(unsigned long long) atomic_ullong;
103typedef _Atomic(uint_least16_t) atomic_char16_t;
104typedef _Atomic(uint_least32_t) atomic_char32_t;
105typedef _Atomic(wchar_t) atomic_wchar_t;
106typedef _Atomic(int_least8_t) atomic_int_least8_t;
107typedef _Atomic(uint_least8_t) atomic_uint_least8_t;
108typedef _Atomic(int_least16_t) atomic_int_least16_t;
109typedef _Atomic(uint_least16_t) atomic_uint_least16_t;
110typedef _Atomic(int_least32_t) atomic_int_least32_t;
111typedef _Atomic(uint_least32_t) atomic_uint_least32_t;
112typedef _Atomic(int_least64_t) atomic_int_least64_t;
113typedef _Atomic(uint_least64_t) atomic_uint_least64_t;
114typedef _Atomic(int_fast8_t) atomic_int_fast8_t;
115typedef _Atomic(uint_fast8_t) atomic_uint_fast8_t;
116typedef _Atomic(int_fast16_t) atomic_int_fast16_t;
117typedef _Atomic(uint_fast16_t) atomic_uint_fast16_t;
118typedef _Atomic(int_fast32_t) atomic_int_fast32_t;
119typedef _Atomic(uint_fast32_t) atomic_uint_fast32_t;
120typedef _Atomic(int_fast64_t) atomic_int_fast64_t;
121typedef _Atomic(uint_fast64_t) atomic_uint_fast64_t;
122typedef _Atomic(intptr_t) atomic_intptr_t;
123typedef _Atomic(uintptr_t) atomic_uintptr_t;
124typedef _Atomic(size_t) atomic_size_t;
125typedef _Atomic(ptrdiff_t) atomic_ptrdiff_t;
126typedef _Atomic(intmax_t) atomic_intmax_t;
127typedef _Atomic(uintmax_t) atomic_uintmax_t;
128
129/* 7.17.7 Operations on atomic types */
130
131#define atomic_store(object, desired) __c11_atomic_store(object, desired, __ATOMIC_SEQ_CST)
132#define atomic_store_explicit __c11_atomic_store
133
134#define atomic_load(object) __c11_atomic_load(object, __ATOMIC_SEQ_CST)
135#define atomic_load_explicit __c11_atomic_load
136
137#define atomic_exchange(object, desired) __c11_atomic_exchange(object, desired, __ATOMIC_SEQ_CST)
138#define atomic_exchange_explicit __c11_atomic_exchange
139
140#define atomic_compare_exchange_strong(object, expected, desired) __c11_atomic_compare_exchange_strong(object, expected, desired, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
141#define atomic_compare_exchange_strong_explicit __c11_atomic_compare_exchange_strong
142
143#define atomic_compare_exchange_weak(object, expected, desired) __c11_atomic_compare_exchange_weak(object, expected, desired, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
144#define atomic_compare_exchange_weak_explicit __c11_atomic_compare_exchange_weak
145
146#define atomic_fetch_add(object, operand) __c11_atomic_fetch_add(object, operand, __ATOMIC_SEQ_CST)
147#define atomic_fetch_add_explicit __c11_atomic_fetch_add
148
149#define atomic_fetch_sub(object, operand) __c11_atomic_fetch_sub(object, operand, __ATOMIC_SEQ_CST)
150#define atomic_fetch_sub_explicit __c11_atomic_fetch_sub
151
152#define atomic_fetch_or(object, operand) __c11_atomic_fetch_or(object, operand, __ATOMIC_SEQ_CST)
153#define atomic_fetch_or_explicit __c11_atomic_fetch_or
154
155#define atomic_fetch_xor(object, operand) __c11_atomic_fetch_xor(object, operand, __ATOMIC_SEQ_CST)
156#define atomic_fetch_xor_explicit __c11_atomic_fetch_xor
157
158#define atomic_fetch_and(object, operand) __c11_atomic_fetch_and(object, operand, __ATOMIC_SEQ_CST)
159#define atomic_fetch_and_explicit __c11_atomic_fetch_and
160
161/* 7.17.8 Atomic flag type and operations */
162
163typedef struct atomic_flag { atomic_bool _Value; } atomic_flag;
164
165#define ATOMIC_FLAG_INIT { 0 }
166
167/* These should be provided by the libc implementation. */
168#ifdef __cplusplus
169bool atomic_flag_test_and_set(volatile atomic_flag *);
170bool atomic_flag_test_and_set_explicit(volatile atomic_flag *, memory_order);
171#else
172_Bool atomic_flag_test_and_set(volatile atomic_flag *);
173_Bool atomic_flag_test_and_set_explicit(volatile atomic_flag *, memory_order);
174#endif
175void atomic_flag_clear(volatile atomic_flag *);
176void atomic_flag_clear_explicit(volatile atomic_flag *, memory_order);
177
178#define atomic_flag_test_and_set(object) __c11_atomic_exchange(&(object)->_Value, 1, __ATOMIC_SEQ_CST)
179#define atomic_flag_test_and_set_explicit(object, order) __c11_atomic_exchange(&(object)->_Value, 1, order)
180
181#define atomic_flag_clear(object) __c11_atomic_store(&(object)->_Value, 0, __ATOMIC_SEQ_CST)
182#define atomic_flag_clear_explicit(object, order) __c11_atomic_store(&(object)->_Value, 0, order)
183
184#ifdef __cplusplus
185}
186#endif
187
188#endif /* __STDC_HOSTED__ */
189#endif /* __CLANG_STDATOMIC_H */
190
c_headers/stdbool.h created+44
......@@ -0,0 +1,44 @@
1/*===---- stdbool.h - Standard header for booleans -------------------------===
2 *
3 * Copyright (c) 2008 Eli Friedman
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 * THE SOFTWARE.
22 *
23 *===-----------------------------------------------------------------------===
24 */
25
26#ifndef __STDBOOL_H
27#define __STDBOOL_H
28
29/* Don't define bool, true, and false in C++, except as a GNU extension. */
30#ifndef __cplusplus
31#define bool _Bool
32#define true 1
33#define false 0
34#elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
35/* Define _Bool, bool, false, true as a GNU extension. */
36#define _Bool bool
37#define bool bool
38#define false false
39#define true true
40#endif
41
42#define __bool_true_false_are_defined 1
43
44#endif /* __STDBOOL_H */
c_headers/stddef.h created+137
......@@ -0,0 +1,137 @@
1/*===---- stddef.h - Basic type definitions --------------------------------===
2 *
3 * Copyright (c) 2008 Eli Friedman
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 * THE SOFTWARE.
22 *
23 *===-----------------------------------------------------------------------===
24 */
25
26#if !defined(__STDDEF_H) || defined(__need_ptrdiff_t) || \
27 defined(__need_size_t) || defined(__need_wchar_t) || \
28 defined(__need_NULL) || defined(__need_wint_t)
29
30#if !defined(__need_ptrdiff_t) && !defined(__need_size_t) && \
31 !defined(__need_wchar_t) && !defined(__need_NULL) && \
32 !defined(__need_wint_t)
33/* Always define miscellaneous pieces when modules are available. */
34#if !__has_feature(modules)
35#define __STDDEF_H
36#endif
37#define __need_ptrdiff_t
38#define __need_size_t
39#define __need_wchar_t
40#define __need_NULL
41#define __need_STDDEF_H_misc
42/* __need_wint_t is intentionally not defined here. */
43#endif
44
45#if defined(__need_ptrdiff_t)
46#if !defined(_PTRDIFF_T) || __has_feature(modules)
47/* Always define ptrdiff_t when modules are available. */
48#if !__has_feature(modules)
49#define _PTRDIFF_T
50#endif
51typedef __PTRDIFF_TYPE__ ptrdiff_t;
52#endif
53#undef __need_ptrdiff_t
54#endif /* defined(__need_ptrdiff_t) */
55
56#if defined(__need_size_t)
57#if !defined(_SIZE_T) || __has_feature(modules)
58/* Always define size_t when modules are available. */
59#if !__has_feature(modules)
60#define _SIZE_T
61#endif
62typedef __SIZE_TYPE__ size_t;
63#endif
64#undef __need_size_t
65#endif /*defined(__need_size_t) */
66
67#if defined(__need_STDDEF_H_misc)
68/* ISO9899:2011 7.20 (C11 Annex K): Define rsize_t if __STDC_WANT_LIB_EXT1__ is
69 * enabled. */
70#if (defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1 && \
71 !defined(_RSIZE_T)) || __has_feature(modules)
72/* Always define rsize_t when modules are available. */
73#if !__has_feature(modules)
74#define _RSIZE_T
75#endif
76typedef __SIZE_TYPE__ rsize_t;
77#endif
78#endif /* defined(__need_STDDEF_H_misc) */
79
80#if defined(__need_wchar_t)
81#ifndef __cplusplus
82/* Always define wchar_t when modules are available. */
83#if !defined(_WCHAR_T) || __has_feature(modules)
84#if !__has_feature(modules)
85#define _WCHAR_T
86#if defined(_MSC_EXTENSIONS)
87#define _WCHAR_T_DEFINED
88#endif
89#endif
90typedef __WCHAR_TYPE__ wchar_t;
91#endif
92#endif
93#undef __need_wchar_t
94#endif /* defined(__need_wchar_t) */
95
96#if defined(__need_NULL)
97#undef NULL
98#ifdef __cplusplus
99# if !defined(__MINGW32__) && !defined(_MSC_VER)
100# define NULL __null
101# else
102# define NULL 0
103# endif
104#else
105# define NULL ((void*)0)
106#endif
107#ifdef __cplusplus
108#if defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED)
109namespace std { typedef decltype(nullptr) nullptr_t; }
110using ::std::nullptr_t;
111#endif
112#endif
113#undef __need_NULL
114#endif /* defined(__need_NULL) */
115
116#if defined(__need_STDDEF_H_misc)
117#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L
118#include "__stddef_max_align_t.h"
119#endif
120#define offsetof(t, d) __builtin_offsetof(t, d)
121#undef __need_STDDEF_H_misc
122#endif /* defined(__need_STDDEF_H_misc) */
123
124/* Some C libraries expect to see a wint_t here. Others (notably MinGW) will use
125__WINT_TYPE__ directly; accommodate both by requiring __need_wint_t */
126#if defined(__need_wint_t)
127/* Always define wint_t when modules are available. */
128#if !defined(_WINT_T) || __has_feature(modules)
129#if !__has_feature(modules)
130#define _WINT_T
131#endif
132typedef __WINT_TYPE__ wint_t;
133#endif
134#undef __need_wint_t
135#endif /* __need_wint_t */
136
137#endif
c_headers/stdint.h created+707
......@@ -0,0 +1,707 @@
1/*===---- stdint.h - Standard header for sized integer types --------------===*\
2 *
3 * Copyright (c) 2009 Chris Lattner
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 * THE SOFTWARE.
22 *
23\*===----------------------------------------------------------------------===*/
24
25#ifndef __CLANG_STDINT_H
26#define __CLANG_STDINT_H
27
28/* If we're hosted, fall back to the system's stdint.h, which might have
29 * additional definitions.
30 */
31#if __STDC_HOSTED__ && __has_include_next(<stdint.h>)
32
33// C99 7.18.3 Limits of other integer types
34//
35// Footnote 219, 220: C++ implementations should define these macros only when
36// __STDC_LIMIT_MACROS is defined before <stdint.h> is included.
37//
38// Footnote 222: C++ implementations should define these macros only when
39// __STDC_CONSTANT_MACROS is defined before <stdint.h> is included.
40//
41// C++11 [cstdint.syn]p2:
42//
43// The macros defined by <cstdint> are provided unconditionally. In particular,
44// the symbols __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS (mentioned in
45// footnotes 219, 220, and 222 in the C standard) play no role in C++.
46//
47// C11 removed the problematic footnotes.
48//
49// Work around this inconsistency by always defining those macros in C++ mode,
50// so that a C library implementation which follows the C99 standard can be
51// used in C++.
52# ifdef __cplusplus
53# if !defined(__STDC_LIMIT_MACROS)
54# define __STDC_LIMIT_MACROS
55# define __STDC_LIMIT_MACROS_DEFINED_BY_CLANG
56# endif
57# if !defined(__STDC_CONSTANT_MACROS)
58# define __STDC_CONSTANT_MACROS
59# define __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG
60# endif
61# endif
62
63# include_next <stdint.h>
64
65# ifdef __STDC_LIMIT_MACROS_DEFINED_BY_CLANG
66# undef __STDC_LIMIT_MACROS
67# undef __STDC_LIMIT_MACROS_DEFINED_BY_CLANG
68# endif
69# ifdef __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG
70# undef __STDC_CONSTANT_MACROS
71# undef __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG
72# endif
73
74#else
75
76/* C99 7.18.1.1 Exact-width integer types.
77 * C99 7.18.1.2 Minimum-width integer types.
78 * C99 7.18.1.3 Fastest minimum-width integer types.
79 *
80 * The standard requires that exact-width type be defined for 8-, 16-, 32-, and
81 * 64-bit types if they are implemented. Other exact width types are optional.
82 * This implementation defines an exact-width types for every integer width
83 * that is represented in the standard integer types.
84 *
85 * The standard also requires minimum-width types be defined for 8-, 16-, 32-,
86 * and 64-bit widths regardless of whether there are corresponding exact-width
87 * types.
88 *
89 * To accommodate targets that are missing types that are exactly 8, 16, 32, or
90 * 64 bits wide, this implementation takes an approach of cascading
91 * redefintions, redefining __int_leastN_t to successively smaller exact-width
92 * types. It is therefore important that the types are defined in order of
93 * descending widths.
94 *
95 * We currently assume that the minimum-width types and the fastest
96 * minimum-width types are the same. This is allowed by the standard, but is
97 * suboptimal.
98 *
99 * In violation of the standard, some targets do not implement a type that is
100 * wide enough to represent all of the required widths (8-, 16-, 32-, 64-bit).
101 * To accommodate these targets, a required minimum-width type is only
102 * defined if there exists an exact-width type of equal or greater width.
103 */
104
105#ifdef __INT64_TYPE__
106# ifndef __int8_t_defined /* glibc sys/types.h also defines int64_t*/
107typedef __INT64_TYPE__ int64_t;
108# endif /* __int8_t_defined */
109typedef __UINT64_TYPE__ uint64_t;
110# define __int_least64_t int64_t
111# define __uint_least64_t uint64_t
112# define __int_least32_t int64_t
113# define __uint_least32_t uint64_t
114# define __int_least16_t int64_t
115# define __uint_least16_t uint64_t
116# define __int_least8_t int64_t
117# define __uint_least8_t uint64_t
118#endif /* __INT64_TYPE__ */
119
120#ifdef __int_least64_t
121typedef __int_least64_t int_least64_t;
122typedef __uint_least64_t uint_least64_t;
123typedef __int_least64_t int_fast64_t;
124typedef __uint_least64_t uint_fast64_t;
125#endif /* __int_least64_t */
126
127#ifdef __INT56_TYPE__
128typedef __INT56_TYPE__ int56_t;
129typedef __UINT56_TYPE__ uint56_t;
130typedef int56_t int_least56_t;
131typedef uint56_t uint_least56_t;
132typedef int56_t int_fast56_t;
133typedef uint56_t uint_fast56_t;
134# define __int_least32_t int56_t
135# define __uint_least32_t uint56_t
136# define __int_least16_t int56_t
137# define __uint_least16_t uint56_t
138# define __int_least8_t int56_t
139# define __uint_least8_t uint56_t
140#endif /* __INT56_TYPE__ */
141
142
143#ifdef __INT48_TYPE__
144typedef __INT48_TYPE__ int48_t;
145typedef __UINT48_TYPE__ uint48_t;
146typedef int48_t int_least48_t;
147typedef uint48_t uint_least48_t;
148typedef int48_t int_fast48_t;
149typedef uint48_t uint_fast48_t;
150# define __int_least32_t int48_t
151# define __uint_least32_t uint48_t
152# define __int_least16_t int48_t
153# define __uint_least16_t uint48_t
154# define __int_least8_t int48_t
155# define __uint_least8_t uint48_t
156#endif /* __INT48_TYPE__ */
157
158
159#ifdef __INT40_TYPE__
160typedef __INT40_TYPE__ int40_t;
161typedef __UINT40_TYPE__ uint40_t;
162typedef int40_t int_least40_t;
163typedef uint40_t uint_least40_t;
164typedef int40_t int_fast40_t;
165typedef uint40_t uint_fast40_t;
166# define __int_least32_t int40_t
167# define __uint_least32_t uint40_t
168# define __int_least16_t int40_t
169# define __uint_least16_t uint40_t
170# define __int_least8_t int40_t
171# define __uint_least8_t uint40_t
172#endif /* __INT40_TYPE__ */
173
174
175#ifdef __INT32_TYPE__
176
177# ifndef __int8_t_defined /* glibc sys/types.h also defines int32_t*/
178typedef __INT32_TYPE__ int32_t;
179# endif /* __int8_t_defined */
180
181# ifndef __uint32_t_defined /* more glibc compatibility */
182# define __uint32_t_defined
183typedef __UINT32_TYPE__ uint32_t;
184# endif /* __uint32_t_defined */
185
186# define __int_least32_t int32_t
187# define __uint_least32_t uint32_t
188# define __int_least16_t int32_t
189# define __uint_least16_t uint32_t
190# define __int_least8_t int32_t
191# define __uint_least8_t uint32_t
192#endif /* __INT32_TYPE__ */
193
194#ifdef __int_least32_t
195typedef __int_least32_t int_least32_t;
196typedef __uint_least32_t uint_least32_t;
197typedef __int_least32_t int_fast32_t;
198typedef __uint_least32_t uint_fast32_t;
199#endif /* __int_least32_t */
200
201#ifdef __INT24_TYPE__
202typedef __INT24_TYPE__ int24_t;
203typedef __UINT24_TYPE__ uint24_t;
204typedef int24_t int_least24_t;
205typedef uint24_t uint_least24_t;
206typedef int24_t int_fast24_t;
207typedef uint24_t uint_fast24_t;
208# define __int_least16_t int24_t
209# define __uint_least16_t uint24_t
210# define __int_least8_t int24_t
211# define __uint_least8_t uint24_t
212#endif /* __INT24_TYPE__ */
213
214#ifdef __INT16_TYPE__
215#ifndef __int8_t_defined /* glibc sys/types.h also defines int16_t*/
216typedef __INT16_TYPE__ int16_t;
217#endif /* __int8_t_defined */
218typedef __UINT16_TYPE__ uint16_t;
219# define __int_least16_t int16_t
220# define __uint_least16_t uint16_t
221# define __int_least8_t int16_t
222# define __uint_least8_t uint16_t
223#endif /* __INT16_TYPE__ */
224
225#ifdef __int_least16_t
226typedef __int_least16_t int_least16_t;
227typedef __uint_least16_t uint_least16_t;
228typedef __int_least16_t int_fast16_t;
229typedef __uint_least16_t uint_fast16_t;
230#endif /* __int_least16_t */
231
232
233#ifdef __INT8_TYPE__
234#ifndef __int8_t_defined /* glibc sys/types.h also defines int8_t*/
235typedef __INT8_TYPE__ int8_t;
236#endif /* __int8_t_defined */
237typedef __UINT8_TYPE__ uint8_t;
238# define __int_least8_t int8_t
239# define __uint_least8_t uint8_t
240#endif /* __INT8_TYPE__ */
241
242#ifdef __int_least8_t
243typedef __int_least8_t int_least8_t;
244typedef __uint_least8_t uint_least8_t;
245typedef __int_least8_t int_fast8_t;
246typedef __uint_least8_t uint_fast8_t;
247#endif /* __int_least8_t */
248
249/* prevent glibc sys/types.h from defining conflicting types */
250#ifndef __int8_t_defined
251# define __int8_t_defined
252#endif /* __int8_t_defined */
253
254/* C99 7.18.1.4 Integer types capable of holding object pointers.
255 */
256#define __stdint_join3(a,b,c) a ## b ## c
257
258#define __intn_t(n) __stdint_join3( int, n, _t)
259#define __uintn_t(n) __stdint_join3(uint, n, _t)
260
261#ifndef _INTPTR_T
262#ifndef __intptr_t_defined
263typedef __intn_t(__INTPTR_WIDTH__) intptr_t;
264#define __intptr_t_defined
265#define _INTPTR_T
266#endif
267#endif
268
269#ifndef _UINTPTR_T
270typedef __uintn_t(__INTPTR_WIDTH__) uintptr_t;
271#define _UINTPTR_T
272#endif
273
274/* C99 7.18.1.5 Greatest-width integer types.
275 */
276typedef __INTMAX_TYPE__ intmax_t;
277typedef __UINTMAX_TYPE__ uintmax_t;
278
279/* C99 7.18.4 Macros for minimum-width integer constants.
280 *
281 * The standard requires that integer constant macros be defined for all the
282 * minimum-width types defined above. As 8-, 16-, 32-, and 64-bit minimum-width
283 * types are required, the corresponding integer constant macros are defined
284 * here. This implementation also defines minimum-width types for every other
285 * integer width that the target implements, so corresponding macros are
286 * defined below, too.
287 *
288 * These macros are defined using the same successive-shrinking approach as
289 * the type definitions above. It is likewise important that macros are defined
290 * in order of decending width.
291 *
292 * Note that C++ should not check __STDC_CONSTANT_MACROS here, contrary to the
293 * claims of the C standard (see C++ 18.3.1p2, [cstdint.syn]).
294 */
295
296#define __int_c_join(a, b) a ## b
297#define __int_c(v, suffix) __int_c_join(v, suffix)
298#define __uint_c(v, suffix) __int_c_join(v##U, suffix)
299
300
301#ifdef __INT64_TYPE__
302# ifdef __INT64_C_SUFFIX__
303# define __int64_c_suffix __INT64_C_SUFFIX__
304# define __int32_c_suffix __INT64_C_SUFFIX__
305# define __int16_c_suffix __INT64_C_SUFFIX__
306# define __int8_c_suffix __INT64_C_SUFFIX__
307# else
308# undef __int64_c_suffix
309# undef __int32_c_suffix
310# undef __int16_c_suffix
311# undef __int8_c_suffix
312# endif /* __INT64_C_SUFFIX__ */
313#endif /* __INT64_TYPE__ */
314
315#ifdef __int_least64_t
316# ifdef __int64_c_suffix
317# define INT64_C(v) __int_c(v, __int64_c_suffix)
318# define UINT64_C(v) __uint_c(v, __int64_c_suffix)
319# else
320# define INT64_C(v) v
321# define UINT64_C(v) v ## U
322# endif /* __int64_c_suffix */
323#endif /* __int_least64_t */
324
325
326#ifdef __INT56_TYPE__
327# ifdef __INT56_C_SUFFIX__
328# define INT56_C(v) __int_c(v, __INT56_C_SUFFIX__)
329# define UINT56_C(v) __uint_c(v, __INT56_C_SUFFIX__)
330# define __int32_c_suffix __INT56_C_SUFFIX__
331# define __int16_c_suffix __INT56_C_SUFFIX__
332# define __int8_c_suffix __INT56_C_SUFFIX__
333# else
334# define INT56_C(v) v
335# define UINT56_C(v) v ## U
336# undef __int32_c_suffix
337# undef __int16_c_suffix
338# undef __int8_c_suffix
339# endif /* __INT56_C_SUFFIX__ */
340#endif /* __INT56_TYPE__ */
341
342
343#ifdef __INT48_TYPE__
344# ifdef __INT48_C_SUFFIX__
345# define INT48_C(v) __int_c(v, __INT48_C_SUFFIX__)
346# define UINT48_C(v) __uint_c(v, __INT48_C_SUFFIX__)
347# define __int32_c_suffix __INT48_C_SUFFIX__
348# define __int16_c_suffix __INT48_C_SUFFIX__
349# define __int8_c_suffix __INT48_C_SUFFIX__
350# else
351# define INT48_C(v) v
352# define UINT48_C(v) v ## U
353# undef __int32_c_suffix
354# undef __int16_c_suffix
355# undef __int8_c_suffix
356# endif /* __INT48_C_SUFFIX__ */
357#endif /* __INT48_TYPE__ */
358
359
360#ifdef __INT40_TYPE__
361# ifdef __INT40_C_SUFFIX__
362# define INT40_C(v) __int_c(v, __INT40_C_SUFFIX__)
363# define UINT40_C(v) __uint_c(v, __INT40_C_SUFFIX__)
364# define __int32_c_suffix __INT40_C_SUFFIX__
365# define __int16_c_suffix __INT40_C_SUFFIX__
366# define __int8_c_suffix __INT40_C_SUFFIX__
367# else
368# define INT40_C(v) v
369# define UINT40_C(v) v ## U
370# undef __int32_c_suffix
371# undef __int16_c_suffix
372# undef __int8_c_suffix
373# endif /* __INT40_C_SUFFIX__ */
374#endif /* __INT40_TYPE__ */
375
376
377#ifdef __INT32_TYPE__
378# ifdef __INT32_C_SUFFIX__
379# define __int32_c_suffix __INT32_C_SUFFIX__
380# define __int16_c_suffix __INT32_C_SUFFIX__
381# define __int8_c_suffix __INT32_C_SUFFIX__
382#else
383# undef __int32_c_suffix
384# undef __int16_c_suffix
385# undef __int8_c_suffix
386# endif /* __INT32_C_SUFFIX__ */
387#endif /* __INT32_TYPE__ */
388
389#ifdef __int_least32_t
390# ifdef __int32_c_suffix
391# define INT32_C(v) __int_c(v, __int32_c_suffix)
392# define UINT32_C(v) __uint_c(v, __int32_c_suffix)
393# else
394# define INT32_C(v) v
395# define UINT32_C(v) v ## U
396# endif /* __int32_c_suffix */
397#endif /* __int_least32_t */
398
399
400#ifdef __INT24_TYPE__
401# ifdef __INT24_C_SUFFIX__
402# define INT24_C(v) __int_c(v, __INT24_C_SUFFIX__)
403# define UINT24_C(v) __uint_c(v, __INT24_C_SUFFIX__)
404# define __int16_c_suffix __INT24_C_SUFFIX__
405# define __int8_c_suffix __INT24_C_SUFFIX__
406# else
407# define INT24_C(v) v
408# define UINT24_C(v) v ## U
409# undef __int16_c_suffix
410# undef __int8_c_suffix
411# endif /* __INT24_C_SUFFIX__ */
412#endif /* __INT24_TYPE__ */
413
414
415#ifdef __INT16_TYPE__
416# ifdef __INT16_C_SUFFIX__
417# define __int16_c_suffix __INT16_C_SUFFIX__
418# define __int8_c_suffix __INT16_C_SUFFIX__
419#else
420# undef __int16_c_suffix
421# undef __int8_c_suffix
422# endif /* __INT16_C_SUFFIX__ */
423#endif /* __INT16_TYPE__ */
424
425#ifdef __int_least16_t
426# ifdef __int16_c_suffix
427# define INT16_C(v) __int_c(v, __int16_c_suffix)
428# define UINT16_C(v) __uint_c(v, __int16_c_suffix)
429# else
430# define INT16_C(v) v
431# define UINT16_C(v) v ## U
432# endif /* __int16_c_suffix */
433#endif /* __int_least16_t */
434
435
436#ifdef __INT8_TYPE__
437# ifdef __INT8_C_SUFFIX__
438# define __int8_c_suffix __INT8_C_SUFFIX__
439#else
440# undef __int8_c_suffix
441# endif /* __INT8_C_SUFFIX__ */
442#endif /* __INT8_TYPE__ */
443
444#ifdef __int_least8_t
445# ifdef __int8_c_suffix
446# define INT8_C(v) __int_c(v, __int8_c_suffix)
447# define UINT8_C(v) __uint_c(v, __int8_c_suffix)
448# else
449# define INT8_C(v) v
450# define UINT8_C(v) v ## U
451# endif /* __int8_c_suffix */
452#endif /* __int_least8_t */
453
454
455/* C99 7.18.2.1 Limits of exact-width integer types.
456 * C99 7.18.2.2 Limits of minimum-width integer types.
457 * C99 7.18.2.3 Limits of fastest minimum-width integer types.
458 *
459 * The presence of limit macros are completely optional in C99. This
460 * implementation defines limits for all of the types (exact- and
461 * minimum-width) that it defines above, using the limits of the minimum-width
462 * type for any types that do not have exact-width representations.
463 *
464 * As in the type definitions, this section takes an approach of
465 * successive-shrinking to determine which limits to use for the standard (8,
466 * 16, 32, 64) bit widths when they don't have exact representations. It is
467 * therefore important that the defintions be kept in order of decending
468 * widths.
469 *
470 * Note that C++ should not check __STDC_LIMIT_MACROS here, contrary to the
471 * claims of the C standard (see C++ 18.3.1p2, [cstdint.syn]).
472 */
473
474#ifdef __INT64_TYPE__
475# define INT64_MAX INT64_C( 9223372036854775807)
476# define INT64_MIN (-INT64_C( 9223372036854775807)-1)
477# define UINT64_MAX UINT64_C(18446744073709551615)
478# define __INT_LEAST64_MIN INT64_MIN
479# define __INT_LEAST64_MAX INT64_MAX
480# define __UINT_LEAST64_MAX UINT64_MAX
481# define __INT_LEAST32_MIN INT64_MIN
482# define __INT_LEAST32_MAX INT64_MAX
483# define __UINT_LEAST32_MAX UINT64_MAX
484# define __INT_LEAST16_MIN INT64_MIN
485# define __INT_LEAST16_MAX INT64_MAX
486# define __UINT_LEAST16_MAX UINT64_MAX
487# define __INT_LEAST8_MIN INT64_MIN
488# define __INT_LEAST8_MAX INT64_MAX
489# define __UINT_LEAST8_MAX UINT64_MAX
490#endif /* __INT64_TYPE__ */
491
492#ifdef __INT_LEAST64_MIN
493# define INT_LEAST64_MIN __INT_LEAST64_MIN
494# define INT_LEAST64_MAX __INT_LEAST64_MAX
495# define UINT_LEAST64_MAX __UINT_LEAST64_MAX
496# define INT_FAST64_MIN __INT_LEAST64_MIN
497# define INT_FAST64_MAX __INT_LEAST64_MAX
498# define UINT_FAST64_MAX __UINT_LEAST64_MAX
499#endif /* __INT_LEAST64_MIN */
500
501
502#ifdef __INT56_TYPE__
503# define INT56_MAX INT56_C(36028797018963967)
504# define INT56_MIN (-INT56_C(36028797018963967)-1)
505# define UINT56_MAX UINT56_C(72057594037927935)
506# define INT_LEAST56_MIN INT56_MIN
507# define INT_LEAST56_MAX INT56_MAX
508# define UINT_LEAST56_MAX UINT56_MAX
509# define INT_FAST56_MIN INT56_MIN
510# define INT_FAST56_MAX INT56_MAX
511# define UINT_FAST56_MAX UINT56_MAX
512# define __INT_LEAST32_MIN INT56_MIN
513# define __INT_LEAST32_MAX INT56_MAX
514# define __UINT_LEAST32_MAX UINT56_MAX
515# define __INT_LEAST16_MIN INT56_MIN
516# define __INT_LEAST16_MAX INT56_MAX
517# define __UINT_LEAST16_MAX UINT56_MAX
518# define __INT_LEAST8_MIN INT56_MIN
519# define __INT_LEAST8_MAX INT56_MAX
520# define __UINT_LEAST8_MAX UINT56_MAX
521#endif /* __INT56_TYPE__ */
522
523
524#ifdef __INT48_TYPE__
525# define INT48_MAX INT48_C(140737488355327)
526# define INT48_MIN (-INT48_C(140737488355327)-1)
527# define UINT48_MAX UINT48_C(281474976710655)
528# define INT_LEAST48_MIN INT48_MIN
529# define INT_LEAST48_MAX INT48_MAX
530# define UINT_LEAST48_MAX UINT48_MAX
531# define INT_FAST48_MIN INT48_MIN
532# define INT_FAST48_MAX INT48_MAX
533# define UINT_FAST48_MAX UINT48_MAX
534# define __INT_LEAST32_MIN INT48_MIN
535# define __INT_LEAST32_MAX INT48_MAX
536# define __UINT_LEAST32_MAX UINT48_MAX
537# define __INT_LEAST16_MIN INT48_MIN
538# define __INT_LEAST16_MAX INT48_MAX
539# define __UINT_LEAST16_MAX UINT48_MAX
540# define __INT_LEAST8_MIN INT48_MIN
541# define __INT_LEAST8_MAX INT48_MAX
542# define __UINT_LEAST8_MAX UINT48_MAX
543#endif /* __INT48_TYPE__ */
544
545
546#ifdef __INT40_TYPE__
547# define INT40_MAX INT40_C(549755813887)
548# define INT40_MIN (-INT40_C(549755813887)-1)
549# define UINT40_MAX UINT40_C(1099511627775)
550# define INT_LEAST40_MIN INT40_MIN
551# define INT_LEAST40_MAX INT40_MAX
552# define UINT_LEAST40_MAX UINT40_MAX
553# define INT_FAST40_MIN INT40_MIN
554# define INT_FAST40_MAX INT40_MAX
555# define UINT_FAST40_MAX UINT40_MAX
556# define __INT_LEAST32_MIN INT40_MIN
557# define __INT_LEAST32_MAX INT40_MAX
558# define __UINT_LEAST32_MAX UINT40_MAX
559# define __INT_LEAST16_MIN INT40_MIN
560# define __INT_LEAST16_MAX INT40_MAX
561# define __UINT_LEAST16_MAX UINT40_MAX
562# define __INT_LEAST8_MIN INT40_MIN
563# define __INT_LEAST8_MAX INT40_MAX
564# define __UINT_LEAST8_MAX UINT40_MAX
565#endif /* __INT40_TYPE__ */
566
567
568#ifdef __INT32_TYPE__
569# define INT32_MAX INT32_C(2147483647)
570# define INT32_MIN (-INT32_C(2147483647)-1)
571# define UINT32_MAX UINT32_C(4294967295)
572# define __INT_LEAST32_MIN INT32_MIN
573# define __INT_LEAST32_MAX INT32_MAX
574# define __UINT_LEAST32_MAX UINT32_MAX
575# define __INT_LEAST16_MIN INT32_MIN
576# define __INT_LEAST16_MAX INT32_MAX
577# define __UINT_LEAST16_MAX UINT32_MAX
578# define __INT_LEAST8_MIN INT32_MIN
579# define __INT_LEAST8_MAX INT32_MAX
580# define __UINT_LEAST8_MAX UINT32_MAX
581#endif /* __INT32_TYPE__ */
582
583#ifdef __INT_LEAST32_MIN
584# define INT_LEAST32_MIN __INT_LEAST32_MIN
585# define INT_LEAST32_MAX __INT_LEAST32_MAX
586# define UINT_LEAST32_MAX __UINT_LEAST32_MAX
587# define INT_FAST32_MIN __INT_LEAST32_MIN
588# define INT_FAST32_MAX __INT_LEAST32_MAX
589# define UINT_FAST32_MAX __UINT_LEAST32_MAX
590#endif /* __INT_LEAST32_MIN */
591
592
593#ifdef __INT24_TYPE__
594# define INT24_MAX INT24_C(8388607)
595# define INT24_MIN (-INT24_C(8388607)-1)
596# define UINT24_MAX UINT24_C(16777215)
597# define INT_LEAST24_MIN INT24_MIN
598# define INT_LEAST24_MAX INT24_MAX
599# define UINT_LEAST24_MAX UINT24_MAX
600# define INT_FAST24_MIN INT24_MIN
601# define INT_FAST24_MAX INT24_MAX
602# define UINT_FAST24_MAX UINT24_MAX
603# define __INT_LEAST16_MIN INT24_MIN
604# define __INT_LEAST16_MAX INT24_MAX
605# define __UINT_LEAST16_MAX UINT24_MAX
606# define __INT_LEAST8_MIN INT24_MIN
607# define __INT_LEAST8_MAX INT24_MAX
608# define __UINT_LEAST8_MAX UINT24_MAX
609#endif /* __INT24_TYPE__ */
610
611
612#ifdef __INT16_TYPE__
613#define INT16_MAX INT16_C(32767)
614#define INT16_MIN (-INT16_C(32767)-1)
615#define UINT16_MAX UINT16_C(65535)
616# define __INT_LEAST16_MIN INT16_MIN
617# define __INT_LEAST16_MAX INT16_MAX
618# define __UINT_LEAST16_MAX UINT16_MAX
619# define __INT_LEAST8_MIN INT16_MIN
620# define __INT_LEAST8_MAX INT16_MAX
621# define __UINT_LEAST8_MAX UINT16_MAX
622#endif /* __INT16_TYPE__ */
623
624#ifdef __INT_LEAST16_MIN
625# define INT_LEAST16_MIN __INT_LEAST16_MIN
626# define INT_LEAST16_MAX __INT_LEAST16_MAX
627# define UINT_LEAST16_MAX __UINT_LEAST16_MAX
628# define INT_FAST16_MIN __INT_LEAST16_MIN
629# define INT_FAST16_MAX __INT_LEAST16_MAX
630# define UINT_FAST16_MAX __UINT_LEAST16_MAX
631#endif /* __INT_LEAST16_MIN */
632
633
634#ifdef __INT8_TYPE__
635# define INT8_MAX INT8_C(127)
636# define INT8_MIN (-INT8_C(127)-1)
637# define UINT8_MAX UINT8_C(255)
638# define __INT_LEAST8_MIN INT8_MIN
639# define __INT_LEAST8_MAX INT8_MAX
640# define __UINT_LEAST8_MAX UINT8_MAX
641#endif /* __INT8_TYPE__ */
642
643#ifdef __INT_LEAST8_MIN
644# define INT_LEAST8_MIN __INT_LEAST8_MIN
645# define INT_LEAST8_MAX __INT_LEAST8_MAX
646# define UINT_LEAST8_MAX __UINT_LEAST8_MAX
647# define INT_FAST8_MIN __INT_LEAST8_MIN
648# define INT_FAST8_MAX __INT_LEAST8_MAX
649# define UINT_FAST8_MAX __UINT_LEAST8_MAX
650#endif /* __INT_LEAST8_MIN */
651
652/* Some utility macros */
653#define __INTN_MIN(n) __stdint_join3( INT, n, _MIN)
654#define __INTN_MAX(n) __stdint_join3( INT, n, _MAX)
655#define __UINTN_MAX(n) __stdint_join3(UINT, n, _MAX)
656#define __INTN_C(n, v) __stdint_join3( INT, n, _C(v))
657#define __UINTN_C(n, v) __stdint_join3(UINT, n, _C(v))
658
659/* C99 7.18.2.4 Limits of integer types capable of holding object pointers. */
660/* C99 7.18.3 Limits of other integer types. */
661
662#define INTPTR_MIN __INTN_MIN(__INTPTR_WIDTH__)
663#define INTPTR_MAX __INTN_MAX(__INTPTR_WIDTH__)
664#define UINTPTR_MAX __UINTN_MAX(__INTPTR_WIDTH__)
665#define PTRDIFF_MIN __INTN_MIN(__PTRDIFF_WIDTH__)
666#define PTRDIFF_MAX __INTN_MAX(__PTRDIFF_WIDTH__)
667#define SIZE_MAX __UINTN_MAX(__SIZE_WIDTH__)
668
669/* ISO9899:2011 7.20 (C11 Annex K): Define RSIZE_MAX if __STDC_WANT_LIB_EXT1__
670 * is enabled. */
671#if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1
672#define RSIZE_MAX (SIZE_MAX >> 1)
673#endif
674
675/* C99 7.18.2.5 Limits of greatest-width integer types. */
676#define INTMAX_MIN __INTN_MIN(__INTMAX_WIDTH__)
677#define INTMAX_MAX __INTN_MAX(__INTMAX_WIDTH__)
678#define UINTMAX_MAX __UINTN_MAX(__INTMAX_WIDTH__)
679
680/* C99 7.18.3 Limits of other integer types. */
681#define SIG_ATOMIC_MIN __INTN_MIN(__SIG_ATOMIC_WIDTH__)
682#define SIG_ATOMIC_MAX __INTN_MAX(__SIG_ATOMIC_WIDTH__)
683#ifdef __WINT_UNSIGNED__
684# define WINT_MIN __UINTN_C(__WINT_WIDTH__, 0)
685# define WINT_MAX __UINTN_MAX(__WINT_WIDTH__)
686#else
687# define WINT_MIN __INTN_MIN(__WINT_WIDTH__)
688# define WINT_MAX __INTN_MAX(__WINT_WIDTH__)
689#endif
690
691#ifndef WCHAR_MAX
692# define WCHAR_MAX __WCHAR_MAX__
693#endif
694#ifndef WCHAR_MIN
695# if __WCHAR_MAX__ == __INTN_MAX(__WCHAR_WIDTH__)
696# define WCHAR_MIN __INTN_MIN(__WCHAR_WIDTH__)
697# else
698# define WCHAR_MIN __UINTN_C(__WCHAR_WIDTH__, 0)
699# endif
700#endif
701
702/* 7.18.4.2 Macros for greatest-width integer constants. */
703#define INTMAX_C(v) __INTN_C(__INTMAX_WIDTH__, v)
704#define UINTMAX_C(v) __UINTN_C(__INTMAX_WIDTH__, v)
705
706#endif /* __STDC_HOSTED__ */
707#endif /* __CLANG_STDINT_H */
c_headers/stdnoreturn.h created+30
......@@ -0,0 +1,30 @@
1/*===---- stdnoreturn.h - Standard header for noreturn macro ---------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __STDNORETURN_H
25#define __STDNORETURN_H
26
27#define noreturn _Noreturn
28#define __noreturn_is_defined 1
29
30#endif /* __STDNORETURN_H */
c_headers/tbmintrin.h created+154
......@@ -0,0 +1,154 @@
1/*===---- tbmintrin.h - TBM intrinsics -------------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __TBM__
25#error "TBM instruction set is not enabled"
26#endif
27
28#ifndef __X86INTRIN_H
29#error "Never use <tbmintrin.h> directly; include <x86intrin.h> instead."
30#endif
31
32#ifndef __TBMINTRIN_H
33#define __TBMINTRIN_H
34
35/* Define the default attributes for the functions in this file. */
36#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
37
38#define __bextri_u32(a, b) (__builtin_ia32_bextri_u32((a), (b)))
39
40static __inline__ unsigned int __DEFAULT_FN_ATTRS
41__blcfill_u32(unsigned int a)
42{
43 return a & (a + 1);
44}
45
46static __inline__ unsigned int __DEFAULT_FN_ATTRS
47__blci_u32(unsigned int a)
48{
49 return a | ~(a + 1);
50}
51
52static __inline__ unsigned int __DEFAULT_FN_ATTRS
53__blcic_u32(unsigned int a)
54{
55 return ~a & (a + 1);
56}
57
58static __inline__ unsigned int __DEFAULT_FN_ATTRS
59__blcmsk_u32(unsigned int a)
60{
61 return a ^ (a + 1);
62}
63
64static __inline__ unsigned int __DEFAULT_FN_ATTRS
65__blcs_u32(unsigned int a)
66{
67 return a | (a + 1);
68}
69
70static __inline__ unsigned int __DEFAULT_FN_ATTRS
71__blsfill_u32(unsigned int a)
72{
73 return a | (a - 1);
74}
75
76static __inline__ unsigned int __DEFAULT_FN_ATTRS
77__blsic_u32(unsigned int a)
78{
79 return ~a | (a - 1);
80}
81
82static __inline__ unsigned int __DEFAULT_FN_ATTRS
83__t1mskc_u32(unsigned int a)
84{
85 return ~a | (a + 1);
86}
87
88static __inline__ unsigned int __DEFAULT_FN_ATTRS
89__tzmsk_u32(unsigned int a)
90{
91 return ~a & (a - 1);
92}
93
94#ifdef __x86_64__
95#define __bextri_u64(a, b) (__builtin_ia32_bextri_u64((a), (int)(b)))
96
97static __inline__ unsigned long long __DEFAULT_FN_ATTRS
98__blcfill_u64(unsigned long long a)
99{
100 return a & (a + 1);
101}
102
103static __inline__ unsigned long long __DEFAULT_FN_ATTRS
104__blci_u64(unsigned long long a)
105{
106 return a | ~(a + 1);
107}
108
109static __inline__ unsigned long long __DEFAULT_FN_ATTRS
110__blcic_u64(unsigned long long a)
111{
112 return ~a & (a + 1);
113}
114
115static __inline__ unsigned long long __DEFAULT_FN_ATTRS
116__blcmsk_u64(unsigned long long a)
117{
118 return a ^ (a + 1);
119}
120
121static __inline__ unsigned long long __DEFAULT_FN_ATTRS
122__blcs_u64(unsigned long long a)
123{
124 return a | (a + 1);
125}
126
127static __inline__ unsigned long long __DEFAULT_FN_ATTRS
128__blsfill_u64(unsigned long long a)
129{
130 return a | (a - 1);
131}
132
133static __inline__ unsigned long long __DEFAULT_FN_ATTRS
134__blsic_u64(unsigned long long a)
135{
136 return ~a | (a - 1);
137}
138
139static __inline__ unsigned long long __DEFAULT_FN_ATTRS
140__t1mskc_u64(unsigned long long a)
141{
142 return ~a | (a + 1);
143}
144
145static __inline__ unsigned long long __DEFAULT_FN_ATTRS
146__tzmsk_u64(unsigned long long a)
147{
148 return ~a & (a - 1);
149}
150#endif
151
152#undef __DEFAULT_FN_ATTRS
153
154#endif /* __TBMINTRIN_H */
c_headers/tgmath.h created+1374
......@@ -0,0 +1,1374 @@
1/*===---- tgmath.h - Standard header for type generic math ----------------===*\
2 *
3 * Copyright (c) 2009 Howard Hinnant
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 * THE SOFTWARE.
22 *
23\*===----------------------------------------------------------------------===*/
24
25#ifndef __TGMATH_H
26#define __TGMATH_H
27
28/* C99 7.22 Type-generic math <tgmath.h>. */
29#include <math.h>
30
31/* C++ handles type genericity with overloading in math.h. */
32#ifndef __cplusplus
33#include <complex.h>
34
35#define _TG_ATTRSp __attribute__((__overloadable__))
36#define _TG_ATTRS __attribute__((__overloadable__, __always_inline__))
37
38// promotion
39
40typedef void _Argument_type_is_not_arithmetic;
41static _Argument_type_is_not_arithmetic __tg_promote(...)
42 __attribute__((__unavailable__,__overloadable__));
43static double _TG_ATTRSp __tg_promote(int);
44static double _TG_ATTRSp __tg_promote(unsigned int);
45static double _TG_ATTRSp __tg_promote(long);
46static double _TG_ATTRSp __tg_promote(unsigned long);
47static double _TG_ATTRSp __tg_promote(long long);
48static double _TG_ATTRSp __tg_promote(unsigned long long);
49static float _TG_ATTRSp __tg_promote(float);
50static double _TG_ATTRSp __tg_promote(double);
51static long double _TG_ATTRSp __tg_promote(long double);
52static float _Complex _TG_ATTRSp __tg_promote(float _Complex);
53static double _Complex _TG_ATTRSp __tg_promote(double _Complex);
54static long double _Complex _TG_ATTRSp __tg_promote(long double _Complex);
55
56#define __tg_promote1(__x) (__typeof__(__tg_promote(__x)))
57#define __tg_promote2(__x, __y) (__typeof__(__tg_promote(__x) + \
58 __tg_promote(__y)))
59#define __tg_promote3(__x, __y, __z) (__typeof__(__tg_promote(__x) + \
60 __tg_promote(__y) + \
61 __tg_promote(__z)))
62
63// acos
64
65static float
66 _TG_ATTRS
67 __tg_acos(float __x) {return acosf(__x);}
68
69static double
70 _TG_ATTRS
71 __tg_acos(double __x) {return acos(__x);}
72
73static long double
74 _TG_ATTRS
75 __tg_acos(long double __x) {return acosl(__x);}
76
77static float _Complex
78 _TG_ATTRS
79 __tg_acos(float _Complex __x) {return cacosf(__x);}
80
81static double _Complex
82 _TG_ATTRS
83 __tg_acos(double _Complex __x) {return cacos(__x);}
84
85static long double _Complex
86 _TG_ATTRS
87 __tg_acos(long double _Complex __x) {return cacosl(__x);}
88
89#undef acos
90#define acos(__x) __tg_acos(__tg_promote1((__x))(__x))
91
92// asin
93
94static float
95 _TG_ATTRS
96 __tg_asin(float __x) {return asinf(__x);}
97
98static double
99 _TG_ATTRS
100 __tg_asin(double __x) {return asin(__x);}
101
102static long double
103 _TG_ATTRS
104 __tg_asin(long double __x) {return asinl(__x);}
105
106static float _Complex
107 _TG_ATTRS
108 __tg_asin(float _Complex __x) {return casinf(__x);}
109
110static double _Complex
111 _TG_ATTRS
112 __tg_asin(double _Complex __x) {return casin(__x);}
113
114static long double _Complex
115 _TG_ATTRS
116 __tg_asin(long double _Complex __x) {return casinl(__x);}
117
118#undef asin
119#define asin(__x) __tg_asin(__tg_promote1((__x))(__x))
120
121// atan
122
123static float
124 _TG_ATTRS
125 __tg_atan(float __x) {return atanf(__x);}
126
127static double
128 _TG_ATTRS
129 __tg_atan(double __x) {return atan(__x);}
130
131static long double
132 _TG_ATTRS
133 __tg_atan(long double __x) {return atanl(__x);}
134
135static float _Complex
136 _TG_ATTRS
137 __tg_atan(float _Complex __x) {return catanf(__x);}
138
139static double _Complex
140 _TG_ATTRS
141 __tg_atan(double _Complex __x) {return catan(__x);}
142
143static long double _Complex
144 _TG_ATTRS
145 __tg_atan(long double _Complex __x) {return catanl(__x);}
146
147#undef atan
148#define atan(__x) __tg_atan(__tg_promote1((__x))(__x))
149
150// acosh
151
152static float
153 _TG_ATTRS
154 __tg_acosh(float __x) {return acoshf(__x);}
155
156static double
157 _TG_ATTRS
158 __tg_acosh(double __x) {return acosh(__x);}
159
160static long double
161 _TG_ATTRS
162 __tg_acosh(long double __x) {return acoshl(__x);}
163
164static float _Complex
165 _TG_ATTRS
166 __tg_acosh(float _Complex __x) {return cacoshf(__x);}
167
168static double _Complex
169 _TG_ATTRS
170 __tg_acosh(double _Complex __x) {return cacosh(__x);}
171
172static long double _Complex
173 _TG_ATTRS
174 __tg_acosh(long double _Complex __x) {return cacoshl(__x);}
175
176#undef acosh
177#define acosh(__x) __tg_acosh(__tg_promote1((__x))(__x))
178
179// asinh
180
181static float
182 _TG_ATTRS
183 __tg_asinh(float __x) {return asinhf(__x);}
184
185static double
186 _TG_ATTRS
187 __tg_asinh(double __x) {return asinh(__x);}
188
189static long double
190 _TG_ATTRS
191 __tg_asinh(long double __x) {return asinhl(__x);}
192
193static float _Complex
194 _TG_ATTRS
195 __tg_asinh(float _Complex __x) {return casinhf(__x);}
196
197static double _Complex
198 _TG_ATTRS
199 __tg_asinh(double _Complex __x) {return casinh(__x);}
200
201static long double _Complex
202 _TG_ATTRS
203 __tg_asinh(long double _Complex __x) {return casinhl(__x);}
204
205#undef asinh
206#define asinh(__x) __tg_asinh(__tg_promote1((__x))(__x))
207
208// atanh
209
210static float
211 _TG_ATTRS
212 __tg_atanh(float __x) {return atanhf(__x);}
213
214static double
215 _TG_ATTRS
216 __tg_atanh(double __x) {return atanh(__x);}
217
218static long double
219 _TG_ATTRS
220 __tg_atanh(long double __x) {return atanhl(__x);}
221
222static float _Complex
223 _TG_ATTRS
224 __tg_atanh(float _Complex __x) {return catanhf(__x);}
225
226static double _Complex
227 _TG_ATTRS
228 __tg_atanh(double _Complex __x) {return catanh(__x);}
229
230static long double _Complex
231 _TG_ATTRS
232 __tg_atanh(long double _Complex __x) {return catanhl(__x);}
233
234#undef atanh
235#define atanh(__x) __tg_atanh(__tg_promote1((__x))(__x))
236
237// cos
238
239static float
240 _TG_ATTRS
241 __tg_cos(float __x) {return cosf(__x);}
242
243static double
244 _TG_ATTRS
245 __tg_cos(double __x) {return cos(__x);}
246
247static long double
248 _TG_ATTRS
249 __tg_cos(long double __x) {return cosl(__x);}
250
251static float _Complex
252 _TG_ATTRS
253 __tg_cos(float _Complex __x) {return ccosf(__x);}
254
255static double _Complex
256 _TG_ATTRS
257 __tg_cos(double _Complex __x) {return ccos(__x);}
258
259static long double _Complex
260 _TG_ATTRS
261 __tg_cos(long double _Complex __x) {return ccosl(__x);}
262
263#undef cos
264#define cos(__x) __tg_cos(__tg_promote1((__x))(__x))
265
266// sin
267
268static float
269 _TG_ATTRS
270 __tg_sin(float __x) {return sinf(__x);}
271
272static double
273 _TG_ATTRS
274 __tg_sin(double __x) {return sin(__x);}
275
276static long double
277 _TG_ATTRS
278 __tg_sin(long double __x) {return sinl(__x);}
279
280static float _Complex
281 _TG_ATTRS
282 __tg_sin(float _Complex __x) {return csinf(__x);}
283
284static double _Complex
285 _TG_ATTRS
286 __tg_sin(double _Complex __x) {return csin(__x);}
287
288static long double _Complex
289 _TG_ATTRS
290 __tg_sin(long double _Complex __x) {return csinl(__x);}
291
292#undef sin
293#define sin(__x) __tg_sin(__tg_promote1((__x))(__x))
294
295// tan
296
297static float
298 _TG_ATTRS
299 __tg_tan(float __x) {return tanf(__x);}
300
301static double
302 _TG_ATTRS
303 __tg_tan(double __x) {return tan(__x);}
304
305static long double
306 _TG_ATTRS
307 __tg_tan(long double __x) {return tanl(__x);}
308
309static float _Complex
310 _TG_ATTRS
311 __tg_tan(float _Complex __x) {return ctanf(__x);}
312
313static double _Complex
314 _TG_ATTRS
315 __tg_tan(double _Complex __x) {return ctan(__x);}
316
317static long double _Complex
318 _TG_ATTRS
319 __tg_tan(long double _Complex __x) {return ctanl(__x);}
320
321#undef tan
322#define tan(__x) __tg_tan(__tg_promote1((__x))(__x))
323
324// cosh
325
326static float
327 _TG_ATTRS
328 __tg_cosh(float __x) {return coshf(__x);}
329
330static double
331 _TG_ATTRS
332 __tg_cosh(double __x) {return cosh(__x);}
333
334static long double
335 _TG_ATTRS
336 __tg_cosh(long double __x) {return coshl(__x);}
337
338static float _Complex
339 _TG_ATTRS
340 __tg_cosh(float _Complex __x) {return ccoshf(__x);}
341
342static double _Complex
343 _TG_ATTRS
344 __tg_cosh(double _Complex __x) {return ccosh(__x);}
345
346static long double _Complex
347 _TG_ATTRS
348 __tg_cosh(long double _Complex __x) {return ccoshl(__x);}
349
350#undef cosh
351#define cosh(__x) __tg_cosh(__tg_promote1((__x))(__x))
352
353// sinh
354
355static float
356 _TG_ATTRS
357 __tg_sinh(float __x) {return sinhf(__x);}
358
359static double
360 _TG_ATTRS
361 __tg_sinh(double __x) {return sinh(__x);}
362
363static long double
364 _TG_ATTRS
365 __tg_sinh(long double __x) {return sinhl(__x);}
366
367static float _Complex
368 _TG_ATTRS
369 __tg_sinh(float _Complex __x) {return csinhf(__x);}
370
371static double _Complex
372 _TG_ATTRS
373 __tg_sinh(double _Complex __x) {return csinh(__x);}
374
375static long double _Complex
376 _TG_ATTRS
377 __tg_sinh(long double _Complex __x) {return csinhl(__x);}
378
379#undef sinh
380#define sinh(__x) __tg_sinh(__tg_promote1((__x))(__x))
381
382// tanh
383
384static float
385 _TG_ATTRS
386 __tg_tanh(float __x) {return tanhf(__x);}
387
388static double
389 _TG_ATTRS
390 __tg_tanh(double __x) {return tanh(__x);}
391
392static long double
393 _TG_ATTRS
394 __tg_tanh(long double __x) {return tanhl(__x);}
395
396static float _Complex
397 _TG_ATTRS
398 __tg_tanh(float _Complex __x) {return ctanhf(__x);}
399
400static double _Complex
401 _TG_ATTRS
402 __tg_tanh(double _Complex __x) {return ctanh(__x);}
403
404static long double _Complex
405 _TG_ATTRS
406 __tg_tanh(long double _Complex __x) {return ctanhl(__x);}
407
408#undef tanh
409#define tanh(__x) __tg_tanh(__tg_promote1((__x))(__x))
410
411// exp
412
413static float
414 _TG_ATTRS
415 __tg_exp(float __x) {return expf(__x);}
416
417static double
418 _TG_ATTRS
419 __tg_exp(double __x) {return exp(__x);}
420
421static long double
422 _TG_ATTRS
423 __tg_exp(long double __x) {return expl(__x);}
424
425static float _Complex
426 _TG_ATTRS
427 __tg_exp(float _Complex __x) {return cexpf(__x);}
428
429static double _Complex
430 _TG_ATTRS
431 __tg_exp(double _Complex __x) {return cexp(__x);}
432
433static long double _Complex
434 _TG_ATTRS
435 __tg_exp(long double _Complex __x) {return cexpl(__x);}
436
437#undef exp
438#define exp(__x) __tg_exp(__tg_promote1((__x))(__x))
439
440// log
441
442static float
443 _TG_ATTRS
444 __tg_log(float __x) {return logf(__x);}
445
446static double
447 _TG_ATTRS
448 __tg_log(double __x) {return log(__x);}
449
450static long double
451 _TG_ATTRS
452 __tg_log(long double __x) {return logl(__x);}
453
454static float _Complex
455 _TG_ATTRS
456 __tg_log(float _Complex __x) {return clogf(__x);}
457
458static double _Complex
459 _TG_ATTRS
460 __tg_log(double _Complex __x) {return clog(__x);}
461
462static long double _Complex
463 _TG_ATTRS
464 __tg_log(long double _Complex __x) {return clogl(__x);}
465
466#undef log
467#define log(__x) __tg_log(__tg_promote1((__x))(__x))
468
469// pow
470
471static float
472 _TG_ATTRS
473 __tg_pow(float __x, float __y) {return powf(__x, __y);}
474
475static double
476 _TG_ATTRS
477 __tg_pow(double __x, double __y) {return pow(__x, __y);}
478
479static long double
480 _TG_ATTRS
481 __tg_pow(long double __x, long double __y) {return powl(__x, __y);}
482
483static float _Complex
484 _TG_ATTRS
485 __tg_pow(float _Complex __x, float _Complex __y) {return cpowf(__x, __y);}
486
487static double _Complex
488 _TG_ATTRS
489 __tg_pow(double _Complex __x, double _Complex __y) {return cpow(__x, __y);}
490
491static long double _Complex
492 _TG_ATTRS
493 __tg_pow(long double _Complex __x, long double _Complex __y)
494 {return cpowl(__x, __y);}
495
496#undef pow
497#define pow(__x, __y) __tg_pow(__tg_promote2((__x), (__y))(__x), \
498 __tg_promote2((__x), (__y))(__y))
499
500// sqrt
501
502static float
503 _TG_ATTRS
504 __tg_sqrt(float __x) {return sqrtf(__x);}
505
506static double
507 _TG_ATTRS
508 __tg_sqrt(double __x) {return sqrt(__x);}
509
510static long double
511 _TG_ATTRS
512 __tg_sqrt(long double __x) {return sqrtl(__x);}
513
514static float _Complex
515 _TG_ATTRS
516 __tg_sqrt(float _Complex __x) {return csqrtf(__x);}
517
518static double _Complex
519 _TG_ATTRS
520 __tg_sqrt(double _Complex __x) {return csqrt(__x);}
521
522static long double _Complex
523 _TG_ATTRS
524 __tg_sqrt(long double _Complex __x) {return csqrtl(__x);}
525
526#undef sqrt
527#define sqrt(__x) __tg_sqrt(__tg_promote1((__x))(__x))
528
529// fabs
530
531static float
532 _TG_ATTRS
533 __tg_fabs(float __x) {return fabsf(__x);}
534
535static double
536 _TG_ATTRS
537 __tg_fabs(double __x) {return fabs(__x);}
538
539static long double
540 _TG_ATTRS
541 __tg_fabs(long double __x) {return fabsl(__x);}
542
543static float
544 _TG_ATTRS
545 __tg_fabs(float _Complex __x) {return cabsf(__x);}
546
547static double
548 _TG_ATTRS
549 __tg_fabs(double _Complex __x) {return cabs(__x);}
550
551static long double
552 _TG_ATTRS
553 __tg_fabs(long double _Complex __x) {return cabsl(__x);}
554
555#undef fabs
556#define fabs(__x) __tg_fabs(__tg_promote1((__x))(__x))
557
558// atan2
559
560static float
561 _TG_ATTRS
562 __tg_atan2(float __x, float __y) {return atan2f(__x, __y);}
563
564static double
565 _TG_ATTRS
566 __tg_atan2(double __x, double __y) {return atan2(__x, __y);}
567
568static long double
569 _TG_ATTRS
570 __tg_atan2(long double __x, long double __y) {return atan2l(__x, __y);}
571
572#undef atan2
573#define atan2(__x, __y) __tg_atan2(__tg_promote2((__x), (__y))(__x), \
574 __tg_promote2((__x), (__y))(__y))
575
576// cbrt
577
578static float
579 _TG_ATTRS
580 __tg_cbrt(float __x) {return cbrtf(__x);}
581
582static double
583 _TG_ATTRS
584 __tg_cbrt(double __x) {return cbrt(__x);}
585
586static long double
587 _TG_ATTRS
588 __tg_cbrt(long double __x) {return cbrtl(__x);}
589
590#undef cbrt
591#define cbrt(__x) __tg_cbrt(__tg_promote1((__x))(__x))
592
593// ceil
594
595static float
596 _TG_ATTRS
597 __tg_ceil(float __x) {return ceilf(__x);}
598
599static double
600 _TG_ATTRS
601 __tg_ceil(double __x) {return ceil(__x);}
602
603static long double
604 _TG_ATTRS
605 __tg_ceil(long double __x) {return ceill(__x);}
606
607#undef ceil
608#define ceil(__x) __tg_ceil(__tg_promote1((__x))(__x))
609
610// copysign
611
612static float
613 _TG_ATTRS
614 __tg_copysign(float __x, float __y) {return copysignf(__x, __y);}
615
616static double
617 _TG_ATTRS
618 __tg_copysign(double __x, double __y) {return copysign(__x, __y);}
619
620static long double
621 _TG_ATTRS
622 __tg_copysign(long double __x, long double __y) {return copysignl(__x, __y);}
623
624#undef copysign
625#define copysign(__x, __y) __tg_copysign(__tg_promote2((__x), (__y))(__x), \
626 __tg_promote2((__x), (__y))(__y))
627
628// erf
629
630static float
631 _TG_ATTRS
632 __tg_erf(float __x) {return erff(__x);}
633
634static double
635 _TG_ATTRS
636 __tg_erf(double __x) {return erf(__x);}
637
638static long double
639 _TG_ATTRS
640 __tg_erf(long double __x) {return erfl(__x);}
641
642#undef erf
643#define erf(__x) __tg_erf(__tg_promote1((__x))(__x))
644
645// erfc
646
647static float
648 _TG_ATTRS
649 __tg_erfc(float __x) {return erfcf(__x);}
650
651static double
652 _TG_ATTRS
653 __tg_erfc(double __x) {return erfc(__x);}
654
655static long double
656 _TG_ATTRS
657 __tg_erfc(long double __x) {return erfcl(__x);}
658
659#undef erfc
660#define erfc(__x) __tg_erfc(__tg_promote1((__x))(__x))
661
662// exp2
663
664static float
665 _TG_ATTRS
666 __tg_exp2(float __x) {return exp2f(__x);}
667
668static double
669 _TG_ATTRS
670 __tg_exp2(double __x) {return exp2(__x);}
671
672static long double
673 _TG_ATTRS
674 __tg_exp2(long double __x) {return exp2l(__x);}
675
676#undef exp2
677#define exp2(__x) __tg_exp2(__tg_promote1((__x))(__x))
678
679// expm1
680
681static float
682 _TG_ATTRS
683 __tg_expm1(float __x) {return expm1f(__x);}
684
685static double
686 _TG_ATTRS
687 __tg_expm1(double __x) {return expm1(__x);}
688
689static long double
690 _TG_ATTRS
691 __tg_expm1(long double __x) {return expm1l(__x);}
692
693#undef expm1
694#define expm1(__x) __tg_expm1(__tg_promote1((__x))(__x))
695
696// fdim
697
698static float
699 _TG_ATTRS
700 __tg_fdim(float __x, float __y) {return fdimf(__x, __y);}
701
702static double
703 _TG_ATTRS
704 __tg_fdim(double __x, double __y) {return fdim(__x, __y);}
705
706static long double
707 _TG_ATTRS
708 __tg_fdim(long double __x, long double __y) {return fdiml(__x, __y);}
709
710#undef fdim
711#define fdim(__x, __y) __tg_fdim(__tg_promote2((__x), (__y))(__x), \
712 __tg_promote2((__x), (__y))(__y))
713
714// floor
715
716static float
717 _TG_ATTRS
718 __tg_floor(float __x) {return floorf(__x);}
719
720static double
721 _TG_ATTRS
722 __tg_floor(double __x) {return floor(__x);}
723
724static long double
725 _TG_ATTRS
726 __tg_floor(long double __x) {return floorl(__x);}
727
728#undef floor
729#define floor(__x) __tg_floor(__tg_promote1((__x))(__x))
730
731// fma
732
733static float
734 _TG_ATTRS
735 __tg_fma(float __x, float __y, float __z)
736 {return fmaf(__x, __y, __z);}
737
738static double
739 _TG_ATTRS
740 __tg_fma(double __x, double __y, double __z)
741 {return fma(__x, __y, __z);}
742
743static long double
744 _TG_ATTRS
745 __tg_fma(long double __x,long double __y, long double __z)
746 {return fmal(__x, __y, __z);}
747
748#undef fma
749#define fma(__x, __y, __z) \
750 __tg_fma(__tg_promote3((__x), (__y), (__z))(__x), \
751 __tg_promote3((__x), (__y), (__z))(__y), \
752 __tg_promote3((__x), (__y), (__z))(__z))
753
754// fmax
755
756static float
757 _TG_ATTRS
758 __tg_fmax(float __x, float __y) {return fmaxf(__x, __y);}
759
760static double
761 _TG_ATTRS
762 __tg_fmax(double __x, double __y) {return fmax(__x, __y);}
763
764static long double
765 _TG_ATTRS
766 __tg_fmax(long double __x, long double __y) {return fmaxl(__x, __y);}
767
768#undef fmax
769#define fmax(__x, __y) __tg_fmax(__tg_promote2((__x), (__y))(__x), \
770 __tg_promote2((__x), (__y))(__y))
771
772// fmin
773
774static float
775 _TG_ATTRS
776 __tg_fmin(float __x, float __y) {return fminf(__x, __y);}
777
778static double
779 _TG_ATTRS
780 __tg_fmin(double __x, double __y) {return fmin(__x, __y);}
781
782static long double
783 _TG_ATTRS
784 __tg_fmin(long double __x, long double __y) {return fminl(__x, __y);}
785
786#undef fmin
787#define fmin(__x, __y) __tg_fmin(__tg_promote2((__x), (__y))(__x), \
788 __tg_promote2((__x), (__y))(__y))
789
790// fmod
791
792static float
793 _TG_ATTRS
794 __tg_fmod(float __x, float __y) {return fmodf(__x, __y);}
795
796static double
797 _TG_ATTRS
798 __tg_fmod(double __x, double __y) {return fmod(__x, __y);}
799
800static long double
801 _TG_ATTRS
802 __tg_fmod(long double __x, long double __y) {return fmodl(__x, __y);}
803
804#undef fmod
805#define fmod(__x, __y) __tg_fmod(__tg_promote2((__x), (__y))(__x), \
806 __tg_promote2((__x), (__y))(__y))
807
808// frexp
809
810static float
811 _TG_ATTRS
812 __tg_frexp(float __x, int* __y) {return frexpf(__x, __y);}
813
814static double
815 _TG_ATTRS
816 __tg_frexp(double __x, int* __y) {return frexp(__x, __y);}
817
818static long double
819 _TG_ATTRS
820 __tg_frexp(long double __x, int* __y) {return frexpl(__x, __y);}
821
822#undef frexp
823#define frexp(__x, __y) __tg_frexp(__tg_promote1((__x))(__x), __y)
824
825// hypot
826
827static float
828 _TG_ATTRS
829 __tg_hypot(float __x, float __y) {return hypotf(__x, __y);}
830
831static double
832 _TG_ATTRS
833 __tg_hypot(double __x, double __y) {return hypot(__x, __y);}
834
835static long double
836 _TG_ATTRS
837 __tg_hypot(long double __x, long double __y) {return hypotl(__x, __y);}
838
839#undef hypot
840#define hypot(__x, __y) __tg_hypot(__tg_promote2((__x), (__y))(__x), \
841 __tg_promote2((__x), (__y))(__y))
842
843// ilogb
844
845static int
846 _TG_ATTRS
847 __tg_ilogb(float __x) {return ilogbf(__x);}
848
849static int
850 _TG_ATTRS
851 __tg_ilogb(double __x) {return ilogb(__x);}
852
853static int
854 _TG_ATTRS
855 __tg_ilogb(long double __x) {return ilogbl(__x);}
856
857#undef ilogb
858#define ilogb(__x) __tg_ilogb(__tg_promote1((__x))(__x))
859
860// ldexp
861
862static float
863 _TG_ATTRS
864 __tg_ldexp(float __x, int __y) {return ldexpf(__x, __y);}
865
866static double
867 _TG_ATTRS
868 __tg_ldexp(double __x, int __y) {return ldexp(__x, __y);}
869
870static long double
871 _TG_ATTRS
872 __tg_ldexp(long double __x, int __y) {return ldexpl(__x, __y);}
873
874#undef ldexp
875#define ldexp(__x, __y) __tg_ldexp(__tg_promote1((__x))(__x), __y)
876
877// lgamma
878
879static float
880 _TG_ATTRS
881 __tg_lgamma(float __x) {return lgammaf(__x);}
882
883static double
884 _TG_ATTRS
885 __tg_lgamma(double __x) {return lgamma(__x);}
886
887static long double
888 _TG_ATTRS
889 __tg_lgamma(long double __x) {return lgammal(__x);}
890
891#undef lgamma
892#define lgamma(__x) __tg_lgamma(__tg_promote1((__x))(__x))
893
894// llrint
895
896static long long
897 _TG_ATTRS
898 __tg_llrint(float __x) {return llrintf(__x);}
899
900static long long
901 _TG_ATTRS
902 __tg_llrint(double __x) {return llrint(__x);}
903
904static long long
905 _TG_ATTRS
906 __tg_llrint(long double __x) {return llrintl(__x);}
907
908#undef llrint
909#define llrint(__x) __tg_llrint(__tg_promote1((__x))(__x))
910
911// llround
912
913static long long
914 _TG_ATTRS
915 __tg_llround(float __x) {return llroundf(__x);}
916
917static long long
918 _TG_ATTRS
919 __tg_llround(double __x) {return llround(__x);}
920
921static long long
922 _TG_ATTRS
923 __tg_llround(long double __x) {return llroundl(__x);}
924
925#undef llround
926#define llround(__x) __tg_llround(__tg_promote1((__x))(__x))
927
928// log10
929
930static float
931 _TG_ATTRS
932 __tg_log10(float __x) {return log10f(__x);}
933
934static double
935 _TG_ATTRS
936 __tg_log10(double __x) {return log10(__x);}
937
938static long double
939 _TG_ATTRS
940 __tg_log10(long double __x) {return log10l(__x);}
941
942#undef log10
943#define log10(__x) __tg_log10(__tg_promote1((__x))(__x))
944
945// log1p
946
947static float
948 _TG_ATTRS
949 __tg_log1p(float __x) {return log1pf(__x);}
950
951static double
952 _TG_ATTRS
953 __tg_log1p(double __x) {return log1p(__x);}
954
955static long double
956 _TG_ATTRS
957 __tg_log1p(long double __x) {return log1pl(__x);}
958
959#undef log1p
960#define log1p(__x) __tg_log1p(__tg_promote1((__x))(__x))
961
962// log2
963
964static float
965 _TG_ATTRS
966 __tg_log2(float __x) {return log2f(__x);}
967
968static double
969 _TG_ATTRS
970 __tg_log2(double __x) {return log2(__x);}
971
972static long double
973 _TG_ATTRS
974 __tg_log2(long double __x) {return log2l(__x);}
975
976#undef log2
977#define log2(__x) __tg_log2(__tg_promote1((__x))(__x))
978
979// logb
980
981static float
982 _TG_ATTRS
983 __tg_logb(float __x) {return logbf(__x);}
984
985static double
986 _TG_ATTRS
987 __tg_logb(double __x) {return logb(__x);}
988
989static long double
990 _TG_ATTRS
991 __tg_logb(long double __x) {return logbl(__x);}
992
993#undef logb
994#define logb(__x) __tg_logb(__tg_promote1((__x))(__x))
995
996// lrint
997
998static long
999 _TG_ATTRS
1000 __tg_lrint(float __x) {return lrintf(__x);}
1001
1002static long
1003 _TG_ATTRS
1004 __tg_lrint(double __x) {return lrint(__x);}
1005
1006static long
1007 _TG_ATTRS
1008 __tg_lrint(long double __x) {return lrintl(__x);}
1009
1010#undef lrint
1011#define lrint(__x) __tg_lrint(__tg_promote1((__x))(__x))
1012
1013// lround
1014
1015static long
1016 _TG_ATTRS
1017 __tg_lround(float __x) {return lroundf(__x);}
1018
1019static long
1020 _TG_ATTRS
1021 __tg_lround(double __x) {return lround(__x);}
1022
1023static long
1024 _TG_ATTRS
1025 __tg_lround(long double __x) {return lroundl(__x);}
1026
1027#undef lround
1028#define lround(__x) __tg_lround(__tg_promote1((__x))(__x))
1029
1030// nearbyint
1031
1032static float
1033 _TG_ATTRS
1034 __tg_nearbyint(float __x) {return nearbyintf(__x);}
1035
1036static double
1037 _TG_ATTRS
1038 __tg_nearbyint(double __x) {return nearbyint(__x);}
1039
1040static long double
1041 _TG_ATTRS
1042 __tg_nearbyint(long double __x) {return nearbyintl(__x);}
1043
1044#undef nearbyint
1045#define nearbyint(__x) __tg_nearbyint(__tg_promote1((__x))(__x))
1046
1047// nextafter
1048
1049static float
1050 _TG_ATTRS
1051 __tg_nextafter(float __x, float __y) {return nextafterf(__x, __y);}
1052
1053static double
1054 _TG_ATTRS
1055 __tg_nextafter(double __x, double __y) {return nextafter(__x, __y);}
1056
1057static long double
1058 _TG_ATTRS
1059 __tg_nextafter(long double __x, long double __y) {return nextafterl(__x, __y);}
1060
1061#undef nextafter
1062#define nextafter(__x, __y) __tg_nextafter(__tg_promote2((__x), (__y))(__x), \
1063 __tg_promote2((__x), (__y))(__y))
1064
1065// nexttoward
1066
1067static float
1068 _TG_ATTRS
1069 __tg_nexttoward(float __x, long double __y) {return nexttowardf(__x, __y);}
1070
1071static double
1072 _TG_ATTRS
1073 __tg_nexttoward(double __x, long double __y) {return nexttoward(__x, __y);}
1074
1075static long double
1076 _TG_ATTRS
1077 __tg_nexttoward(long double __x, long double __y) {return nexttowardl(__x, __y);}
1078
1079#undef nexttoward
1080#define nexttoward(__x, __y) __tg_nexttoward(__tg_promote1((__x))(__x), (__y))
1081
1082// remainder
1083
1084static float
1085 _TG_ATTRS
1086 __tg_remainder(float __x, float __y) {return remainderf(__x, __y);}
1087
1088static double
1089 _TG_ATTRS
1090 __tg_remainder(double __x, double __y) {return remainder(__x, __y);}
1091
1092static long double
1093 _TG_ATTRS
1094 __tg_remainder(long double __x, long double __y) {return remainderl(__x, __y);}
1095
1096#undef remainder
1097#define remainder(__x, __y) __tg_remainder(__tg_promote2((__x), (__y))(__x), \
1098 __tg_promote2((__x), (__y))(__y))
1099
1100// remquo
1101
1102static float
1103 _TG_ATTRS
1104 __tg_remquo(float __x, float __y, int* __z)
1105 {return remquof(__x, __y, __z);}
1106
1107static double
1108 _TG_ATTRS
1109 __tg_remquo(double __x, double __y, int* __z)
1110 {return remquo(__x, __y, __z);}
1111
1112static long double
1113 _TG_ATTRS
1114 __tg_remquo(long double __x,long double __y, int* __z)
1115 {return remquol(__x, __y, __z);}
1116
1117#undef remquo
1118#define remquo(__x, __y, __z) \
1119 __tg_remquo(__tg_promote2((__x), (__y))(__x), \
1120 __tg_promote2((__x), (__y))(__y), \
1121 (__z))
1122
1123// rint
1124
1125static float
1126 _TG_ATTRS
1127 __tg_rint(float __x) {return rintf(__x);}
1128
1129static double
1130 _TG_ATTRS
1131 __tg_rint(double __x) {return rint(__x);}
1132
1133static long double
1134 _TG_ATTRS
1135 __tg_rint(long double __x) {return rintl(__x);}
1136
1137#undef rint
1138#define rint(__x) __tg_rint(__tg_promote1((__x))(__x))
1139
1140// round
1141
1142static float
1143 _TG_ATTRS
1144 __tg_round(float __x) {return roundf(__x);}
1145
1146static double
1147 _TG_ATTRS
1148 __tg_round(double __x) {return round(__x);}
1149
1150static long double
1151 _TG_ATTRS
1152 __tg_round(long double __x) {return roundl(__x);}
1153
1154#undef round
1155#define round(__x) __tg_round(__tg_promote1((__x))(__x))
1156
1157// scalbn
1158
1159static float
1160 _TG_ATTRS
1161 __tg_scalbn(float __x, int __y) {return scalbnf(__x, __y);}
1162
1163static double
1164 _TG_ATTRS
1165 __tg_scalbn(double __x, int __y) {return scalbn(__x, __y);}
1166
1167static long double
1168 _TG_ATTRS
1169 __tg_scalbn(long double __x, int __y) {return scalbnl(__x, __y);}
1170
1171#undef scalbn
1172#define scalbn(__x, __y) __tg_scalbn(__tg_promote1((__x))(__x), __y)
1173
1174// scalbln
1175
1176static float
1177 _TG_ATTRS
1178 __tg_scalbln(float __x, long __y) {return scalblnf(__x, __y);}
1179
1180static double
1181 _TG_ATTRS
1182 __tg_scalbln(double __x, long __y) {return scalbln(__x, __y);}
1183
1184static long double
1185 _TG_ATTRS
1186 __tg_scalbln(long double __x, long __y) {return scalblnl(__x, __y);}
1187
1188#undef scalbln
1189#define scalbln(__x, __y) __tg_scalbln(__tg_promote1((__x))(__x), __y)
1190
1191// tgamma
1192
1193static float
1194 _TG_ATTRS
1195 __tg_tgamma(float __x) {return tgammaf(__x);}
1196
1197static double
1198 _TG_ATTRS
1199 __tg_tgamma(double __x) {return tgamma(__x);}
1200
1201static long double
1202 _TG_ATTRS
1203 __tg_tgamma(long double __x) {return tgammal(__x);}
1204
1205#undef tgamma
1206#define tgamma(__x) __tg_tgamma(__tg_promote1((__x))(__x))
1207
1208// trunc
1209
1210static float
1211 _TG_ATTRS
1212 __tg_trunc(float __x) {return truncf(__x);}
1213
1214static double
1215 _TG_ATTRS
1216 __tg_trunc(double __x) {return trunc(__x);}
1217
1218static long double
1219 _TG_ATTRS
1220 __tg_trunc(long double __x) {return truncl(__x);}
1221
1222#undef trunc
1223#define trunc(__x) __tg_trunc(__tg_promote1((__x))(__x))
1224
1225// carg
1226
1227static float
1228 _TG_ATTRS
1229 __tg_carg(float __x) {return atan2f(0.F, __x);}
1230
1231static double
1232 _TG_ATTRS
1233 __tg_carg(double __x) {return atan2(0., __x);}
1234
1235static long double
1236 _TG_ATTRS
1237 __tg_carg(long double __x) {return atan2l(0.L, __x);}
1238
1239static float
1240 _TG_ATTRS
1241 __tg_carg(float _Complex __x) {return cargf(__x);}
1242
1243static double
1244 _TG_ATTRS
1245 __tg_carg(double _Complex __x) {return carg(__x);}
1246
1247static long double
1248 _TG_ATTRS
1249 __tg_carg(long double _Complex __x) {return cargl(__x);}
1250
1251#undef carg
1252#define carg(__x) __tg_carg(__tg_promote1((__x))(__x))
1253
1254// cimag
1255
1256static float
1257 _TG_ATTRS
1258 __tg_cimag(float __x) {return 0;}
1259
1260static double
1261 _TG_ATTRS
1262 __tg_cimag(double __x) {return 0;}
1263
1264static long double
1265 _TG_ATTRS
1266 __tg_cimag(long double __x) {return 0;}
1267
1268static float
1269 _TG_ATTRS
1270 __tg_cimag(float _Complex __x) {return cimagf(__x);}
1271
1272static double
1273 _TG_ATTRS
1274 __tg_cimag(double _Complex __x) {return cimag(__x);}
1275
1276static long double
1277 _TG_ATTRS
1278 __tg_cimag(long double _Complex __x) {return cimagl(__x);}
1279
1280#undef cimag
1281#define cimag(__x) __tg_cimag(__tg_promote1((__x))(__x))
1282
1283// conj
1284
1285static float _Complex
1286 _TG_ATTRS
1287 __tg_conj(float __x) {return __x;}
1288
1289static double _Complex
1290 _TG_ATTRS
1291 __tg_conj(double __x) {return __x;}
1292
1293static long double _Complex
1294 _TG_ATTRS
1295 __tg_conj(long double __x) {return __x;}
1296
1297static float _Complex
1298 _TG_ATTRS
1299 __tg_conj(float _Complex __x) {return conjf(__x);}
1300
1301static double _Complex
1302 _TG_ATTRS
1303 __tg_conj(double _Complex __x) {return conj(__x);}
1304
1305static long double _Complex
1306 _TG_ATTRS
1307 __tg_conj(long double _Complex __x) {return conjl(__x);}
1308
1309#undef conj
1310#define conj(__x) __tg_conj(__tg_promote1((__x))(__x))
1311
1312// cproj
1313
1314static float _Complex
1315 _TG_ATTRS
1316 __tg_cproj(float __x) {return cprojf(__x);}
1317
1318static double _Complex
1319 _TG_ATTRS
1320 __tg_cproj(double __x) {return cproj(__x);}
1321
1322static long double _Complex
1323 _TG_ATTRS
1324 __tg_cproj(long double __x) {return cprojl(__x);}
1325
1326static float _Complex
1327 _TG_ATTRS
1328 __tg_cproj(float _Complex __x) {return cprojf(__x);}
1329
1330static double _Complex
1331 _TG_ATTRS
1332 __tg_cproj(double _Complex __x) {return cproj(__x);}
1333
1334static long double _Complex
1335 _TG_ATTRS
1336 __tg_cproj(long double _Complex __x) {return cprojl(__x);}
1337
1338#undef cproj
1339#define cproj(__x) __tg_cproj(__tg_promote1((__x))(__x))
1340
1341// creal
1342
1343static float
1344 _TG_ATTRS
1345 __tg_creal(float __x) {return __x;}
1346
1347static double
1348 _TG_ATTRS
1349 __tg_creal(double __x) {return __x;}
1350
1351static long double
1352 _TG_ATTRS
1353 __tg_creal(long double __x) {return __x;}
1354
1355static float
1356 _TG_ATTRS
1357 __tg_creal(float _Complex __x) {return crealf(__x);}
1358
1359static double
1360 _TG_ATTRS
1361 __tg_creal(double _Complex __x) {return creal(__x);}
1362
1363static long double
1364 _TG_ATTRS
1365 __tg_creal(long double _Complex __x) {return creall(__x);}
1366
1367#undef creal
1368#define creal(__x) __tg_creal(__tg_promote1((__x))(__x))
1369
1370#undef _TG_ATTRSp
1371#undef _TG_ATTRS
1372
1373#endif /* __cplusplus */
1374#endif /* __TGMATH_H */
c_headers/tmmintrin.h created+230
......@@ -0,0 +1,230 @@
1/*===---- tmmintrin.h - SSSE3 intrinsics -----------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __TMMINTRIN_H
25#define __TMMINTRIN_H
26
27#ifndef __SSSE3__
28#error "SSSE3 instruction set not enabled"
29#else
30
31#include <pmmintrin.h>
32
33/* Define the default attributes for the functions in this file. */
34#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
35
36static __inline__ __m64 __DEFAULT_FN_ATTRS
37_mm_abs_pi8(__m64 __a)
38{
39 return (__m64)__builtin_ia32_pabsb((__v8qi)__a);
40}
41
42static __inline__ __m128i __DEFAULT_FN_ATTRS
43_mm_abs_epi8(__m128i __a)
44{
45 return (__m128i)__builtin_ia32_pabsb128((__v16qi)__a);
46}
47
48static __inline__ __m64 __DEFAULT_FN_ATTRS
49_mm_abs_pi16(__m64 __a)
50{
51 return (__m64)__builtin_ia32_pabsw((__v4hi)__a);
52}
53
54static __inline__ __m128i __DEFAULT_FN_ATTRS
55_mm_abs_epi16(__m128i __a)
56{
57 return (__m128i)__builtin_ia32_pabsw128((__v8hi)__a);
58}
59
60static __inline__ __m64 __DEFAULT_FN_ATTRS
61_mm_abs_pi32(__m64 __a)
62{
63 return (__m64)__builtin_ia32_pabsd((__v2si)__a);
64}
65
66static __inline__ __m128i __DEFAULT_FN_ATTRS
67_mm_abs_epi32(__m128i __a)
68{
69 return (__m128i)__builtin_ia32_pabsd128((__v4si)__a);
70}
71
72#define _mm_alignr_epi8(a, b, n) __extension__ ({ \
73 __m128i __a = (a); \
74 __m128i __b = (b); \
75 (__m128i)__builtin_ia32_palignr128((__v16qi)__a, (__v16qi)__b, (n)); })
76
77#define _mm_alignr_pi8(a, b, n) __extension__ ({ \
78 __m64 __a = (a); \
79 __m64 __b = (b); \
80 (__m64)__builtin_ia32_palignr((__v8qi)__a, (__v8qi)__b, (n)); })
81
82static __inline__ __m128i __DEFAULT_FN_ATTRS
83_mm_hadd_epi16(__m128i __a, __m128i __b)
84{
85 return (__m128i)__builtin_ia32_phaddw128((__v8hi)__a, (__v8hi)__b);
86}
87
88static __inline__ __m128i __DEFAULT_FN_ATTRS
89_mm_hadd_epi32(__m128i __a, __m128i __b)
90{
91 return (__m128i)__builtin_ia32_phaddd128((__v4si)__a, (__v4si)__b);
92}
93
94static __inline__ __m64 __DEFAULT_FN_ATTRS
95_mm_hadd_pi16(__m64 __a, __m64 __b)
96{
97 return (__m64)__builtin_ia32_phaddw((__v4hi)__a, (__v4hi)__b);
98}
99
100static __inline__ __m64 __DEFAULT_FN_ATTRS
101_mm_hadd_pi32(__m64 __a, __m64 __b)
102{
103 return (__m64)__builtin_ia32_phaddd((__v2si)__a, (__v2si)__b);
104}
105
106static __inline__ __m128i __DEFAULT_FN_ATTRS
107_mm_hadds_epi16(__m128i __a, __m128i __b)
108{
109 return (__m128i)__builtin_ia32_phaddsw128((__v8hi)__a, (__v8hi)__b);
110}
111
112static __inline__ __m64 __DEFAULT_FN_ATTRS
113_mm_hadds_pi16(__m64 __a, __m64 __b)
114{
115 return (__m64)__builtin_ia32_phaddsw((__v4hi)__a, (__v4hi)__b);
116}
117
118static __inline__ __m128i __DEFAULT_FN_ATTRS
119_mm_hsub_epi16(__m128i __a, __m128i __b)
120{
121 return (__m128i)__builtin_ia32_phsubw128((__v8hi)__a, (__v8hi)__b);
122}
123
124static __inline__ __m128i __DEFAULT_FN_ATTRS
125_mm_hsub_epi32(__m128i __a, __m128i __b)
126{
127 return (__m128i)__builtin_ia32_phsubd128((__v4si)__a, (__v4si)__b);
128}
129
130static __inline__ __m64 __DEFAULT_FN_ATTRS
131_mm_hsub_pi16(__m64 __a, __m64 __b)
132{
133 return (__m64)__builtin_ia32_phsubw((__v4hi)__a, (__v4hi)__b);
134}
135
136static __inline__ __m64 __DEFAULT_FN_ATTRS
137_mm_hsub_pi32(__m64 __a, __m64 __b)
138{
139 return (__m64)__builtin_ia32_phsubd((__v2si)__a, (__v2si)__b);
140}
141
142static __inline__ __m128i __DEFAULT_FN_ATTRS
143_mm_hsubs_epi16(__m128i __a, __m128i __b)
144{
145 return (__m128i)__builtin_ia32_phsubsw128((__v8hi)__a, (__v8hi)__b);
146}
147
148static __inline__ __m64 __DEFAULT_FN_ATTRS
149_mm_hsubs_pi16(__m64 __a, __m64 __b)
150{
151 return (__m64)__builtin_ia32_phsubsw((__v4hi)__a, (__v4hi)__b);
152}
153
154static __inline__ __m128i __DEFAULT_FN_ATTRS
155_mm_maddubs_epi16(__m128i __a, __m128i __b)
156{
157 return (__m128i)__builtin_ia32_pmaddubsw128((__v16qi)__a, (__v16qi)__b);
158}
159
160static __inline__ __m64 __DEFAULT_FN_ATTRS
161_mm_maddubs_pi16(__m64 __a, __m64 __b)
162{
163 return (__m64)__builtin_ia32_pmaddubsw((__v8qi)__a, (__v8qi)__b);
164}
165
166static __inline__ __m128i __DEFAULT_FN_ATTRS
167_mm_mulhrs_epi16(__m128i __a, __m128i __b)
168{
169 return (__m128i)__builtin_ia32_pmulhrsw128((__v8hi)__a, (__v8hi)__b);
170}
171
172static __inline__ __m64 __DEFAULT_FN_ATTRS
173_mm_mulhrs_pi16(__m64 __a, __m64 __b)
174{
175 return (__m64)__builtin_ia32_pmulhrsw((__v4hi)__a, (__v4hi)__b);
176}
177
178static __inline__ __m128i __DEFAULT_FN_ATTRS
179_mm_shuffle_epi8(__m128i __a, __m128i __b)
180{
181 return (__m128i)__builtin_ia32_pshufb128((__v16qi)__a, (__v16qi)__b);
182}
183
184static __inline__ __m64 __DEFAULT_FN_ATTRS
185_mm_shuffle_pi8(__m64 __a, __m64 __b)
186{
187 return (__m64)__builtin_ia32_pshufb((__v8qi)__a, (__v8qi)__b);
188}
189
190static __inline__ __m128i __DEFAULT_FN_ATTRS
191_mm_sign_epi8(__m128i __a, __m128i __b)
192{
193 return (__m128i)__builtin_ia32_psignb128((__v16qi)__a, (__v16qi)__b);
194}
195
196static __inline__ __m128i __DEFAULT_FN_ATTRS
197_mm_sign_epi16(__m128i __a, __m128i __b)
198{
199 return (__m128i)__builtin_ia32_psignw128((__v8hi)__a, (__v8hi)__b);
200}
201
202static __inline__ __m128i __DEFAULT_FN_ATTRS
203_mm_sign_epi32(__m128i __a, __m128i __b)
204{
205 return (__m128i)__builtin_ia32_psignd128((__v4si)__a, (__v4si)__b);
206}
207
208static __inline__ __m64 __DEFAULT_FN_ATTRS
209_mm_sign_pi8(__m64 __a, __m64 __b)
210{
211 return (__m64)__builtin_ia32_psignb((__v8qi)__a, (__v8qi)__b);
212}
213
214static __inline__ __m64 __DEFAULT_FN_ATTRS
215_mm_sign_pi16(__m64 __a, __m64 __b)
216{
217 return (__m64)__builtin_ia32_psignw((__v4hi)__a, (__v4hi)__b);
218}
219
220static __inline__ __m64 __DEFAULT_FN_ATTRS
221_mm_sign_pi32(__m64 __a, __m64 __b)
222{
223 return (__m64)__builtin_ia32_psignd((__v2si)__a, (__v2si)__b);
224}
225
226#undef __DEFAULT_FN_ATTRS
227
228#endif /* __SSSE3__ */
229
230#endif /* __TMMINTRIN_H */
c_headers/unwind.h created+282
......@@ -0,0 +1,282 @@
1/*===---- unwind.h - Stack unwinding ----------------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24/* See "Data Definitions for libgcc_s" in the Linux Standard Base.*/
25
26#ifndef __CLANG_UNWIND_H
27#define __CLANG_UNWIND_H
28
29#if defined(__APPLE__) && __has_include_next(<unwind.h>)
30/* Darwin (from 11.x on) provide an unwind.h. If that's available,
31 * use it. libunwind wraps some of its definitions in #ifdef _GNU_SOURCE,
32 * so define that around the include.*/
33# ifndef _GNU_SOURCE
34# define _SHOULD_UNDEFINE_GNU_SOURCE
35# define _GNU_SOURCE
36# endif
37// libunwind's unwind.h reflects the current visibility. However, Mozilla
38// builds with -fvisibility=hidden and relies on gcc's unwind.h to reset the
39// visibility to default and export its contents. gcc also allows users to
40// override its override by #defining HIDE_EXPORTS (but note, this only obeys
41// the user's -fvisibility setting; it doesn't hide any exports on its own). We
42// imitate gcc's header here:
43# ifdef HIDE_EXPORTS
44# include_next <unwind.h>
45# else
46# pragma GCC visibility push(default)
47# include_next <unwind.h>
48# pragma GCC visibility pop
49# endif
50# ifdef _SHOULD_UNDEFINE_GNU_SOURCE
51# undef _GNU_SOURCE
52# undef _SHOULD_UNDEFINE_GNU_SOURCE
53# endif
54#else
55
56#include <stdint.h>
57
58#ifdef __cplusplus
59extern "C" {
60#endif
61
62/* It is a bit strange for a header to play with the visibility of the
63 symbols it declares, but this matches gcc's behavior and some programs
64 depend on it */
65#ifndef HIDE_EXPORTS
66#pragma GCC visibility push(default)
67#endif
68
69typedef uintptr_t _Unwind_Word;
70typedef intptr_t _Unwind_Sword;
71typedef uintptr_t _Unwind_Ptr;
72typedef uintptr_t _Unwind_Internal_Ptr;
73typedef uint64_t _Unwind_Exception_Class;
74
75typedef intptr_t _sleb128_t;
76typedef uintptr_t _uleb128_t;
77
78struct _Unwind_Context;
79struct _Unwind_Exception;
80typedef enum {
81 _URC_NO_REASON = 0,
82 _URC_FOREIGN_EXCEPTION_CAUGHT = 1,
83
84 _URC_FATAL_PHASE2_ERROR = 2,
85 _URC_FATAL_PHASE1_ERROR = 3,
86 _URC_NORMAL_STOP = 4,
87
88 _URC_END_OF_STACK = 5,
89 _URC_HANDLER_FOUND = 6,
90 _URC_INSTALL_CONTEXT = 7,
91 _URC_CONTINUE_UNWIND = 8
92} _Unwind_Reason_Code;
93
94typedef enum {
95 _UA_SEARCH_PHASE = 1,
96 _UA_CLEANUP_PHASE = 2,
97
98 _UA_HANDLER_FRAME = 4,
99 _UA_FORCE_UNWIND = 8,
100 _UA_END_OF_STACK = 16 /* gcc extension to C++ ABI */
101} _Unwind_Action;
102
103typedef void (*_Unwind_Exception_Cleanup_Fn)(_Unwind_Reason_Code,
104 struct _Unwind_Exception *);
105
106struct _Unwind_Exception {
107 _Unwind_Exception_Class exception_class;
108 _Unwind_Exception_Cleanup_Fn exception_cleanup;
109 _Unwind_Word private_1;
110 _Unwind_Word private_2;
111 /* The Itanium ABI requires that _Unwind_Exception objects are "double-word
112 * aligned". GCC has interpreted this to mean "use the maximum useful
113 * alignment for the target"; so do we. */
114} __attribute__((__aligned__));
115
116typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)(int, _Unwind_Action,
117 _Unwind_Exception_Class,
118 struct _Unwind_Exception *,
119 struct _Unwind_Context *,
120 void *);
121
122typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn)(
123 int, _Unwind_Action, _Unwind_Exception_Class, struct _Unwind_Exception *,
124 struct _Unwind_Context *);
125typedef _Unwind_Personality_Fn __personality_routine;
126
127typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn)(struct _Unwind_Context *,
128 void *);
129
130#if defined(__arm__) && !defined(__APPLE__)
131
132typedef enum {
133 _UVRSC_CORE = 0, /* integer register */
134 _UVRSC_VFP = 1, /* vfp */
135 _UVRSC_WMMXD = 3, /* Intel WMMX data register */
136 _UVRSC_WMMXC = 4 /* Intel WMMX control register */
137} _Unwind_VRS_RegClass;
138
139typedef enum {
140 _UVRSD_UINT32 = 0,
141 _UVRSD_VFPX = 1,
142 _UVRSD_UINT64 = 3,
143 _UVRSD_FLOAT = 4,
144 _UVRSD_DOUBLE = 5
145} _Unwind_VRS_DataRepresentation;
146
147typedef enum {
148 _UVRSR_OK = 0,
149 _UVRSR_NOT_IMPLEMENTED = 1,
150 _UVRSR_FAILED = 2
151} _Unwind_VRS_Result;
152
153_Unwind_VRS_Result _Unwind_VRS_Get(struct _Unwind_Context *__context,
154 _Unwind_VRS_RegClass __regclass,
155 uint32_t __regno,
156 _Unwind_VRS_DataRepresentation __representation,
157 void *__valuep);
158
159_Unwind_VRS_Result _Unwind_VRS_Set(struct _Unwind_Context *__context,
160 _Unwind_VRS_RegClass __regclass,
161 uint32_t __regno,
162 _Unwind_VRS_DataRepresentation __representation,
163 void *__valuep);
164
165static __inline__
166_Unwind_Word _Unwind_GetGR(struct _Unwind_Context *__context, int __index) {
167 _Unwind_Word __value;
168 _Unwind_VRS_Get(__context, _UVRSC_CORE, __index, _UVRSD_UINT32, &__value);
169 return __value;
170}
171
172static __inline__
173void _Unwind_SetGR(struct _Unwind_Context *__context, int __index,
174 _Unwind_Word __value) {
175 _Unwind_VRS_Set(__context, _UVRSC_CORE, __index, _UVRSD_UINT32, &__value);
176}
177
178static __inline__
179_Unwind_Word _Unwind_GetIP(struct _Unwind_Context *__context) {
180 _Unwind_Word __ip = _Unwind_GetGR(__context, 15);
181 return __ip & ~(_Unwind_Word)(0x1); /* Remove thumb mode bit. */
182}
183
184static __inline__
185void _Unwind_SetIP(struct _Unwind_Context *__context, _Unwind_Word __value) {
186 _Unwind_Word __thumb_mode_bit = _Unwind_GetGR(__context, 15) & 0x1;
187 _Unwind_SetGR(__context, 15, __value | __thumb_mode_bit);
188}
189#else
190_Unwind_Word _Unwind_GetGR(struct _Unwind_Context *, int);
191void _Unwind_SetGR(struct _Unwind_Context *, int, _Unwind_Word);
192
193_Unwind_Word _Unwind_GetIP(struct _Unwind_Context *);
194void _Unwind_SetIP(struct _Unwind_Context *, _Unwind_Word);
195#endif
196
197
198_Unwind_Word _Unwind_GetIPInfo(struct _Unwind_Context *, int *);
199
200_Unwind_Word _Unwind_GetCFA(struct _Unwind_Context *);
201
202_Unwind_Word _Unwind_GetBSP(struct _Unwind_Context *);
203
204void *_Unwind_GetLanguageSpecificData(struct _Unwind_Context *);
205
206_Unwind_Ptr _Unwind_GetRegionStart(struct _Unwind_Context *);
207
208/* DWARF EH functions; currently not available on Darwin/ARM */
209#if !defined(__APPLE__) || !defined(__arm__)
210
211_Unwind_Reason_Code _Unwind_RaiseException(struct _Unwind_Exception *);
212_Unwind_Reason_Code _Unwind_ForcedUnwind(struct _Unwind_Exception *,
213 _Unwind_Stop_Fn, void *);
214void _Unwind_DeleteException(struct _Unwind_Exception *);
215void _Unwind_Resume(struct _Unwind_Exception *);
216_Unwind_Reason_Code _Unwind_Resume_or_Rethrow(struct _Unwind_Exception *);
217
218#endif
219
220_Unwind_Reason_Code _Unwind_Backtrace(_Unwind_Trace_Fn, void *);
221
222/* setjmp(3)/longjmp(3) stuff */
223typedef struct SjLj_Function_Context *_Unwind_FunctionContext_t;
224
225void _Unwind_SjLj_Register(_Unwind_FunctionContext_t);
226void _Unwind_SjLj_Unregister(_Unwind_FunctionContext_t);
227_Unwind_Reason_Code _Unwind_SjLj_RaiseException(struct _Unwind_Exception *);
228_Unwind_Reason_Code _Unwind_SjLj_ForcedUnwind(struct _Unwind_Exception *,
229 _Unwind_Stop_Fn, void *);
230void _Unwind_SjLj_Resume(struct _Unwind_Exception *);
231_Unwind_Reason_Code _Unwind_SjLj_Resume_or_Rethrow(struct _Unwind_Exception *);
232
233void *_Unwind_FindEnclosingFunction(void *);
234
235#ifdef __APPLE__
236
237_Unwind_Ptr _Unwind_GetDataRelBase(struct _Unwind_Context *)
238 __attribute__((__unavailable__));
239_Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *)
240 __attribute__((__unavailable__));
241
242/* Darwin-specific functions */
243void __register_frame(const void *);
244void __deregister_frame(const void *);
245
246struct dwarf_eh_bases {
247 uintptr_t tbase;
248 uintptr_t dbase;
249 uintptr_t func;
250};
251void *_Unwind_Find_FDE(const void *, struct dwarf_eh_bases *);
252
253void __register_frame_info_bases(const void *, void *, void *, void *)
254 __attribute__((__unavailable__));
255void __register_frame_info(const void *, void *) __attribute__((__unavailable__));
256void __register_frame_info_table_bases(const void *, void*, void *, void *)
257 __attribute__((__unavailable__));
258void __register_frame_info_table(const void *, void *)
259 __attribute__((__unavailable__));
260void __register_frame_table(const void *) __attribute__((__unavailable__));
261void __deregister_frame_info(const void *) __attribute__((__unavailable__));
262void __deregister_frame_info_bases(const void *)__attribute__((__unavailable__));
263
264#else
265
266_Unwind_Ptr _Unwind_GetDataRelBase(struct _Unwind_Context *);
267_Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *);
268
269#endif
270
271
272#ifndef HIDE_EXPORTS
273#pragma GCC visibility pop
274#endif
275
276#ifdef __cplusplus
277}
278#endif
279
280#endif
281
282#endif /* __CLANG_UNWIND_H */
c_headers/vadefs.h created+65
......@@ -0,0 +1,65 @@
1/* ===-------- vadefs.h ---------------------------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24/* Only include this if we are aiming for MSVC compatibility. */
25#ifndef _MSC_VER
26#include_next <vadefs.h>
27#else
28
29#ifndef __clang_vadefs_h
30#define __clang_vadefs_h
31
32#include_next <vadefs.h>
33
34/* Override macros from vadefs.h with definitions that work with Clang. */
35#ifdef _crt_va_start
36#undef _crt_va_start
37#define _crt_va_start(ap, param) __builtin_va_start(ap, param)
38#endif
39#ifdef _crt_va_end
40#undef _crt_va_end
41#define _crt_va_end(ap) __builtin_va_end(ap)
42#endif
43#ifdef _crt_va_arg
44#undef _crt_va_arg
45#define _crt_va_arg(ap, type) __builtin_va_arg(ap, type)
46#endif
47
48/* VS 2015 switched to double underscore names, which is an improvement, but now
49 * we have to intercept those names too.
50 */
51#ifdef __crt_va_start
52#undef __crt_va_start
53#define __crt_va_start(ap, param) __builtin_va_start(ap, param)
54#endif
55#ifdef __crt_va_end
56#undef __crt_va_end
57#define __crt_va_end(ap) __builtin_va_end(ap)
58#endif
59#ifdef __crt_va_arg
60#undef __crt_va_arg
61#define __crt_va_arg(ap, type) __builtin_va_arg(ap, type)
62#endif
63
64#endif
65#endif
c_headers/varargs.h created+26
......@@ -0,0 +1,26 @@
1/*===---- varargs.h - Variable argument handling -------------------------------------===
2*
3* Permission is hereby granted, free of charge, to any person obtaining a copy
4* of this software and associated documentation files (the "Software"), to deal
5* in the Software without restriction, including without limitation the rights
6* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7* copies of the Software, and to permit persons to whom the Software is
8* furnished to do so, subject to the following conditions:
9*
10* The above copyright notice and this permission notice shall be included in
11* all copies or substantial portions of the Software.
12*
13* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19* THE SOFTWARE.
20*
21*===-----------------------------------------------------------------------===
22*/
23#ifndef __VARARGS_H
24#define __VARARGS_H
25 #error "Please use <stdarg.h> instead of <varargs.h>"
26#endif
c_headers/vecintrin.h created+8946
......@@ -0,0 +1,8946 @@
1/*===---- vecintrin.h - Vector intrinsics ----------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#if defined(__s390x__) && defined(__VEC__)
25
26#define __ATTRS_ai __attribute__((__always_inline__))
27#define __ATTRS_o __attribute__((__overloadable__))
28#define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__))
29
30#define __constant(PARM) \
31 __attribute__((__enable_if__ ((PARM) == (PARM), \
32 "argument must be a constant integer")))
33#define __constant_range(PARM, LOW, HIGH) \
34 __attribute__((__enable_if__ ((PARM) >= (LOW) && (PARM) <= (HIGH), \
35 "argument must be a constant integer from " #LOW " to " #HIGH)))
36#define __constant_pow2_range(PARM, LOW, HIGH) \
37 __attribute__((__enable_if__ ((PARM) >= (LOW) && (PARM) <= (HIGH) && \
38 ((PARM) & ((PARM) - 1)) == 0, \
39 "argument must be a constant power of 2 from " #LOW " to " #HIGH)))
40
41/*-- __lcbb -----------------------------------------------------------------*/
42
43extern __ATTRS_o unsigned int
44__lcbb(const void *__ptr, unsigned short __len)
45 __constant_pow2_range(__len, 64, 4096);
46
47#define __lcbb(X, Y) ((__typeof__((__lcbb)((X), (Y)))) \
48 __builtin_s390_lcbb((X), __builtin_constant_p((Y))? \
49 ((Y) == 64 ? 0 : \
50 (Y) == 128 ? 1 : \
51 (Y) == 256 ? 2 : \
52 (Y) == 512 ? 3 : \
53 (Y) == 1024 ? 4 : \
54 (Y) == 2048 ? 5 : \
55 (Y) == 4096 ? 6 : 0) : 0))
56
57/*-- vec_extract ------------------------------------------------------------*/
58
59static inline __ATTRS_o_ai signed char
60vec_extract(vector signed char __vec, int __index) {
61 return __vec[__index & 15];
62}
63
64static inline __ATTRS_o_ai unsigned char
65vec_extract(vector bool char __vec, int __index) {
66 return __vec[__index & 15];
67}
68
69static inline __ATTRS_o_ai unsigned char
70vec_extract(vector unsigned char __vec, int __index) {
71 return __vec[__index & 15];
72}
73
74static inline __ATTRS_o_ai signed short
75vec_extract(vector signed short __vec, int __index) {
76 return __vec[__index & 7];
77}
78
79static inline __ATTRS_o_ai unsigned short
80vec_extract(vector bool short __vec, int __index) {
81 return __vec[__index & 7];
82}
83
84static inline __ATTRS_o_ai unsigned short
85vec_extract(vector unsigned short __vec, int __index) {
86 return __vec[__index & 7];
87}
88
89static inline __ATTRS_o_ai signed int
90vec_extract(vector signed int __vec, int __index) {
91 return __vec[__index & 3];
92}
93
94static inline __ATTRS_o_ai unsigned int
95vec_extract(vector bool int __vec, int __index) {
96 return __vec[__index & 3];
97}
98
99static inline __ATTRS_o_ai unsigned int
100vec_extract(vector unsigned int __vec, int __index) {
101 return __vec[__index & 3];
102}
103
104static inline __ATTRS_o_ai signed long long
105vec_extract(vector signed long long __vec, int __index) {
106 return __vec[__index & 1];
107}
108
109static inline __ATTRS_o_ai unsigned long long
110vec_extract(vector bool long long __vec, int __index) {
111 return __vec[__index & 1];
112}
113
114static inline __ATTRS_o_ai unsigned long long
115vec_extract(vector unsigned long long __vec, int __index) {
116 return __vec[__index & 1];
117}
118
119static inline __ATTRS_o_ai double
120vec_extract(vector double __vec, int __index) {
121 return __vec[__index & 1];
122}
123
124/*-- vec_insert -------------------------------------------------------------*/
125
126static inline __ATTRS_o_ai vector signed char
127vec_insert(signed char __scalar, vector signed char __vec, int __index) {
128 __vec[__index & 15] = __scalar;
129 return __vec;
130}
131
132static inline __ATTRS_o_ai vector unsigned char
133vec_insert(unsigned char __scalar, vector bool char __vec, int __index) {
134 vector unsigned char __newvec = (vector unsigned char)__vec;
135 __newvec[__index & 15] = (unsigned char)__scalar;
136 return __newvec;
137}
138
139static inline __ATTRS_o_ai vector unsigned char
140vec_insert(unsigned char __scalar, vector unsigned char __vec, int __index) {
141 __vec[__index & 15] = __scalar;
142 return __vec;
143}
144
145static inline __ATTRS_o_ai vector signed short
146vec_insert(signed short __scalar, vector signed short __vec, int __index) {
147 __vec[__index & 7] = __scalar;
148 return __vec;
149}
150
151static inline __ATTRS_o_ai vector unsigned short
152vec_insert(unsigned short __scalar, vector bool short __vec, int __index) {
153 vector unsigned short __newvec = (vector unsigned short)__vec;
154 __newvec[__index & 7] = (unsigned short)__scalar;
155 return __newvec;
156}
157
158static inline __ATTRS_o_ai vector unsigned short
159vec_insert(unsigned short __scalar, vector unsigned short __vec, int __index) {
160 __vec[__index & 7] = __scalar;
161 return __vec;
162}
163
164static inline __ATTRS_o_ai vector signed int
165vec_insert(signed int __scalar, vector signed int __vec, int __index) {
166 __vec[__index & 3] = __scalar;
167 return __vec;
168}
169
170static inline __ATTRS_o_ai vector unsigned int
171vec_insert(unsigned int __scalar, vector bool int __vec, int __index) {
172 vector unsigned int __newvec = (vector unsigned int)__vec;
173 __newvec[__index & 3] = __scalar;
174 return __newvec;
175}
176
177static inline __ATTRS_o_ai vector unsigned int
178vec_insert(unsigned int __scalar, vector unsigned int __vec, int __index) {
179 __vec[__index & 3] = __scalar;
180 return __vec;
181}
182
183static inline __ATTRS_o_ai vector signed long long
184vec_insert(signed long long __scalar, vector signed long long __vec,
185 int __index) {
186 __vec[__index & 1] = __scalar;
187 return __vec;
188}
189
190static inline __ATTRS_o_ai vector unsigned long long
191vec_insert(unsigned long long __scalar, vector bool long long __vec,
192 int __index) {
193 vector unsigned long long __newvec = (vector unsigned long long)__vec;
194 __newvec[__index & 1] = __scalar;
195 return __newvec;
196}
197
198static inline __ATTRS_o_ai vector unsigned long long
199vec_insert(unsigned long long __scalar, vector unsigned long long __vec,
200 int __index) {
201 __vec[__index & 1] = __scalar;
202 return __vec;
203}
204
205static inline __ATTRS_o_ai vector double
206vec_insert(double __scalar, vector double __vec, int __index) {
207 __vec[__index & 1] = __scalar;
208 return __vec;
209}
210
211/*-- vec_promote ------------------------------------------------------------*/
212
213static inline __ATTRS_o_ai vector signed char
214vec_promote(signed char __scalar, int __index) {
215 const vector signed char __zero = (vector signed char)0;
216 vector signed char __vec = __builtin_shufflevector(__zero, __zero,
217 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
218 __vec[__index & 15] = __scalar;
219 return __vec;
220}
221
222static inline __ATTRS_o_ai vector unsigned char
223vec_promote(unsigned char __scalar, int __index) {
224 const vector unsigned char __zero = (vector unsigned char)0;
225 vector unsigned char __vec = __builtin_shufflevector(__zero, __zero,
226 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
227 __vec[__index & 15] = __scalar;
228 return __vec;
229}
230
231static inline __ATTRS_o_ai vector signed short
232vec_promote(signed short __scalar, int __index) {
233 const vector signed short __zero = (vector signed short)0;
234 vector signed short __vec = __builtin_shufflevector(__zero, __zero,
235 -1, -1, -1, -1, -1, -1, -1, -1);
236 __vec[__index & 7] = __scalar;
237 return __vec;
238}
239
240static inline __ATTRS_o_ai vector unsigned short
241vec_promote(unsigned short __scalar, int __index) {
242 const vector unsigned short __zero = (vector unsigned short)0;
243 vector unsigned short __vec = __builtin_shufflevector(__zero, __zero,
244 -1, -1, -1, -1, -1, -1, -1, -1);
245 __vec[__index & 7] = __scalar;
246 return __vec;
247}
248
249static inline __ATTRS_o_ai vector signed int
250vec_promote(signed int __scalar, int __index) {
251 const vector signed int __zero = (vector signed int)0;
252 vector signed int __vec = __builtin_shufflevector(__zero, __zero,
253 -1, -1, -1, -1);
254 __vec[__index & 3] = __scalar;
255 return __vec;
256}
257
258static inline __ATTRS_o_ai vector unsigned int
259vec_promote(unsigned int __scalar, int __index) {
260 const vector unsigned int __zero = (vector unsigned int)0;
261 vector unsigned int __vec = __builtin_shufflevector(__zero, __zero,
262 -1, -1, -1, -1);
263 __vec[__index & 3] = __scalar;
264 return __vec;
265}
266
267static inline __ATTRS_o_ai vector signed long long
268vec_promote(signed long long __scalar, int __index) {
269 const vector signed long long __zero = (vector signed long long)0;
270 vector signed long long __vec = __builtin_shufflevector(__zero, __zero,
271 -1, -1);
272 __vec[__index & 1] = __scalar;
273 return __vec;
274}
275
276static inline __ATTRS_o_ai vector unsigned long long
277vec_promote(unsigned long long __scalar, int __index) {
278 const vector unsigned long long __zero = (vector unsigned long long)0;
279 vector unsigned long long __vec = __builtin_shufflevector(__zero, __zero,
280 -1, -1);
281 __vec[__index & 1] = __scalar;
282 return __vec;
283}
284
285static inline __ATTRS_o_ai vector double
286vec_promote(double __scalar, int __index) {
287 const vector double __zero = (vector double)0;
288 vector double __vec = __builtin_shufflevector(__zero, __zero, -1, -1);
289 __vec[__index & 1] = __scalar;
290 return __vec;
291}
292
293/*-- vec_insert_and_zero ----------------------------------------------------*/
294
295static inline __ATTRS_o_ai vector signed char
296vec_insert_and_zero(const signed char *__ptr) {
297 vector signed char __vec = (vector signed char)0;
298 __vec[7] = *__ptr;
299 return __vec;
300}
301
302static inline __ATTRS_o_ai vector unsigned char
303vec_insert_and_zero(const unsigned char *__ptr) {
304 vector unsigned char __vec = (vector unsigned char)0;
305 __vec[7] = *__ptr;
306 return __vec;
307}
308
309static inline __ATTRS_o_ai vector signed short
310vec_insert_and_zero(const signed short *__ptr) {
311 vector signed short __vec = (vector signed short)0;
312 __vec[3] = *__ptr;
313 return __vec;
314}
315
316static inline __ATTRS_o_ai vector unsigned short
317vec_insert_and_zero(const unsigned short *__ptr) {
318 vector unsigned short __vec = (vector unsigned short)0;
319 __vec[3] = *__ptr;
320 return __vec;
321}
322
323static inline __ATTRS_o_ai vector signed int
324vec_insert_and_zero(const signed int *__ptr) {
325 vector signed int __vec = (vector signed int)0;
326 __vec[1] = *__ptr;
327 return __vec;
328}
329
330static inline __ATTRS_o_ai vector unsigned int
331vec_insert_and_zero(const unsigned int *__ptr) {
332 vector unsigned int __vec = (vector unsigned int)0;
333 __vec[1] = *__ptr;
334 return __vec;
335}
336
337static inline __ATTRS_o_ai vector signed long long
338vec_insert_and_zero(const signed long long *__ptr) {
339 vector signed long long __vec = (vector signed long long)0;
340 __vec[0] = *__ptr;
341 return __vec;
342}
343
344static inline __ATTRS_o_ai vector unsigned long long
345vec_insert_and_zero(const unsigned long long *__ptr) {
346 vector unsigned long long __vec = (vector unsigned long long)0;
347 __vec[0] = *__ptr;
348 return __vec;
349}
350
351static inline __ATTRS_o_ai vector double
352vec_insert_and_zero(const double *__ptr) {
353 vector double __vec = (vector double)0;
354 __vec[0] = *__ptr;
355 return __vec;
356}
357
358/*-- vec_perm ---------------------------------------------------------------*/
359
360static inline __ATTRS_o_ai vector signed char
361vec_perm(vector signed char __a, vector signed char __b,
362 vector unsigned char __c) {
363 return (vector signed char)__builtin_s390_vperm(
364 (vector unsigned char)__a, (vector unsigned char)__b, __c);
365}
366
367static inline __ATTRS_o_ai vector unsigned char
368vec_perm(vector unsigned char __a, vector unsigned char __b,
369 vector unsigned char __c) {
370 return (vector unsigned char)__builtin_s390_vperm(
371 (vector unsigned char)__a, (vector unsigned char)__b, __c);
372}
373
374static inline __ATTRS_o_ai vector bool char
375vec_perm(vector bool char __a, vector bool char __b,
376 vector unsigned char __c) {
377 return (vector bool char)__builtin_s390_vperm(
378 (vector unsigned char)__a, (vector unsigned char)__b, __c);
379}
380
381static inline __ATTRS_o_ai vector signed short
382vec_perm(vector signed short __a, vector signed short __b,
383 vector unsigned char __c) {
384 return (vector signed short)__builtin_s390_vperm(
385 (vector unsigned char)__a, (vector unsigned char)__b, __c);
386}
387
388static inline __ATTRS_o_ai vector unsigned short
389vec_perm(vector unsigned short __a, vector unsigned short __b,
390 vector unsigned char __c) {
391 return (vector unsigned short)__builtin_s390_vperm(
392 (vector unsigned char)__a, (vector unsigned char)__b, __c);
393}
394
395static inline __ATTRS_o_ai vector bool short
396vec_perm(vector bool short __a, vector bool short __b,
397 vector unsigned char __c) {
398 return (vector bool short)__builtin_s390_vperm(
399 (vector unsigned char)__a, (vector unsigned char)__b, __c);
400}
401
402static inline __ATTRS_o_ai vector signed int
403vec_perm(vector signed int __a, vector signed int __b,
404 vector unsigned char __c) {
405 return (vector signed int)__builtin_s390_vperm(
406 (vector unsigned char)__a, (vector unsigned char)__b, __c);
407}
408
409static inline __ATTRS_o_ai vector unsigned int
410vec_perm(vector unsigned int __a, vector unsigned int __b,
411 vector unsigned char __c) {
412 return (vector unsigned int)__builtin_s390_vperm(
413 (vector unsigned char)__a, (vector unsigned char)__b, __c);
414}
415
416static inline __ATTRS_o_ai vector bool int
417vec_perm(vector bool int __a, vector bool int __b,
418 vector unsigned char __c) {
419 return (vector bool int)__builtin_s390_vperm(
420 (vector unsigned char)__a, (vector unsigned char)__b, __c);
421}
422
423static inline __ATTRS_o_ai vector signed long long
424vec_perm(vector signed long long __a, vector signed long long __b,
425 vector unsigned char __c) {
426 return (vector signed long long)__builtin_s390_vperm(
427 (vector unsigned char)__a, (vector unsigned char)__b, __c);
428}
429
430static inline __ATTRS_o_ai vector unsigned long long
431vec_perm(vector unsigned long long __a, vector unsigned long long __b,
432 vector unsigned char __c) {
433 return (vector unsigned long long)__builtin_s390_vperm(
434 (vector unsigned char)__a, (vector unsigned char)__b, __c);
435}
436
437static inline __ATTRS_o_ai vector bool long long
438vec_perm(vector bool long long __a, vector bool long long __b,
439 vector unsigned char __c) {
440 return (vector bool long long)__builtin_s390_vperm(
441 (vector unsigned char)__a, (vector unsigned char)__b, __c);
442}
443
444static inline __ATTRS_o_ai vector double
445vec_perm(vector double __a, vector double __b,
446 vector unsigned char __c) {
447 return (vector double)__builtin_s390_vperm(
448 (vector unsigned char)__a, (vector unsigned char)__b, __c);
449}
450
451/*-- vec_permi --------------------------------------------------------------*/
452
453extern __ATTRS_o vector signed long long
454vec_permi(vector signed long long __a, vector signed long long __b, int __c)
455 __constant_range(__c, 0, 3);
456
457extern __ATTRS_o vector unsigned long long
458vec_permi(vector unsigned long long __a, vector unsigned long long __b, int __c)
459 __constant_range(__c, 0, 3);
460
461extern __ATTRS_o vector bool long long
462vec_permi(vector bool long long __a, vector bool long long __b, int __c)
463 __constant_range(__c, 0, 3);
464
465extern __ATTRS_o vector double
466vec_permi(vector double __a, vector double __b, int __c)
467 __constant_range(__c, 0, 3);
468
469#define vec_permi(X, Y, Z) ((__typeof__((vec_permi)((X), (Y), (Z)))) \
470 __builtin_s390_vpdi((vector unsigned long long)(X), \
471 (vector unsigned long long)(Y), \
472 (((Z) & 2) << 1) | ((Z) & 1)))
473
474/*-- vec_sel ----------------------------------------------------------------*/
475
476static inline __ATTRS_o_ai vector signed char
477vec_sel(vector signed char __a, vector signed char __b,
478 vector unsigned char __c) {
479 return ((vector signed char)__c & __b) | (~(vector signed char)__c & __a);
480}
481
482static inline __ATTRS_o_ai vector signed char
483vec_sel(vector signed char __a, vector signed char __b, vector bool char __c) {
484 return ((vector signed char)__c & __b) | (~(vector signed char)__c & __a);
485}
486
487static inline __ATTRS_o_ai vector bool char
488vec_sel(vector bool char __a, vector bool char __b, vector unsigned char __c) {
489 return ((vector bool char)__c & __b) | (~(vector bool char)__c & __a);
490}
491
492static inline __ATTRS_o_ai vector bool char
493vec_sel(vector bool char __a, vector bool char __b, vector bool char __c) {
494 return (__c & __b) | (~__c & __a);
495}
496
497static inline __ATTRS_o_ai vector unsigned char
498vec_sel(vector unsigned char __a, vector unsigned char __b,
499 vector unsigned char __c) {
500 return (__c & __b) | (~__c & __a);
501}
502
503static inline __ATTRS_o_ai vector unsigned char
504vec_sel(vector unsigned char __a, vector unsigned char __b,
505 vector bool char __c) {
506 return ((vector unsigned char)__c & __b) | (~(vector unsigned char)__c & __a);
507}
508
509static inline __ATTRS_o_ai vector signed short
510vec_sel(vector signed short __a, vector signed short __b,
511 vector unsigned short __c) {
512 return ((vector signed short)__c & __b) | (~(vector signed short)__c & __a);
513}
514
515static inline __ATTRS_o_ai vector signed short
516vec_sel(vector signed short __a, vector signed short __b,
517 vector bool short __c) {
518 return ((vector signed short)__c & __b) | (~(vector signed short)__c & __a);
519}
520
521static inline __ATTRS_o_ai vector bool short
522vec_sel(vector bool short __a, vector bool short __b,
523 vector unsigned short __c) {
524 return ((vector bool short)__c & __b) | (~(vector bool short)__c & __a);
525}
526
527static inline __ATTRS_o_ai vector bool short
528vec_sel(vector bool short __a, vector bool short __b, vector bool short __c) {
529 return (__c & __b) | (~__c & __a);
530}
531
532static inline __ATTRS_o_ai vector unsigned short
533vec_sel(vector unsigned short __a, vector unsigned short __b,
534 vector unsigned short __c) {
535 return (__c & __b) | (~__c & __a);
536}
537
538static inline __ATTRS_o_ai vector unsigned short
539vec_sel(vector unsigned short __a, vector unsigned short __b,
540 vector bool short __c) {
541 return (((vector unsigned short)__c & __b) |
542 (~(vector unsigned short)__c & __a));
543}
544
545static inline __ATTRS_o_ai vector signed int
546vec_sel(vector signed int __a, vector signed int __b,
547 vector unsigned int __c) {
548 return ((vector signed int)__c & __b) | (~(vector signed int)__c & __a);
549}
550
551static inline __ATTRS_o_ai vector signed int
552vec_sel(vector signed int __a, vector signed int __b, vector bool int __c) {
553 return ((vector signed int)__c & __b) | (~(vector signed int)__c & __a);
554}
555
556static inline __ATTRS_o_ai vector bool int
557vec_sel(vector bool int __a, vector bool int __b, vector unsigned int __c) {
558 return ((vector bool int)__c & __b) | (~(vector bool int)__c & __a);
559}
560
561static inline __ATTRS_o_ai vector bool int
562vec_sel(vector bool int __a, vector bool int __b, vector bool int __c) {
563 return (__c & __b) | (~__c & __a);
564}
565
566static inline __ATTRS_o_ai vector unsigned int
567vec_sel(vector unsigned int __a, vector unsigned int __b,
568 vector unsigned int __c) {
569 return (__c & __b) | (~__c & __a);
570}
571
572static inline __ATTRS_o_ai vector unsigned int
573vec_sel(vector unsigned int __a, vector unsigned int __b, vector bool int __c) {
574 return ((vector unsigned int)__c & __b) | (~(vector unsigned int)__c & __a);
575}
576
577static inline __ATTRS_o_ai vector signed long long
578vec_sel(vector signed long long __a, vector signed long long __b,
579 vector unsigned long long __c) {
580 return (((vector signed long long)__c & __b) |
581 (~(vector signed long long)__c & __a));
582}
583
584static inline __ATTRS_o_ai vector signed long long
585vec_sel(vector signed long long __a, vector signed long long __b,
586 vector bool long long __c) {
587 return (((vector signed long long)__c & __b) |
588 (~(vector signed long long)__c & __a));
589}
590
591static inline __ATTRS_o_ai vector bool long long
592vec_sel(vector bool long long __a, vector bool long long __b,
593 vector unsigned long long __c) {
594 return (((vector bool long long)__c & __b) |
595 (~(vector bool long long)__c & __a));
596}
597
598static inline __ATTRS_o_ai vector bool long long
599vec_sel(vector bool long long __a, vector bool long long __b,
600 vector bool long long __c) {
601 return (__c & __b) | (~__c & __a);
602}
603
604static inline __ATTRS_o_ai vector unsigned long long
605vec_sel(vector unsigned long long __a, vector unsigned long long __b,
606 vector unsigned long long __c) {
607 return (__c & __b) | (~__c & __a);
608}
609
610static inline __ATTRS_o_ai vector unsigned long long
611vec_sel(vector unsigned long long __a, vector unsigned long long __b,
612 vector bool long long __c) {
613 return (((vector unsigned long long)__c & __b) |
614 (~(vector unsigned long long)__c & __a));
615}
616
617static inline __ATTRS_o_ai vector double
618vec_sel(vector double __a, vector double __b, vector unsigned long long __c) {
619 return (vector double)((__c & (vector unsigned long long)__b) |
620 (~__c & (vector unsigned long long)__a));
621}
622
623static inline __ATTRS_o_ai vector double
624vec_sel(vector double __a, vector double __b, vector bool long long __c) {
625 vector unsigned long long __ac = (vector unsigned long long)__a;
626 vector unsigned long long __bc = (vector unsigned long long)__b;
627 vector unsigned long long __cc = (vector unsigned long long)__c;
628 return (vector double)((__cc & __bc) | (~__cc & __ac));
629}
630
631/*-- vec_gather_element -----------------------------------------------------*/
632
633static inline __ATTRS_o_ai vector signed int
634vec_gather_element(vector signed int __vec, vector unsigned int __offset,
635 const signed int *__ptr, int __index)
636 __constant_range(__index, 0, 3) {
637 __vec[__index] = *(const signed int *)(
638 (__INTPTR_TYPE__)__ptr + (__INTPTR_TYPE__)__offset[__index]);
639 return __vec;
640}
641
642static inline __ATTRS_o_ai vector bool int
643vec_gather_element(vector bool int __vec, vector unsigned int __offset,
644 const unsigned int *__ptr, int __index)
645 __constant_range(__index, 0, 3) {
646 __vec[__index] = *(const unsigned int *)(
647 (__INTPTR_TYPE__)__ptr + (__INTPTR_TYPE__)__offset[__index]);
648 return __vec;
649}
650
651static inline __ATTRS_o_ai vector unsigned int
652vec_gather_element(vector unsigned int __vec, vector unsigned int __offset,
653 const unsigned int *__ptr, int __index)
654 __constant_range(__index, 0, 3) {
655 __vec[__index] = *(const unsigned int *)(
656 (__INTPTR_TYPE__)__ptr + (__INTPTR_TYPE__)__offset[__index]);
657 return __vec;
658}
659
660static inline __ATTRS_o_ai vector signed long long
661vec_gather_element(vector signed long long __vec,
662 vector unsigned long long __offset,
663 const signed long long *__ptr, int __index)
664 __constant_range(__index, 0, 1) {
665 __vec[__index] = *(const signed long long *)(
666 (__INTPTR_TYPE__)__ptr + (__INTPTR_TYPE__)__offset[__index]);
667 return __vec;
668}
669
670static inline __ATTRS_o_ai vector bool long long
671vec_gather_element(vector bool long long __vec,
672 vector unsigned long long __offset,
673 const unsigned long long *__ptr, int __index)
674 __constant_range(__index, 0, 1) {
675 __vec[__index] = *(const unsigned long long *)(
676 (__INTPTR_TYPE__)__ptr + (__INTPTR_TYPE__)__offset[__index]);
677 return __vec;
678}
679
680static inline __ATTRS_o_ai vector unsigned long long
681vec_gather_element(vector unsigned long long __vec,
682 vector unsigned long long __offset,
683 const unsigned long long *__ptr, int __index)
684 __constant_range(__index, 0, 1) {
685 __vec[__index] = *(const unsigned long long *)(
686 (__INTPTR_TYPE__)__ptr + (__INTPTR_TYPE__)__offset[__index]);
687 return __vec;
688}
689
690static inline __ATTRS_o_ai vector double
691vec_gather_element(vector double __vec, vector unsigned long long __offset,
692 const double *__ptr, int __index)
693 __constant_range(__index, 0, 1) {
694 __vec[__index] = *(const double *)(
695 (__INTPTR_TYPE__)__ptr + (__INTPTR_TYPE__)__offset[__index]);
696 return __vec;
697}
698
699/*-- vec_scatter_element ----------------------------------------------------*/
700
701static inline __ATTRS_o_ai void
702vec_scatter_element(vector signed int __vec, vector unsigned int __offset,
703 signed int *__ptr, int __index)
704 __constant_range(__index, 0, 3) {
705 *(signed int *)((__INTPTR_TYPE__)__ptr + __offset[__index]) =
706 __vec[__index];
707}
708
709static inline __ATTRS_o_ai void
710vec_scatter_element(vector bool int __vec, vector unsigned int __offset,
711 unsigned int *__ptr, int __index)
712 __constant_range(__index, 0, 3) {
713 *(unsigned int *)((__INTPTR_TYPE__)__ptr + __offset[__index]) =
714 __vec[__index];
715}
716
717static inline __ATTRS_o_ai void
718vec_scatter_element(vector unsigned int __vec, vector unsigned int __offset,
719 unsigned int *__ptr, int __index)
720 __constant_range(__index, 0, 3) {
721 *(unsigned int *)((__INTPTR_TYPE__)__ptr + __offset[__index]) =
722 __vec[__index];
723}
724
725static inline __ATTRS_o_ai void
726vec_scatter_element(vector signed long long __vec,
727 vector unsigned long long __offset,
728 signed long long *__ptr, int __index)
729 __constant_range(__index, 0, 1) {
730 *(signed long long *)((__INTPTR_TYPE__)__ptr + __offset[__index]) =
731 __vec[__index];
732}
733
734static inline __ATTRS_o_ai void
735vec_scatter_element(vector bool long long __vec,
736 vector unsigned long long __offset,
737 unsigned long long *__ptr, int __index)
738 __constant_range(__index, 0, 1) {
739 *(unsigned long long *)((__INTPTR_TYPE__)__ptr + __offset[__index]) =
740 __vec[__index];
741}
742
743static inline __ATTRS_o_ai void
744vec_scatter_element(vector unsigned long long __vec,
745 vector unsigned long long __offset,
746 unsigned long long *__ptr, int __index)
747 __constant_range(__index, 0, 1) {
748 *(unsigned long long *)((__INTPTR_TYPE__)__ptr + __offset[__index]) =
749 __vec[__index];
750}
751
752static inline __ATTRS_o_ai void
753vec_scatter_element(vector double __vec, vector unsigned long long __offset,
754 double *__ptr, int __index)
755 __constant_range(__index, 0, 1) {
756 *(double *)((__INTPTR_TYPE__)__ptr + __offset[__index]) =
757 __vec[__index];
758}
759
760/*-- vec_xld2 ---------------------------------------------------------------*/
761
762static inline __ATTRS_o_ai vector signed char
763vec_xld2(long __offset, const signed char *__ptr) {
764 return *(const vector signed char *)((__INTPTR_TYPE__)__ptr + __offset);
765}
766
767static inline __ATTRS_o_ai vector unsigned char
768vec_xld2(long __offset, const unsigned char *__ptr) {
769 return *(const vector unsigned char *)((__INTPTR_TYPE__)__ptr + __offset);
770}
771
772static inline __ATTRS_o_ai vector signed short
773vec_xld2(long __offset, const signed short *__ptr) {
774 return *(const vector signed short *)((__INTPTR_TYPE__)__ptr + __offset);
775}
776
777static inline __ATTRS_o_ai vector unsigned short
778vec_xld2(long __offset, const unsigned short *__ptr) {
779 return *(const vector unsigned short *)((__INTPTR_TYPE__)__ptr + __offset);
780}
781
782static inline __ATTRS_o_ai vector signed int
783vec_xld2(long __offset, const signed int *__ptr) {
784 return *(const vector signed int *)((__INTPTR_TYPE__)__ptr + __offset);
785}
786
787static inline __ATTRS_o_ai vector unsigned int
788vec_xld2(long __offset, const unsigned int *__ptr) {
789 return *(const vector unsigned int *)((__INTPTR_TYPE__)__ptr + __offset);
790}
791
792static inline __ATTRS_o_ai vector signed long long
793vec_xld2(long __offset, const signed long long *__ptr) {
794 return *(const vector signed long long *)((__INTPTR_TYPE__)__ptr + __offset);
795}
796
797static inline __ATTRS_o_ai vector unsigned long long
798vec_xld2(long __offset, const unsigned long long *__ptr) {
799 return *(const vector unsigned long long *)((__INTPTR_TYPE__)__ptr + __offset);
800}
801
802static inline __ATTRS_o_ai vector double
803vec_xld2(long __offset, const double *__ptr) {
804 return *(const vector double *)((__INTPTR_TYPE__)__ptr + __offset);
805}
806
807/*-- vec_xlw4 ---------------------------------------------------------------*/
808
809static inline __ATTRS_o_ai vector signed char
810vec_xlw4(long __offset, const signed char *__ptr) {
811 return *(const vector signed char *)((__INTPTR_TYPE__)__ptr + __offset);
812}
813
814static inline __ATTRS_o_ai vector unsigned char
815vec_xlw4(long __offset, const unsigned char *__ptr) {
816 return *(const vector unsigned char *)((__INTPTR_TYPE__)__ptr + __offset);
817}
818
819static inline __ATTRS_o_ai vector signed short
820vec_xlw4(long __offset, const signed short *__ptr) {
821 return *(const vector signed short *)((__INTPTR_TYPE__)__ptr + __offset);
822}
823
824static inline __ATTRS_o_ai vector unsigned short
825vec_xlw4(long __offset, const unsigned short *__ptr) {
826 return *(const vector unsigned short *)((__INTPTR_TYPE__)__ptr + __offset);
827}
828
829static inline __ATTRS_o_ai vector signed int
830vec_xlw4(long __offset, const signed int *__ptr) {
831 return *(const vector signed int *)((__INTPTR_TYPE__)__ptr + __offset);
832}
833
834static inline __ATTRS_o_ai vector unsigned int
835vec_xlw4(long __offset, const unsigned int *__ptr) {
836 return *(const vector unsigned int *)((__INTPTR_TYPE__)__ptr + __offset);
837}
838
839/*-- vec_xstd2 --------------------------------------------------------------*/
840
841static inline __ATTRS_o_ai void
842vec_xstd2(vector signed char __vec, long __offset, signed char *__ptr) {
843 *(vector signed char *)((__INTPTR_TYPE__)__ptr + __offset) = __vec;
844}
845
846static inline __ATTRS_o_ai void
847vec_xstd2(vector unsigned char __vec, long __offset, unsigned char *__ptr) {
848 *(vector unsigned char *)((__INTPTR_TYPE__)__ptr + __offset) = __vec;
849}
850
851static inline __ATTRS_o_ai void
852vec_xstd2(vector signed short __vec, long __offset, signed short *__ptr) {
853 *(vector signed short *)((__INTPTR_TYPE__)__ptr + __offset) = __vec;
854}
855
856static inline __ATTRS_o_ai void
857vec_xstd2(vector unsigned short __vec, long __offset, unsigned short *__ptr) {
858 *(vector unsigned short *)((__INTPTR_TYPE__)__ptr + __offset) = __vec;
859}
860
861static inline __ATTRS_o_ai void
862vec_xstd2(vector signed int __vec, long __offset, signed int *__ptr) {
863 *(vector signed int *)((__INTPTR_TYPE__)__ptr + __offset) = __vec;
864}
865
866static inline __ATTRS_o_ai void
867vec_xstd2(vector unsigned int __vec, long __offset, unsigned int *__ptr) {
868 *(vector unsigned int *)((__INTPTR_TYPE__)__ptr + __offset) = __vec;
869}
870
871static inline __ATTRS_o_ai void
872vec_xstd2(vector signed long long __vec, long __offset,
873 signed long long *__ptr) {
874 *(vector signed long long *)((__INTPTR_TYPE__)__ptr + __offset) = __vec;
875}
876
877static inline __ATTRS_o_ai void
878vec_xstd2(vector unsigned long long __vec, long __offset,
879 unsigned long long *__ptr) {
880 *(vector unsigned long long *)((__INTPTR_TYPE__)__ptr + __offset) =
881 __vec;
882}
883
884static inline __ATTRS_o_ai void
885vec_xstd2(vector double __vec, long __offset, double *__ptr) {
886 *(vector double *)((__INTPTR_TYPE__)__ptr + __offset) = __vec;
887}
888
889/*-- vec_xstw4 --------------------------------------------------------------*/
890
891static inline __ATTRS_o_ai void
892vec_xstw4(vector signed char __vec, long __offset, signed char *__ptr) {
893 *(vector signed char *)((__INTPTR_TYPE__)__ptr + __offset) = __vec;
894}
895
896static inline __ATTRS_o_ai void
897vec_xstw4(vector unsigned char __vec, long __offset, unsigned char *__ptr) {
898 *(vector unsigned char *)((__INTPTR_TYPE__)__ptr + __offset) = __vec;
899}
900
901static inline __ATTRS_o_ai void
902vec_xstw4(vector signed short __vec, long __offset, signed short *__ptr) {
903 *(vector signed short *)((__INTPTR_TYPE__)__ptr + __offset) = __vec;
904}
905
906static inline __ATTRS_o_ai void
907vec_xstw4(vector unsigned short __vec, long __offset, unsigned short *__ptr) {
908 *(vector unsigned short *)((__INTPTR_TYPE__)__ptr + __offset) = __vec;
909}
910
911static inline __ATTRS_o_ai void
912vec_xstw4(vector signed int __vec, long __offset, signed int *__ptr) {
913 *(vector signed int *)((__INTPTR_TYPE__)__ptr + __offset) = __vec;
914}
915
916static inline __ATTRS_o_ai void
917vec_xstw4(vector unsigned int __vec, long __offset, unsigned int *__ptr) {
918 *(vector unsigned int *)((__INTPTR_TYPE__)__ptr + __offset) = __vec;
919}
920
921/*-- vec_load_bndry ---------------------------------------------------------*/
922
923extern __ATTRS_o vector signed char
924vec_load_bndry(const signed char *__ptr, unsigned short __len)
925 __constant_pow2_range(__len, 64, 4096);
926
927extern __ATTRS_o vector unsigned char
928vec_load_bndry(const unsigned char *__ptr, unsigned short __len)
929 __constant_pow2_range(__len, 64, 4096);
930
931extern __ATTRS_o vector signed short
932vec_load_bndry(const signed short *__ptr, unsigned short __len)
933 __constant_pow2_range(__len, 64, 4096);
934
935extern __ATTRS_o vector unsigned short
936vec_load_bndry(const unsigned short *__ptr, unsigned short __len)
937 __constant_pow2_range(__len, 64, 4096);
938
939extern __ATTRS_o vector signed int
940vec_load_bndry(const signed int *__ptr, unsigned short __len)
941 __constant_pow2_range(__len, 64, 4096);
942
943extern __ATTRS_o vector unsigned int
944vec_load_bndry(const unsigned int *__ptr, unsigned short __len)
945 __constant_pow2_range(__len, 64, 4096);
946
947extern __ATTRS_o vector signed long long
948vec_load_bndry(const signed long long *__ptr, unsigned short __len)
949 __constant_pow2_range(__len, 64, 4096);
950
951extern __ATTRS_o vector unsigned long long
952vec_load_bndry(const unsigned long long *__ptr, unsigned short __len)
953 __constant_pow2_range(__len, 64, 4096);
954
955extern __ATTRS_o vector double
956vec_load_bndry(const double *__ptr, unsigned short __len)
957 __constant_pow2_range(__len, 64, 4096);
958
959#define vec_load_bndry(X, Y) ((__typeof__((vec_load_bndry)((X), (Y)))) \
960 __builtin_s390_vlbb((X), ((Y) == 64 ? 0 : \
961 (Y) == 128 ? 1 : \
962 (Y) == 256 ? 2 : \
963 (Y) == 512 ? 3 : \
964 (Y) == 1024 ? 4 : \
965 (Y) == 2048 ? 5 : \
966 (Y) == 4096 ? 6 : -1)))
967
968/*-- vec_load_len -----------------------------------------------------------*/
969
970static inline __ATTRS_o_ai vector signed char
971vec_load_len(const signed char *__ptr, unsigned int __len) {
972 return (vector signed char)__builtin_s390_vll(__len, __ptr);
973}
974
975static inline __ATTRS_o_ai vector unsigned char
976vec_load_len(const unsigned char *__ptr, unsigned int __len) {
977 return (vector unsigned char)__builtin_s390_vll(__len, __ptr);
978}
979
980static inline __ATTRS_o_ai vector signed short
981vec_load_len(const signed short *__ptr, unsigned int __len) {
982 return (vector signed short)__builtin_s390_vll(__len, __ptr);
983}
984
985static inline __ATTRS_o_ai vector unsigned short
986vec_load_len(const unsigned short *__ptr, unsigned int __len) {
987 return (vector unsigned short)__builtin_s390_vll(__len, __ptr);
988}
989
990static inline __ATTRS_o_ai vector signed int
991vec_load_len(const signed int *__ptr, unsigned int __len) {
992 return (vector signed int)__builtin_s390_vll(__len, __ptr);
993}
994
995static inline __ATTRS_o_ai vector unsigned int
996vec_load_len(const unsigned int *__ptr, unsigned int __len) {
997 return (vector unsigned int)__builtin_s390_vll(__len, __ptr);
998}
999
1000static inline __ATTRS_o_ai vector signed long long
1001vec_load_len(const signed long long *__ptr, unsigned int __len) {
1002 return (vector signed long long)__builtin_s390_vll(__len, __ptr);
1003}
1004
1005static inline __ATTRS_o_ai vector unsigned long long
1006vec_load_len(const unsigned long long *__ptr, unsigned int __len) {
1007 return (vector unsigned long long)__builtin_s390_vll(__len, __ptr);
1008}
1009
1010static inline __ATTRS_o_ai vector double
1011vec_load_len(const double *__ptr, unsigned int __len) {
1012 return (vector double)__builtin_s390_vll(__len, __ptr);
1013}
1014
1015/*-- vec_store_len ----------------------------------------------------------*/
1016
1017static inline __ATTRS_o_ai void
1018vec_store_len(vector signed char __vec, signed char *__ptr,
1019 unsigned int __len) {
1020 __builtin_s390_vstl((vector signed char)__vec, __len, __ptr);
1021}
1022
1023static inline __ATTRS_o_ai void
1024vec_store_len(vector unsigned char __vec, unsigned char *__ptr,
1025 unsigned int __len) {
1026 __builtin_s390_vstl((vector signed char)__vec, __len, __ptr);
1027}
1028
1029static inline __ATTRS_o_ai void
1030vec_store_len(vector signed short __vec, signed short *__ptr,
1031 unsigned int __len) {
1032 __builtin_s390_vstl((vector signed char)__vec, __len, __ptr);
1033}
1034
1035static inline __ATTRS_o_ai void
1036vec_store_len(vector unsigned short __vec, unsigned short *__ptr,
1037 unsigned int __len) {
1038 __builtin_s390_vstl((vector signed char)__vec, __len, __ptr);
1039}
1040
1041static inline __ATTRS_o_ai void
1042vec_store_len(vector signed int __vec, signed int *__ptr,
1043 unsigned int __len) {
1044 __builtin_s390_vstl((vector signed char)__vec, __len, __ptr);
1045}
1046
1047static inline __ATTRS_o_ai void
1048vec_store_len(vector unsigned int __vec, unsigned int *__ptr,
1049 unsigned int __len) {
1050 __builtin_s390_vstl((vector signed char)__vec, __len, __ptr);
1051}
1052
1053static inline __ATTRS_o_ai void
1054vec_store_len(vector signed long long __vec, signed long long *__ptr,
1055 unsigned int __len) {
1056 __builtin_s390_vstl((vector signed char)__vec, __len, __ptr);
1057}
1058
1059static inline __ATTRS_o_ai void
1060vec_store_len(vector unsigned long long __vec, unsigned long long *__ptr,
1061 unsigned int __len) {
1062 __builtin_s390_vstl((vector signed char)__vec, __len, __ptr);
1063}
1064
1065static inline __ATTRS_o_ai void
1066vec_store_len(vector double __vec, double *__ptr,
1067 unsigned int __len) {
1068 __builtin_s390_vstl((vector signed char)__vec, __len, __ptr);
1069}
1070
1071/*-- vec_load_pair ----------------------------------------------------------*/
1072
1073static inline __ATTRS_o_ai vector signed long long
1074vec_load_pair(signed long long __a, signed long long __b) {
1075 return (vector signed long long)(__a, __b);
1076}
1077
1078static inline __ATTRS_o_ai vector unsigned long long
1079vec_load_pair(unsigned long long __a, unsigned long long __b) {
1080 return (vector unsigned long long)(__a, __b);
1081}
1082
1083/*-- vec_genmask ------------------------------------------------------------*/
1084
1085static inline __ATTRS_o_ai vector unsigned char
1086vec_genmask(unsigned short __mask)
1087 __constant(__mask) {
1088 return (vector unsigned char)(
1089 __mask & 0x8000 ? 0xff : 0,
1090 __mask & 0x4000 ? 0xff : 0,
1091 __mask & 0x2000 ? 0xff : 0,
1092 __mask & 0x1000 ? 0xff : 0,
1093 __mask & 0x0800 ? 0xff : 0,
1094 __mask & 0x0400 ? 0xff : 0,
1095 __mask & 0x0200 ? 0xff : 0,
1096 __mask & 0x0100 ? 0xff : 0,
1097 __mask & 0x0080 ? 0xff : 0,
1098 __mask & 0x0040 ? 0xff : 0,
1099 __mask & 0x0020 ? 0xff : 0,
1100 __mask & 0x0010 ? 0xff : 0,
1101 __mask & 0x0008 ? 0xff : 0,
1102 __mask & 0x0004 ? 0xff : 0,
1103 __mask & 0x0002 ? 0xff : 0,
1104 __mask & 0x0001 ? 0xff : 0);
1105}
1106
1107/*-- vec_genmasks_* ---------------------------------------------------------*/
1108
1109static inline __ATTRS_o_ai vector unsigned char
1110vec_genmasks_8(unsigned char __first, unsigned char __last)
1111 __constant(__first) __constant(__last) {
1112 unsigned char __bit1 = __first & 7;
1113 unsigned char __bit2 = __last & 7;
1114 unsigned char __mask1 = (unsigned char)(1U << (7 - __bit1) << 1) - 1;
1115 unsigned char __mask2 = (unsigned char)(1U << (7 - __bit2)) - 1;
1116 unsigned char __value = (__bit1 <= __bit2 ?
1117 __mask1 & ~__mask2 :
1118 __mask1 | ~__mask2);
1119 return (vector unsigned char)__value;
1120}
1121
1122static inline __ATTRS_o_ai vector unsigned short
1123vec_genmasks_16(unsigned char __first, unsigned char __last)
1124 __constant(__first) __constant(__last) {
1125 unsigned char __bit1 = __first & 15;
1126 unsigned char __bit2 = __last & 15;
1127 unsigned short __mask1 = (unsigned short)(1U << (15 - __bit1) << 1) - 1;
1128 unsigned short __mask2 = (unsigned short)(1U << (15 - __bit2)) - 1;
1129 unsigned short __value = (__bit1 <= __bit2 ?
1130 __mask1 & ~__mask2 :
1131 __mask1 | ~__mask2);
1132 return (vector unsigned short)__value;
1133}
1134
1135static inline __ATTRS_o_ai vector unsigned int
1136vec_genmasks_32(unsigned char __first, unsigned char __last)
1137 __constant(__first) __constant(__last) {
1138 unsigned char __bit1 = __first & 31;
1139 unsigned char __bit2 = __last & 31;
1140 unsigned int __mask1 = (1U << (31 - __bit1) << 1) - 1;
1141 unsigned int __mask2 = (1U << (31 - __bit2)) - 1;
1142 unsigned int __value = (__bit1 <= __bit2 ?
1143 __mask1 & ~__mask2 :
1144 __mask1 | ~__mask2);
1145 return (vector unsigned int)__value;
1146}
1147
1148static inline __ATTRS_o_ai vector unsigned long long
1149vec_genmasks_64(unsigned char __first, unsigned char __last)
1150 __constant(__first) __constant(__last) {
1151 unsigned char __bit1 = __first & 63;
1152 unsigned char __bit2 = __last & 63;
1153 unsigned long long __mask1 = (1ULL << (63 - __bit1) << 1) - 1;
1154 unsigned long long __mask2 = (1ULL << (63 - __bit2)) - 1;
1155 unsigned long long __value = (__bit1 <= __bit2 ?
1156 __mask1 & ~__mask2 :
1157 __mask1 | ~__mask2);
1158 return (vector unsigned long long)__value;
1159}
1160
1161/*-- vec_splat --------------------------------------------------------------*/
1162
1163static inline __ATTRS_o_ai vector signed char
1164vec_splat(vector signed char __vec, int __index)
1165 __constant_range(__index, 0, 15) {
1166 return (vector signed char)__vec[__index];
1167}
1168
1169static inline __ATTRS_o_ai vector bool char
1170vec_splat(vector bool char __vec, int __index)
1171 __constant_range(__index, 0, 15) {
1172 return (vector bool char)(vector unsigned char)__vec[__index];
1173}
1174
1175static inline __ATTRS_o_ai vector unsigned char
1176vec_splat(vector unsigned char __vec, int __index)
1177 __constant_range(__index, 0, 15) {
1178 return (vector unsigned char)__vec[__index];
1179}
1180
1181static inline __ATTRS_o_ai vector signed short
1182vec_splat(vector signed short __vec, int __index)
1183 __constant_range(__index, 0, 7) {
1184 return (vector signed short)__vec[__index];
1185}
1186
1187static inline __ATTRS_o_ai vector bool short
1188vec_splat(vector bool short __vec, int __index)
1189 __constant_range(__index, 0, 7) {
1190 return (vector bool short)(vector unsigned short)__vec[__index];
1191}
1192
1193static inline __ATTRS_o_ai vector unsigned short
1194vec_splat(vector unsigned short __vec, int __index)
1195 __constant_range(__index, 0, 7) {
1196 return (vector unsigned short)__vec[__index];
1197}
1198
1199static inline __ATTRS_o_ai vector signed int
1200vec_splat(vector signed int __vec, int __index)
1201 __constant_range(__index, 0, 3) {
1202 return (vector signed int)__vec[__index];
1203}
1204
1205static inline __ATTRS_o_ai vector bool int
1206vec_splat(vector bool int __vec, int __index)
1207 __constant_range(__index, 0, 3) {
1208 return (vector bool int)(vector unsigned int)__vec[__index];
1209}
1210
1211static inline __ATTRS_o_ai vector unsigned int
1212vec_splat(vector unsigned int __vec, int __index)
1213 __constant_range(__index, 0, 3) {
1214 return (vector unsigned int)__vec[__index];
1215}
1216
1217static inline __ATTRS_o_ai vector signed long long
1218vec_splat(vector signed long long __vec, int __index)
1219 __constant_range(__index, 0, 1) {
1220 return (vector signed long long)__vec[__index];
1221}
1222
1223static inline __ATTRS_o_ai vector bool long long
1224vec_splat(vector bool long long __vec, int __index)
1225 __constant_range(__index, 0, 1) {
1226 return (vector bool long long)(vector unsigned long long)__vec[__index];
1227}
1228
1229static inline __ATTRS_o_ai vector unsigned long long
1230vec_splat(vector unsigned long long __vec, int __index)
1231 __constant_range(__index, 0, 1) {
1232 return (vector unsigned long long)__vec[__index];
1233}
1234
1235static inline __ATTRS_o_ai vector double
1236vec_splat(vector double __vec, int __index)
1237 __constant_range(__index, 0, 1) {
1238 return (vector double)__vec[__index];
1239}
1240
1241/*-- vec_splat_s* -----------------------------------------------------------*/
1242
1243static inline __ATTRS_ai vector signed char
1244vec_splat_s8(signed char __scalar)
1245 __constant(__scalar) {
1246 return (vector signed char)__scalar;
1247}
1248
1249static inline __ATTRS_ai vector signed short
1250vec_splat_s16(signed short __scalar)
1251 __constant(__scalar) {
1252 return (vector signed short)__scalar;
1253}
1254
1255static inline __ATTRS_ai vector signed int
1256vec_splat_s32(signed short __scalar)
1257 __constant(__scalar) {
1258 return (vector signed int)(signed int)__scalar;
1259}
1260
1261static inline __ATTRS_ai vector signed long long
1262vec_splat_s64(signed short __scalar)
1263 __constant(__scalar) {
1264 return (vector signed long long)(signed long)__scalar;
1265}
1266
1267/*-- vec_splat_u* -----------------------------------------------------------*/
1268
1269static inline __ATTRS_ai vector unsigned char
1270vec_splat_u8(unsigned char __scalar)
1271 __constant(__scalar) {
1272 return (vector unsigned char)__scalar;
1273}
1274
1275static inline __ATTRS_ai vector unsigned short
1276vec_splat_u16(unsigned short __scalar)
1277 __constant(__scalar) {
1278 return (vector unsigned short)__scalar;
1279}
1280
1281static inline __ATTRS_ai vector unsigned int
1282vec_splat_u32(signed short __scalar)
1283 __constant(__scalar) {
1284 return (vector unsigned int)(signed int)__scalar;
1285}
1286
1287static inline __ATTRS_ai vector unsigned long long
1288vec_splat_u64(signed short __scalar)
1289 __constant(__scalar) {
1290 return (vector unsigned long long)(signed long long)__scalar;
1291}
1292
1293/*-- vec_splats -------------------------------------------------------------*/
1294
1295static inline __ATTRS_o_ai vector signed char
1296vec_splats(signed char __scalar) {
1297 return (vector signed char)__scalar;
1298}
1299
1300static inline __ATTRS_o_ai vector unsigned char
1301vec_splats(unsigned char __scalar) {
1302 return (vector unsigned char)__scalar;
1303}
1304
1305static inline __ATTRS_o_ai vector signed short
1306vec_splats(signed short __scalar) {
1307 return (vector signed short)__scalar;
1308}
1309
1310static inline __ATTRS_o_ai vector unsigned short
1311vec_splats(unsigned short __scalar) {
1312 return (vector unsigned short)__scalar;
1313}
1314
1315static inline __ATTRS_o_ai vector signed int
1316vec_splats(signed int __scalar) {
1317 return (vector signed int)__scalar;
1318}
1319
1320static inline __ATTRS_o_ai vector unsigned int
1321vec_splats(unsigned int __scalar) {
1322 return (vector unsigned int)__scalar;
1323}
1324
1325static inline __ATTRS_o_ai vector signed long long
1326vec_splats(signed long long __scalar) {
1327 return (vector signed long long)__scalar;
1328}
1329
1330static inline __ATTRS_o_ai vector unsigned long long
1331vec_splats(unsigned long long __scalar) {
1332 return (vector unsigned long long)__scalar;
1333}
1334
1335static inline __ATTRS_o_ai vector double
1336vec_splats(double __scalar) {
1337 return (vector double)__scalar;
1338}
1339
1340/*-- vec_extend_s64 ---------------------------------------------------------*/
1341
1342static inline __ATTRS_o_ai vector signed long long
1343vec_extend_s64(vector signed char __a) {
1344 return (vector signed long long)(__a[7], __a[15]);
1345}
1346
1347static inline __ATTRS_o_ai vector signed long long
1348vec_extend_s64(vector signed short __a) {
1349 return (vector signed long long)(__a[3], __a[7]);
1350}
1351
1352static inline __ATTRS_o_ai vector signed long long
1353vec_extend_s64(vector signed int __a) {
1354 return (vector signed long long)(__a[1], __a[3]);
1355}
1356
1357/*-- vec_mergeh -------------------------------------------------------------*/
1358
1359static inline __ATTRS_o_ai vector signed char
1360vec_mergeh(vector signed char __a, vector signed char __b) {
1361 return (vector signed char)(
1362 __a[0], __b[0], __a[1], __b[1], __a[2], __b[2], __a[3], __b[3],
1363 __a[4], __b[4], __a[5], __b[5], __a[6], __b[6], __a[7], __b[7]);
1364}
1365
1366static inline __ATTRS_o_ai vector bool char
1367vec_mergeh(vector bool char __a, vector bool char __b) {
1368 return (vector bool char)(
1369 __a[0], __b[0], __a[1], __b[1], __a[2], __b[2], __a[3], __b[3],
1370 __a[4], __b[4], __a[5], __b[5], __a[6], __b[6], __a[7], __b[7]);
1371}
1372
1373static inline __ATTRS_o_ai vector unsigned char
1374vec_mergeh(vector unsigned char __a, vector unsigned char __b) {
1375 return (vector unsigned char)(
1376 __a[0], __b[0], __a[1], __b[1], __a[2], __b[2], __a[3], __b[3],
1377 __a[4], __b[4], __a[5], __b[5], __a[6], __b[6], __a[7], __b[7]);
1378}
1379
1380static inline __ATTRS_o_ai vector signed short
1381vec_mergeh(vector signed short __a, vector signed short __b) {
1382 return (vector signed short)(
1383 __a[0], __b[0], __a[1], __b[1], __a[2], __b[2], __a[3], __b[3]);
1384}
1385
1386static inline __ATTRS_o_ai vector bool short
1387vec_mergeh(vector bool short __a, vector bool short __b) {
1388 return (vector bool short)(
1389 __a[0], __b[0], __a[1], __b[1], __a[2], __b[2], __a[3], __b[3]);
1390}
1391
1392static inline __ATTRS_o_ai vector unsigned short
1393vec_mergeh(vector unsigned short __a, vector unsigned short __b) {
1394 return (vector unsigned short)(
1395 __a[0], __b[0], __a[1], __b[1], __a[2], __b[2], __a[3], __b[3]);
1396}
1397
1398static inline __ATTRS_o_ai vector signed int
1399vec_mergeh(vector signed int __a, vector signed int __b) {
1400 return (vector signed int)(__a[0], __b[0], __a[1], __b[1]);
1401}
1402
1403static inline __ATTRS_o_ai vector bool int
1404vec_mergeh(vector bool int __a, vector bool int __b) {
1405 return (vector bool int)(__a[0], __b[0], __a[1], __b[1]);
1406}
1407
1408static inline __ATTRS_o_ai vector unsigned int
1409vec_mergeh(vector unsigned int __a, vector unsigned int __b) {
1410 return (vector unsigned int)(__a[0], __b[0], __a[1], __b[1]);
1411}
1412
1413static inline __ATTRS_o_ai vector signed long long
1414vec_mergeh(vector signed long long __a, vector signed long long __b) {
1415 return (vector signed long long)(__a[0], __b[0]);
1416}
1417
1418static inline __ATTRS_o_ai vector bool long long
1419vec_mergeh(vector bool long long __a, vector bool long long __b) {
1420 return (vector bool long long)(__a[0], __b[0]);
1421}
1422
1423static inline __ATTRS_o_ai vector unsigned long long
1424vec_mergeh(vector unsigned long long __a, vector unsigned long long __b) {
1425 return (vector unsigned long long)(__a[0], __b[0]);
1426}
1427
1428static inline __ATTRS_o_ai vector double
1429vec_mergeh(vector double __a, vector double __b) {
1430 return (vector double)(__a[0], __b[0]);
1431}
1432
1433/*-- vec_mergel -------------------------------------------------------------*/
1434
1435static inline __ATTRS_o_ai vector signed char
1436vec_mergel(vector signed char __a, vector signed char __b) {
1437 return (vector signed char)(
1438 __a[8], __b[8], __a[9], __b[9], __a[10], __b[10], __a[11], __b[11],
1439 __a[12], __b[12], __a[13], __b[13], __a[14], __b[14], __a[15], __b[15]);
1440}
1441
1442static inline __ATTRS_o_ai vector bool char
1443vec_mergel(vector bool char __a, vector bool char __b) {
1444 return (vector bool char)(
1445 __a[8], __b[8], __a[9], __b[9], __a[10], __b[10], __a[11], __b[11],
1446 __a[12], __b[12], __a[13], __b[13], __a[14], __b[14], __a[15], __b[15]);
1447}
1448
1449static inline __ATTRS_o_ai vector unsigned char
1450vec_mergel(vector unsigned char __a, vector unsigned char __b) {
1451 return (vector unsigned char)(
1452 __a[8], __b[8], __a[9], __b[9], __a[10], __b[10], __a[11], __b[11],
1453 __a[12], __b[12], __a[13], __b[13], __a[14], __b[14], __a[15], __b[15]);
1454}
1455
1456static inline __ATTRS_o_ai vector signed short
1457vec_mergel(vector signed short __a, vector signed short __b) {
1458 return (vector signed short)(
1459 __a[4], __b[4], __a[5], __b[5], __a[6], __b[6], __a[7], __b[7]);
1460}
1461
1462static inline __ATTRS_o_ai vector bool short
1463vec_mergel(vector bool short __a, vector bool short __b) {
1464 return (vector bool short)(
1465 __a[4], __b[4], __a[5], __b[5], __a[6], __b[6], __a[7], __b[7]);
1466}
1467
1468static inline __ATTRS_o_ai vector unsigned short
1469vec_mergel(vector unsigned short __a, vector unsigned short __b) {
1470 return (vector unsigned short)(
1471 __a[4], __b[4], __a[5], __b[5], __a[6], __b[6], __a[7], __b[7]);
1472}
1473
1474static inline __ATTRS_o_ai vector signed int
1475vec_mergel(vector signed int __a, vector signed int __b) {
1476 return (vector signed int)(__a[2], __b[2], __a[3], __b[3]);
1477}
1478
1479static inline __ATTRS_o_ai vector bool int
1480vec_mergel(vector bool int __a, vector bool int __b) {
1481 return (vector bool int)(__a[2], __b[2], __a[3], __b[3]);
1482}
1483
1484static inline __ATTRS_o_ai vector unsigned int
1485vec_mergel(vector unsigned int __a, vector unsigned int __b) {
1486 return (vector unsigned int)(__a[2], __b[2], __a[3], __b[3]);
1487}
1488
1489static inline __ATTRS_o_ai vector signed long long
1490vec_mergel(vector signed long long __a, vector signed long long __b) {
1491 return (vector signed long long)(__a[1], __b[1]);
1492}
1493
1494static inline __ATTRS_o_ai vector bool long long
1495vec_mergel(vector bool long long __a, vector bool long long __b) {
1496 return (vector bool long long)(__a[1], __b[1]);
1497}
1498
1499static inline __ATTRS_o_ai vector unsigned long long
1500vec_mergel(vector unsigned long long __a, vector unsigned long long __b) {
1501 return (vector unsigned long long)(__a[1], __b[1]);
1502}
1503
1504static inline __ATTRS_o_ai vector double
1505vec_mergel(vector double __a, vector double __b) {
1506 return (vector double)(__a[1], __b[1]);
1507}
1508
1509/*-- vec_pack ---------------------------------------------------------------*/
1510
1511static inline __ATTRS_o_ai vector signed char
1512vec_pack(vector signed short __a, vector signed short __b) {
1513 vector signed char __ac = (vector signed char)__a;
1514 vector signed char __bc = (vector signed char)__b;
1515 return (vector signed char)(
1516 __ac[1], __ac[3], __ac[5], __ac[7], __ac[9], __ac[11], __ac[13], __ac[15],
1517 __bc[1], __bc[3], __bc[5], __bc[7], __bc[9], __bc[11], __bc[13], __bc[15]);
1518}
1519
1520static inline __ATTRS_o_ai vector bool char
1521vec_pack(vector bool short __a, vector bool short __b) {
1522 vector bool char __ac = (vector bool char)__a;
1523 vector bool char __bc = (vector bool char)__b;
1524 return (vector bool char)(
1525 __ac[1], __ac[3], __ac[5], __ac[7], __ac[9], __ac[11], __ac[13], __ac[15],
1526 __bc[1], __bc[3], __bc[5], __bc[7], __bc[9], __bc[11], __bc[13], __bc[15]);
1527}
1528
1529static inline __ATTRS_o_ai vector unsigned char
1530vec_pack(vector unsigned short __a, vector unsigned short __b) {
1531 vector unsigned char __ac = (vector unsigned char)__a;
1532 vector unsigned char __bc = (vector unsigned char)__b;
1533 return (vector unsigned char)(
1534 __ac[1], __ac[3], __ac[5], __ac[7], __ac[9], __ac[11], __ac[13], __ac[15],
1535 __bc[1], __bc[3], __bc[5], __bc[7], __bc[9], __bc[11], __bc[13], __bc[15]);
1536}
1537
1538static inline __ATTRS_o_ai vector signed short
1539vec_pack(vector signed int __a, vector signed int __b) {
1540 vector signed short __ac = (vector signed short)__a;
1541 vector signed short __bc = (vector signed short)__b;
1542 return (vector signed short)(
1543 __ac[1], __ac[3], __ac[5], __ac[7],
1544 __bc[1], __bc[3], __bc[5], __bc[7]);
1545}
1546
1547static inline __ATTRS_o_ai vector bool short
1548vec_pack(vector bool int __a, vector bool int __b) {
1549 vector bool short __ac = (vector bool short)__a;
1550 vector bool short __bc = (vector bool short)__b;
1551 return (vector bool short)(
1552 __ac[1], __ac[3], __ac[5], __ac[7],
1553 __bc[1], __bc[3], __bc[5], __bc[7]);
1554}
1555
1556static inline __ATTRS_o_ai vector unsigned short
1557vec_pack(vector unsigned int __a, vector unsigned int __b) {
1558 vector unsigned short __ac = (vector unsigned short)__a;
1559 vector unsigned short __bc = (vector unsigned short)__b;
1560 return (vector unsigned short)(
1561 __ac[1], __ac[3], __ac[5], __ac[7],
1562 __bc[1], __bc[3], __bc[5], __bc[7]);
1563}
1564
1565static inline __ATTRS_o_ai vector signed int
1566vec_pack(vector signed long long __a, vector signed long long __b) {
1567 vector signed int __ac = (vector signed int)__a;
1568 vector signed int __bc = (vector signed int)__b;
1569 return (vector signed int)(__ac[1], __ac[3], __bc[1], __bc[3]);
1570}
1571
1572static inline __ATTRS_o_ai vector bool int
1573vec_pack(vector bool long long __a, vector bool long long __b) {
1574 vector bool int __ac = (vector bool int)__a;
1575 vector bool int __bc = (vector bool int)__b;
1576 return (vector bool int)(__ac[1], __ac[3], __bc[1], __bc[3]);
1577}
1578
1579static inline __ATTRS_o_ai vector unsigned int
1580vec_pack(vector unsigned long long __a, vector unsigned long long __b) {
1581 vector unsigned int __ac = (vector unsigned int)__a;
1582 vector unsigned int __bc = (vector unsigned int)__b;
1583 return (vector unsigned int)(__ac[1], __ac[3], __bc[1], __bc[3]);
1584}
1585
1586/*-- vec_packs --------------------------------------------------------------*/
1587
1588static inline __ATTRS_o_ai vector signed char
1589vec_packs(vector signed short __a, vector signed short __b) {
1590 return __builtin_s390_vpksh(__a, __b);
1591}
1592
1593static inline __ATTRS_o_ai vector unsigned char
1594vec_packs(vector unsigned short __a, vector unsigned short __b) {
1595 return __builtin_s390_vpklsh(__a, __b);
1596}
1597
1598static inline __ATTRS_o_ai vector signed short
1599vec_packs(vector signed int __a, vector signed int __b) {
1600 return __builtin_s390_vpksf(__a, __b);
1601}
1602
1603static inline __ATTRS_o_ai vector unsigned short
1604vec_packs(vector unsigned int __a, vector unsigned int __b) {
1605 return __builtin_s390_vpklsf(__a, __b);
1606}
1607
1608static inline __ATTRS_o_ai vector signed int
1609vec_packs(vector signed long long __a, vector signed long long __b) {
1610 return __builtin_s390_vpksg(__a, __b);
1611}
1612
1613static inline __ATTRS_o_ai vector unsigned int
1614vec_packs(vector unsigned long long __a, vector unsigned long long __b) {
1615 return __builtin_s390_vpklsg(__a, __b);
1616}
1617
1618/*-- vec_packs_cc -----------------------------------------------------------*/
1619
1620static inline __ATTRS_o_ai vector signed char
1621vec_packs_cc(vector signed short __a, vector signed short __b, int *__cc) {
1622 return __builtin_s390_vpkshs(__a, __b, __cc);
1623}
1624
1625static inline __ATTRS_o_ai vector unsigned char
1626vec_packs_cc(vector unsigned short __a, vector unsigned short __b, int *__cc) {
1627 return __builtin_s390_vpklshs(__a, __b, __cc);
1628}
1629
1630static inline __ATTRS_o_ai vector signed short
1631vec_packs_cc(vector signed int __a, vector signed int __b, int *__cc) {
1632 return __builtin_s390_vpksfs(__a, __b, __cc);
1633}
1634
1635static inline __ATTRS_o_ai vector unsigned short
1636vec_packs_cc(vector unsigned int __a, vector unsigned int __b, int *__cc) {
1637 return __builtin_s390_vpklsfs(__a, __b, __cc);
1638}
1639
1640static inline __ATTRS_o_ai vector signed int
1641vec_packs_cc(vector signed long long __a, vector signed long long __b,
1642 int *__cc) {
1643 return __builtin_s390_vpksgs(__a, __b, __cc);
1644}
1645
1646static inline __ATTRS_o_ai vector unsigned int
1647vec_packs_cc(vector unsigned long long __a, vector unsigned long long __b,
1648 int *__cc) {
1649 return __builtin_s390_vpklsgs(__a, __b, __cc);
1650}
1651
1652/*-- vec_packsu -------------------------------------------------------------*/
1653
1654static inline __ATTRS_o_ai vector unsigned char
1655vec_packsu(vector signed short __a, vector signed short __b) {
1656 const vector signed short __zero = (vector signed short)0;
1657 return __builtin_s390_vpklsh(
1658 (vector unsigned short)(__a >= __zero) & (vector unsigned short)__a,
1659 (vector unsigned short)(__b >= __zero) & (vector unsigned short)__b);
1660}
1661
1662static inline __ATTRS_o_ai vector unsigned char
1663vec_packsu(vector unsigned short __a, vector unsigned short __b) {
1664 return __builtin_s390_vpklsh(__a, __b);
1665}
1666
1667static inline __ATTRS_o_ai vector unsigned short
1668vec_packsu(vector signed int __a, vector signed int __b) {
1669 const vector signed int __zero = (vector signed int)0;
1670 return __builtin_s390_vpklsf(
1671 (vector unsigned int)(__a >= __zero) & (vector unsigned int)__a,
1672 (vector unsigned int)(__b >= __zero) & (vector unsigned int)__b);
1673}
1674
1675static inline __ATTRS_o_ai vector unsigned short
1676vec_packsu(vector unsigned int __a, vector unsigned int __b) {
1677 return __builtin_s390_vpklsf(__a, __b);
1678}
1679
1680static inline __ATTRS_o_ai vector unsigned int
1681vec_packsu(vector signed long long __a, vector signed long long __b) {
1682 const vector signed long long __zero = (vector signed long long)0;
1683 return __builtin_s390_vpklsg(
1684 (vector unsigned long long)(__a >= __zero) &
1685 (vector unsigned long long)__a,
1686 (vector unsigned long long)(__b >= __zero) &
1687 (vector unsigned long long)__b);
1688}
1689
1690static inline __ATTRS_o_ai vector unsigned int
1691vec_packsu(vector unsigned long long __a, vector unsigned long long __b) {
1692 return __builtin_s390_vpklsg(__a, __b);
1693}
1694
1695/*-- vec_packsu_cc ----------------------------------------------------------*/
1696
1697static inline __ATTRS_o_ai vector unsigned char
1698vec_packsu_cc(vector unsigned short __a, vector unsigned short __b, int *__cc) {
1699 return __builtin_s390_vpklshs(__a, __b, __cc);
1700}
1701
1702static inline __ATTRS_o_ai vector unsigned short
1703vec_packsu_cc(vector unsigned int __a, vector unsigned int __b, int *__cc) {
1704 return __builtin_s390_vpklsfs(__a, __b, __cc);
1705}
1706
1707static inline __ATTRS_o_ai vector unsigned int
1708vec_packsu_cc(vector unsigned long long __a, vector unsigned long long __b,
1709 int *__cc) {
1710 return __builtin_s390_vpklsgs(__a, __b, __cc);
1711}
1712
1713/*-- vec_unpackh ------------------------------------------------------------*/
1714
1715static inline __ATTRS_o_ai vector signed short
1716vec_unpackh(vector signed char __a) {
1717 return __builtin_s390_vuphb(__a);
1718}
1719
1720static inline __ATTRS_o_ai vector bool short
1721vec_unpackh(vector bool char __a) {
1722 return (vector bool short)__builtin_s390_vuphb((vector signed char)__a);
1723}
1724
1725static inline __ATTRS_o_ai vector unsigned short
1726vec_unpackh(vector unsigned char __a) {
1727 return __builtin_s390_vuplhb(__a);
1728}
1729
1730static inline __ATTRS_o_ai vector signed int
1731vec_unpackh(vector signed short __a) {
1732 return __builtin_s390_vuphh(__a);
1733}
1734
1735static inline __ATTRS_o_ai vector bool int
1736vec_unpackh(vector bool short __a) {
1737 return (vector bool int)__builtin_s390_vuphh((vector signed short)__a);
1738}
1739
1740static inline __ATTRS_o_ai vector unsigned int
1741vec_unpackh(vector unsigned short __a) {
1742 return __builtin_s390_vuplhh(__a);
1743}
1744
1745static inline __ATTRS_o_ai vector signed long long
1746vec_unpackh(vector signed int __a) {
1747 return __builtin_s390_vuphf(__a);
1748}
1749
1750static inline __ATTRS_o_ai vector bool long long
1751vec_unpackh(vector bool int __a) {
1752 return (vector bool long long)__builtin_s390_vuphf((vector signed int)__a);
1753}
1754
1755static inline __ATTRS_o_ai vector unsigned long long
1756vec_unpackh(vector unsigned int __a) {
1757 return __builtin_s390_vuplhf(__a);
1758}
1759
1760/*-- vec_unpackl ------------------------------------------------------------*/
1761
1762static inline __ATTRS_o_ai vector signed short
1763vec_unpackl(vector signed char __a) {
1764 return __builtin_s390_vuplb(__a);
1765}
1766
1767static inline __ATTRS_o_ai vector bool short
1768vec_unpackl(vector bool char __a) {
1769 return (vector bool short)__builtin_s390_vuplb((vector signed char)__a);
1770}
1771
1772static inline __ATTRS_o_ai vector unsigned short
1773vec_unpackl(vector unsigned char __a) {
1774 return __builtin_s390_vupllb(__a);
1775}
1776
1777static inline __ATTRS_o_ai vector signed int
1778vec_unpackl(vector signed short __a) {
1779 return __builtin_s390_vuplhw(__a);
1780}
1781
1782static inline __ATTRS_o_ai vector bool int
1783vec_unpackl(vector bool short __a) {
1784 return (vector bool int)__builtin_s390_vuplhw((vector signed short)__a);
1785}
1786
1787static inline __ATTRS_o_ai vector unsigned int
1788vec_unpackl(vector unsigned short __a) {
1789 return __builtin_s390_vupllh(__a);
1790}
1791
1792static inline __ATTRS_o_ai vector signed long long
1793vec_unpackl(vector signed int __a) {
1794 return __builtin_s390_vuplf(__a);
1795}
1796
1797static inline __ATTRS_o_ai vector bool long long
1798vec_unpackl(vector bool int __a) {
1799 return (vector bool long long)__builtin_s390_vuplf((vector signed int)__a);
1800}
1801
1802static inline __ATTRS_o_ai vector unsigned long long
1803vec_unpackl(vector unsigned int __a) {
1804 return __builtin_s390_vupllf(__a);
1805}
1806
1807/*-- vec_cmpeq --------------------------------------------------------------*/
1808
1809static inline __ATTRS_o_ai vector bool char
1810vec_cmpeq(vector bool char __a, vector bool char __b) {
1811 return (vector bool char)(__a == __b);
1812}
1813
1814static inline __ATTRS_o_ai vector bool char
1815vec_cmpeq(vector signed char __a, vector signed char __b) {
1816 return (vector bool char)(__a == __b);
1817}
1818
1819static inline __ATTRS_o_ai vector bool char
1820vec_cmpeq(vector unsigned char __a, vector unsigned char __b) {
1821 return (vector bool char)(__a == __b);
1822}
1823
1824static inline __ATTRS_o_ai vector bool short
1825vec_cmpeq(vector bool short __a, vector bool short __b) {
1826 return (vector bool short)(__a == __b);
1827}
1828
1829static inline __ATTRS_o_ai vector bool short
1830vec_cmpeq(vector signed short __a, vector signed short __b) {
1831 return (vector bool short)(__a == __b);
1832}
1833
1834static inline __ATTRS_o_ai vector bool short
1835vec_cmpeq(vector unsigned short __a, vector unsigned short __b) {
1836 return (vector bool short)(__a == __b);
1837}
1838
1839static inline __ATTRS_o_ai vector bool int
1840vec_cmpeq(vector bool int __a, vector bool int __b) {
1841 return (vector bool int)(__a == __b);
1842}
1843
1844static inline __ATTRS_o_ai vector bool int
1845vec_cmpeq(vector signed int __a, vector signed int __b) {
1846 return (vector bool int)(__a == __b);
1847}
1848
1849static inline __ATTRS_o_ai vector bool int
1850vec_cmpeq(vector unsigned int __a, vector unsigned int __b) {
1851 return (vector bool int)(__a == __b);
1852}
1853
1854static inline __ATTRS_o_ai vector bool long long
1855vec_cmpeq(vector bool long long __a, vector bool long long __b) {
1856 return (vector bool long long)(__a == __b);
1857}
1858
1859static inline __ATTRS_o_ai vector bool long long
1860vec_cmpeq(vector signed long long __a, vector signed long long __b) {
1861 return (vector bool long long)(__a == __b);
1862}
1863
1864static inline __ATTRS_o_ai vector bool long long
1865vec_cmpeq(vector unsigned long long __a, vector unsigned long long __b) {
1866 return (vector bool long long)(__a == __b);
1867}
1868
1869static inline __ATTRS_o_ai vector bool long long
1870vec_cmpeq(vector double __a, vector double __b) {
1871 return (vector bool long long)(__a == __b);
1872}
1873
1874/*-- vec_cmpge --------------------------------------------------------------*/
1875
1876static inline __ATTRS_o_ai vector bool char
1877vec_cmpge(vector signed char __a, vector signed char __b) {
1878 return (vector bool char)(__a >= __b);
1879}
1880
1881static inline __ATTRS_o_ai vector bool char
1882vec_cmpge(vector unsigned char __a, vector unsigned char __b) {
1883 return (vector bool char)(__a >= __b);
1884}
1885
1886static inline __ATTRS_o_ai vector bool short
1887vec_cmpge(vector signed short __a, vector signed short __b) {
1888 return (vector bool short)(__a >= __b);
1889}
1890
1891static inline __ATTRS_o_ai vector bool short
1892vec_cmpge(vector unsigned short __a, vector unsigned short __b) {
1893 return (vector bool short)(__a >= __b);
1894}
1895
1896static inline __ATTRS_o_ai vector bool int
1897vec_cmpge(vector signed int __a, vector signed int __b) {
1898 return (vector bool int)(__a >= __b);
1899}
1900
1901static inline __ATTRS_o_ai vector bool int
1902vec_cmpge(vector unsigned int __a, vector unsigned int __b) {
1903 return (vector bool int)(__a >= __b);
1904}
1905
1906static inline __ATTRS_o_ai vector bool long long
1907vec_cmpge(vector signed long long __a, vector signed long long __b) {
1908 return (vector bool long long)(__a >= __b);
1909}
1910
1911static inline __ATTRS_o_ai vector bool long long
1912vec_cmpge(vector unsigned long long __a, vector unsigned long long __b) {
1913 return (vector bool long long)(__a >= __b);
1914}
1915
1916static inline __ATTRS_o_ai vector bool long long
1917vec_cmpge(vector double __a, vector double __b) {
1918 return (vector bool long long)(__a >= __b);
1919}
1920
1921/*-- vec_cmpgt --------------------------------------------------------------*/
1922
1923static inline __ATTRS_o_ai vector bool char
1924vec_cmpgt(vector signed char __a, vector signed char __b) {
1925 return (vector bool char)(__a > __b);
1926}
1927
1928static inline __ATTRS_o_ai vector bool char
1929vec_cmpgt(vector unsigned char __a, vector unsigned char __b) {
1930 return (vector bool char)(__a > __b);
1931}
1932
1933static inline __ATTRS_o_ai vector bool short
1934vec_cmpgt(vector signed short __a, vector signed short __b) {
1935 return (vector bool short)(__a > __b);
1936}
1937
1938static inline __ATTRS_o_ai vector bool short
1939vec_cmpgt(vector unsigned short __a, vector unsigned short __b) {
1940 return (vector bool short)(__a > __b);
1941}
1942
1943static inline __ATTRS_o_ai vector bool int
1944vec_cmpgt(vector signed int __a, vector signed int __b) {
1945 return (vector bool int)(__a > __b);
1946}
1947
1948static inline __ATTRS_o_ai vector bool int
1949vec_cmpgt(vector unsigned int __a, vector unsigned int __b) {
1950 return (vector bool int)(__a > __b);
1951}
1952
1953static inline __ATTRS_o_ai vector bool long long
1954vec_cmpgt(vector signed long long __a, vector signed long long __b) {
1955 return (vector bool long long)(__a > __b);
1956}
1957
1958static inline __ATTRS_o_ai vector bool long long
1959vec_cmpgt(vector unsigned long long __a, vector unsigned long long __b) {
1960 return (vector bool long long)(__a > __b);
1961}
1962
1963static inline __ATTRS_o_ai vector bool long long
1964vec_cmpgt(vector double __a, vector double __b) {
1965 return (vector bool long long)(__a > __b);
1966}
1967
1968/*-- vec_cmple --------------------------------------------------------------*/
1969
1970static inline __ATTRS_o_ai vector bool char
1971vec_cmple(vector signed char __a, vector signed char __b) {
1972 return (vector bool char)(__a <= __b);
1973}
1974
1975static inline __ATTRS_o_ai vector bool char
1976vec_cmple(vector unsigned char __a, vector unsigned char __b) {
1977 return (vector bool char)(__a <= __b);
1978}
1979
1980static inline __ATTRS_o_ai vector bool short
1981vec_cmple(vector signed short __a, vector signed short __b) {
1982 return (vector bool short)(__a <= __b);
1983}
1984
1985static inline __ATTRS_o_ai vector bool short
1986vec_cmple(vector unsigned short __a, vector unsigned short __b) {
1987 return (vector bool short)(__a <= __b);
1988}
1989
1990static inline __ATTRS_o_ai vector bool int
1991vec_cmple(vector signed int __a, vector signed int __b) {
1992 return (vector bool int)(__a <= __b);
1993}
1994
1995static inline __ATTRS_o_ai vector bool int
1996vec_cmple(vector unsigned int __a, vector unsigned int __b) {
1997 return (vector bool int)(__a <= __b);
1998}
1999
2000static inline __ATTRS_o_ai vector bool long long
2001vec_cmple(vector signed long long __a, vector signed long long __b) {
2002 return (vector bool long long)(__a <= __b);
2003}
2004
2005static inline __ATTRS_o_ai vector bool long long
2006vec_cmple(vector unsigned long long __a, vector unsigned long long __b) {
2007 return (vector bool long long)(__a <= __b);
2008}
2009
2010static inline __ATTRS_o_ai vector bool long long
2011vec_cmple(vector double __a, vector double __b) {
2012 return (vector bool long long)(__a <= __b);
2013}
2014
2015/*-- vec_cmplt --------------------------------------------------------------*/
2016
2017static inline __ATTRS_o_ai vector bool char
2018vec_cmplt(vector signed char __a, vector signed char __b) {
2019 return (vector bool char)(__a < __b);
2020}
2021
2022static inline __ATTRS_o_ai vector bool char
2023vec_cmplt(vector unsigned char __a, vector unsigned char __b) {
2024 return (vector bool char)(__a < __b);
2025}
2026
2027static inline __ATTRS_o_ai vector bool short
2028vec_cmplt(vector signed short __a, vector signed short __b) {
2029 return (vector bool short)(__a < __b);
2030}
2031
2032static inline __ATTRS_o_ai vector bool short
2033vec_cmplt(vector unsigned short __a, vector unsigned short __b) {
2034 return (vector bool short)(__a < __b);
2035}
2036
2037static inline __ATTRS_o_ai vector bool int
2038vec_cmplt(vector signed int __a, vector signed int __b) {
2039 return (vector bool int)(__a < __b);
2040}
2041
2042static inline __ATTRS_o_ai vector bool int
2043vec_cmplt(vector unsigned int __a, vector unsigned int __b) {
2044 return (vector bool int)(__a < __b);
2045}
2046
2047static inline __ATTRS_o_ai vector bool long long
2048vec_cmplt(vector signed long long __a, vector signed long long __b) {
2049 return (vector bool long long)(__a < __b);
2050}
2051
2052static inline __ATTRS_o_ai vector bool long long
2053vec_cmplt(vector unsigned long long __a, vector unsigned long long __b) {
2054 return (vector bool long long)(__a < __b);
2055}
2056
2057static inline __ATTRS_o_ai vector bool long long
2058vec_cmplt(vector double __a, vector double __b) {
2059 return (vector bool long long)(__a < __b);
2060}
2061
2062/*-- vec_all_eq -------------------------------------------------------------*/
2063
2064static inline __ATTRS_o_ai int
2065vec_all_eq(vector signed char __a, vector signed char __b) {
2066 int __cc;
2067 __builtin_s390_vceqbs(__a, __b, &__cc);
2068 return __cc == 0;
2069}
2070
2071static inline __ATTRS_o_ai int
2072vec_all_eq(vector signed char __a, vector bool char __b) {
2073 int __cc;
2074 __builtin_s390_vceqbs(__a, (vector signed char)__b, &__cc);
2075 return __cc == 0;
2076}
2077
2078static inline __ATTRS_o_ai int
2079vec_all_eq(vector bool char __a, vector signed char __b) {
2080 int __cc;
2081 __builtin_s390_vceqbs((vector signed char)__a, __b, &__cc);
2082 return __cc == 0;
2083}
2084
2085static inline __ATTRS_o_ai int
2086vec_all_eq(vector unsigned char __a, vector unsigned char __b) {
2087 int __cc;
2088 __builtin_s390_vceqbs((vector signed char)__a,
2089 (vector signed char)__b, &__cc);
2090 return __cc == 0;
2091}
2092
2093static inline __ATTRS_o_ai int
2094vec_all_eq(vector unsigned char __a, vector bool char __b) {
2095 int __cc;
2096 __builtin_s390_vceqbs((vector signed char)__a,
2097 (vector signed char)__b, &__cc);
2098 return __cc == 0;
2099}
2100
2101static inline __ATTRS_o_ai int
2102vec_all_eq(vector bool char __a, vector unsigned char __b) {
2103 int __cc;
2104 __builtin_s390_vceqbs((vector signed char)__a,
2105 (vector signed char)__b, &__cc);
2106 return __cc == 0;
2107}
2108
2109static inline __ATTRS_o_ai int
2110vec_all_eq(vector bool char __a, vector bool char __b) {
2111 int __cc;
2112 __builtin_s390_vceqbs((vector signed char)__a,
2113 (vector signed char)__b, &__cc);
2114 return __cc == 0;
2115}
2116
2117static inline __ATTRS_o_ai int
2118vec_all_eq(vector signed short __a, vector signed short __b) {
2119 int __cc;
2120 __builtin_s390_vceqhs(__a, __b, &__cc);
2121 return __cc == 0;
2122}
2123
2124static inline __ATTRS_o_ai int
2125vec_all_eq(vector signed short __a, vector bool short __b) {
2126 int __cc;
2127 __builtin_s390_vceqhs(__a, (vector signed short)__b, &__cc);
2128 return __cc == 0;
2129}
2130
2131static inline __ATTRS_o_ai int
2132vec_all_eq(vector bool short __a, vector signed short __b) {
2133 int __cc;
2134 __builtin_s390_vceqhs((vector signed short)__a, __b, &__cc);
2135 return __cc == 0;
2136}
2137
2138static inline __ATTRS_o_ai int
2139vec_all_eq(vector unsigned short __a, vector unsigned short __b) {
2140 int __cc;
2141 __builtin_s390_vceqhs((vector signed short)__a,
2142 (vector signed short)__b, &__cc);
2143 return __cc == 0;
2144}
2145
2146static inline __ATTRS_o_ai int
2147vec_all_eq(vector unsigned short __a, vector bool short __b) {
2148 int __cc;
2149 __builtin_s390_vceqhs((vector signed short)__a,
2150 (vector signed short)__b, &__cc);
2151 return __cc == 0;
2152}
2153
2154static inline __ATTRS_o_ai int
2155vec_all_eq(vector bool short __a, vector unsigned short __b) {
2156 int __cc;
2157 __builtin_s390_vceqhs((vector signed short)__a,
2158 (vector signed short)__b, &__cc);
2159 return __cc == 0;
2160}
2161
2162static inline __ATTRS_o_ai int
2163vec_all_eq(vector bool short __a, vector bool short __b) {
2164 int __cc;
2165 __builtin_s390_vceqhs((vector signed short)__a,
2166 (vector signed short)__b, &__cc);
2167 return __cc == 0;
2168}
2169
2170static inline __ATTRS_o_ai int
2171vec_all_eq(vector signed int __a, vector signed int __b) {
2172 int __cc;
2173 __builtin_s390_vceqfs(__a, __b, &__cc);
2174 return __cc == 0;
2175}
2176
2177static inline __ATTRS_o_ai int
2178vec_all_eq(vector signed int __a, vector bool int __b) {
2179 int __cc;
2180 __builtin_s390_vceqfs(__a, (vector signed int)__b, &__cc);
2181 return __cc == 0;
2182}
2183
2184static inline __ATTRS_o_ai int
2185vec_all_eq(vector bool int __a, vector signed int __b) {
2186 int __cc;
2187 __builtin_s390_vceqfs((vector signed int)__a, __b, &__cc);
2188 return __cc == 0;
2189}
2190
2191static inline __ATTRS_o_ai int
2192vec_all_eq(vector unsigned int __a, vector unsigned int __b) {
2193 int __cc;
2194 __builtin_s390_vceqfs((vector signed int)__a,
2195 (vector signed int)__b, &__cc);
2196 return __cc == 0;
2197}
2198
2199static inline __ATTRS_o_ai int
2200vec_all_eq(vector unsigned int __a, vector bool int __b) {
2201 int __cc;
2202 __builtin_s390_vceqfs((vector signed int)__a,
2203 (vector signed int)__b, &__cc);
2204 return __cc == 0;
2205}
2206
2207static inline __ATTRS_o_ai int
2208vec_all_eq(vector bool int __a, vector unsigned int __b) {
2209 int __cc;
2210 __builtin_s390_vceqfs((vector signed int)__a,
2211 (vector signed int)__b, &__cc);
2212 return __cc == 0;
2213}
2214
2215static inline __ATTRS_o_ai int
2216vec_all_eq(vector bool int __a, vector bool int __b) {
2217 int __cc;
2218 __builtin_s390_vceqfs((vector signed int)__a,
2219 (vector signed int)__b, &__cc);
2220 return __cc == 0;
2221}
2222
2223static inline __ATTRS_o_ai int
2224vec_all_eq(vector signed long long __a, vector signed long long __b) {
2225 int __cc;
2226 __builtin_s390_vceqgs(__a, __b, &__cc);
2227 return __cc == 0;
2228}
2229
2230static inline __ATTRS_o_ai int
2231vec_all_eq(vector signed long long __a, vector bool long long __b) {
2232 int __cc;
2233 __builtin_s390_vceqgs(__a, (vector signed long long)__b, &__cc);
2234 return __cc == 0;
2235}
2236
2237static inline __ATTRS_o_ai int
2238vec_all_eq(vector bool long long __a, vector signed long long __b) {
2239 int __cc;
2240 __builtin_s390_vceqgs((vector signed long long)__a, __b, &__cc);
2241 return __cc == 0;
2242}
2243
2244static inline __ATTRS_o_ai int
2245vec_all_eq(vector unsigned long long __a, vector unsigned long long __b) {
2246 int __cc;
2247 __builtin_s390_vceqgs((vector signed long long)__a,
2248 (vector signed long long)__b, &__cc);
2249 return __cc == 0;
2250}
2251
2252static inline __ATTRS_o_ai int
2253vec_all_eq(vector unsigned long long __a, vector bool long long __b) {
2254 int __cc;
2255 __builtin_s390_vceqgs((vector signed long long)__a,
2256 (vector signed long long)__b, &__cc);
2257 return __cc == 0;
2258}
2259
2260static inline __ATTRS_o_ai int
2261vec_all_eq(vector bool long long __a, vector unsigned long long __b) {
2262 int __cc;
2263 __builtin_s390_vceqgs((vector signed long long)__a,
2264 (vector signed long long)__b, &__cc);
2265 return __cc == 0;
2266}
2267
2268static inline __ATTRS_o_ai int
2269vec_all_eq(vector bool long long __a, vector bool long long __b) {
2270 int __cc;
2271 __builtin_s390_vceqgs((vector signed long long)__a,
2272 (vector signed long long)__b, &__cc);
2273 return __cc == 0;
2274}
2275
2276static inline __ATTRS_o_ai int
2277vec_all_eq(vector double __a, vector double __b) {
2278 int __cc;
2279 __builtin_s390_vfcedbs(__a, __b, &__cc);
2280 return __cc == 0;
2281}
2282
2283/*-- vec_all_ne -------------------------------------------------------------*/
2284
2285static inline __ATTRS_o_ai int
2286vec_all_ne(vector signed char __a, vector signed char __b) {
2287 int __cc;
2288 __builtin_s390_vceqbs(__a, __b, &__cc);
2289 return __cc == 3;
2290}
2291
2292static inline __ATTRS_o_ai int
2293vec_all_ne(vector signed char __a, vector bool char __b) {
2294 int __cc;
2295 __builtin_s390_vceqbs(__a, (vector signed char)__b, &__cc);
2296 return __cc == 3;
2297}
2298
2299static inline __ATTRS_o_ai int
2300vec_all_ne(vector bool char __a, vector signed char __b) {
2301 int __cc;
2302 __builtin_s390_vceqbs((vector signed char)__a, __b, &__cc);
2303 return __cc == 3;
2304}
2305
2306static inline __ATTRS_o_ai int
2307vec_all_ne(vector unsigned char __a, vector unsigned char __b) {
2308 int __cc;
2309 __builtin_s390_vceqbs((vector signed char)__a,
2310 (vector signed char)__b, &__cc);
2311 return __cc == 3;
2312}
2313
2314static inline __ATTRS_o_ai int
2315vec_all_ne(vector unsigned char __a, vector bool char __b) {
2316 int __cc;
2317 __builtin_s390_vceqbs((vector signed char)__a,
2318 (vector signed char)__b, &__cc);
2319 return __cc == 3;
2320}
2321
2322static inline __ATTRS_o_ai int
2323vec_all_ne(vector bool char __a, vector unsigned char __b) {
2324 int __cc;
2325 __builtin_s390_vceqbs((vector signed char)__a,
2326 (vector signed char)__b, &__cc);
2327 return __cc == 3;
2328}
2329
2330static inline __ATTRS_o_ai int
2331vec_all_ne(vector bool char __a, vector bool char __b) {
2332 int __cc;
2333 __builtin_s390_vceqbs((vector signed char)__a,
2334 (vector signed char)__b, &__cc);
2335 return __cc == 3;
2336}
2337
2338static inline __ATTRS_o_ai int
2339vec_all_ne(vector signed short __a, vector signed short __b) {
2340 int __cc;
2341 __builtin_s390_vceqhs(__a, __b, &__cc);
2342 return __cc == 3;
2343}
2344
2345static inline __ATTRS_o_ai int
2346vec_all_ne(vector signed short __a, vector bool short __b) {
2347 int __cc;
2348 __builtin_s390_vceqhs(__a, (vector signed short)__b, &__cc);
2349 return __cc == 3;
2350}
2351
2352static inline __ATTRS_o_ai int
2353vec_all_ne(vector bool short __a, vector signed short __b) {
2354 int __cc;
2355 __builtin_s390_vceqhs((vector signed short)__a, __b, &__cc);
2356 return __cc == 3;
2357}
2358
2359static inline __ATTRS_o_ai int
2360vec_all_ne(vector unsigned short __a, vector unsigned short __b) {
2361 int __cc;
2362 __builtin_s390_vceqhs((vector signed short)__a,
2363 (vector signed short)__b, &__cc);
2364 return __cc == 3;
2365}
2366
2367static inline __ATTRS_o_ai int
2368vec_all_ne(vector unsigned short __a, vector bool short __b) {
2369 int __cc;
2370 __builtin_s390_vceqhs((vector signed short)__a,
2371 (vector signed short)__b, &__cc);
2372 return __cc == 3;
2373}
2374
2375static inline __ATTRS_o_ai int
2376vec_all_ne(vector bool short __a, vector unsigned short __b) {
2377 int __cc;
2378 __builtin_s390_vceqhs((vector signed short)__a,
2379 (vector signed short)__b, &__cc);
2380 return __cc == 3;
2381}
2382
2383static inline __ATTRS_o_ai int
2384vec_all_ne(vector bool short __a, vector bool short __b) {
2385 int __cc;
2386 __builtin_s390_vceqhs((vector signed short)__a,
2387 (vector signed short)__b, &__cc);
2388 return __cc == 3;
2389}
2390
2391static inline __ATTRS_o_ai int
2392vec_all_ne(vector signed int __a, vector signed int __b) {
2393 int __cc;
2394 __builtin_s390_vceqfs(__a, __b, &__cc);
2395 return __cc == 3;
2396}
2397
2398static inline __ATTRS_o_ai int
2399vec_all_ne(vector signed int __a, vector bool int __b) {
2400 int __cc;
2401 __builtin_s390_vceqfs(__a, (vector signed int)__b, &__cc);
2402 return __cc == 3;
2403}
2404
2405static inline __ATTRS_o_ai int
2406vec_all_ne(vector bool int __a, vector signed int __b) {
2407 int __cc;
2408 __builtin_s390_vceqfs((vector signed int)__a, __b, &__cc);
2409 return __cc == 3;
2410}
2411
2412static inline __ATTRS_o_ai int
2413vec_all_ne(vector unsigned int __a, vector unsigned int __b) {
2414 int __cc;
2415 __builtin_s390_vceqfs((vector signed int)__a,
2416 (vector signed int)__b, &__cc);
2417 return __cc == 3;
2418}
2419
2420static inline __ATTRS_o_ai int
2421vec_all_ne(vector unsigned int __a, vector bool int __b) {
2422 int __cc;
2423 __builtin_s390_vceqfs((vector signed int)__a,
2424 (vector signed int)__b, &__cc);
2425 return __cc == 3;
2426}
2427
2428static inline __ATTRS_o_ai int
2429vec_all_ne(vector bool int __a, vector unsigned int __b) {
2430 int __cc;
2431 __builtin_s390_vceqfs((vector signed int)__a,
2432 (vector signed int)__b, &__cc);
2433 return __cc == 3;
2434}
2435
2436static inline __ATTRS_o_ai int
2437vec_all_ne(vector bool int __a, vector bool int __b) {
2438 int __cc;
2439 __builtin_s390_vceqfs((vector signed int)__a,
2440 (vector signed int)__b, &__cc);
2441 return __cc == 3;
2442}
2443
2444static inline __ATTRS_o_ai int
2445vec_all_ne(vector signed long long __a, vector signed long long __b) {
2446 int __cc;
2447 __builtin_s390_vceqgs(__a, __b, &__cc);
2448 return __cc == 3;
2449}
2450
2451static inline __ATTRS_o_ai int
2452vec_all_ne(vector signed long long __a, vector bool long long __b) {
2453 int __cc;
2454 __builtin_s390_vceqgs(__a, (vector signed long long)__b, &__cc);
2455 return __cc == 3;
2456}
2457
2458static inline __ATTRS_o_ai int
2459vec_all_ne(vector bool long long __a, vector signed long long __b) {
2460 int __cc;
2461 __builtin_s390_vceqgs((vector signed long long)__a, __b, &__cc);
2462 return __cc == 3;
2463}
2464
2465static inline __ATTRS_o_ai int
2466vec_all_ne(vector unsigned long long __a, vector unsigned long long __b) {
2467 int __cc;
2468 __builtin_s390_vceqgs((vector signed long long)__a,
2469 (vector signed long long)__b, &__cc);
2470 return __cc == 3;
2471}
2472
2473static inline __ATTRS_o_ai int
2474vec_all_ne(vector unsigned long long __a, vector bool long long __b) {
2475 int __cc;
2476 __builtin_s390_vceqgs((vector signed long long)__a,
2477 (vector signed long long)__b, &__cc);
2478 return __cc == 3;
2479}
2480
2481static inline __ATTRS_o_ai int
2482vec_all_ne(vector bool long long __a, vector unsigned long long __b) {
2483 int __cc;
2484 __builtin_s390_vceqgs((vector signed long long)__a,
2485 (vector signed long long)__b, &__cc);
2486 return __cc == 3;
2487}
2488
2489static inline __ATTRS_o_ai int
2490vec_all_ne(vector bool long long __a, vector bool long long __b) {
2491 int __cc;
2492 __builtin_s390_vceqgs((vector signed long long)__a,
2493 (vector signed long long)__b, &__cc);
2494 return __cc == 3;
2495}
2496
2497static inline __ATTRS_o_ai int
2498vec_all_ne(vector double __a, vector double __b) {
2499 int __cc;
2500 __builtin_s390_vfcedbs(__a, __b, &__cc);
2501 return __cc == 3;
2502}
2503
2504/*-- vec_all_ge -------------------------------------------------------------*/
2505
2506static inline __ATTRS_o_ai int
2507vec_all_ge(vector signed char __a, vector signed char __b) {
2508 int __cc;
2509 __builtin_s390_vchbs(__b, __a, &__cc);
2510 return __cc == 3;
2511}
2512
2513static inline __ATTRS_o_ai int
2514vec_all_ge(vector signed char __a, vector bool char __b) {
2515 int __cc;
2516 __builtin_s390_vchbs((vector signed char)__b, __a, &__cc);
2517 return __cc == 3;
2518}
2519
2520static inline __ATTRS_o_ai int
2521vec_all_ge(vector bool char __a, vector signed char __b) {
2522 int __cc;
2523 __builtin_s390_vchbs(__b, (vector signed char)__a, &__cc);
2524 return __cc == 3;
2525}
2526
2527static inline __ATTRS_o_ai int
2528vec_all_ge(vector unsigned char __a, vector unsigned char __b) {
2529 int __cc;
2530 __builtin_s390_vchlbs(__b, __a, &__cc);
2531 return __cc == 3;
2532}
2533
2534static inline __ATTRS_o_ai int
2535vec_all_ge(vector unsigned char __a, vector bool char __b) {
2536 int __cc;
2537 __builtin_s390_vchlbs((vector unsigned char)__b, __a, &__cc);
2538 return __cc == 3;
2539}
2540
2541static inline __ATTRS_o_ai int
2542vec_all_ge(vector bool char __a, vector unsigned char __b) {
2543 int __cc;
2544 __builtin_s390_vchlbs(__b, (vector unsigned char)__a, &__cc);
2545 return __cc == 3;
2546}
2547
2548static inline __ATTRS_o_ai int
2549vec_all_ge(vector bool char __a, vector bool char __b) {
2550 int __cc;
2551 __builtin_s390_vchlbs((vector unsigned char)__b,
2552 (vector unsigned char)__a, &__cc);
2553 return __cc == 3;
2554}
2555
2556static inline __ATTRS_o_ai int
2557vec_all_ge(vector signed short __a, vector signed short __b) {
2558 int __cc;
2559 __builtin_s390_vchhs(__b, __a, &__cc);
2560 return __cc == 3;
2561}
2562
2563static inline __ATTRS_o_ai int
2564vec_all_ge(vector signed short __a, vector bool short __b) {
2565 int __cc;
2566 __builtin_s390_vchhs((vector signed short)__b, __a, &__cc);
2567 return __cc == 3;
2568}
2569
2570static inline __ATTRS_o_ai int
2571vec_all_ge(vector bool short __a, vector signed short __b) {
2572 int __cc;
2573 __builtin_s390_vchhs(__b, (vector signed short)__a, &__cc);
2574 return __cc == 3;
2575}
2576
2577static inline __ATTRS_o_ai int
2578vec_all_ge(vector unsigned short __a, vector unsigned short __b) {
2579 int __cc;
2580 __builtin_s390_vchlhs(__b, __a, &__cc);
2581 return __cc == 3;
2582}
2583
2584static inline __ATTRS_o_ai int
2585vec_all_ge(vector unsigned short __a, vector bool short __b) {
2586 int __cc;
2587 __builtin_s390_vchlhs((vector unsigned short)__b, __a, &__cc);
2588 return __cc == 3;
2589}
2590
2591static inline __ATTRS_o_ai int
2592vec_all_ge(vector bool short __a, vector unsigned short __b) {
2593 int __cc;
2594 __builtin_s390_vchlhs(__b, (vector unsigned short)__a, &__cc);
2595 return __cc == 3;
2596}
2597
2598static inline __ATTRS_o_ai int
2599vec_all_ge(vector bool short __a, vector bool short __b) {
2600 int __cc;
2601 __builtin_s390_vchlhs((vector unsigned short)__b,
2602 (vector unsigned short)__a, &__cc);
2603 return __cc == 3;
2604}
2605
2606static inline __ATTRS_o_ai int
2607vec_all_ge(vector signed int __a, vector signed int __b) {
2608 int __cc;
2609 __builtin_s390_vchfs(__b, __a, &__cc);
2610 return __cc == 3;
2611}
2612
2613static inline __ATTRS_o_ai int
2614vec_all_ge(vector signed int __a, vector bool int __b) {
2615 int __cc;
2616 __builtin_s390_vchfs((vector signed int)__b, __a, &__cc);
2617 return __cc == 3;
2618}
2619
2620static inline __ATTRS_o_ai int
2621vec_all_ge(vector bool int __a, vector signed int __b) {
2622 int __cc;
2623 __builtin_s390_vchfs(__b, (vector signed int)__a, &__cc);
2624 return __cc == 3;
2625}
2626
2627static inline __ATTRS_o_ai int
2628vec_all_ge(vector unsigned int __a, vector unsigned int __b) {
2629 int __cc;
2630 __builtin_s390_vchlfs(__b, __a, &__cc);
2631 return __cc == 3;
2632}
2633
2634static inline __ATTRS_o_ai int
2635vec_all_ge(vector unsigned int __a, vector bool int __b) {
2636 int __cc;
2637 __builtin_s390_vchlfs((vector unsigned int)__b, __a, &__cc);
2638 return __cc == 3;
2639}
2640
2641static inline __ATTRS_o_ai int
2642vec_all_ge(vector bool int __a, vector unsigned int __b) {
2643 int __cc;
2644 __builtin_s390_vchlfs(__b, (vector unsigned int)__a, &__cc);
2645 return __cc == 3;
2646}
2647
2648static inline __ATTRS_o_ai int
2649vec_all_ge(vector bool int __a, vector bool int __b) {
2650 int __cc;
2651 __builtin_s390_vchlfs((vector unsigned int)__b,
2652 (vector unsigned int)__a, &__cc);
2653 return __cc == 3;
2654}
2655
2656static inline __ATTRS_o_ai int
2657vec_all_ge(vector signed long long __a, vector signed long long __b) {
2658 int __cc;
2659 __builtin_s390_vchgs(__b, __a, &__cc);
2660 return __cc == 3;
2661}
2662
2663static inline __ATTRS_o_ai int
2664vec_all_ge(vector signed long long __a, vector bool long long __b) {
2665 int __cc;
2666 __builtin_s390_vchgs((vector signed long long)__b, __a, &__cc);
2667 return __cc == 3;
2668}
2669
2670static inline __ATTRS_o_ai int
2671vec_all_ge(vector bool long long __a, vector signed long long __b) {
2672 int __cc;
2673 __builtin_s390_vchgs(__b, (vector signed long long)__a, &__cc);
2674 return __cc == 3;
2675}
2676
2677static inline __ATTRS_o_ai int
2678vec_all_ge(vector unsigned long long __a, vector unsigned long long __b) {
2679 int __cc;
2680 __builtin_s390_vchlgs(__b, __a, &__cc);
2681 return __cc == 3;
2682}
2683
2684static inline __ATTRS_o_ai int
2685vec_all_ge(vector unsigned long long __a, vector bool long long __b) {
2686 int __cc;
2687 __builtin_s390_vchlgs((vector unsigned long long)__b, __a, &__cc);
2688 return __cc == 3;
2689}
2690
2691static inline __ATTRS_o_ai int
2692vec_all_ge(vector bool long long __a, vector unsigned long long __b) {
2693 int __cc;
2694 __builtin_s390_vchlgs(__b, (vector unsigned long long)__a, &__cc);
2695 return __cc == 3;
2696}
2697
2698static inline __ATTRS_o_ai int
2699vec_all_ge(vector bool long long __a, vector bool long long __b) {
2700 int __cc;
2701 __builtin_s390_vchlgs((vector unsigned long long)__b,
2702 (vector unsigned long long)__a, &__cc);
2703 return __cc == 3;
2704}
2705
2706static inline __ATTRS_o_ai int
2707vec_all_ge(vector double __a, vector double __b) {
2708 int __cc;
2709 __builtin_s390_vfchedbs(__a, __b, &__cc);
2710 return __cc == 0;
2711}
2712
2713/*-- vec_all_gt -------------------------------------------------------------*/
2714
2715static inline __ATTRS_o_ai int
2716vec_all_gt(vector signed char __a, vector signed char __b) {
2717 int __cc;
2718 __builtin_s390_vchbs(__a, __b, &__cc);
2719 return __cc == 0;
2720}
2721
2722static inline __ATTRS_o_ai int
2723vec_all_gt(vector signed char __a, vector bool char __b) {
2724 int __cc;
2725 __builtin_s390_vchbs(__a, (vector signed char)__b, &__cc);
2726 return __cc == 0;
2727}
2728
2729static inline __ATTRS_o_ai int
2730vec_all_gt(vector bool char __a, vector signed char __b) {
2731 int __cc;
2732 __builtin_s390_vchbs((vector signed char)__a, __b, &__cc);
2733 return __cc == 0;
2734}
2735
2736static inline __ATTRS_o_ai int
2737vec_all_gt(vector unsigned char __a, vector unsigned char __b) {
2738 int __cc;
2739 __builtin_s390_vchlbs(__a, __b, &__cc);
2740 return __cc == 0;
2741}
2742
2743static inline __ATTRS_o_ai int
2744vec_all_gt(vector unsigned char __a, vector bool char __b) {
2745 int __cc;
2746 __builtin_s390_vchlbs(__a, (vector unsigned char)__b, &__cc);
2747 return __cc == 0;
2748}
2749
2750static inline __ATTRS_o_ai int
2751vec_all_gt(vector bool char __a, vector unsigned char __b) {
2752 int __cc;
2753 __builtin_s390_vchlbs((vector unsigned char)__a, __b, &__cc);
2754 return __cc == 0;
2755}
2756
2757static inline __ATTRS_o_ai int
2758vec_all_gt(vector bool char __a, vector bool char __b) {
2759 int __cc;
2760 __builtin_s390_vchlbs((vector unsigned char)__a,
2761 (vector unsigned char)__b, &__cc);
2762 return __cc == 0;
2763}
2764
2765static inline __ATTRS_o_ai int
2766vec_all_gt(vector signed short __a, vector signed short __b) {
2767 int __cc;
2768 __builtin_s390_vchhs(__a, __b, &__cc);
2769 return __cc == 0;
2770}
2771
2772static inline __ATTRS_o_ai int
2773vec_all_gt(vector signed short __a, vector bool short __b) {
2774 int __cc;
2775 __builtin_s390_vchhs(__a, (vector signed short)__b, &__cc);
2776 return __cc == 0;
2777}
2778
2779static inline __ATTRS_o_ai int
2780vec_all_gt(vector bool short __a, vector signed short __b) {
2781 int __cc;
2782 __builtin_s390_vchhs((vector signed short)__a, __b, &__cc);
2783 return __cc == 0;
2784}
2785
2786static inline __ATTRS_o_ai int
2787vec_all_gt(vector unsigned short __a, vector unsigned short __b) {
2788 int __cc;
2789 __builtin_s390_vchlhs(__a, __b, &__cc);
2790 return __cc == 0;
2791}
2792
2793static inline __ATTRS_o_ai int
2794vec_all_gt(vector unsigned short __a, vector bool short __b) {
2795 int __cc;
2796 __builtin_s390_vchlhs(__a, (vector unsigned short)__b, &__cc);
2797 return __cc == 0;
2798}
2799
2800static inline __ATTRS_o_ai int
2801vec_all_gt(vector bool short __a, vector unsigned short __b) {
2802 int __cc;
2803 __builtin_s390_vchlhs((vector unsigned short)__a, __b, &__cc);
2804 return __cc == 0;
2805}
2806
2807static inline __ATTRS_o_ai int
2808vec_all_gt(vector bool short __a, vector bool short __b) {
2809 int __cc;
2810 __builtin_s390_vchlhs((vector unsigned short)__a,
2811 (vector unsigned short)__b, &__cc);
2812 return __cc == 0;
2813}
2814
2815static inline __ATTRS_o_ai int
2816vec_all_gt(vector signed int __a, vector signed int __b) {
2817 int __cc;
2818 __builtin_s390_vchfs(__a, __b, &__cc);
2819 return __cc == 0;
2820}
2821
2822static inline __ATTRS_o_ai int
2823vec_all_gt(vector signed int __a, vector bool int __b) {
2824 int __cc;
2825 __builtin_s390_vchfs(__a, (vector signed int)__b, &__cc);
2826 return __cc == 0;
2827}
2828
2829static inline __ATTRS_o_ai int
2830vec_all_gt(vector bool int __a, vector signed int __b) {
2831 int __cc;
2832 __builtin_s390_vchfs((vector signed int)__a, __b, &__cc);
2833 return __cc == 0;
2834}
2835
2836static inline __ATTRS_o_ai int
2837vec_all_gt(vector unsigned int __a, vector unsigned int __b) {
2838 int __cc;
2839 __builtin_s390_vchlfs(__a, __b, &__cc);
2840 return __cc == 0;
2841}
2842
2843static inline __ATTRS_o_ai int
2844vec_all_gt(vector unsigned int __a, vector bool int __b) {
2845 int __cc;
2846 __builtin_s390_vchlfs(__a, (vector unsigned int)__b, &__cc);
2847 return __cc == 0;
2848}
2849
2850static inline __ATTRS_o_ai int
2851vec_all_gt(vector bool int __a, vector unsigned int __b) {
2852 int __cc;
2853 __builtin_s390_vchlfs((vector unsigned int)__a, __b, &__cc);
2854 return __cc == 0;
2855}
2856
2857static inline __ATTRS_o_ai int
2858vec_all_gt(vector bool int __a, vector bool int __b) {
2859 int __cc;
2860 __builtin_s390_vchlfs((vector unsigned int)__a,
2861 (vector unsigned int)__b, &__cc);
2862 return __cc == 0;
2863}
2864
2865static inline __ATTRS_o_ai int
2866vec_all_gt(vector signed long long __a, vector signed long long __b) {
2867 int __cc;
2868 __builtin_s390_vchgs(__a, __b, &__cc);
2869 return __cc == 0;
2870}
2871
2872static inline __ATTRS_o_ai int
2873vec_all_gt(vector signed long long __a, vector bool long long __b) {
2874 int __cc;
2875 __builtin_s390_vchgs(__a, (vector signed long long)__b, &__cc);
2876 return __cc == 0;
2877}
2878
2879static inline __ATTRS_o_ai int
2880vec_all_gt(vector bool long long __a, vector signed long long __b) {
2881 int __cc;
2882 __builtin_s390_vchgs((vector signed long long)__a, __b, &__cc);
2883 return __cc == 0;
2884}
2885
2886static inline __ATTRS_o_ai int
2887vec_all_gt(vector unsigned long long __a, vector unsigned long long __b) {
2888 int __cc;
2889 __builtin_s390_vchlgs(__a, __b, &__cc);
2890 return __cc == 0;
2891}
2892
2893static inline __ATTRS_o_ai int
2894vec_all_gt(vector unsigned long long __a, vector bool long long __b) {
2895 int __cc;
2896 __builtin_s390_vchlgs(__a, (vector unsigned long long)__b, &__cc);
2897 return __cc == 0;
2898}
2899
2900static inline __ATTRS_o_ai int
2901vec_all_gt(vector bool long long __a, vector unsigned long long __b) {
2902 int __cc;
2903 __builtin_s390_vchlgs((vector unsigned long long)__a, __b, &__cc);
2904 return __cc == 0;
2905}
2906
2907static inline __ATTRS_o_ai int
2908vec_all_gt(vector bool long long __a, vector bool long long __b) {
2909 int __cc;
2910 __builtin_s390_vchlgs((vector unsigned long long)__a,
2911 (vector unsigned long long)__b, &__cc);
2912 return __cc == 0;
2913}
2914
2915static inline __ATTRS_o_ai int
2916vec_all_gt(vector double __a, vector double __b) {
2917 int __cc;
2918 __builtin_s390_vfchdbs(__a, __b, &__cc);
2919 return __cc == 0;
2920}
2921
2922/*-- vec_all_le -------------------------------------------------------------*/
2923
2924static inline __ATTRS_o_ai int
2925vec_all_le(vector signed char __a, vector signed char __b) {
2926 int __cc;
2927 __builtin_s390_vchbs(__a, __b, &__cc);
2928 return __cc == 3;
2929}
2930
2931static inline __ATTRS_o_ai int
2932vec_all_le(vector signed char __a, vector bool char __b) {
2933 int __cc;
2934 __builtin_s390_vchbs(__a, (vector signed char)__b, &__cc);
2935 return __cc == 3;
2936}
2937
2938static inline __ATTRS_o_ai int
2939vec_all_le(vector bool char __a, vector signed char __b) {
2940 int __cc;
2941 __builtin_s390_vchbs((vector signed char)__a, __b, &__cc);
2942 return __cc == 3;
2943}
2944
2945static inline __ATTRS_o_ai int
2946vec_all_le(vector unsigned char __a, vector unsigned char __b) {
2947 int __cc;
2948 __builtin_s390_vchlbs(__a, __b, &__cc);
2949 return __cc == 3;
2950}
2951
2952static inline __ATTRS_o_ai int
2953vec_all_le(vector unsigned char __a, vector bool char __b) {
2954 int __cc;
2955 __builtin_s390_vchlbs(__a, (vector unsigned char)__b, &__cc);
2956 return __cc == 3;
2957}
2958
2959static inline __ATTRS_o_ai int
2960vec_all_le(vector bool char __a, vector unsigned char __b) {
2961 int __cc;
2962 __builtin_s390_vchlbs((vector unsigned char)__a, __b, &__cc);
2963 return __cc == 3;
2964}
2965
2966static inline __ATTRS_o_ai int
2967vec_all_le(vector bool char __a, vector bool char __b) {
2968 int __cc;
2969 __builtin_s390_vchlbs((vector unsigned char)__a,
2970 (vector unsigned char)__b, &__cc);
2971 return __cc == 3;
2972}
2973
2974static inline __ATTRS_o_ai int
2975vec_all_le(vector signed short __a, vector signed short __b) {
2976 int __cc;
2977 __builtin_s390_vchhs(__a, __b, &__cc);
2978 return __cc == 3;
2979}
2980
2981static inline __ATTRS_o_ai int
2982vec_all_le(vector signed short __a, vector bool short __b) {
2983 int __cc;
2984 __builtin_s390_vchhs(__a, (vector signed short)__b, &__cc);
2985 return __cc == 3;
2986}
2987
2988static inline __ATTRS_o_ai int
2989vec_all_le(vector bool short __a, vector signed short __b) {
2990 int __cc;
2991 __builtin_s390_vchhs((vector signed short)__a, __b, &__cc);
2992 return __cc == 3;
2993}
2994
2995static inline __ATTRS_o_ai int
2996vec_all_le(vector unsigned short __a, vector unsigned short __b) {
2997 int __cc;
2998 __builtin_s390_vchlhs(__a, __b, &__cc);
2999 return __cc == 3;
3000}
3001
3002static inline __ATTRS_o_ai int
3003vec_all_le(vector unsigned short __a, vector bool short __b) {
3004 int __cc;
3005 __builtin_s390_vchlhs(__a, (vector unsigned short)__b, &__cc);
3006 return __cc == 3;
3007}
3008
3009static inline __ATTRS_o_ai int
3010vec_all_le(vector bool short __a, vector unsigned short __b) {
3011 int __cc;
3012 __builtin_s390_vchlhs((vector unsigned short)__a, __b, &__cc);
3013 return __cc == 3;
3014}
3015
3016static inline __ATTRS_o_ai int
3017vec_all_le(vector bool short __a, vector bool short __b) {
3018 int __cc;
3019 __builtin_s390_vchlhs((vector unsigned short)__a,
3020 (vector unsigned short)__b, &__cc);
3021 return __cc == 3;
3022}
3023
3024static inline __ATTRS_o_ai int
3025vec_all_le(vector signed int __a, vector signed int __b) {
3026 int __cc;
3027 __builtin_s390_vchfs(__a, __b, &__cc);
3028 return __cc == 3;
3029}
3030
3031static inline __ATTRS_o_ai int
3032vec_all_le(vector signed int __a, vector bool int __b) {
3033 int __cc;
3034 __builtin_s390_vchfs(__a, (vector signed int)__b, &__cc);
3035 return __cc == 3;
3036}
3037
3038static inline __ATTRS_o_ai int
3039vec_all_le(vector bool int __a, vector signed int __b) {
3040 int __cc;
3041 __builtin_s390_vchfs((vector signed int)__a, __b, &__cc);
3042 return __cc == 3;
3043}
3044
3045static inline __ATTRS_o_ai int
3046vec_all_le(vector unsigned int __a, vector unsigned int __b) {
3047 int __cc;
3048 __builtin_s390_vchlfs(__a, __b, &__cc);
3049 return __cc == 3;
3050}
3051
3052static inline __ATTRS_o_ai int
3053vec_all_le(vector unsigned int __a, vector bool int __b) {
3054 int __cc;
3055 __builtin_s390_vchlfs(__a, (vector unsigned int)__b, &__cc);
3056 return __cc == 3;
3057}
3058
3059static inline __ATTRS_o_ai int
3060vec_all_le(vector bool int __a, vector unsigned int __b) {
3061 int __cc;
3062 __builtin_s390_vchlfs((vector unsigned int)__a, __b, &__cc);
3063 return __cc == 3;
3064}
3065
3066static inline __ATTRS_o_ai int
3067vec_all_le(vector bool int __a, vector bool int __b) {
3068 int __cc;
3069 __builtin_s390_vchlfs((vector unsigned int)__a,
3070 (vector unsigned int)__b, &__cc);
3071 return __cc == 3;
3072}
3073
3074static inline __ATTRS_o_ai int
3075vec_all_le(vector signed long long __a, vector signed long long __b) {
3076 int __cc;
3077 __builtin_s390_vchgs(__a, __b, &__cc);
3078 return __cc == 3;
3079}
3080
3081static inline __ATTRS_o_ai int
3082vec_all_le(vector signed long long __a, vector bool long long __b) {
3083 int __cc;
3084 __builtin_s390_vchgs(__a, (vector signed long long)__b, &__cc);
3085 return __cc == 3;
3086}
3087
3088static inline __ATTRS_o_ai int
3089vec_all_le(vector bool long long __a, vector signed long long __b) {
3090 int __cc;
3091 __builtin_s390_vchgs((vector signed long long)__a, __b, &__cc);
3092 return __cc == 3;
3093}
3094
3095static inline __ATTRS_o_ai int
3096vec_all_le(vector unsigned long long __a, vector unsigned long long __b) {
3097 int __cc;
3098 __builtin_s390_vchlgs(__a, __b, &__cc);
3099 return __cc == 3;
3100}
3101
3102static inline __ATTRS_o_ai int
3103vec_all_le(vector unsigned long long __a, vector bool long long __b) {
3104 int __cc;
3105 __builtin_s390_vchlgs(__a, (vector unsigned long long)__b, &__cc);
3106 return __cc == 3;
3107}
3108
3109static inline __ATTRS_o_ai int
3110vec_all_le(vector bool long long __a, vector unsigned long long __b) {
3111 int __cc;
3112 __builtin_s390_vchlgs((vector unsigned long long)__a, __b, &__cc);
3113 return __cc == 3;
3114}
3115
3116static inline __ATTRS_o_ai int
3117vec_all_le(vector bool long long __a, vector bool long long __b) {
3118 int __cc;
3119 __builtin_s390_vchlgs((vector unsigned long long)__a,
3120 (vector unsigned long long)__b, &__cc);
3121 return __cc == 3;
3122}
3123
3124static inline __ATTRS_o_ai int
3125vec_all_le(vector double __a, vector double __b) {
3126 int __cc;
3127 __builtin_s390_vfchedbs(__b, __a, &__cc);
3128 return __cc == 0;
3129}
3130
3131/*-- vec_all_lt -------------------------------------------------------------*/
3132
3133static inline __ATTRS_o_ai int
3134vec_all_lt(vector signed char __a, vector signed char __b) {
3135 int __cc;
3136 __builtin_s390_vchbs(__b, __a, &__cc);
3137 return __cc == 0;
3138}
3139
3140static inline __ATTRS_o_ai int
3141vec_all_lt(vector signed char __a, vector bool char __b) {
3142 int __cc;
3143 __builtin_s390_vchbs((vector signed char)__b, __a, &__cc);
3144 return __cc == 0;
3145}
3146
3147static inline __ATTRS_o_ai int
3148vec_all_lt(vector bool char __a, vector signed char __b) {
3149 int __cc;
3150 __builtin_s390_vchbs(__b, (vector signed char)__a, &__cc);
3151 return __cc == 0;
3152}
3153
3154static inline __ATTRS_o_ai int
3155vec_all_lt(vector unsigned char __a, vector unsigned char __b) {
3156 int __cc;
3157 __builtin_s390_vchlbs(__b, __a, &__cc);
3158 return __cc == 0;
3159}
3160
3161static inline __ATTRS_o_ai int
3162vec_all_lt(vector unsigned char __a, vector bool char __b) {
3163 int __cc;
3164 __builtin_s390_vchlbs((vector unsigned char)__b, __a, &__cc);
3165 return __cc == 0;
3166}
3167
3168static inline __ATTRS_o_ai int
3169vec_all_lt(vector bool char __a, vector unsigned char __b) {
3170 int __cc;
3171 __builtin_s390_vchlbs(__b, (vector unsigned char)__a, &__cc);
3172 return __cc == 0;
3173}
3174
3175static inline __ATTRS_o_ai int
3176vec_all_lt(vector bool char __a, vector bool char __b) {
3177 int __cc;
3178 __builtin_s390_vchlbs((vector unsigned char)__b,
3179 (vector unsigned char)__a, &__cc);
3180 return __cc == 0;
3181}
3182
3183static inline __ATTRS_o_ai int
3184vec_all_lt(vector signed short __a, vector signed short __b) {
3185 int __cc;
3186 __builtin_s390_vchhs(__b, __a, &__cc);
3187 return __cc == 0;
3188}
3189
3190static inline __ATTRS_o_ai int
3191vec_all_lt(vector signed short __a, vector bool short __b) {
3192 int __cc;
3193 __builtin_s390_vchhs((vector signed short)__b, __a, &__cc);
3194 return __cc == 0;
3195}
3196
3197static inline __ATTRS_o_ai int
3198vec_all_lt(vector bool short __a, vector signed short __b) {
3199 int __cc;
3200 __builtin_s390_vchhs(__b, (vector signed short)__a, &__cc);
3201 return __cc == 0;
3202}
3203
3204static inline __ATTRS_o_ai int
3205vec_all_lt(vector unsigned short __a, vector unsigned short __b) {
3206 int __cc;
3207 __builtin_s390_vchlhs(__b, __a, &__cc);
3208 return __cc == 0;
3209}
3210
3211static inline __ATTRS_o_ai int
3212vec_all_lt(vector unsigned short __a, vector bool short __b) {
3213 int __cc;
3214 __builtin_s390_vchlhs((vector unsigned short)__b, __a, &__cc);
3215 return __cc == 0;
3216}
3217
3218static inline __ATTRS_o_ai int
3219vec_all_lt(vector bool short __a, vector unsigned short __b) {
3220 int __cc;
3221 __builtin_s390_vchlhs(__b, (vector unsigned short)__a, &__cc);
3222 return __cc == 0;
3223}
3224
3225static inline __ATTRS_o_ai int
3226vec_all_lt(vector bool short __a, vector bool short __b) {
3227 int __cc;
3228 __builtin_s390_vchlhs((vector unsigned short)__b,
3229 (vector unsigned short)__a, &__cc);
3230 return __cc == 0;
3231}
3232
3233static inline __ATTRS_o_ai int
3234vec_all_lt(vector signed int __a, vector signed int __b) {
3235 int __cc;
3236 __builtin_s390_vchfs(__b, __a, &__cc);
3237 return __cc == 0;
3238}
3239
3240static inline __ATTRS_o_ai int
3241vec_all_lt(vector signed int __a, vector bool int __b) {
3242 int __cc;
3243 __builtin_s390_vchfs((vector signed int)__b, __a, &__cc);
3244 return __cc == 0;
3245}
3246
3247static inline __ATTRS_o_ai int
3248vec_all_lt(vector bool int __a, vector signed int __b) {
3249 int __cc;
3250 __builtin_s390_vchfs(__b, (vector signed int)__a, &__cc);
3251 return __cc == 0;
3252}
3253
3254static inline __ATTRS_o_ai int
3255vec_all_lt(vector unsigned int __a, vector unsigned int __b) {
3256 int __cc;
3257 __builtin_s390_vchlfs(__b, __a, &__cc);
3258 return __cc == 0;
3259}
3260
3261static inline __ATTRS_o_ai int
3262vec_all_lt(vector unsigned int __a, vector bool int __b) {
3263 int __cc;
3264 __builtin_s390_vchlfs((vector unsigned int)__b, __a, &__cc);
3265 return __cc == 0;
3266}
3267
3268static inline __ATTRS_o_ai int
3269vec_all_lt(vector bool int __a, vector unsigned int __b) {
3270 int __cc;
3271 __builtin_s390_vchlfs(__b, (vector unsigned int)__a, &__cc);
3272 return __cc == 0;
3273}
3274
3275static inline __ATTRS_o_ai int
3276vec_all_lt(vector bool int __a, vector bool int __b) {
3277 int __cc;
3278 __builtin_s390_vchlfs((vector unsigned int)__b,
3279 (vector unsigned int)__a, &__cc);
3280 return __cc == 0;
3281}
3282
3283static inline __ATTRS_o_ai int
3284vec_all_lt(vector signed long long __a, vector signed long long __b) {
3285 int __cc;
3286 __builtin_s390_vchgs(__b, __a, &__cc);
3287 return __cc == 0;
3288}
3289
3290static inline __ATTRS_o_ai int
3291vec_all_lt(vector signed long long __a, vector bool long long __b) {
3292 int __cc;
3293 __builtin_s390_vchgs((vector signed long long)__b, __a, &__cc);
3294 return __cc == 0;
3295}
3296
3297static inline __ATTRS_o_ai int
3298vec_all_lt(vector bool long long __a, vector signed long long __b) {
3299 int __cc;
3300 __builtin_s390_vchgs(__b, (vector signed long long)__a, &__cc);
3301 return __cc == 0;
3302}
3303
3304static inline __ATTRS_o_ai int
3305vec_all_lt(vector unsigned long long __a, vector unsigned long long __b) {
3306 int __cc;
3307 __builtin_s390_vchlgs(__b, __a, &__cc);
3308 return __cc == 0;
3309}
3310
3311static inline __ATTRS_o_ai int
3312vec_all_lt(vector unsigned long long __a, vector bool long long __b) {
3313 int __cc;
3314 __builtin_s390_vchlgs((vector unsigned long long)__b, __a, &__cc);
3315 return __cc == 0;
3316}
3317
3318static inline __ATTRS_o_ai int
3319vec_all_lt(vector bool long long __a, vector unsigned long long __b) {
3320 int __cc;
3321 __builtin_s390_vchlgs(__b, (vector unsigned long long)__a, &__cc);
3322 return __cc == 0;
3323}
3324
3325static inline __ATTRS_o_ai int
3326vec_all_lt(vector bool long long __a, vector bool long long __b) {
3327 int __cc;
3328 __builtin_s390_vchlgs((vector unsigned long long)__b,
3329 (vector unsigned long long)__a, &__cc);
3330 return __cc == 0;
3331}
3332
3333static inline __ATTRS_o_ai int
3334vec_all_lt(vector double __a, vector double __b) {
3335 int __cc;
3336 __builtin_s390_vfchdbs(__b, __a, &__cc);
3337 return __cc == 0;
3338}
3339
3340/*-- vec_all_nge ------------------------------------------------------------*/
3341
3342static inline __ATTRS_ai int
3343vec_all_nge(vector double __a, vector double __b) {
3344 int __cc;
3345 __builtin_s390_vfchedbs(__a, __b, &__cc);
3346 return __cc == 3;
3347}
3348
3349/*-- vec_all_ngt ------------------------------------------------------------*/
3350
3351static inline __ATTRS_ai int
3352vec_all_ngt(vector double __a, vector double __b) {
3353 int __cc;
3354 __builtin_s390_vfchdbs(__a, __b, &__cc);
3355 return __cc == 3;
3356}
3357
3358/*-- vec_all_nle ------------------------------------------------------------*/
3359
3360static inline __ATTRS_ai int
3361vec_all_nle(vector double __a, vector double __b) {
3362 int __cc;
3363 __builtin_s390_vfchedbs(__b, __a, &__cc);
3364 return __cc == 3;
3365}
3366
3367/*-- vec_all_nlt ------------------------------------------------------------*/
3368
3369static inline __ATTRS_ai int
3370vec_all_nlt(vector double __a, vector double __b) {
3371 int __cc;
3372 __builtin_s390_vfchdbs(__b, __a, &__cc);
3373 return __cc == 3;
3374}
3375
3376/*-- vec_all_nan ------------------------------------------------------------*/
3377
3378static inline __ATTRS_ai int
3379vec_all_nan(vector double __a) {
3380 int __cc;
3381 __builtin_s390_vftcidb(__a, 15, &__cc);
3382 return __cc == 0;
3383}
3384
3385/*-- vec_all_numeric --------------------------------------------------------*/
3386
3387static inline __ATTRS_ai int
3388vec_all_numeric(vector double __a) {
3389 int __cc;
3390 __builtin_s390_vftcidb(__a, 15, &__cc);
3391 return __cc == 3;
3392}
3393
3394/*-- vec_any_eq -------------------------------------------------------------*/
3395
3396static inline __ATTRS_o_ai int
3397vec_any_eq(vector signed char __a, vector signed char __b) {
3398 int __cc;
3399 __builtin_s390_vceqbs(__a, __b, &__cc);
3400 return __cc <= 1;
3401}
3402
3403static inline __ATTRS_o_ai int
3404vec_any_eq(vector signed char __a, vector bool char __b) {
3405 int __cc;
3406 __builtin_s390_vceqbs(__a, (vector signed char)__b, &__cc);
3407 return __cc <= 1;
3408}
3409
3410static inline __ATTRS_o_ai int
3411vec_any_eq(vector bool char __a, vector signed char __b) {
3412 int __cc;
3413 __builtin_s390_vceqbs((vector signed char)__a, __b, &__cc);
3414 return __cc <= 1;
3415}
3416
3417static inline __ATTRS_o_ai int
3418vec_any_eq(vector unsigned char __a, vector unsigned char __b) {
3419 int __cc;
3420 __builtin_s390_vceqbs((vector signed char)__a,
3421 (vector signed char)__b, &__cc);
3422 return __cc <= 1;
3423}
3424
3425static inline __ATTRS_o_ai int
3426vec_any_eq(vector unsigned char __a, vector bool char __b) {
3427 int __cc;
3428 __builtin_s390_vceqbs((vector signed char)__a,
3429 (vector signed char)__b, &__cc);
3430 return __cc <= 1;
3431}
3432
3433static inline __ATTRS_o_ai int
3434vec_any_eq(vector bool char __a, vector unsigned char __b) {
3435 int __cc;
3436 __builtin_s390_vceqbs((vector signed char)__a,
3437 (vector signed char)__b, &__cc);
3438 return __cc <= 1;
3439}
3440
3441static inline __ATTRS_o_ai int
3442vec_any_eq(vector bool char __a, vector bool char __b) {
3443 int __cc;
3444 __builtin_s390_vceqbs((vector signed char)__a,
3445 (vector signed char)__b, &__cc);
3446 return __cc <= 1;
3447}
3448
3449static inline __ATTRS_o_ai int
3450vec_any_eq(vector signed short __a, vector signed short __b) {
3451 int __cc;
3452 __builtin_s390_vceqhs(__a, __b, &__cc);
3453 return __cc <= 1;
3454}
3455
3456static inline __ATTRS_o_ai int
3457vec_any_eq(vector signed short __a, vector bool short __b) {
3458 int __cc;
3459 __builtin_s390_vceqhs(__a, (vector signed short)__b, &__cc);
3460 return __cc <= 1;
3461}
3462
3463static inline __ATTRS_o_ai int
3464vec_any_eq(vector bool short __a, vector signed short __b) {
3465 int __cc;
3466 __builtin_s390_vceqhs((vector signed short)__a, __b, &__cc);
3467 return __cc <= 1;
3468}
3469
3470static inline __ATTRS_o_ai int
3471vec_any_eq(vector unsigned short __a, vector unsigned short __b) {
3472 int __cc;
3473 __builtin_s390_vceqhs((vector signed short)__a,
3474 (vector signed short)__b, &__cc);
3475 return __cc <= 1;
3476}
3477
3478static inline __ATTRS_o_ai int
3479vec_any_eq(vector unsigned short __a, vector bool short __b) {
3480 int __cc;
3481 __builtin_s390_vceqhs((vector signed short)__a,
3482 (vector signed short)__b, &__cc);
3483 return __cc <= 1;
3484}
3485
3486static inline __ATTRS_o_ai int
3487vec_any_eq(vector bool short __a, vector unsigned short __b) {
3488 int __cc;
3489 __builtin_s390_vceqhs((vector signed short)__a,
3490 (vector signed short)__b, &__cc);
3491 return __cc <= 1;
3492}
3493
3494static inline __ATTRS_o_ai int
3495vec_any_eq(vector bool short __a, vector bool short __b) {
3496 int __cc;
3497 __builtin_s390_vceqhs((vector signed short)__a,
3498 (vector signed short)__b, &__cc);
3499 return __cc <= 1;
3500}
3501
3502static inline __ATTRS_o_ai int
3503vec_any_eq(vector signed int __a, vector signed int __b) {
3504 int __cc;
3505 __builtin_s390_vceqfs(__a, __b, &__cc);
3506 return __cc <= 1;
3507}
3508
3509static inline __ATTRS_o_ai int
3510vec_any_eq(vector signed int __a, vector bool int __b) {
3511 int __cc;
3512 __builtin_s390_vceqfs(__a, (vector signed int)__b, &__cc);
3513 return __cc <= 1;
3514}
3515
3516static inline __ATTRS_o_ai int
3517vec_any_eq(vector bool int __a, vector signed int __b) {
3518 int __cc;
3519 __builtin_s390_vceqfs((vector signed int)__a, __b, &__cc);
3520 return __cc <= 1;
3521}
3522
3523static inline __ATTRS_o_ai int
3524vec_any_eq(vector unsigned int __a, vector unsigned int __b) {
3525 int __cc;
3526 __builtin_s390_vceqfs((vector signed int)__a,
3527 (vector signed int)__b, &__cc);
3528 return __cc <= 1;
3529}
3530
3531static inline __ATTRS_o_ai int
3532vec_any_eq(vector unsigned int __a, vector bool int __b) {
3533 int __cc;
3534 __builtin_s390_vceqfs((vector signed int)__a,
3535 (vector signed int)__b, &__cc);
3536 return __cc <= 1;
3537}
3538
3539static inline __ATTRS_o_ai int
3540vec_any_eq(vector bool int __a, vector unsigned int __b) {
3541 int __cc;
3542 __builtin_s390_vceqfs((vector signed int)__a,
3543 (vector signed int)__b, &__cc);
3544 return __cc <= 1;
3545}
3546
3547static inline __ATTRS_o_ai int
3548vec_any_eq(vector bool int __a, vector bool int __b) {
3549 int __cc;
3550 __builtin_s390_vceqfs((vector signed int)__a,
3551 (vector signed int)__b, &__cc);
3552 return __cc <= 1;
3553}
3554
3555static inline __ATTRS_o_ai int
3556vec_any_eq(vector signed long long __a, vector signed long long __b) {
3557 int __cc;
3558 __builtin_s390_vceqgs(__a, __b, &__cc);
3559 return __cc <= 1;
3560}
3561
3562static inline __ATTRS_o_ai int
3563vec_any_eq(vector signed long long __a, vector bool long long __b) {
3564 int __cc;
3565 __builtin_s390_vceqgs(__a, (vector signed long long)__b, &__cc);
3566 return __cc <= 1;
3567}
3568
3569static inline __ATTRS_o_ai int
3570vec_any_eq(vector bool long long __a, vector signed long long __b) {
3571 int __cc;
3572 __builtin_s390_vceqgs((vector signed long long)__a, __b, &__cc);
3573 return __cc <= 1;
3574}
3575
3576static inline __ATTRS_o_ai int
3577vec_any_eq(vector unsigned long long __a, vector unsigned long long __b) {
3578 int __cc;
3579 __builtin_s390_vceqgs((vector signed long long)__a,
3580 (vector signed long long)__b, &__cc);
3581 return __cc <= 1;
3582}
3583
3584static inline __ATTRS_o_ai int
3585vec_any_eq(vector unsigned long long __a, vector bool long long __b) {
3586 int __cc;
3587 __builtin_s390_vceqgs((vector signed long long)__a,
3588 (vector signed long long)__b, &__cc);
3589 return __cc <= 1;
3590}
3591
3592static inline __ATTRS_o_ai int
3593vec_any_eq(vector bool long long __a, vector unsigned long long __b) {
3594 int __cc;
3595 __builtin_s390_vceqgs((vector signed long long)__a,
3596 (vector signed long long)__b, &__cc);
3597 return __cc <= 1;
3598}
3599
3600static inline __ATTRS_o_ai int
3601vec_any_eq(vector bool long long __a, vector bool long long __b) {
3602 int __cc;
3603 __builtin_s390_vceqgs((vector signed long long)__a,
3604 (vector signed long long)__b, &__cc);
3605 return __cc <= 1;
3606}
3607
3608static inline __ATTRS_o_ai int
3609vec_any_eq(vector double __a, vector double __b) {
3610 int __cc;
3611 __builtin_s390_vfcedbs(__a, __b, &__cc);
3612 return __cc <= 1;
3613}
3614
3615/*-- vec_any_ne -------------------------------------------------------------*/
3616
3617static inline __ATTRS_o_ai int
3618vec_any_ne(vector signed char __a, vector signed char __b) {
3619 int __cc;
3620 __builtin_s390_vceqbs(__a, __b, &__cc);
3621 return __cc != 0;
3622}
3623
3624static inline __ATTRS_o_ai int
3625vec_any_ne(vector signed char __a, vector bool char __b) {
3626 int __cc;
3627 __builtin_s390_vceqbs(__a, (vector signed char)__b, &__cc);
3628 return __cc != 0;
3629}
3630
3631static inline __ATTRS_o_ai int
3632vec_any_ne(vector bool char __a, vector signed char __b) {
3633 int __cc;
3634 __builtin_s390_vceqbs((vector signed char)__a, __b, &__cc);
3635 return __cc != 0;
3636}
3637
3638static inline __ATTRS_o_ai int
3639vec_any_ne(vector unsigned char __a, vector unsigned char __b) {
3640 int __cc;
3641 __builtin_s390_vceqbs((vector signed char)__a,
3642 (vector signed char)__b, &__cc);
3643 return __cc != 0;
3644}
3645
3646static inline __ATTRS_o_ai int
3647vec_any_ne(vector unsigned char __a, vector bool char __b) {
3648 int __cc;
3649 __builtin_s390_vceqbs((vector signed char)__a,
3650 (vector signed char)__b, &__cc);
3651 return __cc != 0;
3652}
3653
3654static inline __ATTRS_o_ai int
3655vec_any_ne(vector bool char __a, vector unsigned char __b) {
3656 int __cc;
3657 __builtin_s390_vceqbs((vector signed char)__a,
3658 (vector signed char)__b, &__cc);
3659 return __cc != 0;
3660}
3661
3662static inline __ATTRS_o_ai int
3663vec_any_ne(vector bool char __a, vector bool char __b) {
3664 int __cc;
3665 __builtin_s390_vceqbs((vector signed char)__a,
3666 (vector signed char)__b, &__cc);
3667 return __cc != 0;
3668}
3669
3670static inline __ATTRS_o_ai int
3671vec_any_ne(vector signed short __a, vector signed short __b) {
3672 int __cc;
3673 __builtin_s390_vceqhs(__a, __b, &__cc);
3674 return __cc != 0;
3675}
3676
3677static inline __ATTRS_o_ai int
3678vec_any_ne(vector signed short __a, vector bool short __b) {
3679 int __cc;
3680 __builtin_s390_vceqhs(__a, (vector signed short)__b, &__cc);
3681 return __cc != 0;
3682}
3683
3684static inline __ATTRS_o_ai int
3685vec_any_ne(vector bool short __a, vector signed short __b) {
3686 int __cc;
3687 __builtin_s390_vceqhs((vector signed short)__a, __b, &__cc);
3688 return __cc != 0;
3689}
3690
3691static inline __ATTRS_o_ai int
3692vec_any_ne(vector unsigned short __a, vector unsigned short __b) {
3693 int __cc;
3694 __builtin_s390_vceqhs((vector signed short)__a,
3695 (vector signed short)__b, &__cc);
3696 return __cc != 0;
3697}
3698
3699static inline __ATTRS_o_ai int
3700vec_any_ne(vector unsigned short __a, vector bool short __b) {
3701 int __cc;
3702 __builtin_s390_vceqhs((vector signed short)__a,
3703 (vector signed short)__b, &__cc);
3704 return __cc != 0;
3705}
3706
3707static inline __ATTRS_o_ai int
3708vec_any_ne(vector bool short __a, vector unsigned short __b) {
3709 int __cc;
3710 __builtin_s390_vceqhs((vector signed short)__a,
3711 (vector signed short)__b, &__cc);
3712 return __cc != 0;
3713}
3714
3715static inline __ATTRS_o_ai int
3716vec_any_ne(vector bool short __a, vector bool short __b) {
3717 int __cc;
3718 __builtin_s390_vceqhs((vector signed short)__a,
3719 (vector signed short)__b, &__cc);
3720 return __cc != 0;
3721}
3722
3723static inline __ATTRS_o_ai int
3724vec_any_ne(vector signed int __a, vector signed int __b) {
3725 int __cc;
3726 __builtin_s390_vceqfs(__a, __b, &__cc);
3727 return __cc != 0;
3728}
3729
3730static inline __ATTRS_o_ai int
3731vec_any_ne(vector signed int __a, vector bool int __b) {
3732 int __cc;
3733 __builtin_s390_vceqfs(__a, (vector signed int)__b, &__cc);
3734 return __cc != 0;
3735}
3736
3737static inline __ATTRS_o_ai int
3738vec_any_ne(vector bool int __a, vector signed int __b) {
3739 int __cc;
3740 __builtin_s390_vceqfs((vector signed int)__a, __b, &__cc);
3741 return __cc != 0;
3742}
3743
3744static inline __ATTRS_o_ai int
3745vec_any_ne(vector unsigned int __a, vector unsigned int __b) {
3746 int __cc;
3747 __builtin_s390_vceqfs((vector signed int)__a,
3748 (vector signed int)__b, &__cc);
3749 return __cc != 0;
3750}
3751
3752static inline __ATTRS_o_ai int
3753vec_any_ne(vector unsigned int __a, vector bool int __b) {
3754 int __cc;
3755 __builtin_s390_vceqfs((vector signed int)__a,
3756 (vector signed int)__b, &__cc);
3757 return __cc != 0;
3758}
3759
3760static inline __ATTRS_o_ai int
3761vec_any_ne(vector bool int __a, vector unsigned int __b) {
3762 int __cc;
3763 __builtin_s390_vceqfs((vector signed int)__a,
3764 (vector signed int)__b, &__cc);
3765 return __cc != 0;
3766}
3767
3768static inline __ATTRS_o_ai int
3769vec_any_ne(vector bool int __a, vector bool int __b) {
3770 int __cc;
3771 __builtin_s390_vceqfs((vector signed int)__a,
3772 (vector signed int)__b, &__cc);
3773 return __cc != 0;
3774}
3775
3776static inline __ATTRS_o_ai int
3777vec_any_ne(vector signed long long __a, vector signed long long __b) {
3778 int __cc;
3779 __builtin_s390_vceqgs(__a, __b, &__cc);
3780 return __cc != 0;
3781}
3782
3783static inline __ATTRS_o_ai int
3784vec_any_ne(vector signed long long __a, vector bool long long __b) {
3785 int __cc;
3786 __builtin_s390_vceqgs(__a, (vector signed long long)__b, &__cc);
3787 return __cc != 0;
3788}
3789
3790static inline __ATTRS_o_ai int
3791vec_any_ne(vector bool long long __a, vector signed long long __b) {
3792 int __cc;
3793 __builtin_s390_vceqgs((vector signed long long)__a, __b, &__cc);
3794 return __cc != 0;
3795}
3796
3797static inline __ATTRS_o_ai int
3798vec_any_ne(vector unsigned long long __a, vector unsigned long long __b) {
3799 int __cc;
3800 __builtin_s390_vceqgs((vector signed long long)__a,
3801 (vector signed long long)__b, &__cc);
3802 return __cc != 0;
3803}
3804
3805static inline __ATTRS_o_ai int
3806vec_any_ne(vector unsigned long long __a, vector bool long long __b) {
3807 int __cc;
3808 __builtin_s390_vceqgs((vector signed long long)__a,
3809 (vector signed long long)__b, &__cc);
3810 return __cc != 0;
3811}
3812
3813static inline __ATTRS_o_ai int
3814vec_any_ne(vector bool long long __a, vector unsigned long long __b) {
3815 int __cc;
3816 __builtin_s390_vceqgs((vector signed long long)__a,
3817 (vector signed long long)__b, &__cc);
3818 return __cc != 0;
3819}
3820
3821static inline __ATTRS_o_ai int
3822vec_any_ne(vector bool long long __a, vector bool long long __b) {
3823 int __cc;
3824 __builtin_s390_vceqgs((vector signed long long)__a,
3825 (vector signed long long)__b, &__cc);
3826 return __cc != 0;
3827}
3828
3829static inline __ATTRS_o_ai int
3830vec_any_ne(vector double __a, vector double __b) {
3831 int __cc;
3832 __builtin_s390_vfcedbs(__a, __b, &__cc);
3833 return __cc != 0;
3834}
3835
3836/*-- vec_any_ge -------------------------------------------------------------*/
3837
3838static inline __ATTRS_o_ai int
3839vec_any_ge(vector signed char __a, vector signed char __b) {
3840 int __cc;
3841 __builtin_s390_vchbs(__b, __a, &__cc);
3842 return __cc != 0;
3843}
3844
3845static inline __ATTRS_o_ai int
3846vec_any_ge(vector signed char __a, vector bool char __b) {
3847 int __cc;
3848 __builtin_s390_vchbs((vector signed char)__b, __a, &__cc);
3849 return __cc != 0;
3850}
3851
3852static inline __ATTRS_o_ai int
3853vec_any_ge(vector bool char __a, vector signed char __b) {
3854 int __cc;
3855 __builtin_s390_vchbs(__b, (vector signed char)__a, &__cc);
3856 return __cc != 0;
3857}
3858
3859static inline __ATTRS_o_ai int
3860vec_any_ge(vector unsigned char __a, vector unsigned char __b) {
3861 int __cc;
3862 __builtin_s390_vchlbs(__b, __a, &__cc);
3863 return __cc != 0;
3864}
3865
3866static inline __ATTRS_o_ai int
3867vec_any_ge(vector unsigned char __a, vector bool char __b) {
3868 int __cc;
3869 __builtin_s390_vchlbs((vector unsigned char)__b, __a, &__cc);
3870 return __cc != 0;
3871}
3872
3873static inline __ATTRS_o_ai int
3874vec_any_ge(vector bool char __a, vector unsigned char __b) {
3875 int __cc;
3876 __builtin_s390_vchlbs(__b, (vector unsigned char)__a, &__cc);
3877 return __cc != 0;
3878}
3879
3880static inline __ATTRS_o_ai int
3881vec_any_ge(vector bool char __a, vector bool char __b) {
3882 int __cc;
3883 __builtin_s390_vchlbs((vector unsigned char)__b,
3884 (vector unsigned char)__a, &__cc);
3885 return __cc != 0;
3886}
3887
3888static inline __ATTRS_o_ai int
3889vec_any_ge(vector signed short __a, vector signed short __b) {
3890 int __cc;
3891 __builtin_s390_vchhs(__b, __a, &__cc);
3892 return __cc != 0;
3893}
3894
3895static inline __ATTRS_o_ai int
3896vec_any_ge(vector signed short __a, vector bool short __b) {
3897 int __cc;
3898 __builtin_s390_vchhs((vector signed short)__b, __a, &__cc);
3899 return __cc != 0;
3900}
3901
3902static inline __ATTRS_o_ai int
3903vec_any_ge(vector bool short __a, vector signed short __b) {
3904 int __cc;
3905 __builtin_s390_vchhs(__b, (vector signed short)__a, &__cc);
3906 return __cc != 0;
3907}
3908
3909static inline __ATTRS_o_ai int
3910vec_any_ge(vector unsigned short __a, vector unsigned short __b) {
3911 int __cc;
3912 __builtin_s390_vchlhs(__b, __a, &__cc);
3913 return __cc != 0;
3914}
3915
3916static inline __ATTRS_o_ai int
3917vec_any_ge(vector unsigned short __a, vector bool short __b) {
3918 int __cc;
3919 __builtin_s390_vchlhs((vector unsigned short)__b, __a, &__cc);
3920 return __cc != 0;
3921}
3922
3923static inline __ATTRS_o_ai int
3924vec_any_ge(vector bool short __a, vector unsigned short __b) {
3925 int __cc;
3926 __builtin_s390_vchlhs(__b, (vector unsigned short)__a, &__cc);
3927 return __cc != 0;
3928}
3929
3930static inline __ATTRS_o_ai int
3931vec_any_ge(vector bool short __a, vector bool short __b) {
3932 int __cc;
3933 __builtin_s390_vchlhs((vector unsigned short)__b,
3934 (vector unsigned short)__a, &__cc);
3935 return __cc != 0;
3936}
3937
3938static inline __ATTRS_o_ai int
3939vec_any_ge(vector signed int __a, vector signed int __b) {
3940 int __cc;
3941 __builtin_s390_vchfs(__b, __a, &__cc);
3942 return __cc != 0;
3943}
3944
3945static inline __ATTRS_o_ai int
3946vec_any_ge(vector signed int __a, vector bool int __b) {
3947 int __cc;
3948 __builtin_s390_vchfs((vector signed int)__b, __a, &__cc);
3949 return __cc != 0;
3950}
3951
3952static inline __ATTRS_o_ai int
3953vec_any_ge(vector bool int __a, vector signed int __b) {
3954 int __cc;
3955 __builtin_s390_vchfs(__b, (vector signed int)__a, &__cc);
3956 return __cc != 0;
3957}
3958
3959static inline __ATTRS_o_ai int
3960vec_any_ge(vector unsigned int __a, vector unsigned int __b) {
3961 int __cc;
3962 __builtin_s390_vchlfs(__b, __a, &__cc);
3963 return __cc != 0;
3964}
3965
3966static inline __ATTRS_o_ai int
3967vec_any_ge(vector unsigned int __a, vector bool int __b) {
3968 int __cc;
3969 __builtin_s390_vchlfs((vector unsigned int)__b, __a, &__cc);
3970 return __cc != 0;
3971}
3972
3973static inline __ATTRS_o_ai int
3974vec_any_ge(vector bool int __a, vector unsigned int __b) {
3975 int __cc;
3976 __builtin_s390_vchlfs(__b, (vector unsigned int)__a, &__cc);
3977 return __cc != 0;
3978}
3979
3980static inline __ATTRS_o_ai int
3981vec_any_ge(vector bool int __a, vector bool int __b) {
3982 int __cc;
3983 __builtin_s390_vchlfs((vector unsigned int)__b,
3984 (vector unsigned int)__a, &__cc);
3985 return __cc != 0;
3986}
3987
3988static inline __ATTRS_o_ai int
3989vec_any_ge(vector signed long long __a, vector signed long long __b) {
3990 int __cc;
3991 __builtin_s390_vchgs(__b, __a, &__cc);
3992 return __cc != 0;
3993}
3994
3995static inline __ATTRS_o_ai int
3996vec_any_ge(vector signed long long __a, vector bool long long __b) {
3997 int __cc;
3998 __builtin_s390_vchgs((vector signed long long)__b, __a, &__cc);
3999 return __cc != 0;
4000}
4001
4002static inline __ATTRS_o_ai int
4003vec_any_ge(vector bool long long __a, vector signed long long __b) {
4004 int __cc;
4005 __builtin_s390_vchgs(__b, (vector signed long long)__a, &__cc);
4006 return __cc != 0;
4007}
4008
4009static inline __ATTRS_o_ai int
4010vec_any_ge(vector unsigned long long __a, vector unsigned long long __b) {
4011 int __cc;
4012 __builtin_s390_vchlgs(__b, __a, &__cc);
4013 return __cc != 0;
4014}
4015
4016static inline __ATTRS_o_ai int
4017vec_any_ge(vector unsigned long long __a, vector bool long long __b) {
4018 int __cc;
4019 __builtin_s390_vchlgs((vector unsigned long long)__b, __a, &__cc);
4020 return __cc != 0;
4021}
4022
4023static inline __ATTRS_o_ai int
4024vec_any_ge(vector bool long long __a, vector unsigned long long __b) {
4025 int __cc;
4026 __builtin_s390_vchlgs(__b, (vector unsigned long long)__a, &__cc);
4027 return __cc != 0;
4028}
4029
4030static inline __ATTRS_o_ai int
4031vec_any_ge(vector bool long long __a, vector bool long long __b) {
4032 int __cc;
4033 __builtin_s390_vchlgs((vector unsigned long long)__b,
4034 (vector unsigned long long)__a, &__cc);
4035 return __cc != 0;
4036}
4037
4038static inline __ATTRS_o_ai int
4039vec_any_ge(vector double __a, vector double __b) {
4040 int __cc;
4041 __builtin_s390_vfchedbs(__a, __b, &__cc);
4042 return __cc <= 1;
4043}
4044
4045/*-- vec_any_gt -------------------------------------------------------------*/
4046
4047static inline __ATTRS_o_ai int
4048vec_any_gt(vector signed char __a, vector signed char __b) {
4049 int __cc;
4050 __builtin_s390_vchbs(__a, __b, &__cc);
4051 return __cc <= 1;
4052}
4053
4054static inline __ATTRS_o_ai int
4055vec_any_gt(vector signed char __a, vector bool char __b) {
4056 int __cc;
4057 __builtin_s390_vchbs(__a, (vector signed char)__b, &__cc);
4058 return __cc <= 1;
4059}
4060
4061static inline __ATTRS_o_ai int
4062vec_any_gt(vector bool char __a, vector signed char __b) {
4063 int __cc;
4064 __builtin_s390_vchbs((vector signed char)__a, __b, &__cc);
4065 return __cc <= 1;
4066}
4067
4068static inline __ATTRS_o_ai int
4069vec_any_gt(vector unsigned char __a, vector unsigned char __b) {
4070 int __cc;
4071 __builtin_s390_vchlbs(__a, __b, &__cc);
4072 return __cc <= 1;
4073}
4074
4075static inline __ATTRS_o_ai int
4076vec_any_gt(vector unsigned char __a, vector bool char __b) {
4077 int __cc;
4078 __builtin_s390_vchlbs(__a, (vector unsigned char)__b, &__cc);
4079 return __cc <= 1;
4080}
4081
4082static inline __ATTRS_o_ai int
4083vec_any_gt(vector bool char __a, vector unsigned char __b) {
4084 int __cc;
4085 __builtin_s390_vchlbs((vector unsigned char)__a, __b, &__cc);
4086 return __cc <= 1;
4087}
4088
4089static inline __ATTRS_o_ai int
4090vec_any_gt(vector bool char __a, vector bool char __b) {
4091 int __cc;
4092 __builtin_s390_vchlbs((vector unsigned char)__a,
4093 (vector unsigned char)__b, &__cc);
4094 return __cc <= 1;
4095}
4096
4097static inline __ATTRS_o_ai int
4098vec_any_gt(vector signed short __a, vector signed short __b) {
4099 int __cc;
4100 __builtin_s390_vchhs(__a, __b, &__cc);
4101 return __cc <= 1;
4102}
4103
4104static inline __ATTRS_o_ai int
4105vec_any_gt(vector signed short __a, vector bool short __b) {
4106 int __cc;
4107 __builtin_s390_vchhs(__a, (vector signed short)__b, &__cc);
4108 return __cc <= 1;
4109}
4110
4111static inline __ATTRS_o_ai int
4112vec_any_gt(vector bool short __a, vector signed short __b) {
4113 int __cc;
4114 __builtin_s390_vchhs((vector signed short)__a, __b, &__cc);
4115 return __cc <= 1;
4116}
4117
4118static inline __ATTRS_o_ai int
4119vec_any_gt(vector unsigned short __a, vector unsigned short __b) {
4120 int __cc;
4121 __builtin_s390_vchlhs(__a, __b, &__cc);
4122 return __cc <= 1;
4123}
4124
4125static inline __ATTRS_o_ai int
4126vec_any_gt(vector unsigned short __a, vector bool short __b) {
4127 int __cc;
4128 __builtin_s390_vchlhs(__a, (vector unsigned short)__b, &__cc);
4129 return __cc <= 1;
4130}
4131
4132static inline __ATTRS_o_ai int
4133vec_any_gt(vector bool short __a, vector unsigned short __b) {
4134 int __cc;
4135 __builtin_s390_vchlhs((vector unsigned short)__a, __b, &__cc);
4136 return __cc <= 1;
4137}
4138
4139static inline __ATTRS_o_ai int
4140vec_any_gt(vector bool short __a, vector bool short __b) {
4141 int __cc;
4142 __builtin_s390_vchlhs((vector unsigned short)__a,
4143 (vector unsigned short)__b, &__cc);
4144 return __cc <= 1;
4145}
4146
4147static inline __ATTRS_o_ai int
4148vec_any_gt(vector signed int __a, vector signed int __b) {
4149 int __cc;
4150 __builtin_s390_vchfs(__a, __b, &__cc);
4151 return __cc <= 1;
4152}
4153
4154static inline __ATTRS_o_ai int
4155vec_any_gt(vector signed int __a, vector bool int __b) {
4156 int __cc;
4157 __builtin_s390_vchfs(__a, (vector signed int)__b, &__cc);
4158 return __cc <= 1;
4159}
4160
4161static inline __ATTRS_o_ai int
4162vec_any_gt(vector bool int __a, vector signed int __b) {
4163 int __cc;
4164 __builtin_s390_vchfs((vector signed int)__a, __b, &__cc);
4165 return __cc <= 1;
4166}
4167
4168static inline __ATTRS_o_ai int
4169vec_any_gt(vector unsigned int __a, vector unsigned int __b) {
4170 int __cc;
4171 __builtin_s390_vchlfs(__a, __b, &__cc);
4172 return __cc <= 1;
4173}
4174
4175static inline __ATTRS_o_ai int
4176vec_any_gt(vector unsigned int __a, vector bool int __b) {
4177 int __cc;
4178 __builtin_s390_vchlfs(__a, (vector unsigned int)__b, &__cc);
4179 return __cc <= 1;
4180}
4181
4182static inline __ATTRS_o_ai int
4183vec_any_gt(vector bool int __a, vector unsigned int __b) {
4184 int __cc;
4185 __builtin_s390_vchlfs((vector unsigned int)__a, __b, &__cc);
4186 return __cc <= 1;
4187}
4188
4189static inline __ATTRS_o_ai int
4190vec_any_gt(vector bool int __a, vector bool int __b) {
4191 int __cc;
4192 __builtin_s390_vchlfs((vector unsigned int)__a,
4193 (vector unsigned int)__b, &__cc);
4194 return __cc <= 1;
4195}
4196
4197static inline __ATTRS_o_ai int
4198vec_any_gt(vector signed long long __a, vector signed long long __b) {
4199 int __cc;
4200 __builtin_s390_vchgs(__a, __b, &__cc);
4201 return __cc <= 1;
4202}
4203
4204static inline __ATTRS_o_ai int
4205vec_any_gt(vector signed long long __a, vector bool long long __b) {
4206 int __cc;
4207 __builtin_s390_vchgs(__a, (vector signed long long)__b, &__cc);
4208 return __cc <= 1;
4209}
4210
4211static inline __ATTRS_o_ai int
4212vec_any_gt(vector bool long long __a, vector signed long long __b) {
4213 int __cc;
4214 __builtin_s390_vchgs((vector signed long long)__a, __b, &__cc);
4215 return __cc <= 1;
4216}
4217
4218static inline __ATTRS_o_ai int
4219vec_any_gt(vector unsigned long long __a, vector unsigned long long __b) {
4220 int __cc;
4221 __builtin_s390_vchlgs(__a, __b, &__cc);
4222 return __cc <= 1;
4223}
4224
4225static inline __ATTRS_o_ai int
4226vec_any_gt(vector unsigned long long __a, vector bool long long __b) {
4227 int __cc;
4228 __builtin_s390_vchlgs(__a, (vector unsigned long long)__b, &__cc);
4229 return __cc <= 1;
4230}
4231
4232static inline __ATTRS_o_ai int
4233vec_any_gt(vector bool long long __a, vector unsigned long long __b) {
4234 int __cc;
4235 __builtin_s390_vchlgs((vector unsigned long long)__a, __b, &__cc);
4236 return __cc <= 1;
4237}
4238
4239static inline __ATTRS_o_ai int
4240vec_any_gt(vector bool long long __a, vector bool long long __b) {
4241 int __cc;
4242 __builtin_s390_vchlgs((vector unsigned long long)__a,
4243 (vector unsigned long long)__b, &__cc);
4244 return __cc <= 1;
4245}
4246
4247static inline __ATTRS_o_ai int
4248vec_any_gt(vector double __a, vector double __b) {
4249 int __cc;
4250 __builtin_s390_vfchdbs(__a, __b, &__cc);
4251 return __cc <= 1;
4252}
4253
4254/*-- vec_any_le -------------------------------------------------------------*/
4255
4256static inline __ATTRS_o_ai int
4257vec_any_le(vector signed char __a, vector signed char __b) {
4258 int __cc;
4259 __builtin_s390_vchbs(__a, __b, &__cc);
4260 return __cc != 0;
4261}
4262
4263static inline __ATTRS_o_ai int
4264vec_any_le(vector signed char __a, vector bool char __b) {
4265 int __cc;
4266 __builtin_s390_vchbs(__a, (vector signed char)__b, &__cc);
4267 return __cc != 0;
4268}
4269
4270static inline __ATTRS_o_ai int
4271vec_any_le(vector bool char __a, vector signed char __b) {
4272 int __cc;
4273 __builtin_s390_vchbs((vector signed char)__a, __b, &__cc);
4274 return __cc != 0;
4275}
4276
4277static inline __ATTRS_o_ai int
4278vec_any_le(vector unsigned char __a, vector unsigned char __b) {
4279 int __cc;
4280 __builtin_s390_vchlbs(__a, __b, &__cc);
4281 return __cc != 0;
4282}
4283
4284static inline __ATTRS_o_ai int
4285vec_any_le(vector unsigned char __a, vector bool char __b) {
4286 int __cc;
4287 __builtin_s390_vchlbs(__a, (vector unsigned char)__b, &__cc);
4288 return __cc != 0;
4289}
4290
4291static inline __ATTRS_o_ai int
4292vec_any_le(vector bool char __a, vector unsigned char __b) {
4293 int __cc;
4294 __builtin_s390_vchlbs((vector unsigned char)__a, __b, &__cc);
4295 return __cc != 0;
4296}
4297
4298static inline __ATTRS_o_ai int
4299vec_any_le(vector bool char __a, vector bool char __b) {
4300 int __cc;
4301 __builtin_s390_vchlbs((vector unsigned char)__a,
4302 (vector unsigned char)__b, &__cc);
4303 return __cc != 0;
4304}
4305
4306static inline __ATTRS_o_ai int
4307vec_any_le(vector signed short __a, vector signed short __b) {
4308 int __cc;
4309 __builtin_s390_vchhs(__a, __b, &__cc);
4310 return __cc != 0;
4311}
4312
4313static inline __ATTRS_o_ai int
4314vec_any_le(vector signed short __a, vector bool short __b) {
4315 int __cc;
4316 __builtin_s390_vchhs(__a, (vector signed short)__b, &__cc);
4317 return __cc != 0;
4318}
4319
4320static inline __ATTRS_o_ai int
4321vec_any_le(vector bool short __a, vector signed short __b) {
4322 int __cc;
4323 __builtin_s390_vchhs((vector signed short)__a, __b, &__cc);
4324 return __cc != 0;
4325}
4326
4327static inline __ATTRS_o_ai int
4328vec_any_le(vector unsigned short __a, vector unsigned short __b) {
4329 int __cc;
4330 __builtin_s390_vchlhs(__a, __b, &__cc);
4331 return __cc != 0;
4332}
4333
4334static inline __ATTRS_o_ai int
4335vec_any_le(vector unsigned short __a, vector bool short __b) {
4336 int __cc;
4337 __builtin_s390_vchlhs(__a, (vector unsigned short)__b, &__cc);
4338 return __cc != 0;
4339}
4340
4341static inline __ATTRS_o_ai int
4342vec_any_le(vector bool short __a, vector unsigned short __b) {
4343 int __cc;
4344 __builtin_s390_vchlhs((vector unsigned short)__a, __b, &__cc);
4345 return __cc != 0;
4346}
4347
4348static inline __ATTRS_o_ai int
4349vec_any_le(vector bool short __a, vector bool short __b) {
4350 int __cc;
4351 __builtin_s390_vchlhs((vector unsigned short)__a,
4352 (vector unsigned short)__b, &__cc);
4353 return __cc != 0;
4354}
4355
4356static inline __ATTRS_o_ai int
4357vec_any_le(vector signed int __a, vector signed int __b) {
4358 int __cc;
4359 __builtin_s390_vchfs(__a, __b, &__cc);
4360 return __cc != 0;
4361}
4362
4363static inline __ATTRS_o_ai int
4364vec_any_le(vector signed int __a, vector bool int __b) {
4365 int __cc;
4366 __builtin_s390_vchfs(__a, (vector signed int)__b, &__cc);
4367 return __cc != 0;
4368}
4369
4370static inline __ATTRS_o_ai int
4371vec_any_le(vector bool int __a, vector signed int __b) {
4372 int __cc;
4373 __builtin_s390_vchfs((vector signed int)__a, __b, &__cc);
4374 return __cc != 0;
4375}
4376
4377static inline __ATTRS_o_ai int
4378vec_any_le(vector unsigned int __a, vector unsigned int __b) {
4379 int __cc;
4380 __builtin_s390_vchlfs(__a, __b, &__cc);
4381 return __cc != 0;
4382}
4383
4384static inline __ATTRS_o_ai int
4385vec_any_le(vector unsigned int __a, vector bool int __b) {
4386 int __cc;
4387 __builtin_s390_vchlfs(__a, (vector unsigned int)__b, &__cc);
4388 return __cc != 0;
4389}
4390
4391static inline __ATTRS_o_ai int
4392vec_any_le(vector bool int __a, vector unsigned int __b) {
4393 int __cc;
4394 __builtin_s390_vchlfs((vector unsigned int)__a, __b, &__cc);
4395 return __cc != 0;
4396}
4397
4398static inline __ATTRS_o_ai int
4399vec_any_le(vector bool int __a, vector bool int __b) {
4400 int __cc;
4401 __builtin_s390_vchlfs((vector unsigned int)__a,
4402 (vector unsigned int)__b, &__cc);
4403 return __cc != 0;
4404}
4405
4406static inline __ATTRS_o_ai int
4407vec_any_le(vector signed long long __a, vector signed long long __b) {
4408 int __cc;
4409 __builtin_s390_vchgs(__a, __b, &__cc);
4410 return __cc != 0;
4411}
4412
4413static inline __ATTRS_o_ai int
4414vec_any_le(vector signed long long __a, vector bool long long __b) {
4415 int __cc;
4416 __builtin_s390_vchgs(__a, (vector signed long long)__b, &__cc);
4417 return __cc != 0;
4418}
4419
4420static inline __ATTRS_o_ai int
4421vec_any_le(vector bool long long __a, vector signed long long __b) {
4422 int __cc;
4423 __builtin_s390_vchgs((vector signed long long)__a, __b, &__cc);
4424 return __cc != 0;
4425}
4426
4427static inline __ATTRS_o_ai int
4428vec_any_le(vector unsigned long long __a, vector unsigned long long __b) {
4429 int __cc;
4430 __builtin_s390_vchlgs(__a, __b, &__cc);
4431 return __cc != 0;
4432}
4433
4434static inline __ATTRS_o_ai int
4435vec_any_le(vector unsigned long long __a, vector bool long long __b) {
4436 int __cc;
4437 __builtin_s390_vchlgs(__a, (vector unsigned long long)__b, &__cc);
4438 return __cc != 0;
4439}
4440
4441static inline __ATTRS_o_ai int
4442vec_any_le(vector bool long long __a, vector unsigned long long __b) {
4443 int __cc;
4444 __builtin_s390_vchlgs((vector unsigned long long)__a, __b, &__cc);
4445 return __cc != 0;
4446}
4447
4448static inline __ATTRS_o_ai int
4449vec_any_le(vector bool long long __a, vector bool long long __b) {
4450 int __cc;
4451 __builtin_s390_vchlgs((vector unsigned long long)__a,
4452 (vector unsigned long long)__b, &__cc);
4453 return __cc != 0;
4454}
4455
4456static inline __ATTRS_o_ai int
4457vec_any_le(vector double __a, vector double __b) {
4458 int __cc;
4459 __builtin_s390_vfchedbs(__b, __a, &__cc);
4460 return __cc <= 1;
4461}
4462
4463/*-- vec_any_lt -------------------------------------------------------------*/
4464
4465static inline __ATTRS_o_ai int
4466vec_any_lt(vector signed char __a, vector signed char __b) {
4467 int __cc;
4468 __builtin_s390_vchbs(__b, __a, &__cc);
4469 return __cc <= 1;
4470}
4471
4472static inline __ATTRS_o_ai int
4473vec_any_lt(vector signed char __a, vector bool char __b) {
4474 int __cc;
4475 __builtin_s390_vchbs((vector signed char)__b, __a, &__cc);
4476 return __cc <= 1;
4477}
4478
4479static inline __ATTRS_o_ai int
4480vec_any_lt(vector bool char __a, vector signed char __b) {
4481 int __cc;
4482 __builtin_s390_vchbs(__b, (vector signed char)__a, &__cc);
4483 return __cc <= 1;
4484}
4485
4486static inline __ATTRS_o_ai int
4487vec_any_lt(vector unsigned char __a, vector unsigned char __b) {
4488 int __cc;
4489 __builtin_s390_vchlbs(__b, __a, &__cc);
4490 return __cc <= 1;
4491}
4492
4493static inline __ATTRS_o_ai int
4494vec_any_lt(vector unsigned char __a, vector bool char __b) {
4495 int __cc;
4496 __builtin_s390_vchlbs((vector unsigned char)__b, __a, &__cc);
4497 return __cc <= 1;
4498}
4499
4500static inline __ATTRS_o_ai int
4501vec_any_lt(vector bool char __a, vector unsigned char __b) {
4502 int __cc;
4503 __builtin_s390_vchlbs(__b, (vector unsigned char)__a, &__cc);
4504 return __cc <= 1;
4505}
4506
4507static inline __ATTRS_o_ai int
4508vec_any_lt(vector bool char __a, vector bool char __b) {
4509 int __cc;
4510 __builtin_s390_vchlbs((vector unsigned char)__b,
4511 (vector unsigned char)__a, &__cc);
4512 return __cc <= 1;
4513}
4514
4515static inline __ATTRS_o_ai int
4516vec_any_lt(vector signed short __a, vector signed short __b) {
4517 int __cc;
4518 __builtin_s390_vchhs(__b, __a, &__cc);
4519 return __cc <= 1;
4520}
4521
4522static inline __ATTRS_o_ai int
4523vec_any_lt(vector signed short __a, vector bool short __b) {
4524 int __cc;
4525 __builtin_s390_vchhs((vector signed short)__b, __a, &__cc);
4526 return __cc <= 1;
4527}
4528
4529static inline __ATTRS_o_ai int
4530vec_any_lt(vector bool short __a, vector signed short __b) {
4531 int __cc;
4532 __builtin_s390_vchhs(__b, (vector signed short)__a, &__cc);
4533 return __cc <= 1;
4534}
4535
4536static inline __ATTRS_o_ai int
4537vec_any_lt(vector unsigned short __a, vector unsigned short __b) {
4538 int __cc;
4539 __builtin_s390_vchlhs(__b, __a, &__cc);
4540 return __cc <= 1;
4541}
4542
4543static inline __ATTRS_o_ai int
4544vec_any_lt(vector unsigned short __a, vector bool short __b) {
4545 int __cc;
4546 __builtin_s390_vchlhs((vector unsigned short)__b, __a, &__cc);
4547 return __cc <= 1;
4548}
4549
4550static inline __ATTRS_o_ai int
4551vec_any_lt(vector bool short __a, vector unsigned short __b) {
4552 int __cc;
4553 __builtin_s390_vchlhs(__b, (vector unsigned short)__a, &__cc);
4554 return __cc <= 1;
4555}
4556
4557static inline __ATTRS_o_ai int
4558vec_any_lt(vector bool short __a, vector bool short __b) {
4559 int __cc;
4560 __builtin_s390_vchlhs((vector unsigned short)__b,
4561 (vector unsigned short)__a, &__cc);
4562 return __cc <= 1;
4563}
4564
4565static inline __ATTRS_o_ai int
4566vec_any_lt(vector signed int __a, vector signed int __b) {
4567 int __cc;
4568 __builtin_s390_vchfs(__b, __a, &__cc);
4569 return __cc <= 1;
4570}
4571
4572static inline __ATTRS_o_ai int
4573vec_any_lt(vector signed int __a, vector bool int __b) {
4574 int __cc;
4575 __builtin_s390_vchfs((vector signed int)__b, __a, &__cc);
4576 return __cc <= 1;
4577}
4578
4579static inline __ATTRS_o_ai int
4580vec_any_lt(vector bool int __a, vector signed int __b) {
4581 int __cc;
4582 __builtin_s390_vchfs(__b, (vector signed int)__a, &__cc);
4583 return __cc <= 1;
4584}
4585
4586static inline __ATTRS_o_ai int
4587vec_any_lt(vector unsigned int __a, vector unsigned int __b) {
4588 int __cc;
4589 __builtin_s390_vchlfs(__b, __a, &__cc);
4590 return __cc <= 1;
4591}
4592
4593static inline __ATTRS_o_ai int
4594vec_any_lt(vector unsigned int __a, vector bool int __b) {
4595 int __cc;
4596 __builtin_s390_vchlfs((vector unsigned int)__b, __a, &__cc);
4597 return __cc <= 1;
4598}
4599
4600static inline __ATTRS_o_ai int
4601vec_any_lt(vector bool int __a, vector unsigned int __b) {
4602 int __cc;
4603 __builtin_s390_vchlfs(__b, (vector unsigned int)__a, &__cc);
4604 return __cc <= 1;
4605}
4606
4607static inline __ATTRS_o_ai int
4608vec_any_lt(vector bool int __a, vector bool int __b) {
4609 int __cc;
4610 __builtin_s390_vchlfs((vector unsigned int)__b,
4611 (vector unsigned int)__a, &__cc);
4612 return __cc <= 1;
4613}
4614
4615static inline __ATTRS_o_ai int
4616vec_any_lt(vector signed long long __a, vector signed long long __b) {
4617 int __cc;
4618 __builtin_s390_vchgs(__b, __a, &__cc);
4619 return __cc <= 1;
4620}
4621
4622static inline __ATTRS_o_ai int
4623vec_any_lt(vector signed long long __a, vector bool long long __b) {
4624 int __cc;
4625 __builtin_s390_vchgs((vector signed long long)__b, __a, &__cc);
4626 return __cc <= 1;
4627}
4628
4629static inline __ATTRS_o_ai int
4630vec_any_lt(vector bool long long __a, vector signed long long __b) {
4631 int __cc;
4632 __builtin_s390_vchgs(__b, (vector signed long long)__a, &__cc);
4633 return __cc <= 1;
4634}
4635
4636static inline __ATTRS_o_ai int
4637vec_any_lt(vector unsigned long long __a, vector unsigned long long __b) {
4638 int __cc;
4639 __builtin_s390_vchlgs(__b, __a, &__cc);
4640 return __cc <= 1;
4641}
4642
4643static inline __ATTRS_o_ai int
4644vec_any_lt(vector unsigned long long __a, vector bool long long __b) {
4645 int __cc;
4646 __builtin_s390_vchlgs((vector unsigned long long)__b, __a, &__cc);
4647 return __cc <= 1;
4648}
4649
4650static inline __ATTRS_o_ai int
4651vec_any_lt(vector bool long long __a, vector unsigned long long __b) {
4652 int __cc;
4653 __builtin_s390_vchlgs(__b, (vector unsigned long long)__a, &__cc);
4654 return __cc <= 1;
4655}
4656
4657static inline __ATTRS_o_ai int
4658vec_any_lt(vector bool long long __a, vector bool long long __b) {
4659 int __cc;
4660 __builtin_s390_vchlgs((vector unsigned long long)__b,
4661 (vector unsigned long long)__a, &__cc);
4662 return __cc <= 1;
4663}
4664
4665static inline __ATTRS_o_ai int
4666vec_any_lt(vector double __a, vector double __b) {
4667 int __cc;
4668 __builtin_s390_vfchdbs(__b, __a, &__cc);
4669 return __cc <= 1;
4670}
4671
4672/*-- vec_any_nge ------------------------------------------------------------*/
4673
4674static inline __ATTRS_ai int
4675vec_any_nge(vector double __a, vector double __b) {
4676 int __cc;
4677 __builtin_s390_vfchedbs(__a, __b, &__cc);
4678 return __cc != 0;
4679}
4680
4681/*-- vec_any_ngt ------------------------------------------------------------*/
4682
4683static inline __ATTRS_ai int
4684vec_any_ngt(vector double __a, vector double __b) {
4685 int __cc;
4686 __builtin_s390_vfchdbs(__a, __b, &__cc);
4687 return __cc != 0;
4688}
4689
4690/*-- vec_any_nle ------------------------------------------------------------*/
4691
4692static inline __ATTRS_ai int
4693vec_any_nle(vector double __a, vector double __b) {
4694 int __cc;
4695 __builtin_s390_vfchedbs(__b, __a, &__cc);
4696 return __cc != 0;
4697}
4698
4699/*-- vec_any_nlt ------------------------------------------------------------*/
4700
4701static inline __ATTRS_ai int
4702vec_any_nlt(vector double __a, vector double __b) {
4703 int __cc;
4704 __builtin_s390_vfchdbs(__b, __a, &__cc);
4705 return __cc != 0;
4706}
4707
4708/*-- vec_any_nan ------------------------------------------------------------*/
4709
4710static inline __ATTRS_ai int
4711vec_any_nan(vector double __a) {
4712 int __cc;
4713 __builtin_s390_vftcidb(__a, 15, &__cc);
4714 return __cc != 3;
4715}
4716
4717/*-- vec_any_numeric --------------------------------------------------------*/
4718
4719static inline __ATTRS_ai int
4720vec_any_numeric(vector double __a) {
4721 int __cc;
4722 __builtin_s390_vftcidb(__a, 15, &__cc);
4723 return __cc != 0;
4724}
4725
4726/*-- vec_andc ---------------------------------------------------------------*/
4727
4728static inline __ATTRS_o_ai vector bool char
4729vec_andc(vector bool char __a, vector bool char __b) {
4730 return __a & ~__b;
4731}
4732
4733static inline __ATTRS_o_ai vector signed char
4734vec_andc(vector signed char __a, vector signed char __b) {
4735 return __a & ~__b;
4736}
4737
4738static inline __ATTRS_o_ai vector signed char
4739vec_andc(vector bool char __a, vector signed char __b) {
4740 return __a & ~__b;
4741}
4742
4743static inline __ATTRS_o_ai vector signed char
4744vec_andc(vector signed char __a, vector bool char __b) {
4745 return __a & ~__b;
4746}
4747
4748static inline __ATTRS_o_ai vector unsigned char
4749vec_andc(vector unsigned char __a, vector unsigned char __b) {
4750 return __a & ~__b;
4751}
4752
4753static inline __ATTRS_o_ai vector unsigned char
4754vec_andc(vector bool char __a, vector unsigned char __b) {
4755 return __a & ~__b;
4756}
4757
4758static inline __ATTRS_o_ai vector unsigned char
4759vec_andc(vector unsigned char __a, vector bool char __b) {
4760 return __a & ~__b;
4761}
4762
4763static inline __ATTRS_o_ai vector bool short
4764vec_andc(vector bool short __a, vector bool short __b) {
4765 return __a & ~__b;
4766}
4767
4768static inline __ATTRS_o_ai vector signed short
4769vec_andc(vector signed short __a, vector signed short __b) {
4770 return __a & ~__b;
4771}
4772
4773static inline __ATTRS_o_ai vector signed short
4774vec_andc(vector bool short __a, vector signed short __b) {
4775 return __a & ~__b;
4776}
4777
4778static inline __ATTRS_o_ai vector signed short
4779vec_andc(vector signed short __a, vector bool short __b) {
4780 return __a & ~__b;
4781}
4782
4783static inline __ATTRS_o_ai vector unsigned short
4784vec_andc(vector unsigned short __a, vector unsigned short __b) {
4785 return __a & ~__b;
4786}
4787
4788static inline __ATTRS_o_ai vector unsigned short
4789vec_andc(vector bool short __a, vector unsigned short __b) {
4790 return __a & ~__b;
4791}
4792
4793static inline __ATTRS_o_ai vector unsigned short
4794vec_andc(vector unsigned short __a, vector bool short __b) {
4795 return __a & ~__b;
4796}
4797
4798static inline __ATTRS_o_ai vector bool int
4799vec_andc(vector bool int __a, vector bool int __b) {
4800 return __a & ~__b;
4801}
4802
4803static inline __ATTRS_o_ai vector signed int
4804vec_andc(vector signed int __a, vector signed int __b) {
4805 return __a & ~__b;
4806}
4807
4808static inline __ATTRS_o_ai vector signed int
4809vec_andc(vector bool int __a, vector signed int __b) {
4810 return __a & ~__b;
4811}
4812
4813static inline __ATTRS_o_ai vector signed int
4814vec_andc(vector signed int __a, vector bool int __b) {
4815 return __a & ~__b;
4816}
4817
4818static inline __ATTRS_o_ai vector unsigned int
4819vec_andc(vector unsigned int __a, vector unsigned int __b) {
4820 return __a & ~__b;
4821}
4822
4823static inline __ATTRS_o_ai vector unsigned int
4824vec_andc(vector bool int __a, vector unsigned int __b) {
4825 return __a & ~__b;
4826}
4827
4828static inline __ATTRS_o_ai vector unsigned int
4829vec_andc(vector unsigned int __a, vector bool int __b) {
4830 return __a & ~__b;
4831}
4832
4833static inline __ATTRS_o_ai vector bool long long
4834vec_andc(vector bool long long __a, vector bool long long __b) {
4835 return __a & ~__b;
4836}
4837
4838static inline __ATTRS_o_ai vector signed long long
4839vec_andc(vector signed long long __a, vector signed long long __b) {
4840 return __a & ~__b;
4841}
4842
4843static inline __ATTRS_o_ai vector signed long long
4844vec_andc(vector bool long long __a, vector signed long long __b) {
4845 return __a & ~__b;
4846}
4847
4848static inline __ATTRS_o_ai vector signed long long
4849vec_andc(vector signed long long __a, vector bool long long __b) {
4850 return __a & ~__b;
4851}
4852
4853static inline __ATTRS_o_ai vector unsigned long long
4854vec_andc(vector unsigned long long __a, vector unsigned long long __b) {
4855 return __a & ~__b;
4856}
4857
4858static inline __ATTRS_o_ai vector unsigned long long
4859vec_andc(vector bool long long __a, vector unsigned long long __b) {
4860 return __a & ~__b;
4861}
4862
4863static inline __ATTRS_o_ai vector unsigned long long
4864vec_andc(vector unsigned long long __a, vector bool long long __b) {
4865 return __a & ~__b;
4866}
4867
4868static inline __ATTRS_o_ai vector double
4869vec_andc(vector double __a, vector double __b) {
4870 return (vector double)((vector unsigned long long)__a &
4871 ~(vector unsigned long long)__b);
4872}
4873
4874static inline __ATTRS_o_ai vector double
4875vec_andc(vector bool long long __a, vector double __b) {
4876 return (vector double)((vector unsigned long long)__a &
4877 ~(vector unsigned long long)__b);
4878}
4879
4880static inline __ATTRS_o_ai vector double
4881vec_andc(vector double __a, vector bool long long __b) {
4882 return (vector double)((vector unsigned long long)__a &
4883 ~(vector unsigned long long)__b);
4884}
4885
4886/*-- vec_nor ----------------------------------------------------------------*/
4887
4888static inline __ATTRS_o_ai vector bool char
4889vec_nor(vector bool char __a, vector bool char __b) {
4890 return ~(__a | __b);
4891}
4892
4893static inline __ATTRS_o_ai vector signed char
4894vec_nor(vector signed char __a, vector signed char __b) {
4895 return ~(__a | __b);
4896}
4897
4898static inline __ATTRS_o_ai vector signed char
4899vec_nor(vector bool char __a, vector signed char __b) {
4900 return ~(__a | __b);
4901}
4902
4903static inline __ATTRS_o_ai vector signed char
4904vec_nor(vector signed char __a, vector bool char __b) {
4905 return ~(__a | __b);
4906}
4907
4908static inline __ATTRS_o_ai vector unsigned char
4909vec_nor(vector unsigned char __a, vector unsigned char __b) {
4910 return ~(__a | __b);
4911}
4912
4913static inline __ATTRS_o_ai vector unsigned char
4914vec_nor(vector bool char __a, vector unsigned char __b) {
4915 return ~(__a | __b);
4916}
4917
4918static inline __ATTRS_o_ai vector unsigned char
4919vec_nor(vector unsigned char __a, vector bool char __b) {
4920 return ~(__a | __b);
4921}
4922
4923static inline __ATTRS_o_ai vector bool short
4924vec_nor(vector bool short __a, vector bool short __b) {
4925 return ~(__a | __b);
4926}
4927
4928static inline __ATTRS_o_ai vector signed short
4929vec_nor(vector signed short __a, vector signed short __b) {
4930 return ~(__a | __b);
4931}
4932
4933static inline __ATTRS_o_ai vector signed short
4934vec_nor(vector bool short __a, vector signed short __b) {
4935 return ~(__a | __b);
4936}
4937
4938static inline __ATTRS_o_ai vector signed short
4939vec_nor(vector signed short __a, vector bool short __b) {
4940 return ~(__a | __b);
4941}
4942
4943static inline __ATTRS_o_ai vector unsigned short
4944vec_nor(vector unsigned short __a, vector unsigned short __b) {
4945 return ~(__a | __b);
4946}
4947
4948static inline __ATTRS_o_ai vector unsigned short
4949vec_nor(vector bool short __a, vector unsigned short __b) {
4950 return ~(__a | __b);
4951}
4952
4953static inline __ATTRS_o_ai vector unsigned short
4954vec_nor(vector unsigned short __a, vector bool short __b) {
4955 return ~(__a | __b);
4956}
4957
4958static inline __ATTRS_o_ai vector bool int
4959vec_nor(vector bool int __a, vector bool int __b) {
4960 return ~(__a | __b);
4961}
4962
4963static inline __ATTRS_o_ai vector signed int
4964vec_nor(vector signed int __a, vector signed int __b) {
4965 return ~(__a | __b);
4966}
4967
4968static inline __ATTRS_o_ai vector signed int
4969vec_nor(vector bool int __a, vector signed int __b) {
4970 return ~(__a | __b);
4971}
4972
4973static inline __ATTRS_o_ai vector signed int
4974vec_nor(vector signed int __a, vector bool int __b) {
4975 return ~(__a | __b);
4976}
4977
4978static inline __ATTRS_o_ai vector unsigned int
4979vec_nor(vector unsigned int __a, vector unsigned int __b) {
4980 return ~(__a | __b);
4981}
4982
4983static inline __ATTRS_o_ai vector unsigned int
4984vec_nor(vector bool int __a, vector unsigned int __b) {
4985 return ~(__a | __b);
4986}
4987
4988static inline __ATTRS_o_ai vector unsigned int
4989vec_nor(vector unsigned int __a, vector bool int __b) {
4990 return ~(__a | __b);
4991}
4992
4993static inline __ATTRS_o_ai vector bool long long
4994vec_nor(vector bool long long __a, vector bool long long __b) {
4995 return ~(__a | __b);
4996}
4997
4998static inline __ATTRS_o_ai vector signed long long
4999vec_nor(vector signed long long __a, vector signed long long __b) {
5000 return ~(__a | __b);
5001}
5002
5003static inline __ATTRS_o_ai vector signed long long
5004vec_nor(vector bool long long __a, vector signed long long __b) {
5005 return ~(__a | __b);
5006}
5007
5008static inline __ATTRS_o_ai vector signed long long
5009vec_nor(vector signed long long __a, vector bool long long __b) {
5010 return ~(__a | __b);
5011}
5012
5013static inline __ATTRS_o_ai vector unsigned long long
5014vec_nor(vector unsigned long long __a, vector unsigned long long __b) {
5015 return ~(__a | __b);
5016}
5017
5018static inline __ATTRS_o_ai vector unsigned long long
5019vec_nor(vector bool long long __a, vector unsigned long long __b) {
5020 return ~(__a | __b);
5021}
5022
5023static inline __ATTRS_o_ai vector unsigned long long
5024vec_nor(vector unsigned long long __a, vector bool long long __b) {
5025 return ~(__a | __b);
5026}
5027
5028static inline __ATTRS_o_ai vector double
5029vec_nor(vector double __a, vector double __b) {
5030 return (vector double)~((vector unsigned long long)__a |
5031 (vector unsigned long long)__b);
5032}
5033
5034static inline __ATTRS_o_ai vector double
5035vec_nor(vector bool long long __a, vector double __b) {
5036 return (vector double)~((vector unsigned long long)__a |
5037 (vector unsigned long long)__b);
5038}
5039
5040static inline __ATTRS_o_ai vector double
5041vec_nor(vector double __a, vector bool long long __b) {
5042 return (vector double)~((vector unsigned long long)__a |
5043 (vector unsigned long long)__b);
5044}
5045
5046/*-- vec_cntlz --------------------------------------------------------------*/
5047
5048static inline __ATTRS_o_ai vector unsigned char
5049vec_cntlz(vector signed char __a) {
5050 return __builtin_s390_vclzb((vector unsigned char)__a);
5051}
5052
5053static inline __ATTRS_o_ai vector unsigned char
5054vec_cntlz(vector unsigned char __a) {
5055 return __builtin_s390_vclzb(__a);
5056}
5057
5058static inline __ATTRS_o_ai vector unsigned short
5059vec_cntlz(vector signed short __a) {
5060 return __builtin_s390_vclzh((vector unsigned short)__a);
5061}
5062
5063static inline __ATTRS_o_ai vector unsigned short
5064vec_cntlz(vector unsigned short __a) {
5065 return __builtin_s390_vclzh(__a);
5066}
5067
5068static inline __ATTRS_o_ai vector unsigned int
5069vec_cntlz(vector signed int __a) {
5070 return __builtin_s390_vclzf((vector unsigned int)__a);
5071}
5072
5073static inline __ATTRS_o_ai vector unsigned int
5074vec_cntlz(vector unsigned int __a) {
5075 return __builtin_s390_vclzf(__a);
5076}
5077
5078static inline __ATTRS_o_ai vector unsigned long long
5079vec_cntlz(vector signed long long __a) {
5080 return __builtin_s390_vclzg((vector unsigned long long)__a);
5081}
5082
5083static inline __ATTRS_o_ai vector unsigned long long
5084vec_cntlz(vector unsigned long long __a) {
5085 return __builtin_s390_vclzg(__a);
5086}
5087
5088/*-- vec_cnttz --------------------------------------------------------------*/
5089
5090static inline __ATTRS_o_ai vector unsigned char
5091vec_cnttz(vector signed char __a) {
5092 return __builtin_s390_vctzb((vector unsigned char)__a);
5093}
5094
5095static inline __ATTRS_o_ai vector unsigned char
5096vec_cnttz(vector unsigned char __a) {
5097 return __builtin_s390_vctzb(__a);
5098}
5099
5100static inline __ATTRS_o_ai vector unsigned short
5101vec_cnttz(vector signed short __a) {
5102 return __builtin_s390_vctzh((vector unsigned short)__a);
5103}
5104
5105static inline __ATTRS_o_ai vector unsigned short
5106vec_cnttz(vector unsigned short __a) {
5107 return __builtin_s390_vctzh(__a);
5108}
5109
5110static inline __ATTRS_o_ai vector unsigned int
5111vec_cnttz(vector signed int __a) {
5112 return __builtin_s390_vctzf((vector unsigned int)__a);
5113}
5114
5115static inline __ATTRS_o_ai vector unsigned int
5116vec_cnttz(vector unsigned int __a) {
5117 return __builtin_s390_vctzf(__a);
5118}
5119
5120static inline __ATTRS_o_ai vector unsigned long long
5121vec_cnttz(vector signed long long __a) {
5122 return __builtin_s390_vctzg((vector unsigned long long)__a);
5123}
5124
5125static inline __ATTRS_o_ai vector unsigned long long
5126vec_cnttz(vector unsigned long long __a) {
5127 return __builtin_s390_vctzg(__a);
5128}
5129
5130/*-- vec_popcnt -------------------------------------------------------------*/
5131
5132static inline __ATTRS_o_ai vector unsigned char
5133vec_popcnt(vector signed char __a) {
5134 return __builtin_s390_vpopctb((vector unsigned char)__a);
5135}
5136
5137static inline __ATTRS_o_ai vector unsigned char
5138vec_popcnt(vector unsigned char __a) {
5139 return __builtin_s390_vpopctb(__a);
5140}
5141
5142static inline __ATTRS_o_ai vector unsigned short
5143vec_popcnt(vector signed short __a) {
5144 return __builtin_s390_vpopcth((vector unsigned short)__a);
5145}
5146
5147static inline __ATTRS_o_ai vector unsigned short
5148vec_popcnt(vector unsigned short __a) {
5149 return __builtin_s390_vpopcth(__a);
5150}
5151
5152static inline __ATTRS_o_ai vector unsigned int
5153vec_popcnt(vector signed int __a) {
5154 return __builtin_s390_vpopctf((vector unsigned int)__a);
5155}
5156
5157static inline __ATTRS_o_ai vector unsigned int
5158vec_popcnt(vector unsigned int __a) {
5159 return __builtin_s390_vpopctf(__a);
5160}
5161
5162static inline __ATTRS_o_ai vector unsigned long long
5163vec_popcnt(vector signed long long __a) {
5164 return __builtin_s390_vpopctg((vector unsigned long long)__a);
5165}
5166
5167static inline __ATTRS_o_ai vector unsigned long long
5168vec_popcnt(vector unsigned long long __a) {
5169 return __builtin_s390_vpopctg(__a);
5170}
5171
5172/*-- vec_rl -----------------------------------------------------------------*/
5173
5174static inline __ATTRS_o_ai vector signed char
5175vec_rl(vector signed char __a, vector unsigned char __b) {
5176 return (vector signed char)__builtin_s390_verllvb(
5177 (vector unsigned char)__a, __b);
5178}
5179
5180static inline __ATTRS_o_ai vector unsigned char
5181vec_rl(vector unsigned char __a, vector unsigned char __b) {
5182 return __builtin_s390_verllvb(__a, __b);
5183}
5184
5185static inline __ATTRS_o_ai vector signed short
5186vec_rl(vector signed short __a, vector unsigned short __b) {
5187 return (vector signed short)__builtin_s390_verllvh(
5188 (vector unsigned short)__a, __b);
5189}
5190
5191static inline __ATTRS_o_ai vector unsigned short
5192vec_rl(vector unsigned short __a, vector unsigned short __b) {
5193 return __builtin_s390_verllvh(__a, __b);
5194}
5195
5196static inline __ATTRS_o_ai vector signed int
5197vec_rl(vector signed int __a, vector unsigned int __b) {
5198 return (vector signed int)__builtin_s390_verllvf(
5199 (vector unsigned int)__a, __b);
5200}
5201
5202static inline __ATTRS_o_ai vector unsigned int
5203vec_rl(vector unsigned int __a, vector unsigned int __b) {
5204 return __builtin_s390_verllvf(__a, __b);
5205}
5206
5207static inline __ATTRS_o_ai vector signed long long
5208vec_rl(vector signed long long __a, vector unsigned long long __b) {
5209 return (vector signed long long)__builtin_s390_verllvg(
5210 (vector unsigned long long)__a, __b);
5211}
5212
5213static inline __ATTRS_o_ai vector unsigned long long
5214vec_rl(vector unsigned long long __a, vector unsigned long long __b) {
5215 return __builtin_s390_verllvg(__a, __b);
5216}
5217
5218/*-- vec_rli ----------------------------------------------------------------*/
5219
5220static inline __ATTRS_o_ai vector signed char
5221vec_rli(vector signed char __a, unsigned long __b) {
5222 return (vector signed char)__builtin_s390_verllb(
5223 (vector unsigned char)__a, (int)__b);
5224}
5225
5226static inline __ATTRS_o_ai vector unsigned char
5227vec_rli(vector unsigned char __a, unsigned long __b) {
5228 return __builtin_s390_verllb(__a, (int)__b);
5229}
5230
5231static inline __ATTRS_o_ai vector signed short
5232vec_rli(vector signed short __a, unsigned long __b) {
5233 return (vector signed short)__builtin_s390_verllh(
5234 (vector unsigned short)__a, (int)__b);
5235}
5236
5237static inline __ATTRS_o_ai vector unsigned short
5238vec_rli(vector unsigned short __a, unsigned long __b) {
5239 return __builtin_s390_verllh(__a, (int)__b);
5240}
5241
5242static inline __ATTRS_o_ai vector signed int
5243vec_rli(vector signed int __a, unsigned long __b) {
5244 return (vector signed int)__builtin_s390_verllf(
5245 (vector unsigned int)__a, (int)__b);
5246}
5247
5248static inline __ATTRS_o_ai vector unsigned int
5249vec_rli(vector unsigned int __a, unsigned long __b) {
5250 return __builtin_s390_verllf(__a, (int)__b);
5251}
5252
5253static inline __ATTRS_o_ai vector signed long long
5254vec_rli(vector signed long long __a, unsigned long __b) {
5255 return (vector signed long long)__builtin_s390_verllg(
5256 (vector unsigned long long)__a, (int)__b);
5257}
5258
5259static inline __ATTRS_o_ai vector unsigned long long
5260vec_rli(vector unsigned long long __a, unsigned long __b) {
5261 return __builtin_s390_verllg(__a, (int)__b);
5262}
5263
5264/*-- vec_rl_mask ------------------------------------------------------------*/
5265
5266extern __ATTRS_o vector signed char
5267vec_rl_mask(vector signed char __a, vector unsigned char __b,
5268 unsigned char __c) __constant(__c);
5269
5270extern __ATTRS_o vector unsigned char
5271vec_rl_mask(vector unsigned char __a, vector unsigned char __b,
5272 unsigned char __c) __constant(__c);
5273
5274extern __ATTRS_o vector signed short
5275vec_rl_mask(vector signed short __a, vector unsigned short __b,
5276 unsigned char __c) __constant(__c);
5277
5278extern __ATTRS_o vector unsigned short
5279vec_rl_mask(vector unsigned short __a, vector unsigned short __b,
5280 unsigned char __c) __constant(__c);
5281
5282extern __ATTRS_o vector signed int
5283vec_rl_mask(vector signed int __a, vector unsigned int __b,
5284 unsigned char __c) __constant(__c);
5285
5286extern __ATTRS_o vector unsigned int
5287vec_rl_mask(vector unsigned int __a, vector unsigned int __b,
5288 unsigned char __c) __constant(__c);
5289
5290extern __ATTRS_o vector signed long long
5291vec_rl_mask(vector signed long long __a, vector unsigned long long __b,
5292 unsigned char __c) __constant(__c);
5293
5294extern __ATTRS_o vector unsigned long long
5295vec_rl_mask(vector unsigned long long __a, vector unsigned long long __b,
5296 unsigned char __c) __constant(__c);
5297
5298#define vec_rl_mask(X, Y, Z) ((__typeof__((vec_rl_mask)((X), (Y), (Z)))) \
5299 __extension__ ({ \
5300 vector unsigned char __res; \
5301 vector unsigned char __x = (vector unsigned char)(X); \
5302 vector unsigned char __y = (vector unsigned char)(Y); \
5303 switch (sizeof ((X)[0])) { \
5304 case 1: __res = (vector unsigned char) __builtin_s390_verimb( \
5305 (vector unsigned char)__x, (vector unsigned char)__x, \
5306 (vector unsigned char)__y, (Z)); break; \
5307 case 2: __res = (vector unsigned char) __builtin_s390_verimh( \
5308 (vector unsigned short)__x, (vector unsigned short)__x, \
5309 (vector unsigned short)__y, (Z)); break; \
5310 case 4: __res = (vector unsigned char) __builtin_s390_verimf( \
5311 (vector unsigned int)__x, (vector unsigned int)__x, \
5312 (vector unsigned int)__y, (Z)); break; \
5313 default: __res = (vector unsigned char) __builtin_s390_verimg( \
5314 (vector unsigned long long)__x, (vector unsigned long long)__x, \
5315 (vector unsigned long long)__y, (Z)); break; \
5316 } __res; }))
5317
5318/*-- vec_sll ----------------------------------------------------------------*/
5319
5320static inline __ATTRS_o_ai vector signed char
5321vec_sll(vector signed char __a, vector unsigned char __b) {
5322 return (vector signed char)__builtin_s390_vsl(
5323 (vector unsigned char)__a, __b);
5324}
5325
5326static inline __ATTRS_o_ai vector signed char
5327vec_sll(vector signed char __a, vector unsigned short __b) {
5328 return (vector signed char)__builtin_s390_vsl(
5329 (vector unsigned char)__a, (vector unsigned char)__b);
5330}
5331
5332static inline __ATTRS_o_ai vector signed char
5333vec_sll(vector signed char __a, vector unsigned int __b) {
5334 return (vector signed char)__builtin_s390_vsl(
5335 (vector unsigned char)__a, (vector unsigned char)__b);
5336}
5337
5338static inline __ATTRS_o_ai vector bool char
5339vec_sll(vector bool char __a, vector unsigned char __b) {
5340 return (vector bool char)__builtin_s390_vsl(
5341 (vector unsigned char)__a, __b);
5342}
5343
5344static inline __ATTRS_o_ai vector bool char
5345vec_sll(vector bool char __a, vector unsigned short __b) {
5346 return (vector bool char)__builtin_s390_vsl(
5347 (vector unsigned char)__a, (vector unsigned char)__b);
5348}
5349
5350static inline __ATTRS_o_ai vector bool char
5351vec_sll(vector bool char __a, vector unsigned int __b) {
5352 return (vector bool char)__builtin_s390_vsl(
5353 (vector unsigned char)__a, (vector unsigned char)__b);
5354}
5355
5356static inline __ATTRS_o_ai vector unsigned char
5357vec_sll(vector unsigned char __a, vector unsigned char __b) {
5358 return __builtin_s390_vsl(__a, __b);
5359}
5360
5361static inline __ATTRS_o_ai vector unsigned char
5362vec_sll(vector unsigned char __a, vector unsigned short __b) {
5363 return __builtin_s390_vsl(__a, (vector unsigned char)__b);
5364}
5365
5366static inline __ATTRS_o_ai vector unsigned char
5367vec_sll(vector unsigned char __a, vector unsigned int __b) {
5368 return __builtin_s390_vsl(__a, (vector unsigned char)__b);
5369}
5370
5371static inline __ATTRS_o_ai vector signed short
5372vec_sll(vector signed short __a, vector unsigned char __b) {
5373 return (vector signed short)__builtin_s390_vsl(
5374 (vector unsigned char)__a, __b);
5375}
5376
5377static inline __ATTRS_o_ai vector signed short
5378vec_sll(vector signed short __a, vector unsigned short __b) {
5379 return (vector signed short)__builtin_s390_vsl(
5380 (vector unsigned char)__a, (vector unsigned char)__b);
5381}
5382
5383static inline __ATTRS_o_ai vector signed short
5384vec_sll(vector signed short __a, vector unsigned int __b) {
5385 return (vector signed short)__builtin_s390_vsl(
5386 (vector unsigned char)__a, (vector unsigned char)__b);
5387}
5388
5389static inline __ATTRS_o_ai vector bool short
5390vec_sll(vector bool short __a, vector unsigned char __b) {
5391 return (vector bool short)__builtin_s390_vsl(
5392 (vector unsigned char)__a, __b);
5393}
5394
5395static inline __ATTRS_o_ai vector bool short
5396vec_sll(vector bool short __a, vector unsigned short __b) {
5397 return (vector bool short)__builtin_s390_vsl(
5398 (vector unsigned char)__a, (vector unsigned char)__b);
5399}
5400
5401static inline __ATTRS_o_ai vector bool short
5402vec_sll(vector bool short __a, vector unsigned int __b) {
5403 return (vector bool short)__builtin_s390_vsl(
5404 (vector unsigned char)__a, (vector unsigned char)__b);
5405}
5406
5407static inline __ATTRS_o_ai vector unsigned short
5408vec_sll(vector unsigned short __a, vector unsigned char __b) {
5409 return (vector unsigned short)__builtin_s390_vsl(
5410 (vector unsigned char)__a, __b);
5411}
5412
5413static inline __ATTRS_o_ai vector unsigned short
5414vec_sll(vector unsigned short __a, vector unsigned short __b) {
5415 return (vector unsigned short)__builtin_s390_vsl(
5416 (vector unsigned char)__a, (vector unsigned char)__b);
5417}
5418
5419static inline __ATTRS_o_ai vector unsigned short
5420vec_sll(vector unsigned short __a, vector unsigned int __b) {
5421 return (vector unsigned short)__builtin_s390_vsl(
5422 (vector unsigned char)__a, (vector unsigned char)__b);
5423}
5424
5425static inline __ATTRS_o_ai vector signed int
5426vec_sll(vector signed int __a, vector unsigned char __b) {
5427 return (vector signed int)__builtin_s390_vsl(
5428 (vector unsigned char)__a, __b);
5429}
5430
5431static inline __ATTRS_o_ai vector signed int
5432vec_sll(vector signed int __a, vector unsigned short __b) {
5433 return (vector signed int)__builtin_s390_vsl(
5434 (vector unsigned char)__a, (vector unsigned char)__b);
5435}
5436
5437static inline __ATTRS_o_ai vector signed int
5438vec_sll(vector signed int __a, vector unsigned int __b) {
5439 return (vector signed int)__builtin_s390_vsl(
5440 (vector unsigned char)__a, (vector unsigned char)__b);
5441}
5442
5443static inline __ATTRS_o_ai vector bool int
5444vec_sll(vector bool int __a, vector unsigned char __b) {
5445 return (vector bool int)__builtin_s390_vsl(
5446 (vector unsigned char)__a, __b);
5447}
5448
5449static inline __ATTRS_o_ai vector bool int
5450vec_sll(vector bool int __a, vector unsigned short __b) {
5451 return (vector bool int)__builtin_s390_vsl(
5452 (vector unsigned char)__a, (vector unsigned char)__b);
5453}
5454
5455static inline __ATTRS_o_ai vector bool int
5456vec_sll(vector bool int __a, vector unsigned int __b) {
5457 return (vector bool int)__builtin_s390_vsl(
5458 (vector unsigned char)__a, (vector unsigned char)__b);
5459}
5460
5461static inline __ATTRS_o_ai vector unsigned int
5462vec_sll(vector unsigned int __a, vector unsigned char __b) {
5463 return (vector unsigned int)__builtin_s390_vsl(
5464 (vector unsigned char)__a, __b);
5465}
5466
5467static inline __ATTRS_o_ai vector unsigned int
5468vec_sll(vector unsigned int __a, vector unsigned short __b) {
5469 return (vector unsigned int)__builtin_s390_vsl(
5470 (vector unsigned char)__a, (vector unsigned char)__b);
5471}
5472
5473static inline __ATTRS_o_ai vector unsigned int
5474vec_sll(vector unsigned int __a, vector unsigned int __b) {
5475 return (vector unsigned int)__builtin_s390_vsl(
5476 (vector unsigned char)__a, (vector unsigned char)__b);
5477}
5478
5479static inline __ATTRS_o_ai vector signed long long
5480vec_sll(vector signed long long __a, vector unsigned char __b) {
5481 return (vector signed long long)__builtin_s390_vsl(
5482 (vector unsigned char)__a, __b);
5483}
5484
5485static inline __ATTRS_o_ai vector signed long long
5486vec_sll(vector signed long long __a, vector unsigned short __b) {
5487 return (vector signed long long)__builtin_s390_vsl(
5488 (vector unsigned char)__a, (vector unsigned char)__b);
5489}
5490
5491static inline __ATTRS_o_ai vector signed long long
5492vec_sll(vector signed long long __a, vector unsigned int __b) {
5493 return (vector signed long long)__builtin_s390_vsl(
5494 (vector unsigned char)__a, (vector unsigned char)__b);
5495}
5496
5497static inline __ATTRS_o_ai vector bool long long
5498vec_sll(vector bool long long __a, vector unsigned char __b) {
5499 return (vector bool long long)__builtin_s390_vsl(
5500 (vector unsigned char)__a, __b);
5501}
5502
5503static inline __ATTRS_o_ai vector bool long long
5504vec_sll(vector bool long long __a, vector unsigned short __b) {
5505 return (vector bool long long)__builtin_s390_vsl(
5506 (vector unsigned char)__a, (vector unsigned char)__b);
5507}
5508
5509static inline __ATTRS_o_ai vector bool long long
5510vec_sll(vector bool long long __a, vector unsigned int __b) {
5511 return (vector bool long long)__builtin_s390_vsl(
5512 (vector unsigned char)__a, (vector unsigned char)__b);
5513}
5514
5515static inline __ATTRS_o_ai vector unsigned long long
5516vec_sll(vector unsigned long long __a, vector unsigned char __b) {
5517 return (vector unsigned long long)__builtin_s390_vsl(
5518 (vector unsigned char)__a, __b);
5519}
5520
5521static inline __ATTRS_o_ai vector unsigned long long
5522vec_sll(vector unsigned long long __a, vector unsigned short __b) {
5523 return (vector unsigned long long)__builtin_s390_vsl(
5524 (vector unsigned char)__a, (vector unsigned char)__b);
5525}
5526
5527static inline __ATTRS_o_ai vector unsigned long long
5528vec_sll(vector unsigned long long __a, vector unsigned int __b) {
5529 return (vector unsigned long long)__builtin_s390_vsl(
5530 (vector unsigned char)__a, (vector unsigned char)__b);
5531}
5532
5533/*-- vec_slb ----------------------------------------------------------------*/
5534
5535static inline __ATTRS_o_ai vector signed char
5536vec_slb(vector signed char __a, vector signed char __b) {
5537 return (vector signed char)__builtin_s390_vslb(
5538 (vector unsigned char)__a, (vector unsigned char)__b);
5539}
5540
5541static inline __ATTRS_o_ai vector signed char
5542vec_slb(vector signed char __a, vector unsigned char __b) {
5543 return (vector signed char)__builtin_s390_vslb(
5544 (vector unsigned char)__a, __b);
5545}
5546
5547static inline __ATTRS_o_ai vector unsigned char
5548vec_slb(vector unsigned char __a, vector signed char __b) {
5549 return __builtin_s390_vslb(__a, (vector unsigned char)__b);
5550}
5551
5552static inline __ATTRS_o_ai vector unsigned char
5553vec_slb(vector unsigned char __a, vector unsigned char __b) {
5554 return __builtin_s390_vslb(__a, __b);
5555}
5556
5557static inline __ATTRS_o_ai vector signed short
5558vec_slb(vector signed short __a, vector signed short __b) {
5559 return (vector signed short)__builtin_s390_vslb(
5560 (vector unsigned char)__a, (vector unsigned char)__b);
5561}
5562
5563static inline __ATTRS_o_ai vector signed short
5564vec_slb(vector signed short __a, vector unsigned short __b) {
5565 return (vector signed short)__builtin_s390_vslb(
5566 (vector unsigned char)__a, (vector unsigned char)__b);
5567}
5568
5569static inline __ATTRS_o_ai vector unsigned short
5570vec_slb(vector unsigned short __a, vector signed short __b) {
5571 return (vector unsigned short)__builtin_s390_vslb(
5572 (vector unsigned char)__a, (vector unsigned char)__b);
5573}
5574
5575static inline __ATTRS_o_ai vector unsigned short
5576vec_slb(vector unsigned short __a, vector unsigned short __b) {
5577 return (vector unsigned short)__builtin_s390_vslb(
5578 (vector unsigned char)__a, (vector unsigned char)__b);
5579}
5580
5581static inline __ATTRS_o_ai vector signed int
5582vec_slb(vector signed int __a, vector signed int __b) {
5583 return (vector signed int)__builtin_s390_vslb(
5584 (vector unsigned char)__a, (vector unsigned char)__b);
5585}
5586
5587static inline __ATTRS_o_ai vector signed int
5588vec_slb(vector signed int __a, vector unsigned int __b) {
5589 return (vector signed int)__builtin_s390_vslb(
5590 (vector unsigned char)__a, (vector unsigned char)__b);
5591}
5592
5593static inline __ATTRS_o_ai vector unsigned int
5594vec_slb(vector unsigned int __a, vector signed int __b) {
5595 return (vector unsigned int)__builtin_s390_vslb(
5596 (vector unsigned char)__a, (vector unsigned char)__b);
5597}
5598
5599static inline __ATTRS_o_ai vector unsigned int
5600vec_slb(vector unsigned int __a, vector unsigned int __b) {
5601 return (vector unsigned int)__builtin_s390_vslb(
5602 (vector unsigned char)__a, (vector unsigned char)__b);
5603}
5604
5605static inline __ATTRS_o_ai vector signed long long
5606vec_slb(vector signed long long __a, vector signed long long __b) {
5607 return (vector signed long long)__builtin_s390_vslb(
5608 (vector unsigned char)__a, (vector unsigned char)__b);
5609}
5610
5611static inline __ATTRS_o_ai vector signed long long
5612vec_slb(vector signed long long __a, vector unsigned long long __b) {
5613 return (vector signed long long)__builtin_s390_vslb(
5614 (vector unsigned char)__a, (vector unsigned char)__b);
5615}
5616
5617static inline __ATTRS_o_ai vector unsigned long long
5618vec_slb(vector unsigned long long __a, vector signed long long __b) {
5619 return (vector unsigned long long)__builtin_s390_vslb(
5620 (vector unsigned char)__a, (vector unsigned char)__b);
5621}
5622
5623static inline __ATTRS_o_ai vector unsigned long long
5624vec_slb(vector unsigned long long __a, vector unsigned long long __b) {
5625 return (vector unsigned long long)__builtin_s390_vslb(
5626 (vector unsigned char)__a, (vector unsigned char)__b);
5627}
5628
5629static inline __ATTRS_o_ai vector double
5630vec_slb(vector double __a, vector signed long long __b) {
5631 return (vector double)__builtin_s390_vslb(
5632 (vector unsigned char)__a, (vector unsigned char)__b);
5633}
5634
5635static inline __ATTRS_o_ai vector double
5636vec_slb(vector double __a, vector unsigned long long __b) {
5637 return (vector double)__builtin_s390_vslb(
5638 (vector unsigned char)__a, (vector unsigned char)__b);
5639}
5640
5641/*-- vec_sld ----------------------------------------------------------------*/
5642
5643extern __ATTRS_o vector signed char
5644vec_sld(vector signed char __a, vector signed char __b, int __c)
5645 __constant_range(__c, 0, 15);
5646
5647extern __ATTRS_o vector unsigned char
5648vec_sld(vector unsigned char __a, vector unsigned char __b, int __c)
5649 __constant_range(__c, 0, 15);
5650
5651extern __ATTRS_o vector signed short
5652vec_sld(vector signed short __a, vector signed short __b, int __c)
5653 __constant_range(__c, 0, 15);
5654
5655extern __ATTRS_o vector unsigned short
5656vec_sld(vector unsigned short __a, vector unsigned short __b, int __c)
5657 __constant_range(__c, 0, 15);
5658
5659extern __ATTRS_o vector signed int
5660vec_sld(vector signed int __a, vector signed int __b, int __c)
5661 __constant_range(__c, 0, 15);
5662
5663extern __ATTRS_o vector unsigned int
5664vec_sld(vector unsigned int __a, vector unsigned int __b, int __c)
5665 __constant_range(__c, 0, 15);
5666
5667extern __ATTRS_o vector signed long long
5668vec_sld(vector signed long long __a, vector signed long long __b, int __c)
5669 __constant_range(__c, 0, 15);
5670
5671extern __ATTRS_o vector unsigned long long
5672vec_sld(vector unsigned long long __a, vector unsigned long long __b, int __c)
5673 __constant_range(__c, 0, 15);
5674
5675extern __ATTRS_o vector double
5676vec_sld(vector double __a, vector double __b, int __c)
5677 __constant_range(__c, 0, 15);
5678
5679#define vec_sld(X, Y, Z) ((__typeof__((vec_sld)((X), (Y), (Z)))) \
5680 __builtin_s390_vsldb((vector unsigned char)(X), \
5681 (vector unsigned char)(Y), (Z)))
5682
5683/*-- vec_sldw ---------------------------------------------------------------*/
5684
5685extern __ATTRS_o vector signed char
5686vec_sldw(vector signed char __a, vector signed char __b, int __c)
5687 __constant_range(__c, 0, 3);
5688
5689extern __ATTRS_o vector unsigned char
5690vec_sldw(vector unsigned char __a, vector unsigned char __b, int __c)
5691 __constant_range(__c, 0, 3);
5692
5693extern __ATTRS_o vector signed short
5694vec_sldw(vector signed short __a, vector signed short __b, int __c)
5695 __constant_range(__c, 0, 3);
5696
5697extern __ATTRS_o vector unsigned short
5698vec_sldw(vector unsigned short __a, vector unsigned short __b, int __c)
5699 __constant_range(__c, 0, 3);
5700
5701extern __ATTRS_o vector signed int
5702vec_sldw(vector signed int __a, vector signed int __b, int __c)
5703 __constant_range(__c, 0, 3);
5704
5705extern __ATTRS_o vector unsigned int
5706vec_sldw(vector unsigned int __a, vector unsigned int __b, int __c)
5707 __constant_range(__c, 0, 3);
5708
5709extern __ATTRS_o vector signed long long
5710vec_sldw(vector signed long long __a, vector signed long long __b, int __c)
5711 __constant_range(__c, 0, 3);
5712
5713extern __ATTRS_o vector unsigned long long
5714vec_sldw(vector unsigned long long __a, vector unsigned long long __b, int __c)
5715 __constant_range(__c, 0, 3);
5716
5717extern __ATTRS_o vector double
5718vec_sldw(vector double __a, vector double __b, int __c)
5719 __constant_range(__c, 0, 3);
5720
5721#define vec_sldw(X, Y, Z) ((__typeof__((vec_sldw)((X), (Y), (Z)))) \
5722 __builtin_s390_vsldb((vector unsigned char)(X), \
5723 (vector unsigned char)(Y), (Z) * 4))
5724
5725/*-- vec_sral ---------------------------------------------------------------*/
5726
5727static inline __ATTRS_o_ai vector signed char
5728vec_sral(vector signed char __a, vector unsigned char __b) {
5729 return (vector signed char)__builtin_s390_vsra(
5730 (vector unsigned char)__a, __b);
5731}
5732
5733static inline __ATTRS_o_ai vector signed char
5734vec_sral(vector signed char __a, vector unsigned short __b) {
5735 return (vector signed char)__builtin_s390_vsra(
5736 (vector unsigned char)__a, (vector unsigned char)__b);
5737}
5738
5739static inline __ATTRS_o_ai vector signed char
5740vec_sral(vector signed char __a, vector unsigned int __b) {
5741 return (vector signed char)__builtin_s390_vsra(
5742 (vector unsigned char)__a, (vector unsigned char)__b);
5743}
5744
5745static inline __ATTRS_o_ai vector bool char
5746vec_sral(vector bool char __a, vector unsigned char __b) {
5747 return (vector bool char)__builtin_s390_vsra(
5748 (vector unsigned char)__a, __b);
5749}
5750
5751static inline __ATTRS_o_ai vector bool char
5752vec_sral(vector bool char __a, vector unsigned short __b) {
5753 return (vector bool char)__builtin_s390_vsra(
5754 (vector unsigned char)__a, (vector unsigned char)__b);
5755}
5756
5757static inline __ATTRS_o_ai vector bool char
5758vec_sral(vector bool char __a, vector unsigned int __b) {
5759 return (vector bool char)__builtin_s390_vsra(
5760 (vector unsigned char)__a, (vector unsigned char)__b);
5761}
5762
5763static inline __ATTRS_o_ai vector unsigned char
5764vec_sral(vector unsigned char __a, vector unsigned char __b) {
5765 return __builtin_s390_vsra(__a, __b);
5766}
5767
5768static inline __ATTRS_o_ai vector unsigned char
5769vec_sral(vector unsigned char __a, vector unsigned short __b) {
5770 return __builtin_s390_vsra(__a, (vector unsigned char)__b);
5771}
5772
5773static inline __ATTRS_o_ai vector unsigned char
5774vec_sral(vector unsigned char __a, vector unsigned int __b) {
5775 return __builtin_s390_vsra(__a, (vector unsigned char)__b);
5776}
5777
5778static inline __ATTRS_o_ai vector signed short
5779vec_sral(vector signed short __a, vector unsigned char __b) {
5780 return (vector signed short)__builtin_s390_vsra(
5781 (vector unsigned char)__a, __b);
5782}
5783
5784static inline __ATTRS_o_ai vector signed short
5785vec_sral(vector signed short __a, vector unsigned short __b) {
5786 return (vector signed short)__builtin_s390_vsra(
5787 (vector unsigned char)__a, (vector unsigned char)__b);
5788}
5789
5790static inline __ATTRS_o_ai vector signed short
5791vec_sral(vector signed short __a, vector unsigned int __b) {
5792 return (vector signed short)__builtin_s390_vsra(
5793 (vector unsigned char)__a, (vector unsigned char)__b);
5794}
5795
5796static inline __ATTRS_o_ai vector bool short
5797vec_sral(vector bool short __a, vector unsigned char __b) {
5798 return (vector bool short)__builtin_s390_vsra(
5799 (vector unsigned char)__a, __b);
5800}
5801
5802static inline __ATTRS_o_ai vector bool short
5803vec_sral(vector bool short __a, vector unsigned short __b) {
5804 return (vector bool short)__builtin_s390_vsra(
5805 (vector unsigned char)__a, (vector unsigned char)__b);
5806}
5807
5808static inline __ATTRS_o_ai vector bool short
5809vec_sral(vector bool short __a, vector unsigned int __b) {
5810 return (vector bool short)__builtin_s390_vsra(
5811 (vector unsigned char)__a, (vector unsigned char)__b);
5812}
5813
5814static inline __ATTRS_o_ai vector unsigned short
5815vec_sral(vector unsigned short __a, vector unsigned char __b) {
5816 return (vector unsigned short)__builtin_s390_vsra(
5817 (vector unsigned char)__a, __b);
5818}
5819
5820static inline __ATTRS_o_ai vector unsigned short
5821vec_sral(vector unsigned short __a, vector unsigned short __b) {
5822 return (vector unsigned short)__builtin_s390_vsra(
5823 (vector unsigned char)__a, (vector unsigned char)__b);
5824}
5825
5826static inline __ATTRS_o_ai vector unsigned short
5827vec_sral(vector unsigned short __a, vector unsigned int __b) {
5828 return (vector unsigned short)__builtin_s390_vsra(
5829 (vector unsigned char)__a, (vector unsigned char)__b);
5830}
5831
5832static inline __ATTRS_o_ai vector signed int
5833vec_sral(vector signed int __a, vector unsigned char __b) {
5834 return (vector signed int)__builtin_s390_vsra(
5835 (vector unsigned char)__a, __b);
5836}
5837
5838static inline __ATTRS_o_ai vector signed int
5839vec_sral(vector signed int __a, vector unsigned short __b) {
5840 return (vector signed int)__builtin_s390_vsra(
5841 (vector unsigned char)__a, (vector unsigned char)__b);
5842}
5843
5844static inline __ATTRS_o_ai vector signed int
5845vec_sral(vector signed int __a, vector unsigned int __b) {
5846 return (vector signed int)__builtin_s390_vsra(
5847 (vector unsigned char)__a, (vector unsigned char)__b);
5848}
5849
5850static inline __ATTRS_o_ai vector bool int
5851vec_sral(vector bool int __a, vector unsigned char __b) {
5852 return (vector bool int)__builtin_s390_vsra(
5853 (vector unsigned char)__a, __b);
5854}
5855
5856static inline __ATTRS_o_ai vector bool int
5857vec_sral(vector bool int __a, vector unsigned short __b) {
5858 return (vector bool int)__builtin_s390_vsra(
5859 (vector unsigned char)__a, (vector unsigned char)__b);
5860}
5861
5862static inline __ATTRS_o_ai vector bool int
5863vec_sral(vector bool int __a, vector unsigned int __b) {
5864 return (vector bool int)__builtin_s390_vsra(
5865 (vector unsigned char)__a, (vector unsigned char)__b);
5866}
5867
5868static inline __ATTRS_o_ai vector unsigned int
5869vec_sral(vector unsigned int __a, vector unsigned char __b) {
5870 return (vector unsigned int)__builtin_s390_vsra(
5871 (vector unsigned char)__a, __b);
5872}
5873
5874static inline __ATTRS_o_ai vector unsigned int
5875vec_sral(vector unsigned int __a, vector unsigned short __b) {
5876 return (vector unsigned int)__builtin_s390_vsra(
5877 (vector unsigned char)__a, (vector unsigned char)__b);
5878}
5879
5880static inline __ATTRS_o_ai vector unsigned int
5881vec_sral(vector unsigned int __a, vector unsigned int __b) {
5882 return (vector unsigned int)__builtin_s390_vsra(
5883 (vector unsigned char)__a, (vector unsigned char)__b);
5884}
5885
5886static inline __ATTRS_o_ai vector signed long long
5887vec_sral(vector signed long long __a, vector unsigned char __b) {
5888 return (vector signed long long)__builtin_s390_vsra(
5889 (vector unsigned char)__a, __b);
5890}
5891
5892static inline __ATTRS_o_ai vector signed long long
5893vec_sral(vector signed long long __a, vector unsigned short __b) {
5894 return (vector signed long long)__builtin_s390_vsra(
5895 (vector unsigned char)__a, (vector unsigned char)__b);
5896}
5897
5898static inline __ATTRS_o_ai vector signed long long
5899vec_sral(vector signed long long __a, vector unsigned int __b) {
5900 return (vector signed long long)__builtin_s390_vsra(
5901 (vector unsigned char)__a, (vector unsigned char)__b);
5902}
5903
5904static inline __ATTRS_o_ai vector bool long long
5905vec_sral(vector bool long long __a, vector unsigned char __b) {
5906 return (vector bool long long)__builtin_s390_vsra(
5907 (vector unsigned char)__a, __b);
5908}
5909
5910static inline __ATTRS_o_ai vector bool long long
5911vec_sral(vector bool long long __a, vector unsigned short __b) {
5912 return (vector bool long long)__builtin_s390_vsra(
5913 (vector unsigned char)__a, (vector unsigned char)__b);
5914}
5915
5916static inline __ATTRS_o_ai vector bool long long
5917vec_sral(vector bool long long __a, vector unsigned int __b) {
5918 return (vector bool long long)__builtin_s390_vsra(
5919 (vector unsigned char)__a, (vector unsigned char)__b);
5920}
5921
5922static inline __ATTRS_o_ai vector unsigned long long
5923vec_sral(vector unsigned long long __a, vector unsigned char __b) {
5924 return (vector unsigned long long)__builtin_s390_vsra(
5925 (vector unsigned char)__a, __b);
5926}
5927
5928static inline __ATTRS_o_ai vector unsigned long long
5929vec_sral(vector unsigned long long __a, vector unsigned short __b) {
5930 return (vector unsigned long long)__builtin_s390_vsra(
5931 (vector unsigned char)__a, (vector unsigned char)__b);
5932}
5933
5934static inline __ATTRS_o_ai vector unsigned long long
5935vec_sral(vector unsigned long long __a, vector unsigned int __b) {
5936 return (vector unsigned long long)__builtin_s390_vsra(
5937 (vector unsigned char)__a, (vector unsigned char)__b);
5938}
5939
5940/*-- vec_srab ---------------------------------------------------------------*/
5941
5942static inline __ATTRS_o_ai vector signed char
5943vec_srab(vector signed char __a, vector signed char __b) {
5944 return (vector signed char)__builtin_s390_vsrab(
5945 (vector unsigned char)__a, (vector unsigned char)__b);
5946}
5947
5948static inline __ATTRS_o_ai vector signed char
5949vec_srab(vector signed char __a, vector unsigned char __b) {
5950 return (vector signed char)__builtin_s390_vsrab(
5951 (vector unsigned char)__a, __b);
5952}
5953
5954static inline __ATTRS_o_ai vector unsigned char
5955vec_srab(vector unsigned char __a, vector signed char __b) {
5956 return __builtin_s390_vsrab(__a, (vector unsigned char)__b);
5957}
5958
5959static inline __ATTRS_o_ai vector unsigned char
5960vec_srab(vector unsigned char __a, vector unsigned char __b) {
5961 return __builtin_s390_vsrab(__a, __b);
5962}
5963
5964static inline __ATTRS_o_ai vector signed short
5965vec_srab(vector signed short __a, vector signed short __b) {
5966 return (vector signed short)__builtin_s390_vsrab(
5967 (vector unsigned char)__a, (vector unsigned char)__b);
5968}
5969
5970static inline __ATTRS_o_ai vector signed short
5971vec_srab(vector signed short __a, vector unsigned short __b) {
5972 return (vector signed short)__builtin_s390_vsrab(
5973 (vector unsigned char)__a, (vector unsigned char)__b);
5974}
5975
5976static inline __ATTRS_o_ai vector unsigned short
5977vec_srab(vector unsigned short __a, vector signed short __b) {
5978 return (vector unsigned short)__builtin_s390_vsrab(
5979 (vector unsigned char)__a, (vector unsigned char)__b);
5980}
5981
5982static inline __ATTRS_o_ai vector unsigned short
5983vec_srab(vector unsigned short __a, vector unsigned short __b) {
5984 return (vector unsigned short)__builtin_s390_vsrab(
5985 (vector unsigned char)__a, (vector unsigned char)__b);
5986}
5987
5988static inline __ATTRS_o_ai vector signed int
5989vec_srab(vector signed int __a, vector signed int __b) {
5990 return (vector signed int)__builtin_s390_vsrab(
5991 (vector unsigned char)__a, (vector unsigned char)__b);
5992}
5993
5994static inline __ATTRS_o_ai vector signed int
5995vec_srab(vector signed int __a, vector unsigned int __b) {
5996 return (vector signed int)__builtin_s390_vsrab(
5997 (vector unsigned char)__a, (vector unsigned char)__b);
5998}
5999
6000static inline __ATTRS_o_ai vector unsigned int
6001vec_srab(vector unsigned int __a, vector signed int __b) {
6002 return (vector unsigned int)__builtin_s390_vsrab(
6003 (vector unsigned char)__a, (vector unsigned char)__b);
6004}
6005
6006static inline __ATTRS_o_ai vector unsigned int
6007vec_srab(vector unsigned int __a, vector unsigned int __b) {
6008 return (vector unsigned int)__builtin_s390_vsrab(
6009 (vector unsigned char)__a, (vector unsigned char)__b);
6010}
6011
6012static inline __ATTRS_o_ai vector signed long long
6013vec_srab(vector signed long long __a, vector signed long long __b) {
6014 return (vector signed long long)__builtin_s390_vsrab(
6015 (vector unsigned char)__a, (vector unsigned char)__b);
6016}
6017
6018static inline __ATTRS_o_ai vector signed long long
6019vec_srab(vector signed long long __a, vector unsigned long long __b) {
6020 return (vector signed long long)__builtin_s390_vsrab(
6021 (vector unsigned char)__a, (vector unsigned char)__b);
6022}
6023
6024static inline __ATTRS_o_ai vector unsigned long long
6025vec_srab(vector unsigned long long __a, vector signed long long __b) {
6026 return (vector unsigned long long)__builtin_s390_vsrab(
6027 (vector unsigned char)__a, (vector unsigned char)__b);
6028}
6029
6030static inline __ATTRS_o_ai vector unsigned long long
6031vec_srab(vector unsigned long long __a, vector unsigned long long __b) {
6032 return (vector unsigned long long)__builtin_s390_vsrab(
6033 (vector unsigned char)__a, (vector unsigned char)__b);
6034}
6035
6036static inline __ATTRS_o_ai vector double
6037vec_srab(vector double __a, vector signed long long __b) {
6038 return (vector double)__builtin_s390_vsrab(
6039 (vector unsigned char)__a, (vector unsigned char)__b);
6040}
6041
6042static inline __ATTRS_o_ai vector double
6043vec_srab(vector double __a, vector unsigned long long __b) {
6044 return (vector double)__builtin_s390_vsrab(
6045 (vector unsigned char)__a, (vector unsigned char)__b);
6046}
6047
6048/*-- vec_srl ----------------------------------------------------------------*/
6049
6050static inline __ATTRS_o_ai vector signed char
6051vec_srl(vector signed char __a, vector unsigned char __b) {
6052 return (vector signed char)__builtin_s390_vsrl(
6053 (vector unsigned char)__a, __b);
6054}
6055
6056static inline __ATTRS_o_ai vector signed char
6057vec_srl(vector signed char __a, vector unsigned short __b) {
6058 return (vector signed char)__builtin_s390_vsrl(
6059 (vector unsigned char)__a, (vector unsigned char)__b);
6060}
6061
6062static inline __ATTRS_o_ai vector signed char
6063vec_srl(vector signed char __a, vector unsigned int __b) {
6064 return (vector signed char)__builtin_s390_vsrl(
6065 (vector unsigned char)__a, (vector unsigned char)__b);
6066}
6067
6068static inline __ATTRS_o_ai vector bool char
6069vec_srl(vector bool char __a, vector unsigned char __b) {
6070 return (vector bool char)__builtin_s390_vsrl(
6071 (vector unsigned char)__a, __b);
6072}
6073
6074static inline __ATTRS_o_ai vector bool char
6075vec_srl(vector bool char __a, vector unsigned short __b) {
6076 return (vector bool char)__builtin_s390_vsrl(
6077 (vector unsigned char)__a, (vector unsigned char)__b);
6078}
6079
6080static inline __ATTRS_o_ai vector bool char
6081vec_srl(vector bool char __a, vector unsigned int __b) {
6082 return (vector bool char)__builtin_s390_vsrl(
6083 (vector unsigned char)__a, (vector unsigned char)__b);
6084}
6085
6086static inline __ATTRS_o_ai vector unsigned char
6087vec_srl(vector unsigned char __a, vector unsigned char __b) {
6088 return __builtin_s390_vsrl(__a, __b);
6089}
6090
6091static inline __ATTRS_o_ai vector unsigned char
6092vec_srl(vector unsigned char __a, vector unsigned short __b) {
6093 return __builtin_s390_vsrl(__a, (vector unsigned char)__b);
6094}
6095
6096static inline __ATTRS_o_ai vector unsigned char
6097vec_srl(vector unsigned char __a, vector unsigned int __b) {
6098 return __builtin_s390_vsrl(__a, (vector unsigned char)__b);
6099}
6100
6101static inline __ATTRS_o_ai vector signed short
6102vec_srl(vector signed short __a, vector unsigned char __b) {
6103 return (vector signed short)__builtin_s390_vsrl(
6104 (vector unsigned char)__a, __b);
6105}
6106
6107static inline __ATTRS_o_ai vector signed short
6108vec_srl(vector signed short __a, vector unsigned short __b) {
6109 return (vector signed short)__builtin_s390_vsrl(
6110 (vector unsigned char)__a, (vector unsigned char)__b);
6111}
6112
6113static inline __ATTRS_o_ai vector signed short
6114vec_srl(vector signed short __a, vector unsigned int __b) {
6115 return (vector signed short)__builtin_s390_vsrl(
6116 (vector unsigned char)__a, (vector unsigned char)__b);
6117}
6118
6119static inline __ATTRS_o_ai vector bool short
6120vec_srl(vector bool short __a, vector unsigned char __b) {
6121 return (vector bool short)__builtin_s390_vsrl(
6122 (vector unsigned char)__a, __b);
6123}
6124
6125static inline __ATTRS_o_ai vector bool short
6126vec_srl(vector bool short __a, vector unsigned short __b) {
6127 return (vector bool short)__builtin_s390_vsrl(
6128 (vector unsigned char)__a, (vector unsigned char)__b);
6129}
6130
6131static inline __ATTRS_o_ai vector bool short
6132vec_srl(vector bool short __a, vector unsigned int __b) {
6133 return (vector bool short)__builtin_s390_vsrl(
6134 (vector unsigned char)__a, (vector unsigned char)__b);
6135}
6136
6137static inline __ATTRS_o_ai vector unsigned short
6138vec_srl(vector unsigned short __a, vector unsigned char __b) {
6139 return (vector unsigned short)__builtin_s390_vsrl(
6140 (vector unsigned char)__a, __b);
6141}
6142
6143static inline __ATTRS_o_ai vector unsigned short
6144vec_srl(vector unsigned short __a, vector unsigned short __b) {
6145 return (vector unsigned short)__builtin_s390_vsrl(
6146 (vector unsigned char)__a, (vector unsigned char)__b);
6147}
6148
6149static inline __ATTRS_o_ai vector unsigned short
6150vec_srl(vector unsigned short __a, vector unsigned int __b) {
6151 return (vector unsigned short)__builtin_s390_vsrl(
6152 (vector unsigned char)__a, (vector unsigned char)__b);
6153}
6154
6155static inline __ATTRS_o_ai vector signed int
6156vec_srl(vector signed int __a, vector unsigned char __b) {
6157 return (vector signed int)__builtin_s390_vsrl(
6158 (vector unsigned char)__a, __b);
6159}
6160
6161static inline __ATTRS_o_ai vector signed int
6162vec_srl(vector signed int __a, vector unsigned short __b) {
6163 return (vector signed int)__builtin_s390_vsrl(
6164 (vector unsigned char)__a, (vector unsigned char)__b);
6165}
6166
6167static inline __ATTRS_o_ai vector signed int
6168vec_srl(vector signed int __a, vector unsigned int __b) {
6169 return (vector signed int)__builtin_s390_vsrl(
6170 (vector unsigned char)__a, (vector unsigned char)__b);
6171}
6172
6173static inline __ATTRS_o_ai vector bool int
6174vec_srl(vector bool int __a, vector unsigned char __b) {
6175 return (vector bool int)__builtin_s390_vsrl(
6176 (vector unsigned char)__a, __b);
6177}
6178
6179static inline __ATTRS_o_ai vector bool int
6180vec_srl(vector bool int __a, vector unsigned short __b) {
6181 return (vector bool int)__builtin_s390_vsrl(
6182 (vector unsigned char)__a, (vector unsigned char)__b);
6183}
6184
6185static inline __ATTRS_o_ai vector bool int
6186vec_srl(vector bool int __a, vector unsigned int __b) {
6187 return (vector bool int)__builtin_s390_vsrl(
6188 (vector unsigned char)__a, (vector unsigned char)__b);
6189}
6190
6191static inline __ATTRS_o_ai vector unsigned int
6192vec_srl(vector unsigned int __a, vector unsigned char __b) {
6193 return (vector unsigned int)__builtin_s390_vsrl(
6194 (vector unsigned char)__a, __b);
6195}
6196
6197static inline __ATTRS_o_ai vector unsigned int
6198vec_srl(vector unsigned int __a, vector unsigned short __b) {
6199 return (vector unsigned int)__builtin_s390_vsrl(
6200 (vector unsigned char)__a, (vector unsigned char)__b);
6201}
6202
6203static inline __ATTRS_o_ai vector unsigned int
6204vec_srl(vector unsigned int __a, vector unsigned int __b) {
6205 return (vector unsigned int)__builtin_s390_vsrl(
6206 (vector unsigned char)__a, (vector unsigned char)__b);
6207}
6208
6209static inline __ATTRS_o_ai vector signed long long
6210vec_srl(vector signed long long __a, vector unsigned char __b) {
6211 return (vector signed long long)__builtin_s390_vsrl(
6212 (vector unsigned char)__a, __b);
6213}
6214
6215static inline __ATTRS_o_ai vector signed long long
6216vec_srl(vector signed long long __a, vector unsigned short __b) {
6217 return (vector signed long long)__builtin_s390_vsrl(
6218 (vector unsigned char)__a, (vector unsigned char)__b);
6219}
6220
6221static inline __ATTRS_o_ai vector signed long long
6222vec_srl(vector signed long long __a, vector unsigned int __b) {
6223 return (vector signed long long)__builtin_s390_vsrl(
6224 (vector unsigned char)__a, (vector unsigned char)__b);
6225}
6226
6227static inline __ATTRS_o_ai vector bool long long
6228vec_srl(vector bool long long __a, vector unsigned char __b) {
6229 return (vector bool long long)__builtin_s390_vsrl(
6230 (vector unsigned char)__a, __b);
6231}
6232
6233static inline __ATTRS_o_ai vector bool long long
6234vec_srl(vector bool long long __a, vector unsigned short __b) {
6235 return (vector bool long long)__builtin_s390_vsrl(
6236 (vector unsigned char)__a, (vector unsigned char)__b);
6237}
6238
6239static inline __ATTRS_o_ai vector bool long long
6240vec_srl(vector bool long long __a, vector unsigned int __b) {
6241 return (vector bool long long)__builtin_s390_vsrl(
6242 (vector unsigned char)__a, (vector unsigned char)__b);
6243}
6244
6245static inline __ATTRS_o_ai vector unsigned long long
6246vec_srl(vector unsigned long long __a, vector unsigned char __b) {
6247 return (vector unsigned long long)__builtin_s390_vsrl(
6248 (vector unsigned char)__a, __b);
6249}
6250
6251static inline __ATTRS_o_ai vector unsigned long long
6252vec_srl(vector unsigned long long __a, vector unsigned short __b) {
6253 return (vector unsigned long long)__builtin_s390_vsrl(
6254 (vector unsigned char)__a, (vector unsigned char)__b);
6255}
6256
6257static inline __ATTRS_o_ai vector unsigned long long
6258vec_srl(vector unsigned long long __a, vector unsigned int __b) {
6259 return (vector unsigned long long)__builtin_s390_vsrl(
6260 (vector unsigned char)__a, (vector unsigned char)__b);
6261}
6262
6263/*-- vec_srb ----------------------------------------------------------------*/
6264
6265static inline __ATTRS_o_ai vector signed char
6266vec_srb(vector signed char __a, vector signed char __b) {
6267 return (vector signed char)__builtin_s390_vsrlb(
6268 (vector unsigned char)__a, (vector unsigned char)__b);
6269}
6270
6271static inline __ATTRS_o_ai vector signed char
6272vec_srb(vector signed char __a, vector unsigned char __b) {
6273 return (vector signed char)__builtin_s390_vsrlb(
6274 (vector unsigned char)__a, __b);
6275}
6276
6277static inline __ATTRS_o_ai vector unsigned char
6278vec_srb(vector unsigned char __a, vector signed char __b) {
6279 return __builtin_s390_vsrlb(__a, (vector unsigned char)__b);
6280}
6281
6282static inline __ATTRS_o_ai vector unsigned char
6283vec_srb(vector unsigned char __a, vector unsigned char __b) {
6284 return __builtin_s390_vsrlb(__a, __b);
6285}
6286
6287static inline __ATTRS_o_ai vector signed short
6288vec_srb(vector signed short __a, vector signed short __b) {
6289 return (vector signed short)__builtin_s390_vsrlb(
6290 (vector unsigned char)__a, (vector unsigned char)__b);
6291}
6292
6293static inline __ATTRS_o_ai vector signed short
6294vec_srb(vector signed short __a, vector unsigned short __b) {
6295 return (vector signed short)__builtin_s390_vsrlb(
6296 (vector unsigned char)__a, (vector unsigned char)__b);
6297}
6298
6299static inline __ATTRS_o_ai vector unsigned short
6300vec_srb(vector unsigned short __a, vector signed short __b) {
6301 return (vector unsigned short)__builtin_s390_vsrlb(
6302 (vector unsigned char)__a, (vector unsigned char)__b);
6303}
6304
6305static inline __ATTRS_o_ai vector unsigned short
6306vec_srb(vector unsigned short __a, vector unsigned short __b) {
6307 return (vector unsigned short)__builtin_s390_vsrlb(
6308 (vector unsigned char)__a, (vector unsigned char)__b);
6309}
6310
6311static inline __ATTRS_o_ai vector signed int
6312vec_srb(vector signed int __a, vector signed int __b) {
6313 return (vector signed int)__builtin_s390_vsrlb(
6314 (vector unsigned char)__a, (vector unsigned char)__b);
6315}
6316
6317static inline __ATTRS_o_ai vector signed int
6318vec_srb(vector signed int __a, vector unsigned int __b) {
6319 return (vector signed int)__builtin_s390_vsrlb(
6320 (vector unsigned char)__a, (vector unsigned char)__b);
6321}
6322
6323static inline __ATTRS_o_ai vector unsigned int
6324vec_srb(vector unsigned int __a, vector signed int __b) {
6325 return (vector unsigned int)__builtin_s390_vsrlb(
6326 (vector unsigned char)__a, (vector unsigned char)__b);
6327}
6328
6329static inline __ATTRS_o_ai vector unsigned int
6330vec_srb(vector unsigned int __a, vector unsigned int __b) {
6331 return (vector unsigned int)__builtin_s390_vsrlb(
6332 (vector unsigned char)__a, (vector unsigned char)__b);
6333}
6334
6335static inline __ATTRS_o_ai vector signed long long
6336vec_srb(vector signed long long __a, vector signed long long __b) {
6337 return (vector signed long long)__builtin_s390_vsrlb(
6338 (vector unsigned char)__a, (vector unsigned char)__b);
6339}
6340
6341static inline __ATTRS_o_ai vector signed long long
6342vec_srb(vector signed long long __a, vector unsigned long long __b) {
6343 return (vector signed long long)__builtin_s390_vsrlb(
6344 (vector unsigned char)__a, (vector unsigned char)__b);
6345}
6346
6347static inline __ATTRS_o_ai vector unsigned long long
6348vec_srb(vector unsigned long long __a, vector signed long long __b) {
6349 return (vector unsigned long long)__builtin_s390_vsrlb(
6350 (vector unsigned char)__a, (vector unsigned char)__b);
6351}
6352
6353static inline __ATTRS_o_ai vector unsigned long long
6354vec_srb(vector unsigned long long __a, vector unsigned long long __b) {
6355 return (vector unsigned long long)__builtin_s390_vsrlb(
6356 (vector unsigned char)__a, (vector unsigned char)__b);
6357}
6358
6359static inline __ATTRS_o_ai vector double
6360vec_srb(vector double __a, vector signed long long __b) {
6361 return (vector double)__builtin_s390_vsrlb(
6362 (vector unsigned char)__a, (vector unsigned char)__b);
6363}
6364
6365static inline __ATTRS_o_ai vector double
6366vec_srb(vector double __a, vector unsigned long long __b) {
6367 return (vector double)__builtin_s390_vsrlb(
6368 (vector unsigned char)__a, (vector unsigned char)__b);
6369}
6370
6371/*-- vec_abs ----------------------------------------------------------------*/
6372
6373static inline __ATTRS_o_ai vector signed char
6374vec_abs(vector signed char __a) {
6375 return vec_sel(__a, -__a, vec_cmplt(__a, (vector signed char)0));
6376}
6377
6378static inline __ATTRS_o_ai vector signed short
6379vec_abs(vector signed short __a) {
6380 return vec_sel(__a, -__a, vec_cmplt(__a, (vector signed short)0));
6381}
6382
6383static inline __ATTRS_o_ai vector signed int
6384vec_abs(vector signed int __a) {
6385 return vec_sel(__a, -__a, vec_cmplt(__a, (vector signed int)0));
6386}
6387
6388static inline __ATTRS_o_ai vector signed long long
6389vec_abs(vector signed long long __a) {
6390 return vec_sel(__a, -__a, vec_cmplt(__a, (vector signed long long)0));
6391}
6392
6393static inline __ATTRS_o_ai vector double
6394vec_abs(vector double __a) {
6395 return __builtin_s390_vflpdb(__a);
6396}
6397
6398/*-- vec_nabs ---------------------------------------------------------------*/
6399
6400static inline __ATTRS_ai vector double
6401vec_nabs(vector double __a) {
6402 return __builtin_s390_vflndb(__a);
6403}
6404
6405/*-- vec_max ----------------------------------------------------------------*/
6406
6407static inline __ATTRS_o_ai vector signed char
6408vec_max(vector signed char __a, vector signed char __b) {
6409 return vec_sel(__b, __a, vec_cmpgt(__a, __b));
6410}
6411
6412static inline __ATTRS_o_ai vector signed char
6413vec_max(vector signed char __a, vector bool char __b) {
6414 vector signed char __bc = (vector signed char)__b;
6415 return vec_sel(__bc, __a, vec_cmpgt(__a, __bc));
6416}
6417
6418static inline __ATTRS_o_ai vector signed char
6419vec_max(vector bool char __a, vector signed char __b) {
6420 vector signed char __ac = (vector signed char)__a;
6421 return vec_sel(__b, __ac, vec_cmpgt(__ac, __b));
6422}
6423
6424static inline __ATTRS_o_ai vector unsigned char
6425vec_max(vector unsigned char __a, vector unsigned char __b) {
6426 return vec_sel(__b, __a, vec_cmpgt(__a, __b));
6427}
6428
6429static inline __ATTRS_o_ai vector unsigned char
6430vec_max(vector unsigned char __a, vector bool char __b) {
6431 vector unsigned char __bc = (vector unsigned char)__b;
6432 return vec_sel(__bc, __a, vec_cmpgt(__a, __bc));
6433}
6434
6435static inline __ATTRS_o_ai vector unsigned char
6436vec_max(vector bool char __a, vector unsigned char __b) {
6437 vector unsigned char __ac = (vector unsigned char)__a;
6438 return vec_sel(__b, __ac, vec_cmpgt(__ac, __b));
6439}
6440
6441static inline __ATTRS_o_ai vector signed short
6442vec_max(vector signed short __a, vector signed short __b) {
6443 return vec_sel(__b, __a, vec_cmpgt(__a, __b));
6444}
6445
6446static inline __ATTRS_o_ai vector signed short
6447vec_max(vector signed short __a, vector bool short __b) {
6448 vector signed short __bc = (vector signed short)__b;
6449 return vec_sel(__bc, __a, vec_cmpgt(__a, __bc));
6450}
6451
6452static inline __ATTRS_o_ai vector signed short
6453vec_max(vector bool short __a, vector signed short __b) {
6454 vector signed short __ac = (vector signed short)__a;
6455 return vec_sel(__b, __ac, vec_cmpgt(__ac, __b));
6456}
6457
6458static inline __ATTRS_o_ai vector unsigned short
6459vec_max(vector unsigned short __a, vector unsigned short __b) {
6460 return vec_sel(__b, __a, vec_cmpgt(__a, __b));
6461}
6462
6463static inline __ATTRS_o_ai vector unsigned short
6464vec_max(vector unsigned short __a, vector bool short __b) {
6465 vector unsigned short __bc = (vector unsigned short)__b;
6466 return vec_sel(__bc, __a, vec_cmpgt(__a, __bc));
6467}
6468
6469static inline __ATTRS_o_ai vector unsigned short
6470vec_max(vector bool short __a, vector unsigned short __b) {
6471 vector unsigned short __ac = (vector unsigned short)__a;
6472 return vec_sel(__b, __ac, vec_cmpgt(__ac, __b));
6473}
6474
6475static inline __ATTRS_o_ai vector signed int
6476vec_max(vector signed int __a, vector signed int __b) {
6477 return vec_sel(__b, __a, vec_cmpgt(__a, __b));
6478}
6479
6480static inline __ATTRS_o_ai vector signed int
6481vec_max(vector signed int __a, vector bool int __b) {
6482 vector signed int __bc = (vector signed int)__b;
6483 return vec_sel(__bc, __a, vec_cmpgt(__a, __bc));
6484}
6485
6486static inline __ATTRS_o_ai vector signed int
6487vec_max(vector bool int __a, vector signed int __b) {
6488 vector signed int __ac = (vector signed int)__a;
6489 return vec_sel(__b, __ac, vec_cmpgt(__ac, __b));
6490}
6491
6492static inline __ATTRS_o_ai vector unsigned int
6493vec_max(vector unsigned int __a, vector unsigned int __b) {
6494 return vec_sel(__b, __a, vec_cmpgt(__a, __b));
6495}
6496
6497static inline __ATTRS_o_ai vector unsigned int
6498vec_max(vector unsigned int __a, vector bool int __b) {
6499 vector unsigned int __bc = (vector unsigned int)__b;
6500 return vec_sel(__bc, __a, vec_cmpgt(__a, __bc));
6501}
6502
6503static inline __ATTRS_o_ai vector unsigned int
6504vec_max(vector bool int __a, vector unsigned int __b) {
6505 vector unsigned int __ac = (vector unsigned int)__a;
6506 return vec_sel(__b, __ac, vec_cmpgt(__ac, __b));
6507}
6508
6509static inline __ATTRS_o_ai vector signed long long
6510vec_max(vector signed long long __a, vector signed long long __b) {
6511 return vec_sel(__b, __a, vec_cmpgt(__a, __b));
6512}
6513
6514static inline __ATTRS_o_ai vector signed long long
6515vec_max(vector signed long long __a, vector bool long long __b) {
6516 vector signed long long __bc = (vector signed long long)__b;
6517 return vec_sel(__bc, __a, vec_cmpgt(__a, __bc));
6518}
6519
6520static inline __ATTRS_o_ai vector signed long long
6521vec_max(vector bool long long __a, vector signed long long __b) {
6522 vector signed long long __ac = (vector signed long long)__a;
6523 return vec_sel(__b, __ac, vec_cmpgt(__ac, __b));
6524}
6525
6526static inline __ATTRS_o_ai vector unsigned long long
6527vec_max(vector unsigned long long __a, vector unsigned long long __b) {
6528 return vec_sel(__b, __a, vec_cmpgt(__a, __b));
6529}
6530
6531static inline __ATTRS_o_ai vector unsigned long long
6532vec_max(vector unsigned long long __a, vector bool long long __b) {
6533 vector unsigned long long __bc = (vector unsigned long long)__b;
6534 return vec_sel(__bc, __a, vec_cmpgt(__a, __bc));
6535}
6536
6537static inline __ATTRS_o_ai vector unsigned long long
6538vec_max(vector bool long long __a, vector unsigned long long __b) {
6539 vector unsigned long long __ac = (vector unsigned long long)__a;
6540 return vec_sel(__b, __ac, vec_cmpgt(__ac, __b));
6541}
6542
6543static inline __ATTRS_o_ai vector double
6544vec_max(vector double __a, vector double __b) {
6545 return vec_sel(__b, __a, vec_cmpgt(__a, __b));
6546}
6547
6548/*-- vec_min ----------------------------------------------------------------*/
6549
6550static inline __ATTRS_o_ai vector signed char
6551vec_min(vector signed char __a, vector signed char __b) {
6552 return vec_sel(__a, __b, vec_cmpgt(__a, __b));
6553}
6554
6555static inline __ATTRS_o_ai vector signed char
6556vec_min(vector signed char __a, vector bool char __b) {
6557 vector signed char __bc = (vector signed char)__b;
6558 return vec_sel(__a, __bc, vec_cmpgt(__a, __bc));
6559}
6560
6561static inline __ATTRS_o_ai vector signed char
6562vec_min(vector bool char __a, vector signed char __b) {
6563 vector signed char __ac = (vector signed char)__a;
6564 return vec_sel(__ac, __b, vec_cmpgt(__ac, __b));
6565}
6566
6567static inline __ATTRS_o_ai vector unsigned char
6568vec_min(vector unsigned char __a, vector unsigned char __b) {
6569 return vec_sel(__a, __b, vec_cmpgt(__a, __b));
6570}
6571
6572static inline __ATTRS_o_ai vector unsigned char
6573vec_min(vector unsigned char __a, vector bool char __b) {
6574 vector unsigned char __bc = (vector unsigned char)__b;
6575 return vec_sel(__a, __bc, vec_cmpgt(__a, __bc));
6576}
6577
6578static inline __ATTRS_o_ai vector unsigned char
6579vec_min(vector bool char __a, vector unsigned char __b) {
6580 vector unsigned char __ac = (vector unsigned char)__a;
6581 return vec_sel(__ac, __b, vec_cmpgt(__ac, __b));
6582}
6583
6584static inline __ATTRS_o_ai vector signed short
6585vec_min(vector signed short __a, vector signed short __b) {
6586 return vec_sel(__a, __b, vec_cmpgt(__a, __b));
6587}
6588
6589static inline __ATTRS_o_ai vector signed short
6590vec_min(vector signed short __a, vector bool short __b) {
6591 vector signed short __bc = (vector signed short)__b;
6592 return vec_sel(__a, __bc, vec_cmpgt(__a, __bc));
6593}
6594
6595static inline __ATTRS_o_ai vector signed short
6596vec_min(vector bool short __a, vector signed short __b) {
6597 vector signed short __ac = (vector signed short)__a;
6598 return vec_sel(__ac, __b, vec_cmpgt(__ac, __b));
6599}
6600
6601static inline __ATTRS_o_ai vector unsigned short
6602vec_min(vector unsigned short __a, vector unsigned short __b) {
6603 return vec_sel(__a, __b, vec_cmpgt(__a, __b));
6604}
6605
6606static inline __ATTRS_o_ai vector unsigned short
6607vec_min(vector unsigned short __a, vector bool short __b) {
6608 vector unsigned short __bc = (vector unsigned short)__b;
6609 return vec_sel(__a, __bc, vec_cmpgt(__a, __bc));
6610}
6611
6612static inline __ATTRS_o_ai vector unsigned short
6613vec_min(vector bool short __a, vector unsigned short __b) {
6614 vector unsigned short __ac = (vector unsigned short)__a;
6615 return vec_sel(__ac, __b, vec_cmpgt(__ac, __b));
6616}
6617
6618static inline __ATTRS_o_ai vector signed int
6619vec_min(vector signed int __a, vector signed int __b) {
6620 return vec_sel(__a, __b, vec_cmpgt(__a, __b));
6621}
6622
6623static inline __ATTRS_o_ai vector signed int
6624vec_min(vector signed int __a, vector bool int __b) {
6625 vector signed int __bc = (vector signed int)__b;
6626 return vec_sel(__a, __bc, vec_cmpgt(__a, __bc));
6627}
6628
6629static inline __ATTRS_o_ai vector signed int
6630vec_min(vector bool int __a, vector signed int __b) {
6631 vector signed int __ac = (vector signed int)__a;
6632 return vec_sel(__ac, __b, vec_cmpgt(__ac, __b));
6633}
6634
6635static inline __ATTRS_o_ai vector unsigned int
6636vec_min(vector unsigned int __a, vector unsigned int __b) {
6637 return vec_sel(__a, __b, vec_cmpgt(__a, __b));
6638}
6639
6640static inline __ATTRS_o_ai vector unsigned int
6641vec_min(vector unsigned int __a, vector bool int __b) {
6642 vector unsigned int __bc = (vector unsigned int)__b;
6643 return vec_sel(__a, __bc, vec_cmpgt(__a, __bc));
6644}
6645
6646static inline __ATTRS_o_ai vector unsigned int
6647vec_min(vector bool int __a, vector unsigned int __b) {
6648 vector unsigned int __ac = (vector unsigned int)__a;
6649 return vec_sel(__ac, __b, vec_cmpgt(__ac, __b));
6650}
6651
6652static inline __ATTRS_o_ai vector signed long long
6653vec_min(vector signed long long __a, vector signed long long __b) {
6654 return vec_sel(__a, __b, vec_cmpgt(__a, __b));
6655}
6656
6657static inline __ATTRS_o_ai vector signed long long
6658vec_min(vector signed long long __a, vector bool long long __b) {
6659 vector signed long long __bc = (vector signed long long)__b;
6660 return vec_sel(__a, __bc, vec_cmpgt(__a, __bc));
6661}
6662
6663static inline __ATTRS_o_ai vector signed long long
6664vec_min(vector bool long long __a, vector signed long long __b) {
6665 vector signed long long __ac = (vector signed long long)__a;
6666 return vec_sel(__ac, __b, vec_cmpgt(__ac, __b));
6667}
6668
6669static inline __ATTRS_o_ai vector unsigned long long
6670vec_min(vector unsigned long long __a, vector unsigned long long __b) {
6671 return vec_sel(__a, __b, vec_cmpgt(__a, __b));
6672}
6673
6674static inline __ATTRS_o_ai vector unsigned long long
6675vec_min(vector unsigned long long __a, vector bool long long __b) {
6676 vector unsigned long long __bc = (vector unsigned long long)__b;
6677 return vec_sel(__a, __bc, vec_cmpgt(__a, __bc));
6678}
6679
6680static inline __ATTRS_o_ai vector unsigned long long
6681vec_min(vector bool long long __a, vector unsigned long long __b) {
6682 vector unsigned long long __ac = (vector unsigned long long)__a;
6683 return vec_sel(__ac, __b, vec_cmpgt(__ac, __b));
6684}
6685
6686static inline __ATTRS_o_ai vector double
6687vec_min(vector double __a, vector double __b) {
6688 return vec_sel(__a, __b, vec_cmpgt(__a, __b));
6689}
6690
6691/*-- vec_add_u128 -----------------------------------------------------------*/
6692
6693static inline __ATTRS_ai vector unsigned char
6694vec_add_u128(vector unsigned char __a, vector unsigned char __b) {
6695 return __builtin_s390_vaq(__a, __b);
6696}
6697
6698/*-- vec_addc ---------------------------------------------------------------*/
6699
6700static inline __ATTRS_o_ai vector unsigned char
6701vec_addc(vector unsigned char __a, vector unsigned char __b) {
6702 return __builtin_s390_vaccb(__a, __b);
6703}
6704
6705static inline __ATTRS_o_ai vector unsigned short
6706vec_addc(vector unsigned short __a, vector unsigned short __b) {
6707 return __builtin_s390_vacch(__a, __b);
6708}
6709
6710static inline __ATTRS_o_ai vector unsigned int
6711vec_addc(vector unsigned int __a, vector unsigned int __b) {
6712 return __builtin_s390_vaccf(__a, __b);
6713}
6714
6715static inline __ATTRS_o_ai vector unsigned long long
6716vec_addc(vector unsigned long long __a, vector unsigned long long __b) {
6717 return __builtin_s390_vaccg(__a, __b);
6718}
6719
6720/*-- vec_addc_u128 ----------------------------------------------------------*/
6721
6722static inline __ATTRS_ai vector unsigned char
6723vec_addc_u128(vector unsigned char __a, vector unsigned char __b) {
6724 return __builtin_s390_vaccq(__a, __b);
6725}
6726
6727/*-- vec_adde_u128 ----------------------------------------------------------*/
6728
6729static inline __ATTRS_ai vector unsigned char
6730vec_adde_u128(vector unsigned char __a, vector unsigned char __b,
6731 vector unsigned char __c) {
6732 return __builtin_s390_vacq(__a, __b, __c);
6733}
6734
6735/*-- vec_addec_u128 ---------------------------------------------------------*/
6736
6737static inline __ATTRS_ai vector unsigned char
6738vec_addec_u128(vector unsigned char __a, vector unsigned char __b,
6739 vector unsigned char __c) {
6740 return __builtin_s390_vacccq(__a, __b, __c);
6741}
6742
6743/*-- vec_avg ----------------------------------------------------------------*/
6744
6745static inline __ATTRS_o_ai vector signed char
6746vec_avg(vector signed char __a, vector signed char __b) {
6747 return __builtin_s390_vavgb(__a, __b);
6748}
6749
6750static inline __ATTRS_o_ai vector signed short
6751vec_avg(vector signed short __a, vector signed short __b) {
6752 return __builtin_s390_vavgh(__a, __b);
6753}
6754
6755static inline __ATTRS_o_ai vector signed int
6756vec_avg(vector signed int __a, vector signed int __b) {
6757 return __builtin_s390_vavgf(__a, __b);
6758}
6759
6760static inline __ATTRS_o_ai vector signed long long
6761vec_avg(vector signed long long __a, vector signed long long __b) {
6762 return __builtin_s390_vavgg(__a, __b);
6763}
6764
6765static inline __ATTRS_o_ai vector unsigned char
6766vec_avg(vector unsigned char __a, vector unsigned char __b) {
6767 return __builtin_s390_vavglb(__a, __b);
6768}
6769
6770static inline __ATTRS_o_ai vector unsigned short
6771vec_avg(vector unsigned short __a, vector unsigned short __b) {
6772 return __builtin_s390_vavglh(__a, __b);
6773}
6774
6775static inline __ATTRS_o_ai vector unsigned int
6776vec_avg(vector unsigned int __a, vector unsigned int __b) {
6777 return __builtin_s390_vavglf(__a, __b);
6778}
6779
6780static inline __ATTRS_o_ai vector unsigned long long
6781vec_avg(vector unsigned long long __a, vector unsigned long long __b) {
6782 return __builtin_s390_vavglg(__a, __b);
6783}
6784
6785/*-- vec_checksum -----------------------------------------------------------*/
6786
6787static inline __ATTRS_ai vector unsigned int
6788vec_checksum(vector unsigned int __a, vector unsigned int __b) {
6789 return __builtin_s390_vcksm(__a, __b);
6790}
6791
6792/*-- vec_gfmsum -------------------------------------------------------------*/
6793
6794static inline __ATTRS_o_ai vector unsigned short
6795vec_gfmsum(vector unsigned char __a, vector unsigned char __b) {
6796 return __builtin_s390_vgfmb(__a, __b);
6797}
6798
6799static inline __ATTRS_o_ai vector unsigned int
6800vec_gfmsum(vector unsigned short __a, vector unsigned short __b) {
6801 return __builtin_s390_vgfmh(__a, __b);
6802}
6803
6804static inline __ATTRS_o_ai vector unsigned long long
6805vec_gfmsum(vector unsigned int __a, vector unsigned int __b) {
6806 return __builtin_s390_vgfmf(__a, __b);
6807}
6808
6809/*-- vec_gfmsum_128 ---------------------------------------------------------*/
6810
6811static inline __ATTRS_o_ai vector unsigned char
6812vec_gfmsum_128(vector unsigned long long __a, vector unsigned long long __b) {
6813 return __builtin_s390_vgfmg(__a, __b);
6814}
6815
6816/*-- vec_gfmsum_accum -------------------------------------------------------*/
6817
6818static inline __ATTRS_o_ai vector unsigned short
6819vec_gfmsum_accum(vector unsigned char __a, vector unsigned char __b,
6820 vector unsigned short __c) {
6821 return __builtin_s390_vgfmab(__a, __b, __c);
6822}
6823
6824static inline __ATTRS_o_ai vector unsigned int
6825vec_gfmsum_accum(vector unsigned short __a, vector unsigned short __b,
6826 vector unsigned int __c) {
6827 return __builtin_s390_vgfmah(__a, __b, __c);
6828}
6829
6830static inline __ATTRS_o_ai vector unsigned long long
6831vec_gfmsum_accum(vector unsigned int __a, vector unsigned int __b,
6832 vector unsigned long long __c) {
6833 return __builtin_s390_vgfmaf(__a, __b, __c);
6834}
6835
6836/*-- vec_gfmsum_accum_128 ---------------------------------------------------*/
6837
6838static inline __ATTRS_o_ai vector unsigned char
6839vec_gfmsum_accum_128(vector unsigned long long __a,
6840 vector unsigned long long __b,
6841 vector unsigned char __c) {
6842 return __builtin_s390_vgfmag(__a, __b, __c);
6843}
6844
6845/*-- vec_mladd --------------------------------------------------------------*/
6846
6847static inline __ATTRS_o_ai vector signed char
6848vec_mladd(vector signed char __a, vector signed char __b,
6849 vector signed char __c) {
6850 return __a * __b + __c;
6851}
6852
6853static inline __ATTRS_o_ai vector signed char
6854vec_mladd(vector unsigned char __a, vector signed char __b,
6855 vector signed char __c) {
6856 return (vector signed char)__a * __b + __c;
6857}
6858
6859static inline __ATTRS_o_ai vector signed char
6860vec_mladd(vector signed char __a, vector unsigned char __b,
6861 vector unsigned char __c) {
6862 return __a * (vector signed char)__b + (vector signed char)__c;
6863}
6864
6865static inline __ATTRS_o_ai vector unsigned char
6866vec_mladd(vector unsigned char __a, vector unsigned char __b,
6867 vector unsigned char __c) {
6868 return __a * __b + __c;
6869}
6870
6871static inline __ATTRS_o_ai vector signed short
6872vec_mladd(vector signed short __a, vector signed short __b,
6873 vector signed short __c) {
6874 return __a * __b + __c;
6875}
6876
6877static inline __ATTRS_o_ai vector signed short
6878vec_mladd(vector unsigned short __a, vector signed short __b,
6879 vector signed short __c) {
6880 return (vector signed short)__a * __b + __c;
6881}
6882
6883static inline __ATTRS_o_ai vector signed short
6884vec_mladd(vector signed short __a, vector unsigned short __b,
6885 vector unsigned short __c) {
6886 return __a * (vector signed short)__b + (vector signed short)__c;
6887}
6888
6889static inline __ATTRS_o_ai vector unsigned short
6890vec_mladd(vector unsigned short __a, vector unsigned short __b,
6891 vector unsigned short __c) {
6892 return __a * __b + __c;
6893}
6894
6895static inline __ATTRS_o_ai vector signed int
6896vec_mladd(vector signed int __a, vector signed int __b,
6897 vector signed int __c) {
6898 return __a * __b + __c;
6899}
6900
6901static inline __ATTRS_o_ai vector signed int
6902vec_mladd(vector unsigned int __a, vector signed int __b,
6903 vector signed int __c) {
6904 return (vector signed int)__a * __b + __c;
6905}
6906
6907static inline __ATTRS_o_ai vector signed int
6908vec_mladd(vector signed int __a, vector unsigned int __b,
6909 vector unsigned int __c) {
6910 return __a * (vector signed int)__b + (vector signed int)__c;
6911}
6912
6913static inline __ATTRS_o_ai vector unsigned int
6914vec_mladd(vector unsigned int __a, vector unsigned int __b,
6915 vector unsigned int __c) {
6916 return __a * __b + __c;
6917}
6918
6919/*-- vec_mhadd --------------------------------------------------------------*/
6920
6921static inline __ATTRS_o_ai vector signed char
6922vec_mhadd(vector signed char __a, vector signed char __b,
6923 vector signed char __c) {
6924 return __builtin_s390_vmahb(__a, __b, __c);
6925}
6926
6927static inline __ATTRS_o_ai vector unsigned char
6928vec_mhadd(vector unsigned char __a, vector unsigned char __b,
6929 vector unsigned char __c) {
6930 return __builtin_s390_vmalhb(__a, __b, __c);
6931}
6932
6933static inline __ATTRS_o_ai vector signed short
6934vec_mhadd(vector signed short __a, vector signed short __b,
6935 vector signed short __c) {
6936 return __builtin_s390_vmahh(__a, __b, __c);
6937}
6938
6939static inline __ATTRS_o_ai vector unsigned short
6940vec_mhadd(vector unsigned short __a, vector unsigned short __b,
6941 vector unsigned short __c) {
6942 return __builtin_s390_vmalhh(__a, __b, __c);
6943}
6944
6945static inline __ATTRS_o_ai vector signed int
6946vec_mhadd(vector signed int __a, vector signed int __b,
6947 vector signed int __c) {
6948 return __builtin_s390_vmahf(__a, __b, __c);
6949}
6950
6951static inline __ATTRS_o_ai vector unsigned int
6952vec_mhadd(vector unsigned int __a, vector unsigned int __b,
6953 vector unsigned int __c) {
6954 return __builtin_s390_vmalhf(__a, __b, __c);
6955}
6956
6957/*-- vec_meadd --------------------------------------------------------------*/
6958
6959static inline __ATTRS_o_ai vector signed short
6960vec_meadd(vector signed char __a, vector signed char __b,
6961 vector signed short __c) {
6962 return __builtin_s390_vmaeb(__a, __b, __c);
6963}
6964
6965static inline __ATTRS_o_ai vector unsigned short
6966vec_meadd(vector unsigned char __a, vector unsigned char __b,
6967 vector unsigned short __c) {
6968 return __builtin_s390_vmaleb(__a, __b, __c);
6969}
6970
6971static inline __ATTRS_o_ai vector signed int
6972vec_meadd(vector signed short __a, vector signed short __b,
6973 vector signed int __c) {
6974 return __builtin_s390_vmaeh(__a, __b, __c);
6975}
6976
6977static inline __ATTRS_o_ai vector unsigned int
6978vec_meadd(vector unsigned short __a, vector unsigned short __b,
6979 vector unsigned int __c) {
6980 return __builtin_s390_vmaleh(__a, __b, __c);
6981}
6982
6983static inline __ATTRS_o_ai vector signed long long
6984vec_meadd(vector signed int __a, vector signed int __b,
6985 vector signed long long __c) {
6986 return __builtin_s390_vmaef(__a, __b, __c);
6987}
6988
6989static inline __ATTRS_o_ai vector unsigned long long
6990vec_meadd(vector unsigned int __a, vector unsigned int __b,
6991 vector unsigned long long __c) {
6992 return __builtin_s390_vmalef(__a, __b, __c);
6993}
6994
6995/*-- vec_moadd --------------------------------------------------------------*/
6996
6997static inline __ATTRS_o_ai vector signed short
6998vec_moadd(vector signed char __a, vector signed char __b,
6999 vector signed short __c) {
7000 return __builtin_s390_vmaob(__a, __b, __c);
7001}
7002
7003static inline __ATTRS_o_ai vector unsigned short
7004vec_moadd(vector unsigned char __a, vector unsigned char __b,
7005 vector unsigned short __c) {
7006 return __builtin_s390_vmalob(__a, __b, __c);
7007}
7008
7009static inline __ATTRS_o_ai vector signed int
7010vec_moadd(vector signed short __a, vector signed short __b,
7011 vector signed int __c) {
7012 return __builtin_s390_vmaoh(__a, __b, __c);
7013}
7014
7015static inline __ATTRS_o_ai vector unsigned int
7016vec_moadd(vector unsigned short __a, vector unsigned short __b,
7017 vector unsigned int __c) {
7018 return __builtin_s390_vmaloh(__a, __b, __c);
7019}
7020
7021static inline __ATTRS_o_ai vector signed long long
7022vec_moadd(vector signed int __a, vector signed int __b,
7023 vector signed long long __c) {
7024 return __builtin_s390_vmaof(__a, __b, __c);
7025}
7026
7027static inline __ATTRS_o_ai vector unsigned long long
7028vec_moadd(vector unsigned int __a, vector unsigned int __b,
7029 vector unsigned long long __c) {
7030 return __builtin_s390_vmalof(__a, __b, __c);
7031}
7032
7033/*-- vec_mulh ---------------------------------------------------------------*/
7034
7035static inline __ATTRS_o_ai vector signed char
7036vec_mulh(vector signed char __a, vector signed char __b) {
7037 return __builtin_s390_vmhb(__a, __b);
7038}
7039
7040static inline __ATTRS_o_ai vector unsigned char
7041vec_mulh(vector unsigned char __a, vector unsigned char __b) {
7042 return __builtin_s390_vmlhb(__a, __b);
7043}
7044
7045static inline __ATTRS_o_ai vector signed short
7046vec_mulh(vector signed short __a, vector signed short __b) {
7047 return __builtin_s390_vmhh(__a, __b);
7048}
7049
7050static inline __ATTRS_o_ai vector unsigned short
7051vec_mulh(vector unsigned short __a, vector unsigned short __b) {
7052 return __builtin_s390_vmlhh(__a, __b);
7053}
7054
7055static inline __ATTRS_o_ai vector signed int
7056vec_mulh(vector signed int __a, vector signed int __b) {
7057 return __builtin_s390_vmhf(__a, __b);
7058}
7059
7060static inline __ATTRS_o_ai vector unsigned int
7061vec_mulh(vector unsigned int __a, vector unsigned int __b) {
7062 return __builtin_s390_vmlhf(__a, __b);
7063}
7064
7065/*-- vec_mule ---------------------------------------------------------------*/
7066
7067static inline __ATTRS_o_ai vector signed short
7068vec_mule(vector signed char __a, vector signed char __b) {
7069 return __builtin_s390_vmeb(__a, __b);
7070}
7071
7072static inline __ATTRS_o_ai vector unsigned short
7073vec_mule(vector unsigned char __a, vector unsigned char __b) {
7074 return __builtin_s390_vmleb(__a, __b);
7075}
7076
7077static inline __ATTRS_o_ai vector signed int
7078vec_mule(vector signed short __a, vector signed short __b) {
7079 return __builtin_s390_vmeh(__a, __b);
7080}
7081
7082static inline __ATTRS_o_ai vector unsigned int
7083vec_mule(vector unsigned short __a, vector unsigned short __b) {
7084 return __builtin_s390_vmleh(__a, __b);
7085}
7086
7087static inline __ATTRS_o_ai vector signed long long
7088vec_mule(vector signed int __a, vector signed int __b) {
7089 return __builtin_s390_vmef(__a, __b);
7090}
7091
7092static inline __ATTRS_o_ai vector unsigned long long
7093vec_mule(vector unsigned int __a, vector unsigned int __b) {
7094 return __builtin_s390_vmlef(__a, __b);
7095}
7096
7097/*-- vec_mulo ---------------------------------------------------------------*/
7098
7099static inline __ATTRS_o_ai vector signed short
7100vec_mulo(vector signed char __a, vector signed char __b) {
7101 return __builtin_s390_vmob(__a, __b);
7102}
7103
7104static inline __ATTRS_o_ai vector unsigned short
7105vec_mulo(vector unsigned char __a, vector unsigned char __b) {
7106 return __builtin_s390_vmlob(__a, __b);
7107}
7108
7109static inline __ATTRS_o_ai vector signed int
7110vec_mulo(vector signed short __a, vector signed short __b) {
7111 return __builtin_s390_vmoh(__a, __b);
7112}
7113
7114static inline __ATTRS_o_ai vector unsigned int
7115vec_mulo(vector unsigned short __a, vector unsigned short __b) {
7116 return __builtin_s390_vmloh(__a, __b);
7117}
7118
7119static inline __ATTRS_o_ai vector signed long long
7120vec_mulo(vector signed int __a, vector signed int __b) {
7121 return __builtin_s390_vmof(__a, __b);
7122}
7123
7124static inline __ATTRS_o_ai vector unsigned long long
7125vec_mulo(vector unsigned int __a, vector unsigned int __b) {
7126 return __builtin_s390_vmlof(__a, __b);
7127}
7128
7129/*-- vec_sub_u128 -----------------------------------------------------------*/
7130
7131static inline __ATTRS_ai vector unsigned char
7132vec_sub_u128(vector unsigned char __a, vector unsigned char __b) {
7133 return __builtin_s390_vsq(__a, __b);
7134}
7135
7136/*-- vec_subc ---------------------------------------------------------------*/
7137
7138static inline __ATTRS_o_ai vector unsigned char
7139vec_subc(vector unsigned char __a, vector unsigned char __b) {
7140 return __builtin_s390_vscbib(__a, __b);
7141}
7142
7143static inline __ATTRS_o_ai vector unsigned short
7144vec_subc(vector unsigned short __a, vector unsigned short __b) {
7145 return __builtin_s390_vscbih(__a, __b);
7146}
7147
7148static inline __ATTRS_o_ai vector unsigned int
7149vec_subc(vector unsigned int __a, vector unsigned int __b) {
7150 return __builtin_s390_vscbif(__a, __b);
7151}
7152
7153static inline __ATTRS_o_ai vector unsigned long long
7154vec_subc(vector unsigned long long __a, vector unsigned long long __b) {
7155 return __builtin_s390_vscbig(__a, __b);
7156}
7157
7158/*-- vec_subc_u128 ----------------------------------------------------------*/
7159
7160static inline __ATTRS_ai vector unsigned char
7161vec_subc_u128(vector unsigned char __a, vector unsigned char __b) {
7162 return __builtin_s390_vscbiq(__a, __b);
7163}
7164
7165/*-- vec_sube_u128 ----------------------------------------------------------*/
7166
7167static inline __ATTRS_ai vector unsigned char
7168vec_sube_u128(vector unsigned char __a, vector unsigned char __b,
7169 vector unsigned char __c) {
7170 return __builtin_s390_vsbiq(__a, __b, __c);
7171}
7172
7173/*-- vec_subec_u128 ---------------------------------------------------------*/
7174
7175static inline __ATTRS_ai vector unsigned char
7176vec_subec_u128(vector unsigned char __a, vector unsigned char __b,
7177 vector unsigned char __c) {
7178 return __builtin_s390_vsbcbiq(__a, __b, __c);
7179}
7180
7181/*-- vec_sum2 ---------------------------------------------------------------*/
7182
7183static inline __ATTRS_o_ai vector unsigned long long
7184vec_sum2(vector unsigned short __a, vector unsigned short __b) {
7185 return __builtin_s390_vsumgh(__a, __b);
7186}
7187
7188static inline __ATTRS_o_ai vector unsigned long long
7189vec_sum2(vector unsigned int __a, vector unsigned int __b) {
7190 return __builtin_s390_vsumgf(__a, __b);
7191}
7192
7193/*-- vec_sum_u128 -----------------------------------------------------------*/
7194
7195static inline __ATTRS_o_ai vector unsigned char
7196vec_sum_u128(vector unsigned int __a, vector unsigned int __b) {
7197 return __builtin_s390_vsumqf(__a, __b);
7198}
7199
7200static inline __ATTRS_o_ai vector unsigned char
7201vec_sum_u128(vector unsigned long long __a, vector unsigned long long __b) {
7202 return __builtin_s390_vsumqg(__a, __b);
7203}
7204
7205/*-- vec_sum4 ---------------------------------------------------------------*/
7206
7207static inline __ATTRS_o_ai vector unsigned int
7208vec_sum4(vector unsigned char __a, vector unsigned char __b) {
7209 return __builtin_s390_vsumb(__a, __b);
7210}
7211
7212static inline __ATTRS_o_ai vector unsigned int
7213vec_sum4(vector unsigned short __a, vector unsigned short __b) {
7214 return __builtin_s390_vsumh(__a, __b);
7215}
7216
7217/*-- vec_test_mask ----------------------------------------------------------*/
7218
7219static inline __ATTRS_o_ai int
7220vec_test_mask(vector signed char __a, vector unsigned char __b) {
7221 return __builtin_s390_vtm((vector unsigned char)__a,
7222 (vector unsigned char)__b);
7223}
7224
7225static inline __ATTRS_o_ai int
7226vec_test_mask(vector unsigned char __a, vector unsigned char __b) {
7227 return __builtin_s390_vtm(__a, __b);
7228}
7229
7230static inline __ATTRS_o_ai int
7231vec_test_mask(vector signed short __a, vector unsigned short __b) {
7232 return __builtin_s390_vtm((vector unsigned char)__a,
7233 (vector unsigned char)__b);
7234}
7235
7236static inline __ATTRS_o_ai int
7237vec_test_mask(vector unsigned short __a, vector unsigned short __b) {
7238 return __builtin_s390_vtm((vector unsigned char)__a,
7239 (vector unsigned char)__b);
7240}
7241
7242static inline __ATTRS_o_ai int
7243vec_test_mask(vector signed int __a, vector unsigned int __b) {
7244 return __builtin_s390_vtm((vector unsigned char)__a,
7245 (vector unsigned char)__b);
7246}
7247
7248static inline __ATTRS_o_ai int
7249vec_test_mask(vector unsigned int __a, vector unsigned int __b) {
7250 return __builtin_s390_vtm((vector unsigned char)__a,
7251 (vector unsigned char)__b);
7252}
7253
7254static inline __ATTRS_o_ai int
7255vec_test_mask(vector signed long long __a, vector unsigned long long __b) {
7256 return __builtin_s390_vtm((vector unsigned char)__a,
7257 (vector unsigned char)__b);
7258}
7259
7260static inline __ATTRS_o_ai int
7261vec_test_mask(vector unsigned long long __a, vector unsigned long long __b) {
7262 return __builtin_s390_vtm((vector unsigned char)__a,
7263 (vector unsigned char)__b);
7264}
7265
7266static inline __ATTRS_o_ai int
7267vec_test_mask(vector double __a, vector unsigned long long __b) {
7268 return __builtin_s390_vtm((vector unsigned char)__a,
7269 (vector unsigned char)__b);
7270}
7271
7272/*-- vec_madd ---------------------------------------------------------------*/
7273
7274static inline __ATTRS_ai vector double
7275vec_madd(vector double __a, vector double __b, vector double __c) {
7276 return __builtin_s390_vfmadb(__a, __b, __c);
7277}
7278
7279/*-- vec_msub ---------------------------------------------------------------*/
7280
7281static inline __ATTRS_ai vector double
7282vec_msub(vector double __a, vector double __b, vector double __c) {
7283 return __builtin_s390_vfmsdb(__a, __b, __c);
7284}
7285
7286/*-- vec_sqrt ---------------------------------------------------------------*/
7287
7288static inline __ATTRS_ai vector double
7289vec_sqrt(vector double __a) {
7290 return __builtin_s390_vfsqdb(__a);
7291}
7292
7293/*-- vec_ld2f ---------------------------------------------------------------*/
7294
7295static inline __ATTRS_ai vector double
7296vec_ld2f(const float *__ptr) {
7297 typedef float __v2f32 __attribute__((__vector_size__(8)));
7298 return __builtin_convertvector(*(const __v2f32 *)__ptr, vector double);
7299}
7300
7301/*-- vec_st2f ---------------------------------------------------------------*/
7302
7303static inline __ATTRS_ai void
7304vec_st2f(vector double __a, float *__ptr) {
7305 typedef float __v2f32 __attribute__((__vector_size__(8)));
7306 *(__v2f32 *)__ptr = __builtin_convertvector(__a, __v2f32);
7307}
7308
7309/*-- vec_ctd ----------------------------------------------------------------*/
7310
7311static inline __ATTRS_o_ai vector double
7312vec_ctd(vector signed long long __a, int __b)
7313 __constant_range(__b, 0, 31) {
7314 vector double __conv = __builtin_convertvector(__a, vector double);
7315 __conv *= (vector double)(vector unsigned long long)((0x3ffULL - __b) << 52);
7316 return __conv;
7317}
7318
7319static inline __ATTRS_o_ai vector double
7320vec_ctd(vector unsigned long long __a, int __b)
7321 __constant_range(__b, 0, 31) {
7322 vector double __conv = __builtin_convertvector(__a, vector double);
7323 __conv *= (vector double)(vector unsigned long long)((0x3ffULL - __b) << 52);
7324 return __conv;
7325}
7326
7327/*-- vec_ctsl ---------------------------------------------------------------*/
7328
7329static inline __ATTRS_o_ai vector signed long long
7330vec_ctsl(vector double __a, int __b)
7331 __constant_range(__b, 0, 31) {
7332 __a *= (vector double)(vector unsigned long long)((0x3ffULL + __b) << 52);
7333 return __builtin_convertvector(__a, vector signed long long);
7334}
7335
7336/*-- vec_ctul ---------------------------------------------------------------*/
7337
7338static inline __ATTRS_o_ai vector unsigned long long
7339vec_ctul(vector double __a, int __b)
7340 __constant_range(__b, 0, 31) {
7341 __a *= (vector double)(vector unsigned long long)((0x3ffULL + __b) << 52);
7342 return __builtin_convertvector(__a, vector unsigned long long);
7343}
7344
7345/*-- vec_roundp -------------------------------------------------------------*/
7346
7347static inline __ATTRS_ai vector double
7348vec_roundp(vector double __a) {
7349 return __builtin_s390_vfidb(__a, 4, 6);
7350}
7351
7352/*-- vec_ceil ---------------------------------------------------------------*/
7353
7354static inline __ATTRS_ai vector double
7355vec_ceil(vector double __a) {
7356 // On this platform, vec_ceil never triggers the IEEE-inexact exception.
7357 return __builtin_s390_vfidb(__a, 4, 6);
7358}
7359
7360/*-- vec_roundm -------------------------------------------------------------*/
7361
7362static inline __ATTRS_ai vector double
7363vec_roundm(vector double __a) {
7364 return __builtin_s390_vfidb(__a, 4, 7);
7365}
7366
7367/*-- vec_floor --------------------------------------------------------------*/
7368
7369static inline __ATTRS_ai vector double
7370vec_floor(vector double __a) {
7371 // On this platform, vec_floor never triggers the IEEE-inexact exception.
7372 return __builtin_s390_vfidb(__a, 4, 7);
7373}
7374
7375/*-- vec_roundz -------------------------------------------------------------*/
7376
7377static inline __ATTRS_ai vector double
7378vec_roundz(vector double __a) {
7379 return __builtin_s390_vfidb(__a, 4, 5);
7380}
7381
7382/*-- vec_trunc --------------------------------------------------------------*/
7383
7384static inline __ATTRS_ai vector double
7385vec_trunc(vector double __a) {
7386 // On this platform, vec_trunc never triggers the IEEE-inexact exception.
7387 return __builtin_s390_vfidb(__a, 4, 5);
7388}
7389
7390/*-- vec_roundc -------------------------------------------------------------*/
7391
7392static inline __ATTRS_ai vector double
7393vec_roundc(vector double __a) {
7394 return __builtin_s390_vfidb(__a, 4, 0);
7395}
7396
7397/*-- vec_round --------------------------------------------------------------*/
7398
7399static inline __ATTRS_ai vector double
7400vec_round(vector double __a) {
7401 return __builtin_s390_vfidb(__a, 4, 4);
7402}
7403
7404/*-- vec_fp_test_data_class -------------------------------------------------*/
7405
7406#define vec_fp_test_data_class(X, Y, Z) \
7407 ((vector bool long long)__builtin_s390_vftcidb((X), (Y), (Z)))
7408
7409/*-- vec_cp_until_zero ------------------------------------------------------*/
7410
7411static inline __ATTRS_o_ai vector signed char
7412vec_cp_until_zero(vector signed char __a) {
7413 return (vector signed char)__builtin_s390_vistrb((vector unsigned char)__a);
7414}
7415
7416static inline __ATTRS_o_ai vector bool char
7417vec_cp_until_zero(vector bool char __a) {
7418 return (vector bool char)__builtin_s390_vistrb((vector unsigned char)__a);
7419}
7420
7421static inline __ATTRS_o_ai vector unsigned char
7422vec_cp_until_zero(vector unsigned char __a) {
7423 return __builtin_s390_vistrb(__a);
7424}
7425
7426static inline __ATTRS_o_ai vector signed short
7427vec_cp_until_zero(vector signed short __a) {
7428 return (vector signed short)__builtin_s390_vistrh((vector unsigned short)__a);
7429}
7430
7431static inline __ATTRS_o_ai vector bool short
7432vec_cp_until_zero(vector bool short __a) {
7433 return (vector bool short)__builtin_s390_vistrh((vector unsigned short)__a);
7434}
7435
7436static inline __ATTRS_o_ai vector unsigned short
7437vec_cp_until_zero(vector unsigned short __a) {
7438 return __builtin_s390_vistrh(__a);
7439}
7440
7441static inline __ATTRS_o_ai vector signed int
7442vec_cp_until_zero(vector signed int __a) {
7443 return (vector signed int)__builtin_s390_vistrf((vector unsigned int)__a);
7444}
7445
7446static inline __ATTRS_o_ai vector bool int
7447vec_cp_until_zero(vector bool int __a) {
7448 return (vector bool int)__builtin_s390_vistrf((vector unsigned int)__a);
7449}
7450
7451static inline __ATTRS_o_ai vector unsigned int
7452vec_cp_until_zero(vector unsigned int __a) {
7453 return __builtin_s390_vistrf(__a);
7454}
7455
7456/*-- vec_cp_until_zero_cc ---------------------------------------------------*/
7457
7458static inline __ATTRS_o_ai vector signed char
7459vec_cp_until_zero_cc(vector signed char __a, int *__cc) {
7460 return (vector signed char)
7461 __builtin_s390_vistrbs((vector unsigned char)__a, __cc);
7462}
7463
7464static inline __ATTRS_o_ai vector bool char
7465vec_cp_until_zero_cc(vector bool char __a, int *__cc) {
7466 return (vector bool char)
7467 __builtin_s390_vistrbs((vector unsigned char)__a, __cc);
7468}
7469
7470static inline __ATTRS_o_ai vector unsigned char
7471vec_cp_until_zero_cc(vector unsigned char __a, int *__cc) {
7472 return __builtin_s390_vistrbs(__a, __cc);
7473}
7474
7475static inline __ATTRS_o_ai vector signed short
7476vec_cp_until_zero_cc(vector signed short __a, int *__cc) {
7477 return (vector signed short)
7478 __builtin_s390_vistrhs((vector unsigned short)__a, __cc);
7479}
7480
7481static inline __ATTRS_o_ai vector bool short
7482vec_cp_until_zero_cc(vector bool short __a, int *__cc) {
7483 return (vector bool short)
7484 __builtin_s390_vistrhs((vector unsigned short)__a, __cc);
7485}
7486
7487static inline __ATTRS_o_ai vector unsigned short
7488vec_cp_until_zero_cc(vector unsigned short __a, int *__cc) {
7489 return __builtin_s390_vistrhs(__a, __cc);
7490}
7491
7492static inline __ATTRS_o_ai vector signed int
7493vec_cp_until_zero_cc(vector signed int __a, int *__cc) {
7494 return (vector signed int)
7495 __builtin_s390_vistrfs((vector unsigned int)__a, __cc);
7496}
7497
7498static inline __ATTRS_o_ai vector bool int
7499vec_cp_until_zero_cc(vector bool int __a, int *__cc) {
7500 return (vector bool int)__builtin_s390_vistrfs((vector unsigned int)__a,
7501 __cc);
7502}
7503
7504static inline __ATTRS_o_ai vector unsigned int
7505vec_cp_until_zero_cc(vector unsigned int __a, int *__cc) {
7506 return __builtin_s390_vistrfs(__a, __cc);
7507}
7508
7509/*-- vec_cmpeq_idx ----------------------------------------------------------*/
7510
7511static inline __ATTRS_o_ai vector signed char
7512vec_cmpeq_idx(vector signed char __a, vector signed char __b) {
7513 return (vector signed char)
7514 __builtin_s390_vfeeb((vector unsigned char)__a,
7515 (vector unsigned char)__b);
7516}
7517
7518static inline __ATTRS_o_ai vector unsigned char
7519vec_cmpeq_idx(vector bool char __a, vector bool char __b) {
7520 return __builtin_s390_vfeeb((vector unsigned char)__a,
7521 (vector unsigned char)__b);
7522}
7523
7524static inline __ATTRS_o_ai vector unsigned char
7525vec_cmpeq_idx(vector unsigned char __a, vector unsigned char __b) {
7526 return __builtin_s390_vfeeb(__a, __b);
7527}
7528
7529static inline __ATTRS_o_ai vector signed short
7530vec_cmpeq_idx(vector signed short __a, vector signed short __b) {
7531 return (vector signed short)
7532 __builtin_s390_vfeeh((vector unsigned short)__a,
7533 (vector unsigned short)__b);
7534}
7535
7536static inline __ATTRS_o_ai vector unsigned short
7537vec_cmpeq_idx(vector bool short __a, vector bool short __b) {
7538 return __builtin_s390_vfeeh((vector unsigned short)__a,
7539 (vector unsigned short)__b);
7540}
7541
7542static inline __ATTRS_o_ai vector unsigned short
7543vec_cmpeq_idx(vector unsigned short __a, vector unsigned short __b) {
7544 return __builtin_s390_vfeeh(__a, __b);
7545}
7546
7547static inline __ATTRS_o_ai vector signed int
7548vec_cmpeq_idx(vector signed int __a, vector signed int __b) {
7549 return (vector signed int)
7550 __builtin_s390_vfeef((vector unsigned int)__a,
7551 (vector unsigned int)__b);
7552}
7553
7554static inline __ATTRS_o_ai vector unsigned int
7555vec_cmpeq_idx(vector bool int __a, vector bool int __b) {
7556 return __builtin_s390_vfeef((vector unsigned int)__a,
7557 (vector unsigned int)__b);
7558}
7559
7560static inline __ATTRS_o_ai vector unsigned int
7561vec_cmpeq_idx(vector unsigned int __a, vector unsigned int __b) {
7562 return __builtin_s390_vfeef(__a, __b);
7563}
7564
7565/*-- vec_cmpeq_idx_cc -------------------------------------------------------*/
7566
7567static inline __ATTRS_o_ai vector signed char
7568vec_cmpeq_idx_cc(vector signed char __a, vector signed char __b, int *__cc) {
7569 return (vector signed char)
7570 __builtin_s390_vfeebs((vector unsigned char)__a,
7571 (vector unsigned char)__b, __cc);
7572}
7573
7574static inline __ATTRS_o_ai vector unsigned char
7575vec_cmpeq_idx_cc(vector bool char __a, vector bool char __b, int *__cc) {
7576 return __builtin_s390_vfeebs((vector unsigned char)__a,
7577 (vector unsigned char)__b, __cc);
7578}
7579
7580static inline __ATTRS_o_ai vector unsigned char
7581vec_cmpeq_idx_cc(vector unsigned char __a, vector unsigned char __b,
7582 int *__cc) {
7583 return __builtin_s390_vfeebs(__a, __b, __cc);
7584}
7585
7586static inline __ATTRS_o_ai vector signed short
7587vec_cmpeq_idx_cc(vector signed short __a, vector signed short __b, int *__cc) {
7588 return (vector signed short)
7589 __builtin_s390_vfeehs((vector unsigned short)__a,
7590 (vector unsigned short)__b, __cc);
7591}
7592
7593static inline __ATTRS_o_ai vector unsigned short
7594vec_cmpeq_idx_cc(vector bool short __a, vector bool short __b, int *__cc) {
7595 return __builtin_s390_vfeehs((vector unsigned short)__a,
7596 (vector unsigned short)__b, __cc);
7597}
7598
7599static inline __ATTRS_o_ai vector unsigned short
7600vec_cmpeq_idx_cc(vector unsigned short __a, vector unsigned short __b,
7601 int *__cc) {
7602 return __builtin_s390_vfeehs(__a, __b, __cc);
7603}
7604
7605static inline __ATTRS_o_ai vector signed int
7606vec_cmpeq_idx_cc(vector signed int __a, vector signed int __b, int *__cc) {
7607 return (vector signed int)
7608 __builtin_s390_vfeefs((vector unsigned int)__a,
7609 (vector unsigned int)__b, __cc);
7610}
7611
7612static inline __ATTRS_o_ai vector unsigned int
7613vec_cmpeq_idx_cc(vector bool int __a, vector bool int __b, int *__cc) {
7614 return __builtin_s390_vfeefs((vector unsigned int)__a,
7615 (vector unsigned int)__b, __cc);
7616}
7617
7618static inline __ATTRS_o_ai vector unsigned int
7619vec_cmpeq_idx_cc(vector unsigned int __a, vector unsigned int __b, int *__cc) {
7620 return __builtin_s390_vfeefs(__a, __b, __cc);
7621}
7622
7623/*-- vec_cmpeq_or_0_idx -----------------------------------------------------*/
7624
7625static inline __ATTRS_o_ai vector signed char
7626vec_cmpeq_or_0_idx(vector signed char __a, vector signed char __b) {
7627 return (vector signed char)
7628 __builtin_s390_vfeezb((vector unsigned char)__a,
7629 (vector unsigned char)__b);
7630}
7631
7632static inline __ATTRS_o_ai vector unsigned char
7633vec_cmpeq_or_0_idx(vector bool char __a, vector bool char __b) {
7634 return __builtin_s390_vfeezb((vector unsigned char)__a,
7635 (vector unsigned char)__b);
7636}
7637
7638static inline __ATTRS_o_ai vector unsigned char
7639vec_cmpeq_or_0_idx(vector unsigned char __a, vector unsigned char __b) {
7640 return __builtin_s390_vfeezb(__a, __b);
7641}
7642
7643static inline __ATTRS_o_ai vector signed short
7644vec_cmpeq_or_0_idx(vector signed short __a, vector signed short __b) {
7645 return (vector signed short)
7646 __builtin_s390_vfeezh((vector unsigned short)__a,
7647 (vector unsigned short)__b);
7648}
7649
7650static inline __ATTRS_o_ai vector unsigned short
7651vec_cmpeq_or_0_idx(vector bool short __a, vector bool short __b) {
7652 return __builtin_s390_vfeezh((vector unsigned short)__a,
7653 (vector unsigned short)__b);
7654}
7655
7656static inline __ATTRS_o_ai vector unsigned short
7657vec_cmpeq_or_0_idx(vector unsigned short __a, vector unsigned short __b) {
7658 return __builtin_s390_vfeezh(__a, __b);
7659}
7660
7661static inline __ATTRS_o_ai vector signed int
7662vec_cmpeq_or_0_idx(vector signed int __a, vector signed int __b) {
7663 return (vector signed int)
7664 __builtin_s390_vfeezf((vector unsigned int)__a,
7665 (vector unsigned int)__b);
7666}
7667
7668static inline __ATTRS_o_ai vector unsigned int
7669vec_cmpeq_or_0_idx(vector bool int __a, vector bool int __b) {
7670 return __builtin_s390_vfeezf((vector unsigned int)__a,
7671 (vector unsigned int)__b);
7672}
7673
7674static inline __ATTRS_o_ai vector unsigned int
7675vec_cmpeq_or_0_idx(vector unsigned int __a, vector unsigned int __b) {
7676 return __builtin_s390_vfeezf(__a, __b);
7677}
7678
7679/*-- vec_cmpeq_or_0_idx_cc --------------------------------------------------*/
7680
7681static inline __ATTRS_o_ai vector signed char
7682vec_cmpeq_or_0_idx_cc(vector signed char __a, vector signed char __b,
7683 int *__cc) {
7684 return (vector signed char)
7685 __builtin_s390_vfeezbs((vector unsigned char)__a,
7686 (vector unsigned char)__b, __cc);
7687}
7688
7689static inline __ATTRS_o_ai vector unsigned char
7690vec_cmpeq_or_0_idx_cc(vector bool char __a, vector bool char __b, int *__cc) {
7691 return __builtin_s390_vfeezbs((vector unsigned char)__a,
7692 (vector unsigned char)__b, __cc);
7693}
7694
7695static inline __ATTRS_o_ai vector unsigned char
7696vec_cmpeq_or_0_idx_cc(vector unsigned char __a, vector unsigned char __b,
7697 int *__cc) {
7698 return __builtin_s390_vfeezbs(__a, __b, __cc);
7699}
7700
7701static inline __ATTRS_o_ai vector signed short
7702vec_cmpeq_or_0_idx_cc(vector signed short __a, vector signed short __b,
7703 int *__cc) {
7704 return (vector signed short)
7705 __builtin_s390_vfeezhs((vector unsigned short)__a,
7706 (vector unsigned short)__b, __cc);
7707}
7708
7709static inline __ATTRS_o_ai vector unsigned short
7710vec_cmpeq_or_0_idx_cc(vector bool short __a, vector bool short __b, int *__cc) {
7711 return __builtin_s390_vfeezhs((vector unsigned short)__a,
7712 (vector unsigned short)__b, __cc);
7713}
7714
7715static inline __ATTRS_o_ai vector unsigned short
7716vec_cmpeq_or_0_idx_cc(vector unsigned short __a, vector unsigned short __b,
7717 int *__cc) {
7718 return __builtin_s390_vfeezhs(__a, __b, __cc);
7719}
7720
7721static inline __ATTRS_o_ai vector signed int
7722vec_cmpeq_or_0_idx_cc(vector signed int __a, vector signed int __b, int *__cc) {
7723 return (vector signed int)
7724 __builtin_s390_vfeezfs((vector unsigned int)__a,
7725 (vector unsigned int)__b, __cc);
7726}
7727
7728static inline __ATTRS_o_ai vector unsigned int
7729vec_cmpeq_or_0_idx_cc(vector bool int __a, vector bool int __b, int *__cc) {
7730 return __builtin_s390_vfeezfs((vector unsigned int)__a,
7731 (vector unsigned int)__b, __cc);
7732}
7733
7734static inline __ATTRS_o_ai vector unsigned int
7735vec_cmpeq_or_0_idx_cc(vector unsigned int __a, vector unsigned int __b,
7736 int *__cc) {
7737 return __builtin_s390_vfeezfs(__a, __b, __cc);
7738}
7739
7740/*-- vec_cmpne_idx ----------------------------------------------------------*/
7741
7742static inline __ATTRS_o_ai vector signed char
7743vec_cmpne_idx(vector signed char __a, vector signed char __b) {
7744 return (vector signed char)
7745 __builtin_s390_vfeneb((vector unsigned char)__a,
7746 (vector unsigned char)__b);
7747}
7748
7749static inline __ATTRS_o_ai vector unsigned char
7750vec_cmpne_idx(vector bool char __a, vector bool char __b) {
7751 return __builtin_s390_vfeneb((vector unsigned char)__a,
7752 (vector unsigned char)__b);
7753}
7754
7755static inline __ATTRS_o_ai vector unsigned char
7756vec_cmpne_idx(vector unsigned char __a, vector unsigned char __b) {
7757 return __builtin_s390_vfeneb(__a, __b);
7758}
7759
7760static inline __ATTRS_o_ai vector signed short
7761vec_cmpne_idx(vector signed short __a, vector signed short __b) {
7762 return (vector signed short)
7763 __builtin_s390_vfeneh((vector unsigned short)__a,
7764 (vector unsigned short)__b);
7765}
7766
7767static inline __ATTRS_o_ai vector unsigned short
7768vec_cmpne_idx(vector bool short __a, vector bool short __b) {
7769 return __builtin_s390_vfeneh((vector unsigned short)__a,
7770 (vector unsigned short)__b);
7771}
7772
7773static inline __ATTRS_o_ai vector unsigned short
7774vec_cmpne_idx(vector unsigned short __a, vector unsigned short __b) {
7775 return __builtin_s390_vfeneh(__a, __b);
7776}
7777
7778static inline __ATTRS_o_ai vector signed int
7779vec_cmpne_idx(vector signed int __a, vector signed int __b) {
7780 return (vector signed int)
7781 __builtin_s390_vfenef((vector unsigned int)__a,
7782 (vector unsigned int)__b);
7783}
7784
7785static inline __ATTRS_o_ai vector unsigned int
7786vec_cmpne_idx(vector bool int __a, vector bool int __b) {
7787 return __builtin_s390_vfenef((vector unsigned int)__a,
7788 (vector unsigned int)__b);
7789}
7790
7791static inline __ATTRS_o_ai vector unsigned int
7792vec_cmpne_idx(vector unsigned int __a, vector unsigned int __b) {
7793 return __builtin_s390_vfenef(__a, __b);
7794}
7795
7796/*-- vec_cmpne_idx_cc -------------------------------------------------------*/
7797
7798static inline __ATTRS_o_ai vector signed char
7799vec_cmpne_idx_cc(vector signed char __a, vector signed char __b, int *__cc) {
7800 return (vector signed char)
7801 __builtin_s390_vfenebs((vector unsigned char)__a,
7802 (vector unsigned char)__b, __cc);
7803}
7804
7805static inline __ATTRS_o_ai vector unsigned char
7806vec_cmpne_idx_cc(vector bool char __a, vector bool char __b, int *__cc) {
7807 return __builtin_s390_vfenebs((vector unsigned char)__a,
7808 (vector unsigned char)__b, __cc);
7809}
7810
7811static inline __ATTRS_o_ai vector unsigned char
7812vec_cmpne_idx_cc(vector unsigned char __a, vector unsigned char __b,
7813 int *__cc) {
7814 return __builtin_s390_vfenebs(__a, __b, __cc);
7815}
7816
7817static inline __ATTRS_o_ai vector signed short
7818vec_cmpne_idx_cc(vector signed short __a, vector signed short __b, int *__cc) {
7819 return (vector signed short)
7820 __builtin_s390_vfenehs((vector unsigned short)__a,
7821 (vector unsigned short)__b, __cc);
7822}
7823
7824static inline __ATTRS_o_ai vector unsigned short
7825vec_cmpne_idx_cc(vector bool short __a, vector bool short __b, int *__cc) {
7826 return __builtin_s390_vfenehs((vector unsigned short)__a,
7827 (vector unsigned short)__b, __cc);
7828}
7829
7830static inline __ATTRS_o_ai vector unsigned short
7831vec_cmpne_idx_cc(vector unsigned short __a, vector unsigned short __b,
7832 int *__cc) {
7833 return __builtin_s390_vfenehs(__a, __b, __cc);
7834}
7835
7836static inline __ATTRS_o_ai vector signed int
7837vec_cmpne_idx_cc(vector signed int __a, vector signed int __b, int *__cc) {
7838 return (vector signed int)
7839 __builtin_s390_vfenefs((vector unsigned int)__a,
7840 (vector unsigned int)__b, __cc);
7841}
7842
7843static inline __ATTRS_o_ai vector unsigned int
7844vec_cmpne_idx_cc(vector bool int __a, vector bool int __b, int *__cc) {
7845 return __builtin_s390_vfenefs((vector unsigned int)__a,
7846 (vector unsigned int)__b, __cc);
7847}
7848
7849static inline __ATTRS_o_ai vector unsigned int
7850vec_cmpne_idx_cc(vector unsigned int __a, vector unsigned int __b, int *__cc) {
7851 return __builtin_s390_vfenefs(__a, __b, __cc);
7852}
7853
7854/*-- vec_cmpne_or_0_idx -----------------------------------------------------*/
7855
7856static inline __ATTRS_o_ai vector signed char
7857vec_cmpne_or_0_idx(vector signed char __a, vector signed char __b) {
7858 return (vector signed char)
7859 __builtin_s390_vfenezb((vector unsigned char)__a,
7860 (vector unsigned char)__b);
7861}
7862
7863static inline __ATTRS_o_ai vector unsigned char
7864vec_cmpne_or_0_idx(vector bool char __a, vector bool char __b) {
7865 return __builtin_s390_vfenezb((vector unsigned char)__a,
7866 (vector unsigned char)__b);
7867}
7868
7869static inline __ATTRS_o_ai vector unsigned char
7870vec_cmpne_or_0_idx(vector unsigned char __a, vector unsigned char __b) {
7871 return __builtin_s390_vfenezb(__a, __b);
7872}
7873
7874static inline __ATTRS_o_ai vector signed short
7875vec_cmpne_or_0_idx(vector signed short __a, vector signed short __b) {
7876 return (vector signed short)
7877 __builtin_s390_vfenezh((vector unsigned short)__a,
7878 (vector unsigned short)__b);
7879}
7880
7881static inline __ATTRS_o_ai vector unsigned short
7882vec_cmpne_or_0_idx(vector bool short __a, vector bool short __b) {
7883 return __builtin_s390_vfenezh((vector unsigned short)__a,
7884 (vector unsigned short)__b);
7885}
7886
7887static inline __ATTRS_o_ai vector unsigned short
7888vec_cmpne_or_0_idx(vector unsigned short __a, vector unsigned short __b) {
7889 return __builtin_s390_vfenezh(__a, __b);
7890}
7891
7892static inline __ATTRS_o_ai vector signed int
7893vec_cmpne_or_0_idx(vector signed int __a, vector signed int __b) {
7894 return (vector signed int)
7895 __builtin_s390_vfenezf((vector unsigned int)__a,
7896 (vector unsigned int)__b);
7897}
7898
7899static inline __ATTRS_o_ai vector unsigned int
7900vec_cmpne_or_0_idx(vector bool int __a, vector bool int __b) {
7901 return __builtin_s390_vfenezf((vector unsigned int)__a,
7902 (vector unsigned int)__b);
7903}
7904
7905static inline __ATTRS_o_ai vector unsigned int
7906vec_cmpne_or_0_idx(vector unsigned int __a, vector unsigned int __b) {
7907 return __builtin_s390_vfenezf(__a, __b);
7908}
7909
7910/*-- vec_cmpne_or_0_idx_cc --------------------------------------------------*/
7911
7912static inline __ATTRS_o_ai vector signed char
7913vec_cmpne_or_0_idx_cc(vector signed char __a, vector signed char __b,
7914 int *__cc) {
7915 return (vector signed char)
7916 __builtin_s390_vfenezbs((vector unsigned char)__a,
7917 (vector unsigned char)__b, __cc);
7918}
7919
7920static inline __ATTRS_o_ai vector unsigned char
7921vec_cmpne_or_0_idx_cc(vector bool char __a, vector bool char __b, int *__cc) {
7922 return __builtin_s390_vfenezbs((vector unsigned char)__a,
7923 (vector unsigned char)__b, __cc);
7924}
7925
7926static inline __ATTRS_o_ai vector unsigned char
7927vec_cmpne_or_0_idx_cc(vector unsigned char __a, vector unsigned char __b,
7928 int *__cc) {
7929 return __builtin_s390_vfenezbs(__a, __b, __cc);
7930}
7931
7932static inline __ATTRS_o_ai vector signed short
7933vec_cmpne_or_0_idx_cc(vector signed short __a, vector signed short __b,
7934 int *__cc) {
7935 return (vector signed short)
7936 __builtin_s390_vfenezhs((vector unsigned short)__a,
7937 (vector unsigned short)__b, __cc);
7938}
7939
7940static inline __ATTRS_o_ai vector unsigned short
7941vec_cmpne_or_0_idx_cc(vector bool short __a, vector bool short __b, int *__cc) {
7942 return __builtin_s390_vfenezhs((vector unsigned short)__a,
7943 (vector unsigned short)__b, __cc);
7944}
7945
7946static inline __ATTRS_o_ai vector unsigned short
7947vec_cmpne_or_0_idx_cc(vector unsigned short __a, vector unsigned short __b,
7948 int *__cc) {
7949 return __builtin_s390_vfenezhs(__a, __b, __cc);
7950}
7951
7952static inline __ATTRS_o_ai vector signed int
7953vec_cmpne_or_0_idx_cc(vector signed int __a, vector signed int __b, int *__cc) {
7954 return (vector signed int)
7955 __builtin_s390_vfenezfs((vector unsigned int)__a,
7956 (vector unsigned int)__b, __cc);
7957}
7958
7959static inline __ATTRS_o_ai vector unsigned int
7960vec_cmpne_or_0_idx_cc(vector bool int __a, vector bool int __b, int *__cc) {
7961 return __builtin_s390_vfenezfs((vector unsigned int)__a,
7962 (vector unsigned int)__b, __cc);
7963}
7964
7965static inline __ATTRS_o_ai vector unsigned int
7966vec_cmpne_or_0_idx_cc(vector unsigned int __a, vector unsigned int __b,
7967 int *__cc) {
7968 return __builtin_s390_vfenezfs(__a, __b, __cc);
7969}
7970
7971/*-- vec_cmprg --------------------------------------------------------------*/
7972
7973static inline __ATTRS_o_ai vector bool char
7974vec_cmprg(vector unsigned char __a, vector unsigned char __b,
7975 vector unsigned char __c) {
7976 return (vector bool char)__builtin_s390_vstrcb(__a, __b, __c, 4);
7977}
7978
7979static inline __ATTRS_o_ai vector bool short
7980vec_cmprg(vector unsigned short __a, vector unsigned short __b,
7981 vector unsigned short __c) {
7982 return (vector bool short)__builtin_s390_vstrch(__a, __b, __c, 4);
7983}
7984
7985static inline __ATTRS_o_ai vector bool int
7986vec_cmprg(vector unsigned int __a, vector unsigned int __b,
7987 vector unsigned int __c) {
7988 return (vector bool int)__builtin_s390_vstrcf(__a, __b, __c, 4);
7989}
7990
7991/*-- vec_cmprg_cc -----------------------------------------------------------*/
7992
7993static inline __ATTRS_o_ai vector bool char
7994vec_cmprg_cc(vector unsigned char __a, vector unsigned char __b,
7995 vector unsigned char __c, int *__cc) {
7996 return (vector bool char)__builtin_s390_vstrcbs(__a, __b, __c, 4, __cc);
7997}
7998
7999static inline __ATTRS_o_ai vector bool short
8000vec_cmprg_cc(vector unsigned short __a, vector unsigned short __b,
8001 vector unsigned short __c, int *__cc) {
8002 return (vector bool short)__builtin_s390_vstrchs(__a, __b, __c, 4, __cc);
8003}
8004
8005static inline __ATTRS_o_ai vector bool int
8006vec_cmprg_cc(vector unsigned int __a, vector unsigned int __b,
8007 vector unsigned int __c, int *__cc) {
8008 return (vector bool int)__builtin_s390_vstrcfs(__a, __b, __c, 4, __cc);
8009}
8010
8011/*-- vec_cmprg_idx ----------------------------------------------------------*/
8012
8013static inline __ATTRS_o_ai vector unsigned char
8014vec_cmprg_idx(vector unsigned char __a, vector unsigned char __b,
8015 vector unsigned char __c) {
8016 return __builtin_s390_vstrcb(__a, __b, __c, 0);
8017}
8018
8019static inline __ATTRS_o_ai vector unsigned short
8020vec_cmprg_idx(vector unsigned short __a, vector unsigned short __b,
8021 vector unsigned short __c) {
8022 return __builtin_s390_vstrch(__a, __b, __c, 0);
8023}
8024
8025static inline __ATTRS_o_ai vector unsigned int
8026vec_cmprg_idx(vector unsigned int __a, vector unsigned int __b,
8027 vector unsigned int __c) {
8028 return __builtin_s390_vstrcf(__a, __b, __c, 0);
8029}
8030
8031/*-- vec_cmprg_idx_cc -------------------------------------------------------*/
8032
8033static inline __ATTRS_o_ai vector unsigned char
8034vec_cmprg_idx_cc(vector unsigned char __a, vector unsigned char __b,
8035 vector unsigned char __c, int *__cc) {
8036 return __builtin_s390_vstrcbs(__a, __b, __c, 0, __cc);
8037}
8038
8039static inline __ATTRS_o_ai vector unsigned short
8040vec_cmprg_idx_cc(vector unsigned short __a, vector unsigned short __b,
8041 vector unsigned short __c, int *__cc) {
8042 return __builtin_s390_vstrchs(__a, __b, __c, 0, __cc);
8043}
8044
8045static inline __ATTRS_o_ai vector unsigned int
8046vec_cmprg_idx_cc(vector unsigned int __a, vector unsigned int __b,
8047 vector unsigned int __c, int *__cc) {
8048 return __builtin_s390_vstrcfs(__a, __b, __c, 0, __cc);
8049}
8050
8051/*-- vec_cmprg_or_0_idx -----------------------------------------------------*/
8052
8053static inline __ATTRS_o_ai vector unsigned char
8054vec_cmprg_or_0_idx(vector unsigned char __a, vector unsigned char __b,
8055 vector unsigned char __c) {
8056 return __builtin_s390_vstrczb(__a, __b, __c, 0);
8057}
8058
8059static inline __ATTRS_o_ai vector unsigned short
8060vec_cmprg_or_0_idx(vector unsigned short __a, vector unsigned short __b,
8061 vector unsigned short __c) {
8062 return __builtin_s390_vstrczh(__a, __b, __c, 0);
8063}
8064
8065static inline __ATTRS_o_ai vector unsigned int
8066vec_cmprg_or_0_idx(vector unsigned int __a, vector unsigned int __b,
8067 vector unsigned int __c) {
8068 return __builtin_s390_vstrczf(__a, __b, __c, 0);
8069}
8070
8071/*-- vec_cmprg_or_0_idx_cc --------------------------------------------------*/
8072
8073static inline __ATTRS_o_ai vector unsigned char
8074vec_cmprg_or_0_idx_cc(vector unsigned char __a, vector unsigned char __b,
8075 vector unsigned char __c, int *__cc) {
8076 return __builtin_s390_vstrczbs(__a, __b, __c, 0, __cc);
8077}
8078
8079static inline __ATTRS_o_ai vector unsigned short
8080vec_cmprg_or_0_idx_cc(vector unsigned short __a, vector unsigned short __b,
8081 vector unsigned short __c, int *__cc) {
8082 return __builtin_s390_vstrczhs(__a, __b, __c, 0, __cc);
8083}
8084
8085static inline __ATTRS_o_ai vector unsigned int
8086vec_cmprg_or_0_idx_cc(vector unsigned int __a, vector unsigned int __b,
8087 vector unsigned int __c, int *__cc) {
8088 return __builtin_s390_vstrczfs(__a, __b, __c, 0, __cc);
8089}
8090
8091/*-- vec_cmpnrg -------------------------------------------------------------*/
8092
8093static inline __ATTRS_o_ai vector bool char
8094vec_cmpnrg(vector unsigned char __a, vector unsigned char __b,
8095 vector unsigned char __c) {
8096 return (vector bool char)__builtin_s390_vstrcb(__a, __b, __c, 12);
8097}
8098
8099static inline __ATTRS_o_ai vector bool short
8100vec_cmpnrg(vector unsigned short __a, vector unsigned short __b,
8101 vector unsigned short __c) {
8102 return (vector bool short)__builtin_s390_vstrch(__a, __b, __c, 12);
8103}
8104
8105static inline __ATTRS_o_ai vector bool int
8106vec_cmpnrg(vector unsigned int __a, vector unsigned int __b,
8107 vector unsigned int __c) {
8108 return (vector bool int)__builtin_s390_vstrcf(__a, __b, __c, 12);
8109}
8110
8111/*-- vec_cmpnrg_cc ----------------------------------------------------------*/
8112
8113static inline __ATTRS_o_ai vector bool char
8114vec_cmpnrg_cc(vector unsigned char __a, vector unsigned char __b,
8115 vector unsigned char __c, int *__cc) {
8116 return (vector bool char)__builtin_s390_vstrcbs(__a, __b, __c, 12, __cc);
8117}
8118
8119static inline __ATTRS_o_ai vector bool short
8120vec_cmpnrg_cc(vector unsigned short __a, vector unsigned short __b,
8121 vector unsigned short __c, int *__cc) {
8122 return (vector bool short)__builtin_s390_vstrchs(__a, __b, __c, 12, __cc);
8123}
8124
8125static inline __ATTRS_o_ai vector bool int
8126vec_cmpnrg_cc(vector unsigned int __a, vector unsigned int __b,
8127 vector unsigned int __c, int *__cc) {
8128 return (vector bool int)__builtin_s390_vstrcfs(__a, __b, __c, 12, __cc);
8129}
8130
8131/*-- vec_cmpnrg_idx ---------------------------------------------------------*/
8132
8133static inline __ATTRS_o_ai vector unsigned char
8134vec_cmpnrg_idx(vector unsigned char __a, vector unsigned char __b,
8135 vector unsigned char __c) {
8136 return __builtin_s390_vstrcb(__a, __b, __c, 8);
8137}
8138
8139static inline __ATTRS_o_ai vector unsigned short
8140vec_cmpnrg_idx(vector unsigned short __a, vector unsigned short __b,
8141 vector unsigned short __c) {
8142 return __builtin_s390_vstrch(__a, __b, __c, 8);
8143}
8144
8145static inline __ATTRS_o_ai vector unsigned int
8146vec_cmpnrg_idx(vector unsigned int __a, vector unsigned int __b,
8147 vector unsigned int __c) {
8148 return __builtin_s390_vstrcf(__a, __b, __c, 8);
8149}
8150
8151/*-- vec_cmpnrg_idx_cc ------------------------------------------------------*/
8152
8153static inline __ATTRS_o_ai vector unsigned char
8154vec_cmpnrg_idx_cc(vector unsigned char __a, vector unsigned char __b,
8155 vector unsigned char __c, int *__cc) {
8156 return __builtin_s390_vstrcbs(__a, __b, __c, 8, __cc);
8157}
8158
8159static inline __ATTRS_o_ai vector unsigned short
8160vec_cmpnrg_idx_cc(vector unsigned short __a, vector unsigned short __b,
8161 vector unsigned short __c, int *__cc) {
8162 return __builtin_s390_vstrchs(__a, __b, __c, 8, __cc);
8163}
8164
8165static inline __ATTRS_o_ai vector unsigned int
8166vec_cmpnrg_idx_cc(vector unsigned int __a, vector unsigned int __b,
8167 vector unsigned int __c, int *__cc) {
8168 return __builtin_s390_vstrcfs(__a, __b, __c, 8, __cc);
8169}
8170
8171/*-- vec_cmpnrg_or_0_idx ----------------------------------------------------*/
8172
8173static inline __ATTRS_o_ai vector unsigned char
8174vec_cmpnrg_or_0_idx(vector unsigned char __a, vector unsigned char __b,
8175 vector unsigned char __c) {
8176 return __builtin_s390_vstrczb(__a, __b, __c, 8);
8177}
8178
8179static inline __ATTRS_o_ai vector unsigned short
8180vec_cmpnrg_or_0_idx(vector unsigned short __a, vector unsigned short __b,
8181 vector unsigned short __c) {
8182 return __builtin_s390_vstrczh(__a, __b, __c, 8);
8183}
8184
8185static inline __ATTRS_o_ai vector unsigned int
8186vec_cmpnrg_or_0_idx(vector unsigned int __a, vector unsigned int __b,
8187 vector unsigned int __c) {
8188 return __builtin_s390_vstrczf(__a, __b, __c, 8);
8189}
8190
8191/*-- vec_cmpnrg_or_0_idx_cc -------------------------------------------------*/
8192
8193static inline __ATTRS_o_ai vector unsigned char
8194vec_cmpnrg_or_0_idx_cc(vector unsigned char __a, vector unsigned char __b,
8195 vector unsigned char __c, int *__cc) {
8196 return __builtin_s390_vstrczbs(__a, __b, __c, 8, __cc);
8197}
8198
8199static inline __ATTRS_o_ai vector unsigned short
8200vec_cmpnrg_or_0_idx_cc(vector unsigned short __a, vector unsigned short __b,
8201 vector unsigned short __c, int *__cc) {
8202 return __builtin_s390_vstrczhs(__a, __b, __c, 8, __cc);
8203}
8204
8205static inline __ATTRS_o_ai vector unsigned int
8206vec_cmpnrg_or_0_idx_cc(vector unsigned int __a, vector unsigned int __b,
8207 vector unsigned int __c, int *__cc) {
8208 return __builtin_s390_vstrczfs(__a, __b, __c, 8, __cc);
8209}
8210
8211/*-- vec_find_any_eq --------------------------------------------------------*/
8212
8213static inline __ATTRS_o_ai vector bool char
8214vec_find_any_eq(vector signed char __a, vector signed char __b) {
8215 return (vector bool char)
8216 __builtin_s390_vfaeb((vector unsigned char)__a,
8217 (vector unsigned char)__b, 4);
8218}
8219
8220static inline __ATTRS_o_ai vector bool char
8221vec_find_any_eq(vector bool char __a, vector bool char __b) {
8222 return (vector bool char)
8223 __builtin_s390_vfaeb((vector unsigned char)__a,
8224 (vector unsigned char)__b, 4);
8225}
8226
8227static inline __ATTRS_o_ai vector bool char
8228vec_find_any_eq(vector unsigned char __a, vector unsigned char __b) {
8229 return (vector bool char)__builtin_s390_vfaeb(__a, __b, 4);
8230}
8231
8232static inline __ATTRS_o_ai vector bool short
8233vec_find_any_eq(vector signed short __a, vector signed short __b) {
8234 return (vector bool short)
8235 __builtin_s390_vfaeh((vector unsigned short)__a,
8236 (vector unsigned short)__b, 4);
8237}
8238
8239static inline __ATTRS_o_ai vector bool short
8240vec_find_any_eq(vector bool short __a, vector bool short __b) {
8241 return (vector bool short)
8242 __builtin_s390_vfaeh((vector unsigned short)__a,
8243 (vector unsigned short)__b, 4);
8244}
8245
8246static inline __ATTRS_o_ai vector bool short
8247vec_find_any_eq(vector unsigned short __a, vector unsigned short __b) {
8248 return (vector bool short)__builtin_s390_vfaeh(__a, __b, 4);
8249}
8250
8251static inline __ATTRS_o_ai vector bool int
8252vec_find_any_eq(vector signed int __a, vector signed int __b) {
8253 return (vector bool int)
8254 __builtin_s390_vfaef((vector unsigned int)__a,
8255 (vector unsigned int)__b, 4);
8256}
8257
8258static inline __ATTRS_o_ai vector bool int
8259vec_find_any_eq(vector bool int __a, vector bool int __b) {
8260 return (vector bool int)
8261 __builtin_s390_vfaef((vector unsigned int)__a,
8262 (vector unsigned int)__b, 4);
8263}
8264
8265static inline __ATTRS_o_ai vector bool int
8266vec_find_any_eq(vector unsigned int __a, vector unsigned int __b) {
8267 return (vector bool int)__builtin_s390_vfaef(__a, __b, 4);
8268}
8269
8270/*-- vec_find_any_eq_cc -----------------------------------------------------*/
8271
8272static inline __ATTRS_o_ai vector bool char
8273vec_find_any_eq_cc(vector signed char __a, vector signed char __b, int *__cc) {
8274 return (vector bool char)
8275 __builtin_s390_vfaebs((vector unsigned char)__a,
8276 (vector unsigned char)__b, 4, __cc);
8277}
8278
8279static inline __ATTRS_o_ai vector bool char
8280vec_find_any_eq_cc(vector bool char __a, vector bool char __b, int *__cc) {
8281 return (vector bool char)
8282 __builtin_s390_vfaebs((vector unsigned char)__a,
8283 (vector unsigned char)__b, 4, __cc);
8284}
8285
8286static inline __ATTRS_o_ai vector bool char
8287vec_find_any_eq_cc(vector unsigned char __a, vector unsigned char __b,
8288 int *__cc) {
8289 return (vector bool char)__builtin_s390_vfaebs(__a, __b, 4, __cc);
8290}
8291
8292static inline __ATTRS_o_ai vector bool short
8293vec_find_any_eq_cc(vector signed short __a, vector signed short __b,
8294 int *__cc) {
8295 return (vector bool short)
8296 __builtin_s390_vfaehs((vector unsigned short)__a,
8297 (vector unsigned short)__b, 4, __cc);
8298}
8299
8300static inline __ATTRS_o_ai vector bool short
8301vec_find_any_eq_cc(vector bool short __a, vector bool short __b, int *__cc) {
8302 return (vector bool short)
8303 __builtin_s390_vfaehs((vector unsigned short)__a,
8304 (vector unsigned short)__b, 4, __cc);
8305}
8306
8307static inline __ATTRS_o_ai vector bool short
8308vec_find_any_eq_cc(vector unsigned short __a, vector unsigned short __b,
8309 int *__cc) {
8310 return (vector bool short)__builtin_s390_vfaehs(__a, __b, 4, __cc);
8311}
8312
8313static inline __ATTRS_o_ai vector bool int
8314vec_find_any_eq_cc(vector signed int __a, vector signed int __b, int *__cc) {
8315 return (vector bool int)
8316 __builtin_s390_vfaefs((vector unsigned int)__a,
8317 (vector unsigned int)__b, 4, __cc);
8318}
8319
8320static inline __ATTRS_o_ai vector bool int
8321vec_find_any_eq_cc(vector bool int __a, vector bool int __b, int *__cc) {
8322 return (vector bool int)
8323 __builtin_s390_vfaefs((vector unsigned int)__a,
8324 (vector unsigned int)__b, 4, __cc);
8325}
8326
8327static inline __ATTRS_o_ai vector bool int
8328vec_find_any_eq_cc(vector unsigned int __a, vector unsigned int __b,
8329 int *__cc) {
8330 return (vector bool int)__builtin_s390_vfaefs(__a, __b, 4, __cc);
8331}
8332
8333/*-- vec_find_any_eq_idx ----------------------------------------------------*/
8334
8335static inline __ATTRS_o_ai vector signed char
8336vec_find_any_eq_idx(vector signed char __a, vector signed char __b) {
8337 return (vector signed char)
8338 __builtin_s390_vfaeb((vector unsigned char)__a,
8339 (vector unsigned char)__b, 0);
8340}
8341
8342static inline __ATTRS_o_ai vector unsigned char
8343vec_find_any_eq_idx(vector bool char __a, vector bool char __b) {
8344 return __builtin_s390_vfaeb((vector unsigned char)__a,
8345 (vector unsigned char)__b, 0);
8346}
8347
8348static inline __ATTRS_o_ai vector unsigned char
8349vec_find_any_eq_idx(vector unsigned char __a, vector unsigned char __b) {
8350 return __builtin_s390_vfaeb(__a, __b, 0);
8351}
8352
8353static inline __ATTRS_o_ai vector signed short
8354vec_find_any_eq_idx(vector signed short __a, vector signed short __b) {
8355 return (vector signed short)
8356 __builtin_s390_vfaeh((vector unsigned short)__a,
8357 (vector unsigned short)__b, 0);
8358}
8359
8360static inline __ATTRS_o_ai vector unsigned short
8361vec_find_any_eq_idx(vector bool short __a, vector bool short __b) {
8362 return __builtin_s390_vfaeh((vector unsigned short)__a,
8363 (vector unsigned short)__b, 0);
8364}
8365
8366static inline __ATTRS_o_ai vector unsigned short
8367vec_find_any_eq_idx(vector unsigned short __a, vector unsigned short __b) {
8368 return __builtin_s390_vfaeh(__a, __b, 0);
8369}
8370
8371static inline __ATTRS_o_ai vector signed int
8372vec_find_any_eq_idx(vector signed int __a, vector signed int __b) {
8373 return (vector signed int)
8374 __builtin_s390_vfaef((vector unsigned int)__a,
8375 (vector unsigned int)__b, 0);
8376}
8377
8378static inline __ATTRS_o_ai vector unsigned int
8379vec_find_any_eq_idx(vector bool int __a, vector bool int __b) {
8380 return __builtin_s390_vfaef((vector unsigned int)__a,
8381 (vector unsigned int)__b, 0);
8382}
8383
8384static inline __ATTRS_o_ai vector unsigned int
8385vec_find_any_eq_idx(vector unsigned int __a, vector unsigned int __b) {
8386 return __builtin_s390_vfaef(__a, __b, 0);
8387}
8388
8389/*-- vec_find_any_eq_idx_cc -------------------------------------------------*/
8390
8391static inline __ATTRS_o_ai vector signed char
8392vec_find_any_eq_idx_cc(vector signed char __a, vector signed char __b,
8393 int *__cc) {
8394 return (vector signed char)
8395 __builtin_s390_vfaebs((vector unsigned char)__a,
8396 (vector unsigned char)__b, 0, __cc);
8397}
8398
8399static inline __ATTRS_o_ai vector unsigned char
8400vec_find_any_eq_idx_cc(vector bool char __a, vector bool char __b, int *__cc) {
8401 return __builtin_s390_vfaebs((vector unsigned char)__a,
8402 (vector unsigned char)__b, 0, __cc);
8403}
8404
8405static inline __ATTRS_o_ai vector unsigned char
8406vec_find_any_eq_idx_cc(vector unsigned char __a, vector unsigned char __b,
8407 int *__cc) {
8408 return __builtin_s390_vfaebs(__a, __b, 0, __cc);
8409}
8410
8411static inline __ATTRS_o_ai vector signed short
8412vec_find_any_eq_idx_cc(vector signed short __a, vector signed short __b,
8413 int *__cc) {
8414 return (vector signed short)
8415 __builtin_s390_vfaehs((vector unsigned short)__a,
8416 (vector unsigned short)__b, 0, __cc);
8417}
8418
8419static inline __ATTRS_o_ai vector unsigned short
8420vec_find_any_eq_idx_cc(vector bool short __a, vector bool short __b,
8421 int *__cc) {
8422 return __builtin_s390_vfaehs((vector unsigned short)__a,
8423 (vector unsigned short)__b, 0, __cc);
8424}
8425
8426static inline __ATTRS_o_ai vector unsigned short
8427vec_find_any_eq_idx_cc(vector unsigned short __a, vector unsigned short __b,
8428 int *__cc) {
8429 return __builtin_s390_vfaehs(__a, __b, 0, __cc);
8430}
8431
8432static inline __ATTRS_o_ai vector signed int
8433vec_find_any_eq_idx_cc(vector signed int __a, vector signed int __b,
8434 int *__cc) {
8435 return (vector signed int)
8436 __builtin_s390_vfaefs((vector unsigned int)__a,
8437 (vector unsigned int)__b, 0, __cc);
8438}
8439
8440static inline __ATTRS_o_ai vector unsigned int
8441vec_find_any_eq_idx_cc(vector bool int __a, vector bool int __b, int *__cc) {
8442 return __builtin_s390_vfaefs((vector unsigned int)__a,
8443 (vector unsigned int)__b, 0, __cc);
8444}
8445
8446static inline __ATTRS_o_ai vector unsigned int
8447vec_find_any_eq_idx_cc(vector unsigned int __a, vector unsigned int __b,
8448 int *__cc) {
8449 return __builtin_s390_vfaefs(__a, __b, 0, __cc);
8450}
8451
8452/*-- vec_find_any_eq_or_0_idx -----------------------------------------------*/
8453
8454static inline __ATTRS_o_ai vector signed char
8455vec_find_any_eq_or_0_idx(vector signed char __a, vector signed char __b) {
8456 return (vector signed char)
8457 __builtin_s390_vfaezb((vector unsigned char)__a,
8458 (vector unsigned char)__b, 0);
8459}
8460
8461static inline __ATTRS_o_ai vector unsigned char
8462vec_find_any_eq_or_0_idx(vector bool char __a, vector bool char __b) {
8463 return __builtin_s390_vfaezb((vector unsigned char)__a,
8464 (vector unsigned char)__b, 0);
8465}
8466
8467static inline __ATTRS_o_ai vector unsigned char
8468vec_find_any_eq_or_0_idx(vector unsigned char __a, vector unsigned char __b) {
8469 return __builtin_s390_vfaezb(__a, __b, 0);
8470}
8471
8472static inline __ATTRS_o_ai vector signed short
8473vec_find_any_eq_or_0_idx(vector signed short __a, vector signed short __b) {
8474 return (vector signed short)
8475 __builtin_s390_vfaezh((vector unsigned short)__a,
8476 (vector unsigned short)__b, 0);
8477}
8478
8479static inline __ATTRS_o_ai vector unsigned short
8480vec_find_any_eq_or_0_idx(vector bool short __a, vector bool short __b) {
8481 return __builtin_s390_vfaezh((vector unsigned short)__a,
8482 (vector unsigned short)__b, 0);
8483}
8484
8485static inline __ATTRS_o_ai vector unsigned short
8486vec_find_any_eq_or_0_idx(vector unsigned short __a, vector unsigned short __b) {
8487 return __builtin_s390_vfaezh(__a, __b, 0);
8488}
8489
8490static inline __ATTRS_o_ai vector signed int
8491vec_find_any_eq_or_0_idx(vector signed int __a, vector signed int __b) {
8492 return (vector signed int)
8493 __builtin_s390_vfaezf((vector unsigned int)__a,
8494 (vector unsigned int)__b, 0);
8495}
8496
8497static inline __ATTRS_o_ai vector unsigned int
8498vec_find_any_eq_or_0_idx(vector bool int __a, vector bool int __b) {
8499 return __builtin_s390_vfaezf((vector unsigned int)__a,
8500 (vector unsigned int)__b, 0);
8501}
8502
8503static inline __ATTRS_o_ai vector unsigned int
8504vec_find_any_eq_or_0_idx(vector unsigned int __a, vector unsigned int __b) {
8505 return __builtin_s390_vfaezf(__a, __b, 0);
8506}
8507
8508/*-- vec_find_any_eq_or_0_idx_cc --------------------------------------------*/
8509
8510static inline __ATTRS_o_ai vector signed char
8511vec_find_any_eq_or_0_idx_cc(vector signed char __a, vector signed char __b,
8512 int *__cc) {
8513 return (vector signed char)
8514 __builtin_s390_vfaezbs((vector unsigned char)__a,
8515 (vector unsigned char)__b, 0, __cc);
8516}
8517
8518static inline __ATTRS_o_ai vector unsigned char
8519vec_find_any_eq_or_0_idx_cc(vector bool char __a, vector bool char __b,
8520 int *__cc) {
8521 return __builtin_s390_vfaezbs((vector unsigned char)__a,
8522 (vector unsigned char)__b, 0, __cc);
8523}
8524
8525static inline __ATTRS_o_ai vector unsigned char
8526vec_find_any_eq_or_0_idx_cc(vector unsigned char __a, vector unsigned char __b,
8527 int *__cc) {
8528 return __builtin_s390_vfaezbs(__a, __b, 0, __cc);
8529}
8530
8531static inline __ATTRS_o_ai vector signed short
8532vec_find_any_eq_or_0_idx_cc(vector signed short __a, vector signed short __b,
8533 int *__cc) {
8534 return (vector signed short)
8535 __builtin_s390_vfaezhs((vector unsigned short)__a,
8536 (vector unsigned short)__b, 0, __cc);
8537}
8538
8539static inline __ATTRS_o_ai vector unsigned short
8540vec_find_any_eq_or_0_idx_cc(vector bool short __a, vector bool short __b,
8541 int *__cc) {
8542 return __builtin_s390_vfaezhs((vector unsigned short)__a,
8543 (vector unsigned short)__b, 0, __cc);
8544}
8545
8546static inline __ATTRS_o_ai vector unsigned short
8547vec_find_any_eq_or_0_idx_cc(vector unsigned short __a,
8548 vector unsigned short __b, int *__cc) {
8549 return __builtin_s390_vfaezhs(__a, __b, 0, __cc);
8550}
8551
8552static inline __ATTRS_o_ai vector signed int
8553vec_find_any_eq_or_0_idx_cc(vector signed int __a, vector signed int __b,
8554 int *__cc) {
8555 return (vector signed int)
8556 __builtin_s390_vfaezfs((vector unsigned int)__a,
8557 (vector unsigned int)__b, 0, __cc);
8558}
8559
8560static inline __ATTRS_o_ai vector unsigned int
8561vec_find_any_eq_or_0_idx_cc(vector bool int __a, vector bool int __b,
8562 int *__cc) {
8563 return __builtin_s390_vfaezfs((vector unsigned int)__a,
8564 (vector unsigned int)__b, 0, __cc);
8565}
8566
8567static inline __ATTRS_o_ai vector unsigned int
8568vec_find_any_eq_or_0_idx_cc(vector unsigned int __a, vector unsigned int __b,
8569 int *__cc) {
8570 return __builtin_s390_vfaezfs(__a, __b, 0, __cc);
8571}
8572
8573/*-- vec_find_any_ne --------------------------------------------------------*/
8574
8575static inline __ATTRS_o_ai vector bool char
8576vec_find_any_ne(vector signed char __a, vector signed char __b) {
8577 return (vector bool char)
8578 __builtin_s390_vfaeb((vector unsigned char)__a,
8579 (vector unsigned char)__b, 12);
8580}
8581
8582static inline __ATTRS_o_ai vector bool char
8583vec_find_any_ne(vector bool char __a, vector bool char __b) {
8584 return (vector bool char)
8585 __builtin_s390_vfaeb((vector unsigned char)__a,
8586 (vector unsigned char)__b, 12);
8587}
8588
8589static inline __ATTRS_o_ai vector bool char
8590vec_find_any_ne(vector unsigned char __a, vector unsigned char __b) {
8591 return (vector bool char)__builtin_s390_vfaeb(__a, __b, 12);
8592}
8593
8594static inline __ATTRS_o_ai vector bool short
8595vec_find_any_ne(vector signed short __a, vector signed short __b) {
8596 return (vector bool short)
8597 __builtin_s390_vfaeh((vector unsigned short)__a,
8598 (vector unsigned short)__b, 12);
8599}
8600
8601static inline __ATTRS_o_ai vector bool short
8602vec_find_any_ne(vector bool short __a, vector bool short __b) {
8603 return (vector bool short)
8604 __builtin_s390_vfaeh((vector unsigned short)__a,
8605 (vector unsigned short)__b, 12);
8606}
8607
8608static inline __ATTRS_o_ai vector bool short
8609vec_find_any_ne(vector unsigned short __a, vector unsigned short __b) {
8610 return (vector bool short)__builtin_s390_vfaeh(__a, __b, 12);
8611}
8612
8613static inline __ATTRS_o_ai vector bool int
8614vec_find_any_ne(vector signed int __a, vector signed int __b) {
8615 return (vector bool int)
8616 __builtin_s390_vfaef((vector unsigned int)__a,
8617 (vector unsigned int)__b, 12);
8618}
8619
8620static inline __ATTRS_o_ai vector bool int
8621vec_find_any_ne(vector bool int __a, vector bool int __b) {
8622 return (vector bool int)
8623 __builtin_s390_vfaef((vector unsigned int)__a,
8624 (vector unsigned int)__b, 12);
8625}
8626
8627static inline __ATTRS_o_ai vector bool int
8628vec_find_any_ne(vector unsigned int __a, vector unsigned int __b) {
8629 return (vector bool int)__builtin_s390_vfaef(__a, __b, 12);
8630}
8631
8632/*-- vec_find_any_ne_cc -----------------------------------------------------*/
8633
8634static inline __ATTRS_o_ai vector bool char
8635vec_find_any_ne_cc(vector signed char __a, vector signed char __b, int *__cc) {
8636 return (vector bool char)
8637 __builtin_s390_vfaebs((vector unsigned char)__a,
8638 (vector unsigned char)__b, 12, __cc);
8639}
8640
8641static inline __ATTRS_o_ai vector bool char
8642vec_find_any_ne_cc(vector bool char __a, vector bool char __b, int *__cc) {
8643 return (vector bool char)
8644 __builtin_s390_vfaebs((vector unsigned char)__a,
8645 (vector unsigned char)__b, 12, __cc);
8646}
8647
8648static inline __ATTRS_o_ai vector bool char
8649vec_find_any_ne_cc(vector unsigned char __a, vector unsigned char __b,
8650 int *__cc) {
8651 return (vector bool char)__builtin_s390_vfaebs(__a, __b, 12, __cc);
8652}
8653
8654static inline __ATTRS_o_ai vector bool short
8655vec_find_any_ne_cc(vector signed short __a, vector signed short __b,
8656 int *__cc) {
8657 return (vector bool short)
8658 __builtin_s390_vfaehs((vector unsigned short)__a,
8659 (vector unsigned short)__b, 12, __cc);
8660}
8661
8662static inline __ATTRS_o_ai vector bool short
8663vec_find_any_ne_cc(vector bool short __a, vector bool short __b, int *__cc) {
8664 return (vector bool short)
8665 __builtin_s390_vfaehs((vector unsigned short)__a,
8666 (vector unsigned short)__b, 12, __cc);
8667}
8668
8669static inline __ATTRS_o_ai vector bool short
8670vec_find_any_ne_cc(vector unsigned short __a, vector unsigned short __b,
8671 int *__cc) {
8672 return (vector bool short)__builtin_s390_vfaehs(__a, __b, 12, __cc);
8673}
8674
8675static inline __ATTRS_o_ai vector bool int
8676vec_find_any_ne_cc(vector signed int __a, vector signed int __b, int *__cc) {
8677 return (vector bool int)
8678 __builtin_s390_vfaefs((vector unsigned int)__a,
8679 (vector unsigned int)__b, 12, __cc);
8680}
8681
8682static inline __ATTRS_o_ai vector bool int
8683vec_find_any_ne_cc(vector bool int __a, vector bool int __b, int *__cc) {
8684 return (vector bool int)
8685 __builtin_s390_vfaefs((vector unsigned int)__a,
8686 (vector unsigned int)__b, 12, __cc);
8687}
8688
8689static inline __ATTRS_o_ai vector bool int
8690vec_find_any_ne_cc(vector unsigned int __a, vector unsigned int __b,
8691 int *__cc) {
8692 return (vector bool int)__builtin_s390_vfaefs(__a, __b, 12, __cc);
8693}
8694
8695/*-- vec_find_any_ne_idx ----------------------------------------------------*/
8696
8697static inline __ATTRS_o_ai vector signed char
8698vec_find_any_ne_idx(vector signed char __a, vector signed char __b) {
8699 return (vector signed char)
8700 __builtin_s390_vfaeb((vector unsigned char)__a,
8701 (vector unsigned char)__b, 8);
8702}
8703
8704static inline __ATTRS_o_ai vector unsigned char
8705vec_find_any_ne_idx(vector bool char __a, vector bool char __b) {
8706 return __builtin_s390_vfaeb((vector unsigned char)__a,
8707 (vector unsigned char)__b, 8);
8708}
8709
8710static inline __ATTRS_o_ai vector unsigned char
8711vec_find_any_ne_idx(vector unsigned char __a, vector unsigned char __b) {
8712 return __builtin_s390_vfaeb(__a, __b, 8);
8713}
8714
8715static inline __ATTRS_o_ai vector signed short
8716vec_find_any_ne_idx(vector signed short __a, vector signed short __b) {
8717 return (vector signed short)
8718 __builtin_s390_vfaeh((vector unsigned short)__a,
8719 (vector unsigned short)__b, 8);
8720}
8721
8722static inline __ATTRS_o_ai vector unsigned short
8723vec_find_any_ne_idx(vector bool short __a, vector bool short __b) {
8724 return __builtin_s390_vfaeh((vector unsigned short)__a,
8725 (vector unsigned short)__b, 8);
8726}
8727
8728static inline __ATTRS_o_ai vector unsigned short
8729vec_find_any_ne_idx(vector unsigned short __a, vector unsigned short __b) {
8730 return __builtin_s390_vfaeh(__a, __b, 8);
8731}
8732
8733static inline __ATTRS_o_ai vector signed int
8734vec_find_any_ne_idx(vector signed int __a, vector signed int __b) {
8735 return (vector signed int)
8736 __builtin_s390_vfaef((vector unsigned int)__a,
8737 (vector unsigned int)__b, 8);
8738}
8739
8740static inline __ATTRS_o_ai vector unsigned int
8741vec_find_any_ne_idx(vector bool int __a, vector bool int __b) {
8742 return __builtin_s390_vfaef((vector unsigned int)__a,
8743 (vector unsigned int)__b, 8);
8744}
8745
8746static inline __ATTRS_o_ai vector unsigned int
8747vec_find_any_ne_idx(vector unsigned int __a, vector unsigned int __b) {
8748 return __builtin_s390_vfaef(__a, __b, 8);
8749}
8750
8751/*-- vec_find_any_ne_idx_cc -------------------------------------------------*/
8752
8753static inline __ATTRS_o_ai vector signed char
8754vec_find_any_ne_idx_cc(vector signed char __a, vector signed char __b,
8755 int *__cc) {
8756 return (vector signed char)
8757 __builtin_s390_vfaebs((vector unsigned char)__a,
8758 (vector unsigned char)__b, 8, __cc);
8759}
8760
8761static inline __ATTRS_o_ai vector unsigned char
8762vec_find_any_ne_idx_cc(vector bool char __a, vector bool char __b, int *__cc) {
8763 return __builtin_s390_vfaebs((vector unsigned char)__a,
8764 (vector unsigned char)__b, 8, __cc);
8765}
8766
8767static inline __ATTRS_o_ai vector unsigned char
8768vec_find_any_ne_idx_cc(vector unsigned char __a, vector unsigned char __b,
8769 int *__cc) {
8770 return __builtin_s390_vfaebs(__a, __b, 8, __cc);
8771}
8772
8773static inline __ATTRS_o_ai vector signed short
8774vec_find_any_ne_idx_cc(vector signed short __a, vector signed short __b,
8775 int *__cc) {
8776 return (vector signed short)
8777 __builtin_s390_vfaehs((vector unsigned short)__a,
8778 (vector unsigned short)__b, 8, __cc);
8779}
8780
8781static inline __ATTRS_o_ai vector unsigned short
8782vec_find_any_ne_idx_cc(vector bool short __a, vector bool short __b,
8783 int *__cc) {
8784 return __builtin_s390_vfaehs((vector unsigned short)__a,
8785 (vector unsigned short)__b, 8, __cc);
8786}
8787
8788static inline __ATTRS_o_ai vector unsigned short
8789vec_find_any_ne_idx_cc(vector unsigned short __a, vector unsigned short __b,
8790 int *__cc) {
8791 return __builtin_s390_vfaehs(__a, __b, 8, __cc);
8792}
8793
8794static inline __ATTRS_o_ai vector signed int
8795vec_find_any_ne_idx_cc(vector signed int __a, vector signed int __b,
8796 int *__cc) {
8797 return (vector signed int)
8798 __builtin_s390_vfaefs((vector unsigned int)__a,
8799 (vector unsigned int)__b, 8, __cc);
8800}
8801
8802static inline __ATTRS_o_ai vector unsigned int
8803vec_find_any_ne_idx_cc(vector bool int __a, vector bool int __b, int *__cc) {
8804 return __builtin_s390_vfaefs((vector unsigned int)__a,
8805 (vector unsigned int)__b, 8, __cc);
8806}
8807
8808static inline __ATTRS_o_ai vector unsigned int
8809vec_find_any_ne_idx_cc(vector unsigned int __a, vector unsigned int __b,
8810 int *__cc) {
8811 return __builtin_s390_vfaefs(__a, __b, 8, __cc);
8812}
8813
8814/*-- vec_find_any_ne_or_0_idx -----------------------------------------------*/
8815
8816static inline __ATTRS_o_ai vector signed char
8817vec_find_any_ne_or_0_idx(vector signed char __a, vector signed char __b) {
8818 return (vector signed char)
8819 __builtin_s390_vfaezb((vector unsigned char)__a,
8820 (vector unsigned char)__b, 8);
8821}
8822
8823static inline __ATTRS_o_ai vector unsigned char
8824vec_find_any_ne_or_0_idx(vector bool char __a, vector bool char __b) {
8825 return __builtin_s390_vfaezb((vector unsigned char)__a,
8826 (vector unsigned char)__b, 8);
8827}
8828
8829static inline __ATTRS_o_ai vector unsigned char
8830vec_find_any_ne_or_0_idx(vector unsigned char __a, vector unsigned char __b) {
8831 return __builtin_s390_vfaezb(__a, __b, 8);
8832}
8833
8834static inline __ATTRS_o_ai vector signed short
8835vec_find_any_ne_or_0_idx(vector signed short __a, vector signed short __b) {
8836 return (vector signed short)
8837 __builtin_s390_vfaezh((vector unsigned short)__a,
8838 (vector unsigned short)__b, 8);
8839}
8840
8841static inline __ATTRS_o_ai vector unsigned short
8842vec_find_any_ne_or_0_idx(vector bool short __a, vector bool short __b) {
8843 return __builtin_s390_vfaezh((vector unsigned short)__a,
8844 (vector unsigned short)__b, 8);
8845}
8846
8847static inline __ATTRS_o_ai vector unsigned short
8848vec_find_any_ne_or_0_idx(vector unsigned short __a, vector unsigned short __b) {
8849 return __builtin_s390_vfaezh(__a, __b, 8);
8850}
8851
8852static inline __ATTRS_o_ai vector signed int
8853vec_find_any_ne_or_0_idx(vector signed int __a, vector signed int __b) {
8854 return (vector signed int)
8855 __builtin_s390_vfaezf((vector unsigned int)__a,
8856 (vector unsigned int)__b, 8);
8857}
8858
8859static inline __ATTRS_o_ai vector unsigned int
8860vec_find_any_ne_or_0_idx(vector bool int __a, vector bool int __b) {
8861 return __builtin_s390_vfaezf((vector unsigned int)__a,
8862 (vector unsigned int)__b, 8);
8863}
8864
8865static inline __ATTRS_o_ai vector unsigned int
8866vec_find_any_ne_or_0_idx(vector unsigned int __a, vector unsigned int __b) {
8867 return __builtin_s390_vfaezf(__a, __b, 8);
8868}
8869
8870/*-- vec_find_any_ne_or_0_idx_cc --------------------------------------------*/
8871
8872static inline __ATTRS_o_ai vector signed char
8873vec_find_any_ne_or_0_idx_cc(vector signed char __a, vector signed char __b,
8874 int *__cc) {
8875 return (vector signed char)
8876 __builtin_s390_vfaezbs((vector unsigned char)__a,
8877 (vector unsigned char)__b, 8, __cc);
8878}
8879
8880static inline __ATTRS_o_ai vector unsigned char
8881vec_find_any_ne_or_0_idx_cc(vector bool char __a, vector bool char __b,
8882 int *__cc) {
8883 return __builtin_s390_vfaezbs((vector unsigned char)__a,
8884 (vector unsigned char)__b, 8, __cc);
8885}
8886
8887static inline __ATTRS_o_ai vector unsigned char
8888vec_find_any_ne_or_0_idx_cc(vector unsigned char __a, vector unsigned char __b,
8889 int *__cc) {
8890 return __builtin_s390_vfaezbs(__a, __b, 8, __cc);
8891}
8892
8893static inline __ATTRS_o_ai vector signed short
8894vec_find_any_ne_or_0_idx_cc(vector signed short __a, vector signed short __b,
8895 int *__cc) {
8896 return (vector signed short)
8897 __builtin_s390_vfaezhs((vector unsigned short)__a,
8898 (vector unsigned short)__b, 8, __cc);
8899}
8900
8901static inline __ATTRS_o_ai vector unsigned short
8902vec_find_any_ne_or_0_idx_cc(vector bool short __a, vector bool short __b,
8903 int *__cc) {
8904 return __builtin_s390_vfaezhs((vector unsigned short)__a,
8905 (vector unsigned short)__b, 8, __cc);
8906}
8907
8908static inline __ATTRS_o_ai vector unsigned short
8909vec_find_any_ne_or_0_idx_cc(vector unsigned short __a,
8910 vector unsigned short __b, int *__cc) {
8911 return __builtin_s390_vfaezhs(__a, __b, 8, __cc);
8912}
8913
8914static inline __ATTRS_o_ai vector signed int
8915vec_find_any_ne_or_0_idx_cc(vector signed int __a, vector signed int __b,
8916 int *__cc) {
8917 return (vector signed int)
8918 __builtin_s390_vfaezfs((vector unsigned int)__a,
8919 (vector unsigned int)__b, 8, __cc);
8920}
8921
8922static inline __ATTRS_o_ai vector unsigned int
8923vec_find_any_ne_or_0_idx_cc(vector bool int __a, vector bool int __b,
8924 int *__cc) {
8925 return __builtin_s390_vfaezfs((vector unsigned int)__a,
8926 (vector unsigned int)__b, 8, __cc);
8927}
8928
8929static inline __ATTRS_o_ai vector unsigned int
8930vec_find_any_ne_or_0_idx_cc(vector unsigned int __a, vector unsigned int __b,
8931 int *__cc) {
8932 return __builtin_s390_vfaezfs(__a, __b, 8, __cc);
8933}
8934
8935#undef __constant_pow2_range
8936#undef __constant_range
8937#undef __constant
8938#undef __ATTRS_o
8939#undef __ATTRS_o_ai
8940#undef __ATTRS_ai
8941
8942#else
8943
8944#error "Use -fzvector to enable vector extensions"
8945
8946#endif
c_headers/wmmintrin.h created+42
......@@ -0,0 +1,42 @@
1/*===---- wmmintrin.h - AES intrinsics ------------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef _WMMINTRIN_H
25#define _WMMINTRIN_H
26
27#include <emmintrin.h>
28
29#if !defined (__AES__) && !defined (__PCLMUL__)
30# error "AES/PCLMUL instructions not enabled"
31#else
32
33#ifdef __AES__
34#include <__wmmintrin_aes.h>
35#endif /* __AES__ */
36
37#ifdef __PCLMUL__
38#include <__wmmintrin_pclmul.h>
39#endif /* __PCLMUL__ */
40
41#endif /* __AES__ || __PCLMUL__ */
42#endif /* _WMMINTRIN_H */
c_headers/x86intrin.h created+81
......@@ -0,0 +1,81 @@
1/*===---- x86intrin.h - X86 intrinsics -------------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __X86INTRIN_H
25#define __X86INTRIN_H
26
27#include <ia32intrin.h>
28
29#include <immintrin.h>
30
31#ifdef __3dNOW__
32#include <mm3dnow.h>
33#endif
34
35#ifdef __BMI__
36#include <bmiintrin.h>
37#endif
38
39#ifdef __BMI2__
40#include <bmi2intrin.h>
41#endif
42
43#ifdef __LZCNT__
44#include <lzcntintrin.h>
45#endif
46
47#ifdef __POPCNT__
48#include <popcntintrin.h>
49#endif
50
51#ifdef __RDSEED__
52#include <rdseedintrin.h>
53#endif
54
55#ifdef __PRFCHW__
56#include <prfchwintrin.h>
57#endif
58
59#ifdef __SSE4A__
60#include <ammintrin.h>
61#endif
62
63#ifdef __FMA4__
64#include <fma4intrin.h>
65#endif
66
67#ifdef __XOP__
68#include <xopintrin.h>
69#endif
70
71#ifdef __TBM__
72#include <tbmintrin.h>
73#endif
74
75#ifdef __F16C__
76#include <f16cintrin.h>
77#endif
78
79/* FIXME: LWP */
80
81#endif /* __X86INTRIN_H */
c_headers/xmmintrin.h created+1008
......@@ -0,0 +1,1008 @@
1/*===---- xmmintrin.h - SSE intrinsics -------------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __XMMINTRIN_H
25#define __XMMINTRIN_H
26
27#ifndef __SSE__
28#error "SSE instruction set not enabled"
29#else
30
31#include <mmintrin.h>
32
33typedef int __v4si __attribute__((__vector_size__(16)));
34typedef float __v4sf __attribute__((__vector_size__(16)));
35typedef float __m128 __attribute__((__vector_size__(16)));
36
37/* This header should only be included in a hosted environment as it depends on
38 * a standard library to provide allocation routines. */
39#if __STDC_HOSTED__
40#include <mm_malloc.h>
41#endif
42
43/* Define the default attributes for the functions in this file. */
44#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
45
46static __inline__ __m128 __DEFAULT_FN_ATTRS
47_mm_add_ss(__m128 __a, __m128 __b)
48{
49 __a[0] += __b[0];
50 return __a;
51}
52
53static __inline__ __m128 __DEFAULT_FN_ATTRS
54_mm_add_ps(__m128 __a, __m128 __b)
55{
56 return __a + __b;
57}
58
59static __inline__ __m128 __DEFAULT_FN_ATTRS
60_mm_sub_ss(__m128 __a, __m128 __b)
61{
62 __a[0] -= __b[0];
63 return __a;
64}
65
66static __inline__ __m128 __DEFAULT_FN_ATTRS
67_mm_sub_ps(__m128 __a, __m128 __b)
68{
69 return __a - __b;
70}
71
72static __inline__ __m128 __DEFAULT_FN_ATTRS
73_mm_mul_ss(__m128 __a, __m128 __b)
74{
75 __a[0] *= __b[0];
76 return __a;
77}
78
79static __inline__ __m128 __DEFAULT_FN_ATTRS
80_mm_mul_ps(__m128 __a, __m128 __b)
81{
82 return __a * __b;
83}
84
85static __inline__ __m128 __DEFAULT_FN_ATTRS
86_mm_div_ss(__m128 __a, __m128 __b)
87{
88 __a[0] /= __b[0];
89 return __a;
90}
91
92static __inline__ __m128 __DEFAULT_FN_ATTRS
93_mm_div_ps(__m128 __a, __m128 __b)
94{
95 return __a / __b;
96}
97
98static __inline__ __m128 __DEFAULT_FN_ATTRS
99_mm_sqrt_ss(__m128 __a)
100{
101 __m128 __c = __builtin_ia32_sqrtss(__a);
102 return (__m128) { __c[0], __a[1], __a[2], __a[3] };
103}
104
105static __inline__ __m128 __DEFAULT_FN_ATTRS
106_mm_sqrt_ps(__m128 __a)
107{
108 return __builtin_ia32_sqrtps(__a);
109}
110
111static __inline__ __m128 __DEFAULT_FN_ATTRS
112_mm_rcp_ss(__m128 __a)
113{
114 __m128 __c = __builtin_ia32_rcpss(__a);
115 return (__m128) { __c[0], __a[1], __a[2], __a[3] };
116}
117
118static __inline__ __m128 __DEFAULT_FN_ATTRS
119_mm_rcp_ps(__m128 __a)
120{
121 return __builtin_ia32_rcpps(__a);
122}
123
124static __inline__ __m128 __DEFAULT_FN_ATTRS
125_mm_rsqrt_ss(__m128 __a)
126{
127 __m128 __c = __builtin_ia32_rsqrtss(__a);
128 return (__m128) { __c[0], __a[1], __a[2], __a[3] };
129}
130
131static __inline__ __m128 __DEFAULT_FN_ATTRS
132_mm_rsqrt_ps(__m128 __a)
133{
134 return __builtin_ia32_rsqrtps(__a);
135}
136
137static __inline__ __m128 __DEFAULT_FN_ATTRS
138_mm_min_ss(__m128 __a, __m128 __b)
139{
140 return __builtin_ia32_minss(__a, __b);
141}
142
143static __inline__ __m128 __DEFAULT_FN_ATTRS
144_mm_min_ps(__m128 __a, __m128 __b)
145{
146 return __builtin_ia32_minps(__a, __b);
147}
148
149static __inline__ __m128 __DEFAULT_FN_ATTRS
150_mm_max_ss(__m128 __a, __m128 __b)
151{
152 return __builtin_ia32_maxss(__a, __b);
153}
154
155static __inline__ __m128 __DEFAULT_FN_ATTRS
156_mm_max_ps(__m128 __a, __m128 __b)
157{
158 return __builtin_ia32_maxps(__a, __b);
159}
160
161static __inline__ __m128 __DEFAULT_FN_ATTRS
162_mm_and_ps(__m128 __a, __m128 __b)
163{
164 return (__m128)((__v4si)__a & (__v4si)__b);
165}
166
167static __inline__ __m128 __DEFAULT_FN_ATTRS
168_mm_andnot_ps(__m128 __a, __m128 __b)
169{
170 return (__m128)(~(__v4si)__a & (__v4si)__b);
171}
172
173static __inline__ __m128 __DEFAULT_FN_ATTRS
174_mm_or_ps(__m128 __a, __m128 __b)
175{
176 return (__m128)((__v4si)__a | (__v4si)__b);
177}
178
179static __inline__ __m128 __DEFAULT_FN_ATTRS
180_mm_xor_ps(__m128 __a, __m128 __b)
181{
182 return (__m128)((__v4si)__a ^ (__v4si)__b);
183}
184
185static __inline__ __m128 __DEFAULT_FN_ATTRS
186_mm_cmpeq_ss(__m128 __a, __m128 __b)
187{
188 return (__m128)__builtin_ia32_cmpeqss(__a, __b);
189}
190
191static __inline__ __m128 __DEFAULT_FN_ATTRS
192_mm_cmpeq_ps(__m128 __a, __m128 __b)
193{
194 return (__m128)__builtin_ia32_cmpeqps(__a, __b);
195}
196
197static __inline__ __m128 __DEFAULT_FN_ATTRS
198_mm_cmplt_ss(__m128 __a, __m128 __b)
199{
200 return (__m128)__builtin_ia32_cmpltss(__a, __b);
201}
202
203static __inline__ __m128 __DEFAULT_FN_ATTRS
204_mm_cmplt_ps(__m128 __a, __m128 __b)
205{
206 return (__m128)__builtin_ia32_cmpltps(__a, __b);
207}
208
209static __inline__ __m128 __DEFAULT_FN_ATTRS
210_mm_cmple_ss(__m128 __a, __m128 __b)
211{
212 return (__m128)__builtin_ia32_cmpless(__a, __b);
213}
214
215static __inline__ __m128 __DEFAULT_FN_ATTRS
216_mm_cmple_ps(__m128 __a, __m128 __b)
217{
218 return (__m128)__builtin_ia32_cmpleps(__a, __b);
219}
220
221static __inline__ __m128 __DEFAULT_FN_ATTRS
222_mm_cmpgt_ss(__m128 __a, __m128 __b)
223{
224 return (__m128)__builtin_shufflevector(__a,
225 __builtin_ia32_cmpltss(__b, __a),
226 4, 1, 2, 3);
227}
228
229static __inline__ __m128 __DEFAULT_FN_ATTRS
230_mm_cmpgt_ps(__m128 __a, __m128 __b)
231{
232 return (__m128)__builtin_ia32_cmpltps(__b, __a);
233}
234
235static __inline__ __m128 __DEFAULT_FN_ATTRS
236_mm_cmpge_ss(__m128 __a, __m128 __b)
237{
238 return (__m128)__builtin_shufflevector(__a,
239 __builtin_ia32_cmpless(__b, __a),
240 4, 1, 2, 3);
241}
242
243static __inline__ __m128 __DEFAULT_FN_ATTRS
244_mm_cmpge_ps(__m128 __a, __m128 __b)
245{
246 return (__m128)__builtin_ia32_cmpleps(__b, __a);
247}
248
249static __inline__ __m128 __DEFAULT_FN_ATTRS
250_mm_cmpneq_ss(__m128 __a, __m128 __b)
251{
252 return (__m128)__builtin_ia32_cmpneqss(__a, __b);
253}
254
255static __inline__ __m128 __DEFAULT_FN_ATTRS
256_mm_cmpneq_ps(__m128 __a, __m128 __b)
257{
258 return (__m128)__builtin_ia32_cmpneqps(__a, __b);
259}
260
261static __inline__ __m128 __DEFAULT_FN_ATTRS
262_mm_cmpnlt_ss(__m128 __a, __m128 __b)
263{
264 return (__m128)__builtin_ia32_cmpnltss(__a, __b);
265}
266
267static __inline__ __m128 __DEFAULT_FN_ATTRS
268_mm_cmpnlt_ps(__m128 __a, __m128 __b)
269{
270 return (__m128)__builtin_ia32_cmpnltps(__a, __b);
271}
272
273static __inline__ __m128 __DEFAULT_FN_ATTRS
274_mm_cmpnle_ss(__m128 __a, __m128 __b)
275{
276 return (__m128)__builtin_ia32_cmpnless(__a, __b);
277}
278
279static __inline__ __m128 __DEFAULT_FN_ATTRS
280_mm_cmpnle_ps(__m128 __a, __m128 __b)
281{
282 return (__m128)__builtin_ia32_cmpnleps(__a, __b);
283}
284
285static __inline__ __m128 __DEFAULT_FN_ATTRS
286_mm_cmpngt_ss(__m128 __a, __m128 __b)
287{
288 return (__m128)__builtin_shufflevector(__a,
289 __builtin_ia32_cmpnltss(__b, __a),
290 4, 1, 2, 3);
291}
292
293static __inline__ __m128 __DEFAULT_FN_ATTRS
294_mm_cmpngt_ps(__m128 __a, __m128 __b)
295{
296 return (__m128)__builtin_ia32_cmpnltps(__b, __a);
297}
298
299static __inline__ __m128 __DEFAULT_FN_ATTRS
300_mm_cmpnge_ss(__m128 __a, __m128 __b)
301{
302 return (__m128)__builtin_shufflevector(__a,
303 __builtin_ia32_cmpnless(__b, __a),
304 4, 1, 2, 3);
305}
306
307static __inline__ __m128 __DEFAULT_FN_ATTRS
308_mm_cmpnge_ps(__m128 __a, __m128 __b)
309{
310 return (__m128)__builtin_ia32_cmpnleps(__b, __a);
311}
312
313static __inline__ __m128 __DEFAULT_FN_ATTRS
314_mm_cmpord_ss(__m128 __a, __m128 __b)
315{
316 return (__m128)__builtin_ia32_cmpordss(__a, __b);
317}
318
319static __inline__ __m128 __DEFAULT_FN_ATTRS
320_mm_cmpord_ps(__m128 __a, __m128 __b)
321{
322 return (__m128)__builtin_ia32_cmpordps(__a, __b);
323}
324
325static __inline__ __m128 __DEFAULT_FN_ATTRS
326_mm_cmpunord_ss(__m128 __a, __m128 __b)
327{
328 return (__m128)__builtin_ia32_cmpunordss(__a, __b);
329}
330
331static __inline__ __m128 __DEFAULT_FN_ATTRS
332_mm_cmpunord_ps(__m128 __a, __m128 __b)
333{
334 return (__m128)__builtin_ia32_cmpunordps(__a, __b);
335}
336
337static __inline__ int __DEFAULT_FN_ATTRS
338_mm_comieq_ss(__m128 __a, __m128 __b)
339{
340 return __builtin_ia32_comieq(__a, __b);
341}
342
343static __inline__ int __DEFAULT_FN_ATTRS
344_mm_comilt_ss(__m128 __a, __m128 __b)
345{
346 return __builtin_ia32_comilt(__a, __b);
347}
348
349static __inline__ int __DEFAULT_FN_ATTRS
350_mm_comile_ss(__m128 __a, __m128 __b)
351{
352 return __builtin_ia32_comile(__a, __b);
353}
354
355static __inline__ int __DEFAULT_FN_ATTRS
356_mm_comigt_ss(__m128 __a, __m128 __b)
357{
358 return __builtin_ia32_comigt(__a, __b);
359}
360
361static __inline__ int __DEFAULT_FN_ATTRS
362_mm_comige_ss(__m128 __a, __m128 __b)
363{
364 return __builtin_ia32_comige(__a, __b);
365}
366
367static __inline__ int __DEFAULT_FN_ATTRS
368_mm_comineq_ss(__m128 __a, __m128 __b)
369{
370 return __builtin_ia32_comineq(__a, __b);
371}
372
373static __inline__ int __DEFAULT_FN_ATTRS
374_mm_ucomieq_ss(__m128 __a, __m128 __b)
375{
376 return __builtin_ia32_ucomieq(__a, __b);
377}
378
379static __inline__ int __DEFAULT_FN_ATTRS
380_mm_ucomilt_ss(__m128 __a, __m128 __b)
381{
382 return __builtin_ia32_ucomilt(__a, __b);
383}
384
385static __inline__ int __DEFAULT_FN_ATTRS
386_mm_ucomile_ss(__m128 __a, __m128 __b)
387{
388 return __builtin_ia32_ucomile(__a, __b);
389}
390
391static __inline__ int __DEFAULT_FN_ATTRS
392_mm_ucomigt_ss(__m128 __a, __m128 __b)
393{
394 return __builtin_ia32_ucomigt(__a, __b);
395}
396
397static __inline__ int __DEFAULT_FN_ATTRS
398_mm_ucomige_ss(__m128 __a, __m128 __b)
399{
400 return __builtin_ia32_ucomige(__a, __b);
401}
402
403static __inline__ int __DEFAULT_FN_ATTRS
404_mm_ucomineq_ss(__m128 __a, __m128 __b)
405{
406 return __builtin_ia32_ucomineq(__a, __b);
407}
408
409static __inline__ int __DEFAULT_FN_ATTRS
410_mm_cvtss_si32(__m128 __a)
411{
412 return __builtin_ia32_cvtss2si(__a);
413}
414
415static __inline__ int __DEFAULT_FN_ATTRS
416_mm_cvt_ss2si(__m128 __a)
417{
418 return _mm_cvtss_si32(__a);
419}
420
421#ifdef __x86_64__
422
423static __inline__ long long __DEFAULT_FN_ATTRS
424_mm_cvtss_si64(__m128 __a)
425{
426 return __builtin_ia32_cvtss2si64(__a);
427}
428
429#endif
430
431static __inline__ __m64 __DEFAULT_FN_ATTRS
432_mm_cvtps_pi32(__m128 __a)
433{
434 return (__m64)__builtin_ia32_cvtps2pi(__a);
435}
436
437static __inline__ __m64 __DEFAULT_FN_ATTRS
438_mm_cvt_ps2pi(__m128 __a)
439{
440 return _mm_cvtps_pi32(__a);
441}
442
443static __inline__ int __DEFAULT_FN_ATTRS
444_mm_cvttss_si32(__m128 __a)
445{
446 return __a[0];
447}
448
449static __inline__ int __DEFAULT_FN_ATTRS
450_mm_cvtt_ss2si(__m128 __a)
451{
452 return _mm_cvttss_si32(__a);
453}
454
455static __inline__ long long __DEFAULT_FN_ATTRS
456_mm_cvttss_si64(__m128 __a)
457{
458 return __a[0];
459}
460
461static __inline__ __m64 __DEFAULT_FN_ATTRS
462_mm_cvttps_pi32(__m128 __a)
463{
464 return (__m64)__builtin_ia32_cvttps2pi(__a);
465}
466
467static __inline__ __m64 __DEFAULT_FN_ATTRS
468_mm_cvtt_ps2pi(__m128 __a)
469{
470 return _mm_cvttps_pi32(__a);
471}
472
473static __inline__ __m128 __DEFAULT_FN_ATTRS
474_mm_cvtsi32_ss(__m128 __a, int __b)
475{
476 __a[0] = __b;
477 return __a;
478}
479
480static __inline__ __m128 __DEFAULT_FN_ATTRS
481_mm_cvt_si2ss(__m128 __a, int __b)
482{
483 return _mm_cvtsi32_ss(__a, __b);
484}
485
486#ifdef __x86_64__
487
488static __inline__ __m128 __DEFAULT_FN_ATTRS
489_mm_cvtsi64_ss(__m128 __a, long long __b)
490{
491 __a[0] = __b;
492 return __a;
493}
494
495#endif
496
497static __inline__ __m128 __DEFAULT_FN_ATTRS
498_mm_cvtpi32_ps(__m128 __a, __m64 __b)
499{
500 return __builtin_ia32_cvtpi2ps(__a, (__v2si)__b);
501}
502
503static __inline__ __m128 __DEFAULT_FN_ATTRS
504_mm_cvt_pi2ps(__m128 __a, __m64 __b)
505{
506 return _mm_cvtpi32_ps(__a, __b);
507}
508
509static __inline__ float __DEFAULT_FN_ATTRS
510_mm_cvtss_f32(__m128 __a)
511{
512 return __a[0];
513}
514
515static __inline__ __m128 __DEFAULT_FN_ATTRS
516_mm_loadh_pi(__m128 __a, const __m64 *__p)
517{
518 typedef float __mm_loadh_pi_v2f32 __attribute__((__vector_size__(8)));
519 struct __mm_loadh_pi_struct {
520 __mm_loadh_pi_v2f32 __u;
521 } __attribute__((__packed__, __may_alias__));
522 __mm_loadh_pi_v2f32 __b = ((struct __mm_loadh_pi_struct*)__p)->__u;
523 __m128 __bb = __builtin_shufflevector(__b, __b, 0, 1, 0, 1);
524 return __builtin_shufflevector(__a, __bb, 0, 1, 4, 5);
525}
526
527static __inline__ __m128 __DEFAULT_FN_ATTRS
528_mm_loadl_pi(__m128 __a, const __m64 *__p)
529{
530 typedef float __mm_loadl_pi_v2f32 __attribute__((__vector_size__(8)));
531 struct __mm_loadl_pi_struct {
532 __mm_loadl_pi_v2f32 __u;
533 } __attribute__((__packed__, __may_alias__));
534 __mm_loadl_pi_v2f32 __b = ((struct __mm_loadl_pi_struct*)__p)->__u;
535 __m128 __bb = __builtin_shufflevector(__b, __b, 0, 1, 0, 1);
536 return __builtin_shufflevector(__a, __bb, 4, 5, 2, 3);
537}
538
539static __inline__ __m128 __DEFAULT_FN_ATTRS
540_mm_load_ss(const float *__p)
541{
542 struct __mm_load_ss_struct {
543 float __u;
544 } __attribute__((__packed__, __may_alias__));
545 float __u = ((struct __mm_load_ss_struct*)__p)->__u;
546 return (__m128){ __u, 0, 0, 0 };
547}
548
549static __inline__ __m128 __DEFAULT_FN_ATTRS
550_mm_load1_ps(const float *__p)
551{
552 struct __mm_load1_ps_struct {
553 float __u;
554 } __attribute__((__packed__, __may_alias__));
555 float __u = ((struct __mm_load1_ps_struct*)__p)->__u;
556 return (__m128){ __u, __u, __u, __u };
557}
558
559#define _mm_load_ps1(p) _mm_load1_ps(p)
560
561static __inline__ __m128 __DEFAULT_FN_ATTRS
562_mm_load_ps(const float *__p)
563{
564 return *(__m128*)__p;
565}
566
567static __inline__ __m128 __DEFAULT_FN_ATTRS
568_mm_loadu_ps(const float *__p)
569{
570 struct __loadu_ps {
571 __m128 __v;
572 } __attribute__((__packed__, __may_alias__));
573 return ((struct __loadu_ps*)__p)->__v;
574}
575
576static __inline__ __m128 __DEFAULT_FN_ATTRS
577_mm_loadr_ps(const float *__p)
578{
579 __m128 __a = _mm_load_ps(__p);
580 return __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
581}
582
583static __inline__ __m128 __DEFAULT_FN_ATTRS
584_mm_set_ss(float __w)
585{
586 return (__m128){ __w, 0, 0, 0 };
587}
588
589static __inline__ __m128 __DEFAULT_FN_ATTRS
590_mm_set1_ps(float __w)
591{
592 return (__m128){ __w, __w, __w, __w };
593}
594
595/* Microsoft specific. */
596static __inline__ __m128 __DEFAULT_FN_ATTRS
597_mm_set_ps1(float __w)
598{
599 return _mm_set1_ps(__w);
600}
601
602static __inline__ __m128 __DEFAULT_FN_ATTRS
603_mm_set_ps(float __z, float __y, float __x, float __w)
604{
605 return (__m128){ __w, __x, __y, __z };
606}
607
608static __inline__ __m128 __DEFAULT_FN_ATTRS
609_mm_setr_ps(float __z, float __y, float __x, float __w)
610{
611 return (__m128){ __z, __y, __x, __w };
612}
613
614static __inline__ __m128 __DEFAULT_FN_ATTRS
615_mm_setzero_ps(void)
616{
617 return (__m128){ 0, 0, 0, 0 };
618}
619
620static __inline__ void __DEFAULT_FN_ATTRS
621_mm_storeh_pi(__m64 *__p, __m128 __a)
622{
623 __builtin_ia32_storehps((__v2si *)__p, __a);
624}
625
626static __inline__ void __DEFAULT_FN_ATTRS
627_mm_storel_pi(__m64 *__p, __m128 __a)
628{
629 __builtin_ia32_storelps((__v2si *)__p, __a);
630}
631
632static __inline__ void __DEFAULT_FN_ATTRS
633_mm_store_ss(float *__p, __m128 __a)
634{
635 struct __mm_store_ss_struct {
636 float __u;
637 } __attribute__((__packed__, __may_alias__));
638 ((struct __mm_store_ss_struct*)__p)->__u = __a[0];
639}
640
641static __inline__ void __DEFAULT_FN_ATTRS
642_mm_storeu_ps(float *__p, __m128 __a)
643{
644 __builtin_ia32_storeups(__p, __a);
645}
646
647static __inline__ void __DEFAULT_FN_ATTRS
648_mm_store1_ps(float *__p, __m128 __a)
649{
650 __a = __builtin_shufflevector(__a, __a, 0, 0, 0, 0);
651 _mm_storeu_ps(__p, __a);
652}
653
654static __inline__ void __DEFAULT_FN_ATTRS
655_mm_store_ps1(float *__p, __m128 __a)
656{
657 return _mm_store1_ps(__p, __a);
658}
659
660static __inline__ void __DEFAULT_FN_ATTRS
661_mm_store_ps(float *__p, __m128 __a)
662{
663 *(__m128 *)__p = __a;
664}
665
666static __inline__ void __DEFAULT_FN_ATTRS
667_mm_storer_ps(float *__p, __m128 __a)
668{
669 __a = __builtin_shufflevector(__a, __a, 3, 2, 1, 0);
670 _mm_store_ps(__p, __a);
671}
672
673#define _MM_HINT_T0 3
674#define _MM_HINT_T1 2
675#define _MM_HINT_T2 1
676#define _MM_HINT_NTA 0
677
678#ifndef _MSC_VER
679/* FIXME: We have to #define this because "sel" must be a constant integer, and
680 Sema doesn't do any form of constant propagation yet. */
681
682#define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0, (sel)))
683#endif
684
685static __inline__ void __DEFAULT_FN_ATTRS
686_mm_stream_pi(__m64 *__p, __m64 __a)
687{
688 __builtin_ia32_movntq(__p, __a);
689}
690
691static __inline__ void __DEFAULT_FN_ATTRS
692_mm_stream_ps(float *__p, __m128 __a)
693{
694 __builtin_ia32_movntps(__p, __a);
695}
696
697static __inline__ void __DEFAULT_FN_ATTRS
698_mm_sfence(void)
699{
700 __builtin_ia32_sfence();
701}
702
703static __inline__ int __DEFAULT_FN_ATTRS
704_mm_extract_pi16(__m64 __a, int __n)
705{
706 __v4hi __b = (__v4hi)__a;
707 return (unsigned short)__b[__n & 3];
708}
709
710static __inline__ __m64 __DEFAULT_FN_ATTRS
711_mm_insert_pi16(__m64 __a, int __d, int __n)
712{
713 __v4hi __b = (__v4hi)__a;
714 __b[__n & 3] = __d;
715 return (__m64)__b;
716}
717
718static __inline__ __m64 __DEFAULT_FN_ATTRS
719_mm_max_pi16(__m64 __a, __m64 __b)
720{
721 return (__m64)__builtin_ia32_pmaxsw((__v4hi)__a, (__v4hi)__b);
722}
723
724static __inline__ __m64 __DEFAULT_FN_ATTRS
725_mm_max_pu8(__m64 __a, __m64 __b)
726{
727 return (__m64)__builtin_ia32_pmaxub((__v8qi)__a, (__v8qi)__b);
728}
729
730static __inline__ __m64 __DEFAULT_FN_ATTRS
731_mm_min_pi16(__m64 __a, __m64 __b)
732{
733 return (__m64)__builtin_ia32_pminsw((__v4hi)__a, (__v4hi)__b);
734}
735
736static __inline__ __m64 __DEFAULT_FN_ATTRS
737_mm_min_pu8(__m64 __a, __m64 __b)
738{
739 return (__m64)__builtin_ia32_pminub((__v8qi)__a, (__v8qi)__b);
740}
741
742static __inline__ int __DEFAULT_FN_ATTRS
743_mm_movemask_pi8(__m64 __a)
744{
745 return __builtin_ia32_pmovmskb((__v8qi)__a);
746}
747
748static __inline__ __m64 __DEFAULT_FN_ATTRS
749_mm_mulhi_pu16(__m64 __a, __m64 __b)
750{
751 return (__m64)__builtin_ia32_pmulhuw((__v4hi)__a, (__v4hi)__b);
752}
753
754#define _mm_shuffle_pi16(a, n) __extension__ ({ \
755 __m64 __a = (a); \
756 (__m64)__builtin_ia32_pshufw((__v4hi)__a, (n)); })
757
758static __inline__ void __DEFAULT_FN_ATTRS
759_mm_maskmove_si64(__m64 __d, __m64 __n, char *__p)
760{
761 __builtin_ia32_maskmovq((__v8qi)__d, (__v8qi)__n, __p);
762}
763
764static __inline__ __m64 __DEFAULT_FN_ATTRS
765_mm_avg_pu8(__m64 __a, __m64 __b)
766{
767 return (__m64)__builtin_ia32_pavgb((__v8qi)__a, (__v8qi)__b);
768}
769
770static __inline__ __m64 __DEFAULT_FN_ATTRS
771_mm_avg_pu16(__m64 __a, __m64 __b)
772{
773 return (__m64)__builtin_ia32_pavgw((__v4hi)__a, (__v4hi)__b);
774}
775
776static __inline__ __m64 __DEFAULT_FN_ATTRS
777_mm_sad_pu8(__m64 __a, __m64 __b)
778{
779 return (__m64)__builtin_ia32_psadbw((__v8qi)__a, (__v8qi)__b);
780}
781
782static __inline__ unsigned int __DEFAULT_FN_ATTRS
783_mm_getcsr(void)
784{
785 return __builtin_ia32_stmxcsr();
786}
787
788static __inline__ void __DEFAULT_FN_ATTRS
789_mm_setcsr(unsigned int __i)
790{
791 __builtin_ia32_ldmxcsr(__i);
792}
793
794#define _mm_shuffle_ps(a, b, mask) __extension__ ({ \
795 __m128 __a = (a); \
796 __m128 __b = (b); \
797 (__m128)__builtin_shufflevector((__v4sf)__a, (__v4sf)__b, \
798 (mask) & 0x3, ((mask) & 0xc) >> 2, \
799 (((mask) & 0x30) >> 4) + 4, \
800 (((mask) & 0xc0) >> 6) + 4); })
801
802static __inline__ __m128 __DEFAULT_FN_ATTRS
803_mm_unpackhi_ps(__m128 __a, __m128 __b)
804{
805 return __builtin_shufflevector(__a, __b, 2, 6, 3, 7);
806}
807
808static __inline__ __m128 __DEFAULT_FN_ATTRS
809_mm_unpacklo_ps(__m128 __a, __m128 __b)
810{
811 return __builtin_shufflevector(__a, __b, 0, 4, 1, 5);
812}
813
814static __inline__ __m128 __DEFAULT_FN_ATTRS
815_mm_move_ss(__m128 __a, __m128 __b)
816{
817 return __builtin_shufflevector(__a, __b, 4, 1, 2, 3);
818}
819
820static __inline__ __m128 __DEFAULT_FN_ATTRS
821_mm_movehl_ps(__m128 __a, __m128 __b)
822{
823 return __builtin_shufflevector(__a, __b, 6, 7, 2, 3);
824}
825
826static __inline__ __m128 __DEFAULT_FN_ATTRS
827_mm_movelh_ps(__m128 __a, __m128 __b)
828{
829 return __builtin_shufflevector(__a, __b, 0, 1, 4, 5);
830}
831
832static __inline__ __m128 __DEFAULT_FN_ATTRS
833_mm_cvtpi16_ps(__m64 __a)
834{
835 __m64 __b, __c;
836 __m128 __r;
837
838 __b = _mm_setzero_si64();
839 __b = _mm_cmpgt_pi16(__b, __a);
840 __c = _mm_unpackhi_pi16(__a, __b);
841 __r = _mm_setzero_ps();
842 __r = _mm_cvtpi32_ps(__r, __c);
843 __r = _mm_movelh_ps(__r, __r);
844 __c = _mm_unpacklo_pi16(__a, __b);
845 __r = _mm_cvtpi32_ps(__r, __c);
846
847 return __r;
848}
849
850static __inline__ __m128 __DEFAULT_FN_ATTRS
851_mm_cvtpu16_ps(__m64 __a)
852{
853 __m64 __b, __c;
854 __m128 __r;
855
856 __b = _mm_setzero_si64();
857 __c = _mm_unpackhi_pi16(__a, __b);
858 __r = _mm_setzero_ps();
859 __r = _mm_cvtpi32_ps(__r, __c);
860 __r = _mm_movelh_ps(__r, __r);
861 __c = _mm_unpacklo_pi16(__a, __b);
862 __r = _mm_cvtpi32_ps(__r, __c);
863
864 return __r;
865}
866
867static __inline__ __m128 __DEFAULT_FN_ATTRS
868_mm_cvtpi8_ps(__m64 __a)
869{
870 __m64 __b;
871
872 __b = _mm_setzero_si64();
873 __b = _mm_cmpgt_pi8(__b, __a);
874 __b = _mm_unpacklo_pi8(__a, __b);
875
876 return _mm_cvtpi16_ps(__b);
877}
878
879static __inline__ __m128 __DEFAULT_FN_ATTRS
880_mm_cvtpu8_ps(__m64 __a)
881{
882 __m64 __b;
883
884 __b = _mm_setzero_si64();
885 __b = _mm_unpacklo_pi8(__a, __b);
886
887 return _mm_cvtpi16_ps(__b);
888}
889
890static __inline__ __m128 __DEFAULT_FN_ATTRS
891_mm_cvtpi32x2_ps(__m64 __a, __m64 __b)
892{
893 __m128 __c;
894
895 __c = _mm_setzero_ps();
896 __c = _mm_cvtpi32_ps(__c, __b);
897 __c = _mm_movelh_ps(__c, __c);
898
899 return _mm_cvtpi32_ps(__c, __a);
900}
901
902static __inline__ __m64 __DEFAULT_FN_ATTRS
903_mm_cvtps_pi16(__m128 __a)
904{
905 __m64 __b, __c;
906
907 __b = _mm_cvtps_pi32(__a);
908 __a = _mm_movehl_ps(__a, __a);
909 __c = _mm_cvtps_pi32(__a);
910
911 return _mm_packs_pi32(__b, __c);
912}
913
914static __inline__ __m64 __DEFAULT_FN_ATTRS
915_mm_cvtps_pi8(__m128 __a)
916{
917 __m64 __b, __c;
918
919 __b = _mm_cvtps_pi16(__a);
920 __c = _mm_setzero_si64();
921
922 return _mm_packs_pi16(__b, __c);
923}
924
925static __inline__ int __DEFAULT_FN_ATTRS
926_mm_movemask_ps(__m128 __a)
927{
928 return __builtin_ia32_movmskps(__a);
929}
930
931#define _MM_SHUFFLE(z, y, x, w) (((z) << 6) | ((y) << 4) | ((x) << 2) | (w))
932
933#define _MM_EXCEPT_INVALID (0x0001)
934#define _MM_EXCEPT_DENORM (0x0002)
935#define _MM_EXCEPT_DIV_ZERO (0x0004)
936#define _MM_EXCEPT_OVERFLOW (0x0008)
937#define _MM_EXCEPT_UNDERFLOW (0x0010)
938#define _MM_EXCEPT_INEXACT (0x0020)
939#define _MM_EXCEPT_MASK (0x003f)
940
941#define _MM_MASK_INVALID (0x0080)
942#define _MM_MASK_DENORM (0x0100)
943#define _MM_MASK_DIV_ZERO (0x0200)
944#define _MM_MASK_OVERFLOW (0x0400)
945#define _MM_MASK_UNDERFLOW (0x0800)
946#define _MM_MASK_INEXACT (0x1000)
947#define _MM_MASK_MASK (0x1f80)
948
949#define _MM_ROUND_NEAREST (0x0000)
950#define _MM_ROUND_DOWN (0x2000)
951#define _MM_ROUND_UP (0x4000)
952#define _MM_ROUND_TOWARD_ZERO (0x6000)
953#define _MM_ROUND_MASK (0x6000)
954
955#define _MM_FLUSH_ZERO_MASK (0x8000)
956#define _MM_FLUSH_ZERO_ON (0x8000)
957#define _MM_FLUSH_ZERO_OFF (0x0000)
958
959#define _MM_GET_EXCEPTION_MASK() (_mm_getcsr() & _MM_MASK_MASK)
960#define _MM_GET_EXCEPTION_STATE() (_mm_getcsr() & _MM_EXCEPT_MASK)
961#define _MM_GET_FLUSH_ZERO_MODE() (_mm_getcsr() & _MM_FLUSH_ZERO_MASK)
962#define _MM_GET_ROUNDING_MODE() (_mm_getcsr() & _MM_ROUND_MASK)
963
964#define _MM_SET_EXCEPTION_MASK(x) (_mm_setcsr((_mm_getcsr() & ~_MM_MASK_MASK) | (x)))
965#define _MM_SET_EXCEPTION_STATE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_EXCEPT_MASK) | (x)))
966#define _MM_SET_FLUSH_ZERO_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_FLUSH_ZERO_MASK) | (x)))
967#define _MM_SET_ROUNDING_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_ROUND_MASK) | (x)))
968
969#define _MM_TRANSPOSE4_PS(row0, row1, row2, row3) \
970do { \
971 __m128 tmp3, tmp2, tmp1, tmp0; \
972 tmp0 = _mm_unpacklo_ps((row0), (row1)); \
973 tmp2 = _mm_unpacklo_ps((row2), (row3)); \
974 tmp1 = _mm_unpackhi_ps((row0), (row1)); \
975 tmp3 = _mm_unpackhi_ps((row2), (row3)); \
976 (row0) = _mm_movelh_ps(tmp0, tmp2); \
977 (row1) = _mm_movehl_ps(tmp2, tmp0); \
978 (row2) = _mm_movelh_ps(tmp1, tmp3); \
979 (row3) = _mm_movehl_ps(tmp3, tmp1); \
980} while (0)
981
982/* Aliases for compatibility. */
983#define _m_pextrw _mm_extract_pi16
984#define _m_pinsrw _mm_insert_pi16
985#define _m_pmaxsw _mm_max_pi16
986#define _m_pmaxub _mm_max_pu8
987#define _m_pminsw _mm_min_pi16
988#define _m_pminub _mm_min_pu8
989#define _m_pmovmskb _mm_movemask_pi8
990#define _m_pmulhuw _mm_mulhi_pu16
991#define _m_pshufw _mm_shuffle_pi16
992#define _m_maskmovq _mm_maskmove_si64
993#define _m_pavgb _mm_avg_pu8
994#define _m_pavgw _mm_avg_pu16
995#define _m_psadbw _mm_sad_pu8
996#define _m_ _mm_
997#define _m_ _mm_
998
999#undef __DEFAULT_FN_ATTRS
1000
1001/* Ugly hack for backwards-compatibility (compatible with gcc) */
1002#if defined(__SSE2__) && !__has_feature(modules)
1003#include <emmintrin.h>
1004#endif
1005
1006#endif /* __SSE__ */
1007
1008#endif /* __XMMINTRIN_H */
c_headers/xopintrin.h created+809
......@@ -0,0 +1,809 @@
1/*===---- xopintrin.h - XOP intrinsics -------------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __X86INTRIN_H
25#error "Never use <xopintrin.h> directly; include <x86intrin.h> instead."
26#endif
27
28#ifndef __XOPINTRIN_H
29#define __XOPINTRIN_H
30
31#ifndef __XOP__
32# error "XOP instruction set is not enabled"
33#else
34
35#include <fma4intrin.h>
36
37/* Define the default attributes for the functions in this file. */
38#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
39
40static __inline__ __m128i __DEFAULT_FN_ATTRS
41_mm_maccs_epi16(__m128i __A, __m128i __B, __m128i __C)
42{
43 return (__m128i)__builtin_ia32_vpmacssww((__v8hi)__A, (__v8hi)__B, (__v8hi)__C);
44}
45
46static __inline__ __m128i __DEFAULT_FN_ATTRS
47_mm_macc_epi16(__m128i __A, __m128i __B, __m128i __C)
48{
49 return (__m128i)__builtin_ia32_vpmacsww((__v8hi)__A, (__v8hi)__B, (__v8hi)__C);
50}
51
52static __inline__ __m128i __DEFAULT_FN_ATTRS
53_mm_maccsd_epi16(__m128i __A, __m128i __B, __m128i __C)
54{
55 return (__m128i)__builtin_ia32_vpmacsswd((__v8hi)__A, (__v8hi)__B, (__v4si)__C);
56}
57
58static __inline__ __m128i __DEFAULT_FN_ATTRS
59_mm_maccd_epi16(__m128i __A, __m128i __B, __m128i __C)
60{
61 return (__m128i)__builtin_ia32_vpmacswd((__v8hi)__A, (__v8hi)__B, (__v4si)__C);
62}
63
64static __inline__ __m128i __DEFAULT_FN_ATTRS
65_mm_maccs_epi32(__m128i __A, __m128i __B, __m128i __C)
66{
67 return (__m128i)__builtin_ia32_vpmacssdd((__v4si)__A, (__v4si)__B, (__v4si)__C);
68}
69
70static __inline__ __m128i __DEFAULT_FN_ATTRS
71_mm_macc_epi32(__m128i __A, __m128i __B, __m128i __C)
72{
73 return (__m128i)__builtin_ia32_vpmacsdd((__v4si)__A, (__v4si)__B, (__v4si)__C);
74}
75
76static __inline__ __m128i __DEFAULT_FN_ATTRS
77_mm_maccslo_epi32(__m128i __A, __m128i __B, __m128i __C)
78{
79 return (__m128i)__builtin_ia32_vpmacssdql((__v4si)__A, (__v4si)__B, (__v2di)__C);
80}
81
82static __inline__ __m128i __DEFAULT_FN_ATTRS
83_mm_macclo_epi32(__m128i __A, __m128i __B, __m128i __C)
84{
85 return (__m128i)__builtin_ia32_vpmacsdql((__v4si)__A, (__v4si)__B, (__v2di)__C);
86}
87
88static __inline__ __m128i __DEFAULT_FN_ATTRS
89_mm_maccshi_epi32(__m128i __A, __m128i __B, __m128i __C)
90{
91 return (__m128i)__builtin_ia32_vpmacssdqh((__v4si)__A, (__v4si)__B, (__v2di)__C);
92}
93
94static __inline__ __m128i __DEFAULT_FN_ATTRS
95_mm_macchi_epi32(__m128i __A, __m128i __B, __m128i __C)
96{
97 return (__m128i)__builtin_ia32_vpmacsdqh((__v4si)__A, (__v4si)__B, (__v2di)__C);
98}
99
100static __inline__ __m128i __DEFAULT_FN_ATTRS
101_mm_maddsd_epi16(__m128i __A, __m128i __B, __m128i __C)
102{
103 return (__m128i)__builtin_ia32_vpmadcsswd((__v8hi)__A, (__v8hi)__B, (__v4si)__C);
104}
105
106static __inline__ __m128i __DEFAULT_FN_ATTRS
107_mm_maddd_epi16(__m128i __A, __m128i __B, __m128i __C)
108{
109 return (__m128i)__builtin_ia32_vpmadcswd((__v8hi)__A, (__v8hi)__B, (__v4si)__C);
110}
111
112static __inline__ __m128i __DEFAULT_FN_ATTRS
113_mm_haddw_epi8(__m128i __A)
114{
115 return (__m128i)__builtin_ia32_vphaddbw((__v16qi)__A);
116}
117
118static __inline__ __m128i __DEFAULT_FN_ATTRS
119_mm_haddd_epi8(__m128i __A)
120{
121 return (__m128i)__builtin_ia32_vphaddbd((__v16qi)__A);
122}
123
124static __inline__ __m128i __DEFAULT_FN_ATTRS
125_mm_haddq_epi8(__m128i __A)
126{
127 return (__m128i)__builtin_ia32_vphaddbq((__v16qi)__A);
128}
129
130static __inline__ __m128i __DEFAULT_FN_ATTRS
131_mm_haddd_epi16(__m128i __A)
132{
133 return (__m128i)__builtin_ia32_vphaddwd((__v8hi)__A);
134}
135
136static __inline__ __m128i __DEFAULT_FN_ATTRS
137_mm_haddq_epi16(__m128i __A)
138{
139 return (__m128i)__builtin_ia32_vphaddwq((__v8hi)__A);
140}
141
142static __inline__ __m128i __DEFAULT_FN_ATTRS
143_mm_haddq_epi32(__m128i __A)
144{
145 return (__m128i)__builtin_ia32_vphadddq((__v4si)__A);
146}
147
148static __inline__ __m128i __DEFAULT_FN_ATTRS
149_mm_haddw_epu8(__m128i __A)
150{
151 return (__m128i)__builtin_ia32_vphaddubw((__v16qi)__A);
152}
153
154static __inline__ __m128i __DEFAULT_FN_ATTRS
155_mm_haddd_epu8(__m128i __A)
156{
157 return (__m128i)__builtin_ia32_vphaddubd((__v16qi)__A);
158}
159
160static __inline__ __m128i __DEFAULT_FN_ATTRS
161_mm_haddq_epu8(__m128i __A)
162{
163 return (__m128i)__builtin_ia32_vphaddubq((__v16qi)__A);
164}
165
166static __inline__ __m128i __DEFAULT_FN_ATTRS
167_mm_haddd_epu16(__m128i __A)
168{
169 return (__m128i)__builtin_ia32_vphadduwd((__v8hi)__A);
170}
171
172static __inline__ __m128i __DEFAULT_FN_ATTRS
173_mm_haddq_epu16(__m128i __A)
174{
175 return (__m128i)__builtin_ia32_vphadduwq((__v8hi)__A);
176}
177
178static __inline__ __m128i __DEFAULT_FN_ATTRS
179_mm_haddq_epu32(__m128i __A)
180{
181 return (__m128i)__builtin_ia32_vphaddudq((__v4si)__A);
182}
183
184static __inline__ __m128i __DEFAULT_FN_ATTRS
185_mm_hsubw_epi8(__m128i __A)
186{
187 return (__m128i)__builtin_ia32_vphsubbw((__v16qi)__A);
188}
189
190static __inline__ __m128i __DEFAULT_FN_ATTRS
191_mm_hsubd_epi16(__m128i __A)
192{
193 return (__m128i)__builtin_ia32_vphsubwd((__v8hi)__A);
194}
195
196static __inline__ __m128i __DEFAULT_FN_ATTRS
197_mm_hsubq_epi32(__m128i __A)
198{
199 return (__m128i)__builtin_ia32_vphsubdq((__v4si)__A);
200}
201
202static __inline__ __m128i __DEFAULT_FN_ATTRS
203_mm_cmov_si128(__m128i __A, __m128i __B, __m128i __C)
204{
205 return (__m128i)__builtin_ia32_vpcmov(__A, __B, __C);
206}
207
208static __inline__ __m256i __DEFAULT_FN_ATTRS
209_mm256_cmov_si256(__m256i __A, __m256i __B, __m256i __C)
210{
211 return (__m256i)__builtin_ia32_vpcmov_256(__A, __B, __C);
212}
213
214static __inline__ __m128i __DEFAULT_FN_ATTRS
215_mm_perm_epi8(__m128i __A, __m128i __B, __m128i __C)
216{
217 return (__m128i)__builtin_ia32_vpperm((__v16qi)__A, (__v16qi)__B, (__v16qi)__C);
218}
219
220static __inline__ __m128i __DEFAULT_FN_ATTRS
221_mm_rot_epi8(__m128i __A, __m128i __B)
222{
223 return (__m128i)__builtin_ia32_vprotb((__v16qi)__A, (__v16qi)__B);
224}
225
226static __inline__ __m128i __DEFAULT_FN_ATTRS
227_mm_rot_epi16(__m128i __A, __m128i __B)
228{
229 return (__m128i)__builtin_ia32_vprotw((__v8hi)__A, (__v8hi)__B);
230}
231
232static __inline__ __m128i __DEFAULT_FN_ATTRS
233_mm_rot_epi32(__m128i __A, __m128i __B)
234{
235 return (__m128i)__builtin_ia32_vprotd((__v4si)__A, (__v4si)__B);
236}
237
238static __inline__ __m128i __DEFAULT_FN_ATTRS
239_mm_rot_epi64(__m128i __A, __m128i __B)
240{
241 return (__m128i)__builtin_ia32_vprotq((__v2di)__A, (__v2di)__B);
242}
243
244#define _mm_roti_epi8(A, N) __extension__ ({ \
245 __m128i __A = (A); \
246 (__m128i)__builtin_ia32_vprotbi((__v16qi)__A, (N)); })
247
248#define _mm_roti_epi16(A, N) __extension__ ({ \
249 __m128i __A = (A); \
250 (__m128i)__builtin_ia32_vprotwi((__v8hi)__A, (N)); })
251
252#define _mm_roti_epi32(A, N) __extension__ ({ \
253 __m128i __A = (A); \
254 (__m128i)__builtin_ia32_vprotdi((__v4si)__A, (N)); })
255
256#define _mm_roti_epi64(A, N) __extension__ ({ \
257 __m128i __A = (A); \
258 (__m128i)__builtin_ia32_vprotqi((__v2di)__A, (N)); })
259
260static __inline__ __m128i __DEFAULT_FN_ATTRS
261_mm_shl_epi8(__m128i __A, __m128i __B)
262{
263 return (__m128i)__builtin_ia32_vpshlb((__v16qi)__A, (__v16qi)__B);
264}
265
266static __inline__ __m128i __DEFAULT_FN_ATTRS
267_mm_shl_epi16(__m128i __A, __m128i __B)
268{
269 return (__m128i)__builtin_ia32_vpshlw((__v8hi)__A, (__v8hi)__B);
270}
271
272static __inline__ __m128i __DEFAULT_FN_ATTRS
273_mm_shl_epi32(__m128i __A, __m128i __B)
274{
275 return (__m128i)__builtin_ia32_vpshld((__v4si)__A, (__v4si)__B);
276}
277
278static __inline__ __m128i __DEFAULT_FN_ATTRS
279_mm_shl_epi64(__m128i __A, __m128i __B)
280{
281 return (__m128i)__builtin_ia32_vpshlq((__v2di)__A, (__v2di)__B);
282}
283
284static __inline__ __m128i __DEFAULT_FN_ATTRS
285_mm_sha_epi8(__m128i __A, __m128i __B)
286{
287 return (__m128i)__builtin_ia32_vpshab((__v16qi)__A, (__v16qi)__B);
288}
289
290static __inline__ __m128i __DEFAULT_FN_ATTRS
291_mm_sha_epi16(__m128i __A, __m128i __B)
292{
293 return (__m128i)__builtin_ia32_vpshaw((__v8hi)__A, (__v8hi)__B);
294}
295
296static __inline__ __m128i __DEFAULT_FN_ATTRS
297_mm_sha_epi32(__m128i __A, __m128i __B)
298{
299 return (__m128i)__builtin_ia32_vpshad((__v4si)__A, (__v4si)__B);
300}
301
302static __inline__ __m128i __DEFAULT_FN_ATTRS
303_mm_sha_epi64(__m128i __A, __m128i __B)
304{
305 return (__m128i)__builtin_ia32_vpshaq((__v2di)__A, (__v2di)__B);
306}
307
308#define _mm_com_epu8(A, B, N) __extension__ ({ \
309 __m128i __A = (A); \
310 __m128i __B = (B); \
311 (__m128i)__builtin_ia32_vpcomub((__v16qi)__A, (__v16qi)__B, (N)); })
312
313#define _mm_com_epu16(A, B, N) __extension__ ({ \
314 __m128i __A = (A); \
315 __m128i __B = (B); \
316 (__m128i)__builtin_ia32_vpcomuw((__v8hi)__A, (__v8hi)__B, (N)); })
317
318#define _mm_com_epu32(A, B, N) __extension__ ({ \
319 __m128i __A = (A); \
320 __m128i __B = (B); \
321 (__m128i)__builtin_ia32_vpcomud((__v4si)__A, (__v4si)__B, (N)); })
322
323#define _mm_com_epu64(A, B, N) __extension__ ({ \
324 __m128i __A = (A); \
325 __m128i __B = (B); \
326 (__m128i)__builtin_ia32_vpcomuq((__v2di)__A, (__v2di)__B, (N)); })
327
328#define _mm_com_epi8(A, B, N) __extension__ ({ \
329 __m128i __A = (A); \
330 __m128i __B = (B); \
331 (__m128i)__builtin_ia32_vpcomb((__v16qi)__A, (__v16qi)__B, (N)); })
332
333#define _mm_com_epi16(A, B, N) __extension__ ({ \
334 __m128i __A = (A); \
335 __m128i __B = (B); \
336 (__m128i)__builtin_ia32_vpcomw((__v8hi)__A, (__v8hi)__B, (N)); })
337
338#define _mm_com_epi32(A, B, N) __extension__ ({ \
339 __m128i __A = (A); \
340 __m128i __B = (B); \
341 (__m128i)__builtin_ia32_vpcomd((__v4si)__A, (__v4si)__B, (N)); })
342
343#define _mm_com_epi64(A, B, N) __extension__ ({ \
344 __m128i __A = (A); \
345 __m128i __B = (B); \
346 (__m128i)__builtin_ia32_vpcomq((__v2di)__A, (__v2di)__B, (N)); })
347
348#define _MM_PCOMCTRL_LT 0
349#define _MM_PCOMCTRL_LE 1
350#define _MM_PCOMCTRL_GT 2
351#define _MM_PCOMCTRL_GE 3
352#define _MM_PCOMCTRL_EQ 4
353#define _MM_PCOMCTRL_NEQ 5
354#define _MM_PCOMCTRL_FALSE 6
355#define _MM_PCOMCTRL_TRUE 7
356
357static __inline__ __m128i __DEFAULT_FN_ATTRS
358_mm_comlt_epu8(__m128i __A, __m128i __B)
359{
360 return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_LT);
361}
362
363static __inline__ __m128i __DEFAULT_FN_ATTRS
364_mm_comle_epu8(__m128i __A, __m128i __B)
365{
366 return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_LE);
367}
368
369static __inline__ __m128i __DEFAULT_FN_ATTRS
370_mm_comgt_epu8(__m128i __A, __m128i __B)
371{
372 return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_GT);
373}
374
375static __inline__ __m128i __DEFAULT_FN_ATTRS
376_mm_comge_epu8(__m128i __A, __m128i __B)
377{
378 return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_GE);
379}
380
381static __inline__ __m128i __DEFAULT_FN_ATTRS
382_mm_comeq_epu8(__m128i __A, __m128i __B)
383{
384 return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_EQ);
385}
386
387static __inline__ __m128i __DEFAULT_FN_ATTRS
388_mm_comneq_epu8(__m128i __A, __m128i __B)
389{
390 return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_NEQ);
391}
392
393static __inline__ __m128i __DEFAULT_FN_ATTRS
394_mm_comfalse_epu8(__m128i __A, __m128i __B)
395{
396 return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_FALSE);
397}
398
399static __inline__ __m128i __DEFAULT_FN_ATTRS
400_mm_comtrue_epu8(__m128i __A, __m128i __B)
401{
402 return _mm_com_epu8(__A, __B, _MM_PCOMCTRL_TRUE);
403}
404
405static __inline__ __m128i __DEFAULT_FN_ATTRS
406_mm_comlt_epu16(__m128i __A, __m128i __B)
407{
408 return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_LT);
409}
410
411static __inline__ __m128i __DEFAULT_FN_ATTRS
412_mm_comle_epu16(__m128i __A, __m128i __B)
413{
414 return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_LE);
415}
416
417static __inline__ __m128i __DEFAULT_FN_ATTRS
418_mm_comgt_epu16(__m128i __A, __m128i __B)
419{
420 return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_GT);
421}
422
423static __inline__ __m128i __DEFAULT_FN_ATTRS
424_mm_comge_epu16(__m128i __A, __m128i __B)
425{
426 return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_GE);
427}
428
429static __inline__ __m128i __DEFAULT_FN_ATTRS
430_mm_comeq_epu16(__m128i __A, __m128i __B)
431{
432 return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_EQ);
433}
434
435static __inline__ __m128i __DEFAULT_FN_ATTRS
436_mm_comneq_epu16(__m128i __A, __m128i __B)
437{
438 return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_NEQ);
439}
440
441static __inline__ __m128i __DEFAULT_FN_ATTRS
442_mm_comfalse_epu16(__m128i __A, __m128i __B)
443{
444 return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_FALSE);
445}
446
447static __inline__ __m128i __DEFAULT_FN_ATTRS
448_mm_comtrue_epu16(__m128i __A, __m128i __B)
449{
450 return _mm_com_epu16(__A, __B, _MM_PCOMCTRL_TRUE);
451}
452
453static __inline__ __m128i __DEFAULT_FN_ATTRS
454_mm_comlt_epu32(__m128i __A, __m128i __B)
455{
456 return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_LT);
457}
458
459static __inline__ __m128i __DEFAULT_FN_ATTRS
460_mm_comle_epu32(__m128i __A, __m128i __B)
461{
462 return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_LE);
463}
464
465static __inline__ __m128i __DEFAULT_FN_ATTRS
466_mm_comgt_epu32(__m128i __A, __m128i __B)
467{
468 return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_GT);
469}
470
471static __inline__ __m128i __DEFAULT_FN_ATTRS
472_mm_comge_epu32(__m128i __A, __m128i __B)
473{
474 return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_GE);
475}
476
477static __inline__ __m128i __DEFAULT_FN_ATTRS
478_mm_comeq_epu32(__m128i __A, __m128i __B)
479{
480 return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_EQ);
481}
482
483static __inline__ __m128i __DEFAULT_FN_ATTRS
484_mm_comneq_epu32(__m128i __A, __m128i __B)
485{
486 return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_NEQ);
487}
488
489static __inline__ __m128i __DEFAULT_FN_ATTRS
490_mm_comfalse_epu32(__m128i __A, __m128i __B)
491{
492 return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_FALSE);
493}
494
495static __inline__ __m128i __DEFAULT_FN_ATTRS
496_mm_comtrue_epu32(__m128i __A, __m128i __B)
497{
498 return _mm_com_epu32(__A, __B, _MM_PCOMCTRL_TRUE);
499}
500
501static __inline__ __m128i __DEFAULT_FN_ATTRS
502_mm_comlt_epu64(__m128i __A, __m128i __B)
503{
504 return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_LT);
505}
506
507static __inline__ __m128i __DEFAULT_FN_ATTRS
508_mm_comle_epu64(__m128i __A, __m128i __B)
509{
510 return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_LE);
511}
512
513static __inline__ __m128i __DEFAULT_FN_ATTRS
514_mm_comgt_epu64(__m128i __A, __m128i __B)
515{
516 return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_GT);
517}
518
519static __inline__ __m128i __DEFAULT_FN_ATTRS
520_mm_comge_epu64(__m128i __A, __m128i __B)
521{
522 return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_GE);
523}
524
525static __inline__ __m128i __DEFAULT_FN_ATTRS
526_mm_comeq_epu64(__m128i __A, __m128i __B)
527{
528 return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_EQ);
529}
530
531static __inline__ __m128i __DEFAULT_FN_ATTRS
532_mm_comneq_epu64(__m128i __A, __m128i __B)
533{
534 return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_NEQ);
535}
536
537static __inline__ __m128i __DEFAULT_FN_ATTRS
538_mm_comfalse_epu64(__m128i __A, __m128i __B)
539{
540 return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_FALSE);
541}
542
543static __inline__ __m128i __DEFAULT_FN_ATTRS
544_mm_comtrue_epu64(__m128i __A, __m128i __B)
545{
546 return _mm_com_epu64(__A, __B, _MM_PCOMCTRL_TRUE);
547}
548
549static __inline__ __m128i __DEFAULT_FN_ATTRS
550_mm_comlt_epi8(__m128i __A, __m128i __B)
551{
552 return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_LT);
553}
554
555static __inline__ __m128i __DEFAULT_FN_ATTRS
556_mm_comle_epi8(__m128i __A, __m128i __B)
557{
558 return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_LE);
559}
560
561static __inline__ __m128i __DEFAULT_FN_ATTRS
562_mm_comgt_epi8(__m128i __A, __m128i __B)
563{
564 return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_GT);
565}
566
567static __inline__ __m128i __DEFAULT_FN_ATTRS
568_mm_comge_epi8(__m128i __A, __m128i __B)
569{
570 return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_GE);
571}
572
573static __inline__ __m128i __DEFAULT_FN_ATTRS
574_mm_comeq_epi8(__m128i __A, __m128i __B)
575{
576 return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_EQ);
577}
578
579static __inline__ __m128i __DEFAULT_FN_ATTRS
580_mm_comneq_epi8(__m128i __A, __m128i __B)
581{
582 return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_NEQ);
583}
584
585static __inline__ __m128i __DEFAULT_FN_ATTRS
586_mm_comfalse_epi8(__m128i __A, __m128i __B)
587{
588 return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_FALSE);
589}
590
591static __inline__ __m128i __DEFAULT_FN_ATTRS
592_mm_comtrue_epi8(__m128i __A, __m128i __B)
593{
594 return _mm_com_epi8(__A, __B, _MM_PCOMCTRL_TRUE);
595}
596
597static __inline__ __m128i __DEFAULT_FN_ATTRS
598_mm_comlt_epi16(__m128i __A, __m128i __B)
599{
600 return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_LT);
601}
602
603static __inline__ __m128i __DEFAULT_FN_ATTRS
604_mm_comle_epi16(__m128i __A, __m128i __B)
605{
606 return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_LE);
607}
608
609static __inline__ __m128i __DEFAULT_FN_ATTRS
610_mm_comgt_epi16(__m128i __A, __m128i __B)
611{
612 return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_GT);
613}
614
615static __inline__ __m128i __DEFAULT_FN_ATTRS
616_mm_comge_epi16(__m128i __A, __m128i __B)
617{
618 return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_GE);
619}
620
621static __inline__ __m128i __DEFAULT_FN_ATTRS
622_mm_comeq_epi16(__m128i __A, __m128i __B)
623{
624 return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_EQ);
625}
626
627static __inline__ __m128i __DEFAULT_FN_ATTRS
628_mm_comneq_epi16(__m128i __A, __m128i __B)
629{
630 return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_NEQ);
631}
632
633static __inline__ __m128i __DEFAULT_FN_ATTRS
634_mm_comfalse_epi16(__m128i __A, __m128i __B)
635{
636 return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_FALSE);
637}
638
639static __inline__ __m128i __DEFAULT_FN_ATTRS
640_mm_comtrue_epi16(__m128i __A, __m128i __B)
641{
642 return _mm_com_epi16(__A, __B, _MM_PCOMCTRL_TRUE);
643}
644
645static __inline__ __m128i __DEFAULT_FN_ATTRS
646_mm_comlt_epi32(__m128i __A, __m128i __B)
647{
648 return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_LT);
649}
650
651static __inline__ __m128i __DEFAULT_FN_ATTRS
652_mm_comle_epi32(__m128i __A, __m128i __B)
653{
654 return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_LE);
655}
656
657static __inline__ __m128i __DEFAULT_FN_ATTRS
658_mm_comgt_epi32(__m128i __A, __m128i __B)
659{
660 return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_GT);
661}
662
663static __inline__ __m128i __DEFAULT_FN_ATTRS
664_mm_comge_epi32(__m128i __A, __m128i __B)
665{
666 return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_GE);
667}
668
669static __inline__ __m128i __DEFAULT_FN_ATTRS
670_mm_comeq_epi32(__m128i __A, __m128i __B)
671{
672 return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_EQ);
673}
674
675static __inline__ __m128i __DEFAULT_FN_ATTRS
676_mm_comneq_epi32(__m128i __A, __m128i __B)
677{
678 return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_NEQ);
679}
680
681static __inline__ __m128i __DEFAULT_FN_ATTRS
682_mm_comfalse_epi32(__m128i __A, __m128i __B)
683{
684 return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_FALSE);
685}
686
687static __inline__ __m128i __DEFAULT_FN_ATTRS
688_mm_comtrue_epi32(__m128i __A, __m128i __B)
689{
690 return _mm_com_epi32(__A, __B, _MM_PCOMCTRL_TRUE);
691}
692
693static __inline__ __m128i __DEFAULT_FN_ATTRS
694_mm_comlt_epi64(__m128i __A, __m128i __B)
695{
696 return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_LT);
697}
698
699static __inline__ __m128i __DEFAULT_FN_ATTRS
700_mm_comle_epi64(__m128i __A, __m128i __B)
701{
702 return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_LE);
703}
704
705static __inline__ __m128i __DEFAULT_FN_ATTRS
706_mm_comgt_epi64(__m128i __A, __m128i __B)
707{
708 return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_GT);
709}
710
711static __inline__ __m128i __DEFAULT_FN_ATTRS
712_mm_comge_epi64(__m128i __A, __m128i __B)
713{
714 return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_GE);
715}
716
717static __inline__ __m128i __DEFAULT_FN_ATTRS
718_mm_comeq_epi64(__m128i __A, __m128i __B)
719{
720 return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_EQ);
721}
722
723static __inline__ __m128i __DEFAULT_FN_ATTRS
724_mm_comneq_epi64(__m128i __A, __m128i __B)
725{
726 return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_NEQ);
727}
728
729static __inline__ __m128i __DEFAULT_FN_ATTRS
730_mm_comfalse_epi64(__m128i __A, __m128i __B)
731{
732 return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_FALSE);
733}
734
735static __inline__ __m128i __DEFAULT_FN_ATTRS
736_mm_comtrue_epi64(__m128i __A, __m128i __B)
737{
738 return _mm_com_epi64(__A, __B, _MM_PCOMCTRL_TRUE);
739}
740
741#define _mm_permute2_pd(X, Y, C, I) __extension__ ({ \
742 __m128d __X = (X); \
743 __m128d __Y = (Y); \
744 __m128i __C = (C); \
745 (__m128d)__builtin_ia32_vpermil2pd((__v2df)__X, (__v2df)__Y, \
746 (__v2di)__C, (I)); })
747
748#define _mm256_permute2_pd(X, Y, C, I) __extension__ ({ \
749 __m256d __X = (X); \
750 __m256d __Y = (Y); \
751 __m256i __C = (C); \
752 (__m256d)__builtin_ia32_vpermil2pd256((__v4df)__X, (__v4df)__Y, \
753 (__v4di)__C, (I)); })
754
755#define _mm_permute2_ps(X, Y, C, I) __extension__ ({ \
756 __m128 __X = (X); \
757 __m128 __Y = (Y); \
758 __m128i __C = (C); \
759 (__m128)__builtin_ia32_vpermil2ps((__v4sf)__X, (__v4sf)__Y, \
760 (__v4si)__C, (I)); })
761
762#define _mm256_permute2_ps(X, Y, C, I) __extension__ ({ \
763 __m256 __X = (X); \
764 __m256 __Y = (Y); \
765 __m256i __C = (C); \
766 (__m256)__builtin_ia32_vpermil2ps256((__v8sf)__X, (__v8sf)__Y, \
767 (__v8si)__C, (I)); })
768
769static __inline__ __m128 __DEFAULT_FN_ATTRS
770_mm_frcz_ss(__m128 __A)
771{
772 return (__m128)__builtin_ia32_vfrczss((__v4sf)__A);
773}
774
775static __inline__ __m128d __DEFAULT_FN_ATTRS
776_mm_frcz_sd(__m128d __A)
777{
778 return (__m128d)__builtin_ia32_vfrczsd((__v2df)__A);
779}
780
781static __inline__ __m128 __DEFAULT_FN_ATTRS
782_mm_frcz_ps(__m128 __A)
783{
784 return (__m128)__builtin_ia32_vfrczps((__v4sf)__A);
785}
786
787static __inline__ __m128d __DEFAULT_FN_ATTRS
788_mm_frcz_pd(__m128d __A)
789{
790 return (__m128d)__builtin_ia32_vfrczpd((__v2df)__A);
791}
792
793static __inline__ __m256 __DEFAULT_FN_ATTRS
794_mm256_frcz_ps(__m256 __A)
795{
796 return (__m256)__builtin_ia32_vfrczps256((__v8sf)__A);
797}
798
799static __inline__ __m256d __DEFAULT_FN_ATTRS
800_mm256_frcz_pd(__m256d __A)
801{
802 return (__m256d)__builtin_ia32_vfrczpd256((__v4df)__A);
803}
804
805#undef __DEFAULT_FN_ATTRS
806
807#endif /* __XOP__ */
808
809#endif /* __XOPINTRIN_H */
c_headers/xtestintrin.h created+41
......@@ -0,0 +1,41 @@
1/*===---- xtestintrin.h - XTEST intrinsic ---------------------------------===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23
24#ifndef __IMMINTRIN_H
25#error "Never use <xtestintrin.h> directly; include <immintrin.h> instead."
26#endif
27
28#ifndef __XTESTINTRIN_H
29#define __XTESTINTRIN_H
30
31/* xtest returns non-zero if the instruction is executed within an RTM or active
32 * HLE region. */
33/* FIXME: This can be an either or for RTM/HLE. Deal with this when HLE is
34 * supported. */
35static __inline__ int
36 __attribute__((__always_inline__, __nodebug__, __target__("rtm")))
37 _xtest(void) {
38 return __builtin_ia32_xtest();
39}
40
41#endif
src/config.h.in+2
......@@ -6,4 +6,6 @@
66#define ZIG_VERSION_PATCH @ZIG_VERSION_PATCH@
77#define ZIG_VERSION_STRING "@ZIG_VERSION@"
88
9#define ZIG_HEADERS_DIR "@CMAKE_INSTALL_PREFIX@/@C_HEADERS_DEST@"
10
911#endif
src/parseh.cpp+23-7
......@@ -1,4 +1,12 @@
1/*
2 * Copyright (c) 2015 Andrew Kelley
3 *
4 * This file is part of zig, which is MIT licensed.
5 * See http://opensource.org/licenses/MIT
6 */
7
18#include "parseh.hpp"
9#include "config.h"
210
311#include <clang-c/Index.h>
412
......@@ -14,6 +22,7 @@ struct Fn {
1422 Buf *return_type;
1523 Arg *args;
1624 int arg_count;
25 bool is_variadic;
1726};
1827
1928struct ParseH {
......@@ -254,7 +263,12 @@ static enum CXChildVisitResult visit_fn_children(CXCursor cursor, CXCursor paren
254263 assert(p->cur_fn);
255264 assert(p->arg_index < p->cur_fn->arg_count);
256265 CXString name = clang_getCursorSpelling(cursor);
257 buf_init_from_str(&p->cur_fn->args[p->arg_index].name, clang_getCString(name));
266 Buf *arg_name = &p->cur_fn->args[p->arg_index].name;
267 buf_init_from_str(arg_name, clang_getCString(name));
268 if (buf_len(arg_name) == 0) {
269 buf_appendf(arg_name, "arg%d", p->arg_index);
270 }
271
258272 p->arg_index += 1;
259273 return CXChildVisit_Continue;
260274 }
......@@ -280,11 +294,6 @@ static enum CXChildVisitResult fn_visitor(CXCursor cursor, CXCursor parent, CXCl
280294 return CXChildVisit_Continue;
281295
282296 CXType fn_type = clang_getCursorType(cursor);
283 if (clang_isFunctionTypeVariadic(fn_type)) {
284 print_location(p);
285 fprintf(stderr, "warning: skipping variadic function, not yet supported\n");
286 return CXChildVisit_Continue;
287 }
288297 if (clang_getFunctionTypeCallingConv(fn_type) != CXCallingConv_C) {
289298 print_location(p);
290299 fprintf(stderr, "warning: skipping non c calling convention function, not yet supported\n");
......@@ -294,6 +303,8 @@ static enum CXChildVisitResult fn_visitor(CXCursor cursor, CXCursor parent, CXCl
294303 assert(!p->cur_fn);
295304 p->cur_fn = allocate<Fn>(1);
296305
306 p->cur_fn->is_variadic = clang_isFunctionTypeVariadic(fn_type);
307
297308 CXType return_type = clang_getResultType(fn_type);
298309 p->cur_fn->return_type = to_zig_type(p, return_type);
299310
......@@ -353,6 +364,8 @@ void parse_h_file(const char *target_path, ZigList<const char *> *clang_argv, FI
353364 buf_init_from_str(&tmp_buf, start);
354365 clang_argv->append(buf_ptr(buf_create_from_buf(&tmp_buf)));
355366 }
367 clang_argv->append("-isystem");
368 clang_argv->append(ZIG_HEADERS_DIR);
356369
357370 clang_argv->append(nullptr);
358371
......@@ -398,10 +411,13 @@ void parse_h_file(const char *target_path, ZigList<const char *> *clang_argv, FI
398411 for (int arg_i = 0; arg_i < fn->arg_count; arg_i += 1) {
399412 Arg *arg = &fn->args[arg_i];
400413 fprintf(p->f, "%s: %s", buf_ptr(&arg->name), buf_ptr(arg->type));
401 if (arg_i + 1 < fn->arg_count) {
414 if (arg_i + 1 < fn->arg_count || fn->is_variadic) {
402415 fprintf(p->f, ", ");
403416 }
404417 }
418 if (fn->is_variadic) {
419 fprintf(p->f, "...");
420 }
405421 fprintf(p->f, ")");
406422 if (!buf_eql_str(fn->return_type, "void")) {
407423 fprintf(p->f, " -> %s", buf_ptr(fn->return_type));