1e5dd7070Spatrick /*===---- avx512dqintrin.h - AVX512DQ intrinsics ---------------------------===
2e5dd7070Spatrick  *
3e5dd7070Spatrick  * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4e5dd7070Spatrick  * See https://llvm.org/LICENSE.txt for license information.
5e5dd7070Spatrick  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6e5dd7070Spatrick  *
7e5dd7070Spatrick  *===-----------------------------------------------------------------------===
8e5dd7070Spatrick  */
9e5dd7070Spatrick 
10e5dd7070Spatrick #ifndef __IMMINTRIN_H
11e5dd7070Spatrick #error "Never use <avx512dqintrin.h> directly; include <immintrin.h> instead."
12e5dd7070Spatrick #endif
13e5dd7070Spatrick 
14e5dd7070Spatrick #ifndef __AVX512DQINTRIN_H
15e5dd7070Spatrick #define __AVX512DQINTRIN_H
16e5dd7070Spatrick 
17e5dd7070Spatrick /* Define the default attributes for the functions in this file. */
18e5dd7070Spatrick #define __DEFAULT_FN_ATTRS512 __attribute__((__always_inline__, __nodebug__, __target__("avx512dq"), __min_vector_width__(512)))
19e5dd7070Spatrick #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512dq")))
20e5dd7070Spatrick 
21e5dd7070Spatrick static __inline __mmask8 __DEFAULT_FN_ATTRS
_knot_mask8(__mmask8 __M)22e5dd7070Spatrick _knot_mask8(__mmask8 __M)
23e5dd7070Spatrick {
24e5dd7070Spatrick   return __builtin_ia32_knotqi(__M);
25e5dd7070Spatrick }
26e5dd7070Spatrick 
27e5dd7070Spatrick static __inline__ __mmask8 __DEFAULT_FN_ATTRS
_kand_mask8(__mmask8 __A,__mmask8 __B)28e5dd7070Spatrick _kand_mask8(__mmask8 __A, __mmask8 __B)
29e5dd7070Spatrick {
30e5dd7070Spatrick   return (__mmask8)__builtin_ia32_kandqi((__mmask8)__A, (__mmask8)__B);
31e5dd7070Spatrick }
32e5dd7070Spatrick 
33e5dd7070Spatrick static __inline__ __mmask8 __DEFAULT_FN_ATTRS
_kandn_mask8(__mmask8 __A,__mmask8 __B)34e5dd7070Spatrick _kandn_mask8(__mmask8 __A, __mmask8 __B)
35e5dd7070Spatrick {
36e5dd7070Spatrick   return (__mmask8)__builtin_ia32_kandnqi((__mmask8)__A, (__mmask8)__B);
37e5dd7070Spatrick }
38e5dd7070Spatrick 
39e5dd7070Spatrick static __inline__ __mmask8 __DEFAULT_FN_ATTRS
_kor_mask8(__mmask8 __A,__mmask8 __B)40e5dd7070Spatrick _kor_mask8(__mmask8 __A, __mmask8 __B)
41e5dd7070Spatrick {
42e5dd7070Spatrick   return (__mmask8)__builtin_ia32_korqi((__mmask8)__A, (__mmask8)__B);
43e5dd7070Spatrick }
44e5dd7070Spatrick 
45e5dd7070Spatrick static __inline__ __mmask8 __DEFAULT_FN_ATTRS
_kxnor_mask8(__mmask8 __A,__mmask8 __B)46e5dd7070Spatrick _kxnor_mask8(__mmask8 __A, __mmask8 __B)
47e5dd7070Spatrick {
48e5dd7070Spatrick   return (__mmask8)__builtin_ia32_kxnorqi((__mmask8)__A, (__mmask8)__B);
49e5dd7070Spatrick }
50e5dd7070Spatrick 
51e5dd7070Spatrick static __inline__ __mmask8 __DEFAULT_FN_ATTRS
_kxor_mask8(__mmask8 __A,__mmask8 __B)52e5dd7070Spatrick _kxor_mask8(__mmask8 __A, __mmask8 __B)
53e5dd7070Spatrick {
54e5dd7070Spatrick   return (__mmask8)__builtin_ia32_kxorqi((__mmask8)__A, (__mmask8)__B);
55e5dd7070Spatrick }
56e5dd7070Spatrick 
57e5dd7070Spatrick static __inline__ unsigned char __DEFAULT_FN_ATTRS
_kortestc_mask8_u8(__mmask8 __A,__mmask8 __B)58e5dd7070Spatrick _kortestc_mask8_u8(__mmask8 __A, __mmask8 __B)
59e5dd7070Spatrick {
60e5dd7070Spatrick   return (unsigned char)__builtin_ia32_kortestcqi(__A, __B);
61e5dd7070Spatrick }
62e5dd7070Spatrick 
63e5dd7070Spatrick static __inline__ unsigned char __DEFAULT_FN_ATTRS
_kortestz_mask8_u8(__mmask8 __A,__mmask8 __B)64e5dd7070Spatrick _kortestz_mask8_u8(__mmask8 __A, __mmask8 __B)
65e5dd7070Spatrick {
66e5dd7070Spatrick   return (unsigned char)__builtin_ia32_kortestzqi(__A, __B);
67e5dd7070Spatrick }
68e5dd7070Spatrick 
69e5dd7070Spatrick static __inline__ unsigned char __DEFAULT_FN_ATTRS
_kortest_mask8_u8(__mmask8 __A,__mmask8 __B,unsigned char * __C)70e5dd7070Spatrick _kortest_mask8_u8(__mmask8 __A, __mmask8 __B, unsigned char *__C) {
71e5dd7070Spatrick   *__C = (unsigned char)__builtin_ia32_kortestcqi(__A, __B);
72e5dd7070Spatrick   return (unsigned char)__builtin_ia32_kortestzqi(__A, __B);
73e5dd7070Spatrick }
74e5dd7070Spatrick 
75e5dd7070Spatrick static __inline__ unsigned char __DEFAULT_FN_ATTRS
_ktestc_mask8_u8(__mmask8 __A,__mmask8 __B)76e5dd7070Spatrick _ktestc_mask8_u8(__mmask8 __A, __mmask8 __B)
77e5dd7070Spatrick {
78e5dd7070Spatrick   return (unsigned char)__builtin_ia32_ktestcqi(__A, __B);
79e5dd7070Spatrick }
80e5dd7070Spatrick 
81e5dd7070Spatrick static __inline__ unsigned char __DEFAULT_FN_ATTRS
_ktestz_mask8_u8(__mmask8 __A,__mmask8 __B)82e5dd7070Spatrick _ktestz_mask8_u8(__mmask8 __A, __mmask8 __B)
83e5dd7070Spatrick {
84e5dd7070Spatrick   return (unsigned char)__builtin_ia32_ktestzqi(__A, __B);
85e5dd7070Spatrick }
86e5dd7070Spatrick 
87e5dd7070Spatrick static __inline__ unsigned char __DEFAULT_FN_ATTRS
_ktest_mask8_u8(__mmask8 __A,__mmask8 __B,unsigned char * __C)88e5dd7070Spatrick _ktest_mask8_u8(__mmask8 __A, __mmask8 __B, unsigned char *__C) {
89e5dd7070Spatrick   *__C = (unsigned char)__builtin_ia32_ktestcqi(__A, __B);
90e5dd7070Spatrick   return (unsigned char)__builtin_ia32_ktestzqi(__A, __B);
91e5dd7070Spatrick }
92e5dd7070Spatrick 
93e5dd7070Spatrick static __inline__ unsigned char __DEFAULT_FN_ATTRS
_ktestc_mask16_u8(__mmask16 __A,__mmask16 __B)94e5dd7070Spatrick _ktestc_mask16_u8(__mmask16 __A, __mmask16 __B)
95e5dd7070Spatrick {
96e5dd7070Spatrick   return (unsigned char)__builtin_ia32_ktestchi(__A, __B);
97e5dd7070Spatrick }
98e5dd7070Spatrick 
99e5dd7070Spatrick static __inline__ unsigned char __DEFAULT_FN_ATTRS
_ktestz_mask16_u8(__mmask16 __A,__mmask16 __B)100e5dd7070Spatrick _ktestz_mask16_u8(__mmask16 __A, __mmask16 __B)
101e5dd7070Spatrick {
102e5dd7070Spatrick   return (unsigned char)__builtin_ia32_ktestzhi(__A, __B);
103e5dd7070Spatrick }
104e5dd7070Spatrick 
105e5dd7070Spatrick static __inline__ unsigned char __DEFAULT_FN_ATTRS
_ktest_mask16_u8(__mmask16 __A,__mmask16 __B,unsigned char * __C)106e5dd7070Spatrick _ktest_mask16_u8(__mmask16 __A, __mmask16 __B, unsigned char *__C) {
107e5dd7070Spatrick   *__C = (unsigned char)__builtin_ia32_ktestchi(__A, __B);
108e5dd7070Spatrick   return (unsigned char)__builtin_ia32_ktestzhi(__A, __B);
109e5dd7070Spatrick }
110e5dd7070Spatrick 
111e5dd7070Spatrick static __inline__ __mmask8 __DEFAULT_FN_ATTRS
_kadd_mask8(__mmask8 __A,__mmask8 __B)112e5dd7070Spatrick _kadd_mask8(__mmask8 __A, __mmask8 __B)
113e5dd7070Spatrick {
114e5dd7070Spatrick   return (__mmask8)__builtin_ia32_kaddqi((__mmask8)__A, (__mmask8)__B);
115e5dd7070Spatrick }
116e5dd7070Spatrick 
117e5dd7070Spatrick static __inline__ __mmask16 __DEFAULT_FN_ATTRS
_kadd_mask16(__mmask16 __A,__mmask16 __B)118e5dd7070Spatrick _kadd_mask16(__mmask16 __A, __mmask16 __B)
119e5dd7070Spatrick {
120e5dd7070Spatrick   return (__mmask16)__builtin_ia32_kaddhi((__mmask16)__A, (__mmask16)__B);
121e5dd7070Spatrick }
122e5dd7070Spatrick 
123e5dd7070Spatrick #define _kshiftli_mask8(A, I) \
124*12c85518Srobert   ((__mmask8)__builtin_ia32_kshiftliqi((__mmask8)(A), (unsigned int)(I)))
125e5dd7070Spatrick 
126e5dd7070Spatrick #define _kshiftri_mask8(A, I) \
127*12c85518Srobert   ((__mmask8)__builtin_ia32_kshiftriqi((__mmask8)(A), (unsigned int)(I)))
128e5dd7070Spatrick 
129e5dd7070Spatrick static __inline__ unsigned int __DEFAULT_FN_ATTRS
_cvtmask8_u32(__mmask8 __A)130e5dd7070Spatrick _cvtmask8_u32(__mmask8 __A) {
131e5dd7070Spatrick   return (unsigned int)__builtin_ia32_kmovb((__mmask8)__A);
132e5dd7070Spatrick }
133e5dd7070Spatrick 
134e5dd7070Spatrick static __inline__ __mmask8 __DEFAULT_FN_ATTRS
_cvtu32_mask8(unsigned int __A)135e5dd7070Spatrick _cvtu32_mask8(unsigned int __A) {
136e5dd7070Spatrick   return (__mmask8)__builtin_ia32_kmovb((__mmask8)__A);
137e5dd7070Spatrick }
138e5dd7070Spatrick 
139e5dd7070Spatrick static __inline__ __mmask8 __DEFAULT_FN_ATTRS
_load_mask8(__mmask8 * __A)140e5dd7070Spatrick _load_mask8(__mmask8 *__A) {
141e5dd7070Spatrick   return (__mmask8)__builtin_ia32_kmovb(*(__mmask8 *)__A);
142e5dd7070Spatrick }
143e5dd7070Spatrick 
144e5dd7070Spatrick static __inline__ void __DEFAULT_FN_ATTRS
_store_mask8(__mmask8 * __A,__mmask8 __B)145e5dd7070Spatrick _store_mask8(__mmask8 *__A, __mmask8 __B) {
146e5dd7070Spatrick   *(__mmask8 *)__A = __builtin_ia32_kmovb((__mmask8)__B);
147e5dd7070Spatrick }
148e5dd7070Spatrick 
149e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_mullo_epi64(__m512i __A,__m512i __B)150e5dd7070Spatrick _mm512_mullo_epi64 (__m512i __A, __m512i __B) {
151e5dd7070Spatrick   return (__m512i) ((__v8du) __A * (__v8du) __B);
152e5dd7070Spatrick }
153e5dd7070Spatrick 
154e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_mask_mullo_epi64(__m512i __W,__mmask8 __U,__m512i __A,__m512i __B)155e5dd7070Spatrick _mm512_mask_mullo_epi64(__m512i __W, __mmask8 __U, __m512i __A, __m512i __B) {
156e5dd7070Spatrick   return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
157e5dd7070Spatrick                                              (__v8di)_mm512_mullo_epi64(__A, __B),
158e5dd7070Spatrick                                              (__v8di)__W);
159e5dd7070Spatrick }
160e5dd7070Spatrick 
161e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_maskz_mullo_epi64(__mmask8 __U,__m512i __A,__m512i __B)162e5dd7070Spatrick _mm512_maskz_mullo_epi64(__mmask8 __U, __m512i __A, __m512i __B) {
163e5dd7070Spatrick   return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U,
164e5dd7070Spatrick                                              (__v8di)_mm512_mullo_epi64(__A, __B),
165e5dd7070Spatrick                                              (__v8di)_mm512_setzero_si512());
166e5dd7070Spatrick }
167e5dd7070Spatrick 
168e5dd7070Spatrick static __inline__ __m512d __DEFAULT_FN_ATTRS512
_mm512_xor_pd(__m512d __A,__m512d __B)169e5dd7070Spatrick _mm512_xor_pd(__m512d __A, __m512d __B) {
170e5dd7070Spatrick   return (__m512d)((__v8du)__A ^ (__v8du)__B);
171e5dd7070Spatrick }
172e5dd7070Spatrick 
173e5dd7070Spatrick static __inline__ __m512d __DEFAULT_FN_ATTRS512
_mm512_mask_xor_pd(__m512d __W,__mmask8 __U,__m512d __A,__m512d __B)174e5dd7070Spatrick _mm512_mask_xor_pd(__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) {
175e5dd7070Spatrick   return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
176e5dd7070Spatrick                                               (__v8df)_mm512_xor_pd(__A, __B),
177e5dd7070Spatrick                                               (__v8df)__W);
178e5dd7070Spatrick }
179e5dd7070Spatrick 
180e5dd7070Spatrick static __inline__ __m512d __DEFAULT_FN_ATTRS512
_mm512_maskz_xor_pd(__mmask8 __U,__m512d __A,__m512d __B)181e5dd7070Spatrick _mm512_maskz_xor_pd(__mmask8 __U, __m512d __A, __m512d __B) {
182e5dd7070Spatrick   return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
183e5dd7070Spatrick                                               (__v8df)_mm512_xor_pd(__A, __B),
184e5dd7070Spatrick                                               (__v8df)_mm512_setzero_pd());
185e5dd7070Spatrick }
186e5dd7070Spatrick 
187e5dd7070Spatrick static __inline__ __m512 __DEFAULT_FN_ATTRS512
_mm512_xor_ps(__m512 __A,__m512 __B)188e5dd7070Spatrick _mm512_xor_ps (__m512 __A, __m512 __B) {
189e5dd7070Spatrick   return (__m512)((__v16su)__A ^ (__v16su)__B);
190e5dd7070Spatrick }
191e5dd7070Spatrick 
192e5dd7070Spatrick static __inline__ __m512 __DEFAULT_FN_ATTRS512
_mm512_mask_xor_ps(__m512 __W,__mmask16 __U,__m512 __A,__m512 __B)193e5dd7070Spatrick _mm512_mask_xor_ps(__m512 __W, __mmask16 __U, __m512 __A, __m512 __B) {
194e5dd7070Spatrick   return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
195e5dd7070Spatrick                                              (__v16sf)_mm512_xor_ps(__A, __B),
196e5dd7070Spatrick                                              (__v16sf)__W);
197e5dd7070Spatrick }
198e5dd7070Spatrick 
199e5dd7070Spatrick static __inline__ __m512 __DEFAULT_FN_ATTRS512
_mm512_maskz_xor_ps(__mmask16 __U,__m512 __A,__m512 __B)200e5dd7070Spatrick _mm512_maskz_xor_ps(__mmask16 __U, __m512 __A, __m512 __B) {
201e5dd7070Spatrick   return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
202e5dd7070Spatrick                                              (__v16sf)_mm512_xor_ps(__A, __B),
203e5dd7070Spatrick                                              (__v16sf)_mm512_setzero_ps());
204e5dd7070Spatrick }
205e5dd7070Spatrick 
206e5dd7070Spatrick static __inline__ __m512d __DEFAULT_FN_ATTRS512
_mm512_or_pd(__m512d __A,__m512d __B)207e5dd7070Spatrick _mm512_or_pd(__m512d __A, __m512d __B) {
208e5dd7070Spatrick   return (__m512d)((__v8du)__A | (__v8du)__B);
209e5dd7070Spatrick }
210e5dd7070Spatrick 
211e5dd7070Spatrick static __inline__ __m512d __DEFAULT_FN_ATTRS512
_mm512_mask_or_pd(__m512d __W,__mmask8 __U,__m512d __A,__m512d __B)212e5dd7070Spatrick _mm512_mask_or_pd(__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) {
213e5dd7070Spatrick   return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
214e5dd7070Spatrick                                               (__v8df)_mm512_or_pd(__A, __B),
215e5dd7070Spatrick                                               (__v8df)__W);
216e5dd7070Spatrick }
217e5dd7070Spatrick 
218e5dd7070Spatrick static __inline__ __m512d __DEFAULT_FN_ATTRS512
_mm512_maskz_or_pd(__mmask8 __U,__m512d __A,__m512d __B)219e5dd7070Spatrick _mm512_maskz_or_pd(__mmask8 __U, __m512d __A, __m512d __B) {
220e5dd7070Spatrick   return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
221e5dd7070Spatrick                                               (__v8df)_mm512_or_pd(__A, __B),
222e5dd7070Spatrick                                               (__v8df)_mm512_setzero_pd());
223e5dd7070Spatrick }
224e5dd7070Spatrick 
225e5dd7070Spatrick static __inline__ __m512 __DEFAULT_FN_ATTRS512
_mm512_or_ps(__m512 __A,__m512 __B)226e5dd7070Spatrick _mm512_or_ps(__m512 __A, __m512 __B) {
227e5dd7070Spatrick   return (__m512)((__v16su)__A | (__v16su)__B);
228e5dd7070Spatrick }
229e5dd7070Spatrick 
230e5dd7070Spatrick static __inline__ __m512 __DEFAULT_FN_ATTRS512
_mm512_mask_or_ps(__m512 __W,__mmask16 __U,__m512 __A,__m512 __B)231e5dd7070Spatrick _mm512_mask_or_ps(__m512 __W, __mmask16 __U, __m512 __A, __m512 __B) {
232e5dd7070Spatrick   return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
233e5dd7070Spatrick                                              (__v16sf)_mm512_or_ps(__A, __B),
234e5dd7070Spatrick                                              (__v16sf)__W);
235e5dd7070Spatrick }
236e5dd7070Spatrick 
237e5dd7070Spatrick static __inline__ __m512 __DEFAULT_FN_ATTRS512
_mm512_maskz_or_ps(__mmask16 __U,__m512 __A,__m512 __B)238e5dd7070Spatrick _mm512_maskz_or_ps(__mmask16 __U, __m512 __A, __m512 __B) {
239e5dd7070Spatrick   return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
240e5dd7070Spatrick                                              (__v16sf)_mm512_or_ps(__A, __B),
241e5dd7070Spatrick                                              (__v16sf)_mm512_setzero_ps());
242e5dd7070Spatrick }
243e5dd7070Spatrick 
244e5dd7070Spatrick static __inline__ __m512d __DEFAULT_FN_ATTRS512
_mm512_and_pd(__m512d __A,__m512d __B)245e5dd7070Spatrick _mm512_and_pd(__m512d __A, __m512d __B) {
246e5dd7070Spatrick   return (__m512d)((__v8du)__A & (__v8du)__B);
247e5dd7070Spatrick }
248e5dd7070Spatrick 
249e5dd7070Spatrick static __inline__ __m512d __DEFAULT_FN_ATTRS512
_mm512_mask_and_pd(__m512d __W,__mmask8 __U,__m512d __A,__m512d __B)250e5dd7070Spatrick _mm512_mask_and_pd(__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) {
251e5dd7070Spatrick   return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
252e5dd7070Spatrick                                               (__v8df)_mm512_and_pd(__A, __B),
253e5dd7070Spatrick                                               (__v8df)__W);
254e5dd7070Spatrick }
255e5dd7070Spatrick 
256e5dd7070Spatrick static __inline__ __m512d __DEFAULT_FN_ATTRS512
_mm512_maskz_and_pd(__mmask8 __U,__m512d __A,__m512d __B)257e5dd7070Spatrick _mm512_maskz_and_pd(__mmask8 __U, __m512d __A, __m512d __B) {
258e5dd7070Spatrick   return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
259e5dd7070Spatrick                                               (__v8df)_mm512_and_pd(__A, __B),
260e5dd7070Spatrick                                               (__v8df)_mm512_setzero_pd());
261e5dd7070Spatrick }
262e5dd7070Spatrick 
263e5dd7070Spatrick static __inline__ __m512 __DEFAULT_FN_ATTRS512
_mm512_and_ps(__m512 __A,__m512 __B)264e5dd7070Spatrick _mm512_and_ps(__m512 __A, __m512 __B) {
265e5dd7070Spatrick   return (__m512)((__v16su)__A & (__v16su)__B);
266e5dd7070Spatrick }
267e5dd7070Spatrick 
268e5dd7070Spatrick static __inline__ __m512 __DEFAULT_FN_ATTRS512
_mm512_mask_and_ps(__m512 __W,__mmask16 __U,__m512 __A,__m512 __B)269e5dd7070Spatrick _mm512_mask_and_ps(__m512 __W, __mmask16 __U, __m512 __A, __m512 __B) {
270e5dd7070Spatrick   return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
271e5dd7070Spatrick                                              (__v16sf)_mm512_and_ps(__A, __B),
272e5dd7070Spatrick                                              (__v16sf)__W);
273e5dd7070Spatrick }
274e5dd7070Spatrick 
275e5dd7070Spatrick static __inline__ __m512 __DEFAULT_FN_ATTRS512
_mm512_maskz_and_ps(__mmask16 __U,__m512 __A,__m512 __B)276e5dd7070Spatrick _mm512_maskz_and_ps(__mmask16 __U, __m512 __A, __m512 __B) {
277e5dd7070Spatrick   return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
278e5dd7070Spatrick                                              (__v16sf)_mm512_and_ps(__A, __B),
279e5dd7070Spatrick                                              (__v16sf)_mm512_setzero_ps());
280e5dd7070Spatrick }
281e5dd7070Spatrick 
282e5dd7070Spatrick static __inline__ __m512d __DEFAULT_FN_ATTRS512
_mm512_andnot_pd(__m512d __A,__m512d __B)283e5dd7070Spatrick _mm512_andnot_pd(__m512d __A, __m512d __B) {
284e5dd7070Spatrick   return (__m512d)(~(__v8du)__A & (__v8du)__B);
285e5dd7070Spatrick }
286e5dd7070Spatrick 
287e5dd7070Spatrick static __inline__ __m512d __DEFAULT_FN_ATTRS512
_mm512_mask_andnot_pd(__m512d __W,__mmask8 __U,__m512d __A,__m512d __B)288e5dd7070Spatrick _mm512_mask_andnot_pd(__m512d __W, __mmask8 __U, __m512d __A, __m512d __B) {
289e5dd7070Spatrick   return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
290e5dd7070Spatrick                                               (__v8df)_mm512_andnot_pd(__A, __B),
291e5dd7070Spatrick                                               (__v8df)__W);
292e5dd7070Spatrick }
293e5dd7070Spatrick 
294e5dd7070Spatrick static __inline__ __m512d __DEFAULT_FN_ATTRS512
_mm512_maskz_andnot_pd(__mmask8 __U,__m512d __A,__m512d __B)295e5dd7070Spatrick _mm512_maskz_andnot_pd(__mmask8 __U, __m512d __A, __m512d __B) {
296e5dd7070Spatrick   return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
297e5dd7070Spatrick                                               (__v8df)_mm512_andnot_pd(__A, __B),
298e5dd7070Spatrick                                               (__v8df)_mm512_setzero_pd());
299e5dd7070Spatrick }
300e5dd7070Spatrick 
301e5dd7070Spatrick static __inline__ __m512 __DEFAULT_FN_ATTRS512
_mm512_andnot_ps(__m512 __A,__m512 __B)302e5dd7070Spatrick _mm512_andnot_ps(__m512 __A, __m512 __B) {
303e5dd7070Spatrick   return (__m512)(~(__v16su)__A & (__v16su)__B);
304e5dd7070Spatrick }
305e5dd7070Spatrick 
306e5dd7070Spatrick static __inline__ __m512 __DEFAULT_FN_ATTRS512
_mm512_mask_andnot_ps(__m512 __W,__mmask16 __U,__m512 __A,__m512 __B)307e5dd7070Spatrick _mm512_mask_andnot_ps(__m512 __W, __mmask16 __U, __m512 __A, __m512 __B) {
308e5dd7070Spatrick   return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
309e5dd7070Spatrick                                              (__v16sf)_mm512_andnot_ps(__A, __B),
310e5dd7070Spatrick                                              (__v16sf)__W);
311e5dd7070Spatrick }
312e5dd7070Spatrick 
313e5dd7070Spatrick static __inline__ __m512 __DEFAULT_FN_ATTRS512
_mm512_maskz_andnot_ps(__mmask16 __U,__m512 __A,__m512 __B)314e5dd7070Spatrick _mm512_maskz_andnot_ps(__mmask16 __U, __m512 __A, __m512 __B) {
315e5dd7070Spatrick   return (__m512)__builtin_ia32_selectps_512((__mmask16)__U,
316e5dd7070Spatrick                                              (__v16sf)_mm512_andnot_ps(__A, __B),
317e5dd7070Spatrick                                              (__v16sf)_mm512_setzero_ps());
318e5dd7070Spatrick }
319e5dd7070Spatrick 
320e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_cvtpd_epi64(__m512d __A)321e5dd7070Spatrick _mm512_cvtpd_epi64 (__m512d __A) {
322e5dd7070Spatrick   return (__m512i) __builtin_ia32_cvtpd2qq512_mask ((__v8df) __A,
323e5dd7070Spatrick                 (__v8di) _mm512_setzero_si512(),
324e5dd7070Spatrick                 (__mmask8) -1,
325e5dd7070Spatrick                 _MM_FROUND_CUR_DIRECTION);
326e5dd7070Spatrick }
327e5dd7070Spatrick 
328e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_mask_cvtpd_epi64(__m512i __W,__mmask8 __U,__m512d __A)329e5dd7070Spatrick _mm512_mask_cvtpd_epi64 (__m512i __W, __mmask8 __U, __m512d __A) {
330e5dd7070Spatrick   return (__m512i) __builtin_ia32_cvtpd2qq512_mask ((__v8df) __A,
331e5dd7070Spatrick                 (__v8di) __W,
332e5dd7070Spatrick                 (__mmask8) __U,
333e5dd7070Spatrick                 _MM_FROUND_CUR_DIRECTION);
334e5dd7070Spatrick }
335e5dd7070Spatrick 
336e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_maskz_cvtpd_epi64(__mmask8 __U,__m512d __A)337e5dd7070Spatrick _mm512_maskz_cvtpd_epi64 (__mmask8 __U, __m512d __A) {
338e5dd7070Spatrick   return (__m512i) __builtin_ia32_cvtpd2qq512_mask ((__v8df) __A,
339e5dd7070Spatrick                 (__v8di) _mm512_setzero_si512(),
340e5dd7070Spatrick                 (__mmask8) __U,
341e5dd7070Spatrick                 _MM_FROUND_CUR_DIRECTION);
342e5dd7070Spatrick }
343e5dd7070Spatrick 
344e5dd7070Spatrick #define _mm512_cvt_roundpd_epi64(A, R) \
345*12c85518Srobert   ((__m512i)__builtin_ia32_cvtpd2qq512_mask((__v8df)(__m512d)(A), \
346e5dd7070Spatrick                                             (__v8di)_mm512_setzero_si512(), \
347*12c85518Srobert                                             (__mmask8)-1, (int)(R)))
348e5dd7070Spatrick 
349e5dd7070Spatrick #define _mm512_mask_cvt_roundpd_epi64(W, U, A, R) \
350*12c85518Srobert   ((__m512i)__builtin_ia32_cvtpd2qq512_mask((__v8df)(__m512d)(A), \
351e5dd7070Spatrick                                             (__v8di)(__m512i)(W), \
352*12c85518Srobert                                             (__mmask8)(U), (int)(R)))
353e5dd7070Spatrick 
354e5dd7070Spatrick #define _mm512_maskz_cvt_roundpd_epi64(U, A, R) \
355*12c85518Srobert   ((__m512i)__builtin_ia32_cvtpd2qq512_mask((__v8df)(__m512d)(A), \
356e5dd7070Spatrick                                             (__v8di)_mm512_setzero_si512(), \
357*12c85518Srobert                                             (__mmask8)(U), (int)(R)))
358e5dd7070Spatrick 
359e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_cvtpd_epu64(__m512d __A)360e5dd7070Spatrick _mm512_cvtpd_epu64 (__m512d __A) {
361e5dd7070Spatrick   return (__m512i) __builtin_ia32_cvtpd2uqq512_mask ((__v8df) __A,
362e5dd7070Spatrick                  (__v8di) _mm512_setzero_si512(),
363e5dd7070Spatrick                  (__mmask8) -1,
364e5dd7070Spatrick                  _MM_FROUND_CUR_DIRECTION);
365e5dd7070Spatrick }
366e5dd7070Spatrick 
367e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_mask_cvtpd_epu64(__m512i __W,__mmask8 __U,__m512d __A)368e5dd7070Spatrick _mm512_mask_cvtpd_epu64 (__m512i __W, __mmask8 __U, __m512d __A) {
369e5dd7070Spatrick   return (__m512i) __builtin_ia32_cvtpd2uqq512_mask ((__v8df) __A,
370e5dd7070Spatrick                  (__v8di) __W,
371e5dd7070Spatrick                  (__mmask8) __U,
372e5dd7070Spatrick                  _MM_FROUND_CUR_DIRECTION);
373e5dd7070Spatrick }
374e5dd7070Spatrick 
375e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_maskz_cvtpd_epu64(__mmask8 __U,__m512d __A)376e5dd7070Spatrick _mm512_maskz_cvtpd_epu64 (__mmask8 __U, __m512d __A) {
377e5dd7070Spatrick   return (__m512i) __builtin_ia32_cvtpd2uqq512_mask ((__v8df) __A,
378e5dd7070Spatrick                  (__v8di) _mm512_setzero_si512(),
379e5dd7070Spatrick                  (__mmask8) __U,
380e5dd7070Spatrick                  _MM_FROUND_CUR_DIRECTION);
381e5dd7070Spatrick }
382e5dd7070Spatrick 
383e5dd7070Spatrick #define _mm512_cvt_roundpd_epu64(A, R) \
384*12c85518Srobert   ((__m512i)__builtin_ia32_cvtpd2uqq512_mask((__v8df)(__m512d)(A), \
385e5dd7070Spatrick                                              (__v8di)_mm512_setzero_si512(), \
386*12c85518Srobert                                              (__mmask8)-1, (int)(R)))
387e5dd7070Spatrick 
388e5dd7070Spatrick #define _mm512_mask_cvt_roundpd_epu64(W, U, A, R) \
389*12c85518Srobert   ((__m512i)__builtin_ia32_cvtpd2uqq512_mask((__v8df)(__m512d)(A), \
390e5dd7070Spatrick                                              (__v8di)(__m512i)(W), \
391*12c85518Srobert                                              (__mmask8)(U), (int)(R)))
392e5dd7070Spatrick 
393e5dd7070Spatrick #define _mm512_maskz_cvt_roundpd_epu64(U, A, R) \
394*12c85518Srobert   ((__m512i)__builtin_ia32_cvtpd2uqq512_mask((__v8df)(__m512d)(A), \
395e5dd7070Spatrick                                              (__v8di)_mm512_setzero_si512(), \
396*12c85518Srobert                                              (__mmask8)(U), (int)(R)))
397e5dd7070Spatrick 
398e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_cvtps_epi64(__m256 __A)399e5dd7070Spatrick _mm512_cvtps_epi64 (__m256 __A) {
400e5dd7070Spatrick   return (__m512i) __builtin_ia32_cvtps2qq512_mask ((__v8sf) __A,
401e5dd7070Spatrick                 (__v8di) _mm512_setzero_si512(),
402e5dd7070Spatrick                 (__mmask8) -1,
403e5dd7070Spatrick                 _MM_FROUND_CUR_DIRECTION);
404e5dd7070Spatrick }
405e5dd7070Spatrick 
406e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_mask_cvtps_epi64(__m512i __W,__mmask8 __U,__m256 __A)407e5dd7070Spatrick _mm512_mask_cvtps_epi64 (__m512i __W, __mmask8 __U, __m256 __A) {
408e5dd7070Spatrick   return (__m512i) __builtin_ia32_cvtps2qq512_mask ((__v8sf) __A,
409e5dd7070Spatrick                 (__v8di) __W,
410e5dd7070Spatrick                 (__mmask8) __U,
411e5dd7070Spatrick                 _MM_FROUND_CUR_DIRECTION);
412e5dd7070Spatrick }
413e5dd7070Spatrick 
414e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_maskz_cvtps_epi64(__mmask8 __U,__m256 __A)415e5dd7070Spatrick _mm512_maskz_cvtps_epi64 (__mmask8 __U, __m256 __A) {
416e5dd7070Spatrick   return (__m512i) __builtin_ia32_cvtps2qq512_mask ((__v8sf) __A,
417e5dd7070Spatrick                 (__v8di) _mm512_setzero_si512(),
418e5dd7070Spatrick                 (__mmask8) __U,
419e5dd7070Spatrick                 _MM_FROUND_CUR_DIRECTION);
420e5dd7070Spatrick }
421e5dd7070Spatrick 
422e5dd7070Spatrick #define _mm512_cvt_roundps_epi64(A, R) \
423*12c85518Srobert   ((__m512i)__builtin_ia32_cvtps2qq512_mask((__v8sf)(__m256)(A), \
424e5dd7070Spatrick                                             (__v8di)_mm512_setzero_si512(), \
425*12c85518Srobert                                             (__mmask8)-1, (int)(R)))
426e5dd7070Spatrick 
427e5dd7070Spatrick #define _mm512_mask_cvt_roundps_epi64(W, U, A, R) \
428*12c85518Srobert   ((__m512i)__builtin_ia32_cvtps2qq512_mask((__v8sf)(__m256)(A), \
429e5dd7070Spatrick                                             (__v8di)(__m512i)(W), \
430*12c85518Srobert                                             (__mmask8)(U), (int)(R)))
431e5dd7070Spatrick 
432e5dd7070Spatrick #define _mm512_maskz_cvt_roundps_epi64(U, A, R) \
433*12c85518Srobert   ((__m512i)__builtin_ia32_cvtps2qq512_mask((__v8sf)(__m256)(A), \
434e5dd7070Spatrick                                             (__v8di)_mm512_setzero_si512(), \
435*12c85518Srobert                                             (__mmask8)(U), (int)(R)))
436e5dd7070Spatrick 
437e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_cvtps_epu64(__m256 __A)438e5dd7070Spatrick _mm512_cvtps_epu64 (__m256 __A) {
439e5dd7070Spatrick   return (__m512i) __builtin_ia32_cvtps2uqq512_mask ((__v8sf) __A,
440e5dd7070Spatrick                  (__v8di) _mm512_setzero_si512(),
441e5dd7070Spatrick                  (__mmask8) -1,
442e5dd7070Spatrick                  _MM_FROUND_CUR_DIRECTION);
443e5dd7070Spatrick }
444e5dd7070Spatrick 
445e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_mask_cvtps_epu64(__m512i __W,__mmask8 __U,__m256 __A)446e5dd7070Spatrick _mm512_mask_cvtps_epu64 (__m512i __W, __mmask8 __U, __m256 __A) {
447e5dd7070Spatrick   return (__m512i) __builtin_ia32_cvtps2uqq512_mask ((__v8sf) __A,
448e5dd7070Spatrick                  (__v8di) __W,
449e5dd7070Spatrick                  (__mmask8) __U,
450e5dd7070Spatrick                  _MM_FROUND_CUR_DIRECTION);
451e5dd7070Spatrick }
452e5dd7070Spatrick 
453e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_maskz_cvtps_epu64(__mmask8 __U,__m256 __A)454e5dd7070Spatrick _mm512_maskz_cvtps_epu64 (__mmask8 __U, __m256 __A) {
455e5dd7070Spatrick   return (__m512i) __builtin_ia32_cvtps2uqq512_mask ((__v8sf) __A,
456e5dd7070Spatrick                  (__v8di) _mm512_setzero_si512(),
457e5dd7070Spatrick                  (__mmask8) __U,
458e5dd7070Spatrick                  _MM_FROUND_CUR_DIRECTION);
459e5dd7070Spatrick }
460e5dd7070Spatrick 
461e5dd7070Spatrick #define _mm512_cvt_roundps_epu64(A, R) \
462*12c85518Srobert   ((__m512i)__builtin_ia32_cvtps2uqq512_mask((__v8sf)(__m256)(A), \
463e5dd7070Spatrick                                              (__v8di)_mm512_setzero_si512(), \
464*12c85518Srobert                                              (__mmask8)-1, (int)(R)))
465e5dd7070Spatrick 
466e5dd7070Spatrick #define _mm512_mask_cvt_roundps_epu64(W, U, A, R) \
467*12c85518Srobert   ((__m512i)__builtin_ia32_cvtps2uqq512_mask((__v8sf)(__m256)(A), \
468e5dd7070Spatrick                                              (__v8di)(__m512i)(W), \
469*12c85518Srobert                                              (__mmask8)(U), (int)(R)))
470e5dd7070Spatrick 
471e5dd7070Spatrick #define _mm512_maskz_cvt_roundps_epu64(U, A, R) \
472*12c85518Srobert   ((__m512i)__builtin_ia32_cvtps2uqq512_mask((__v8sf)(__m256)(A), \
473e5dd7070Spatrick                                              (__v8di)_mm512_setzero_si512(), \
474*12c85518Srobert                                              (__mmask8)(U), (int)(R)))
475e5dd7070Spatrick 
476e5dd7070Spatrick 
477e5dd7070Spatrick static __inline__ __m512d __DEFAULT_FN_ATTRS512
_mm512_cvtepi64_pd(__m512i __A)478e5dd7070Spatrick _mm512_cvtepi64_pd (__m512i __A) {
479e5dd7070Spatrick   return (__m512d)__builtin_convertvector((__v8di)__A, __v8df);
480e5dd7070Spatrick }
481e5dd7070Spatrick 
482e5dd7070Spatrick static __inline__ __m512d __DEFAULT_FN_ATTRS512
_mm512_mask_cvtepi64_pd(__m512d __W,__mmask8 __U,__m512i __A)483e5dd7070Spatrick _mm512_mask_cvtepi64_pd (__m512d __W, __mmask8 __U, __m512i __A) {
484e5dd7070Spatrick   return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
485e5dd7070Spatrick                                               (__v8df)_mm512_cvtepi64_pd(__A),
486e5dd7070Spatrick                                               (__v8df)__W);
487e5dd7070Spatrick }
488e5dd7070Spatrick 
489e5dd7070Spatrick static __inline__ __m512d __DEFAULT_FN_ATTRS512
_mm512_maskz_cvtepi64_pd(__mmask8 __U,__m512i __A)490e5dd7070Spatrick _mm512_maskz_cvtepi64_pd (__mmask8 __U, __m512i __A) {
491e5dd7070Spatrick   return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
492e5dd7070Spatrick                                               (__v8df)_mm512_cvtepi64_pd(__A),
493e5dd7070Spatrick                                               (__v8df)_mm512_setzero_pd());
494e5dd7070Spatrick }
495e5dd7070Spatrick 
496e5dd7070Spatrick #define _mm512_cvt_roundepi64_pd(A, R) \
497*12c85518Srobert   ((__m512d)__builtin_ia32_cvtqq2pd512_mask((__v8di)(__m512i)(A), \
498e5dd7070Spatrick                                             (__v8df)_mm512_setzero_pd(), \
499*12c85518Srobert                                             (__mmask8)-1, (int)(R)))
500e5dd7070Spatrick 
501e5dd7070Spatrick #define _mm512_mask_cvt_roundepi64_pd(W, U, A, R) \
502*12c85518Srobert   ((__m512d)__builtin_ia32_cvtqq2pd512_mask((__v8di)(__m512i)(A), \
503e5dd7070Spatrick                                             (__v8df)(__m512d)(W), \
504*12c85518Srobert                                             (__mmask8)(U), (int)(R)))
505e5dd7070Spatrick 
506e5dd7070Spatrick #define _mm512_maskz_cvt_roundepi64_pd(U, A, R) \
507*12c85518Srobert   ((__m512d)__builtin_ia32_cvtqq2pd512_mask((__v8di)(__m512i)(A), \
508e5dd7070Spatrick                                             (__v8df)_mm512_setzero_pd(), \
509*12c85518Srobert                                             (__mmask8)(U), (int)(R)))
510e5dd7070Spatrick 
511e5dd7070Spatrick static __inline__ __m256 __DEFAULT_FN_ATTRS512
_mm512_cvtepi64_ps(__m512i __A)512e5dd7070Spatrick _mm512_cvtepi64_ps (__m512i __A) {
513e5dd7070Spatrick   return (__m256) __builtin_ia32_cvtqq2ps512_mask ((__v8di) __A,
514e5dd7070Spatrick                (__v8sf) _mm256_setzero_ps(),
515e5dd7070Spatrick                (__mmask8) -1,
516e5dd7070Spatrick                _MM_FROUND_CUR_DIRECTION);
517e5dd7070Spatrick }
518e5dd7070Spatrick 
519e5dd7070Spatrick static __inline__ __m256 __DEFAULT_FN_ATTRS512
_mm512_mask_cvtepi64_ps(__m256 __W,__mmask8 __U,__m512i __A)520e5dd7070Spatrick _mm512_mask_cvtepi64_ps (__m256 __W, __mmask8 __U, __m512i __A) {
521e5dd7070Spatrick   return (__m256) __builtin_ia32_cvtqq2ps512_mask ((__v8di) __A,
522e5dd7070Spatrick                (__v8sf) __W,
523e5dd7070Spatrick                (__mmask8) __U,
524e5dd7070Spatrick                _MM_FROUND_CUR_DIRECTION);
525e5dd7070Spatrick }
526e5dd7070Spatrick 
527e5dd7070Spatrick static __inline__ __m256 __DEFAULT_FN_ATTRS512
_mm512_maskz_cvtepi64_ps(__mmask8 __U,__m512i __A)528e5dd7070Spatrick _mm512_maskz_cvtepi64_ps (__mmask8 __U, __m512i __A) {
529e5dd7070Spatrick   return (__m256) __builtin_ia32_cvtqq2ps512_mask ((__v8di) __A,
530e5dd7070Spatrick                (__v8sf) _mm256_setzero_ps(),
531e5dd7070Spatrick                (__mmask8) __U,
532e5dd7070Spatrick                _MM_FROUND_CUR_DIRECTION);
533e5dd7070Spatrick }
534e5dd7070Spatrick 
535e5dd7070Spatrick #define _mm512_cvt_roundepi64_ps(A, R) \
536*12c85518Srobert   ((__m256)__builtin_ia32_cvtqq2ps512_mask((__v8di)(__m512i)(A), \
537e5dd7070Spatrick                                            (__v8sf)_mm256_setzero_ps(), \
538*12c85518Srobert                                            (__mmask8)-1, (int)(R)))
539e5dd7070Spatrick 
540e5dd7070Spatrick #define _mm512_mask_cvt_roundepi64_ps(W, U, A, R) \
541*12c85518Srobert   ((__m256)__builtin_ia32_cvtqq2ps512_mask((__v8di)(__m512i)(A), \
542e5dd7070Spatrick                                            (__v8sf)(__m256)(W), (__mmask8)(U), \
543*12c85518Srobert                                            (int)(R)))
544e5dd7070Spatrick 
545e5dd7070Spatrick #define _mm512_maskz_cvt_roundepi64_ps(U, A, R) \
546*12c85518Srobert   ((__m256)__builtin_ia32_cvtqq2ps512_mask((__v8di)(__m512i)(A), \
547e5dd7070Spatrick                                            (__v8sf)_mm256_setzero_ps(), \
548*12c85518Srobert                                            (__mmask8)(U), (int)(R)))
549e5dd7070Spatrick 
550e5dd7070Spatrick 
551e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_cvttpd_epi64(__m512d __A)552e5dd7070Spatrick _mm512_cvttpd_epi64 (__m512d __A) {
553e5dd7070Spatrick   return (__m512i) __builtin_ia32_cvttpd2qq512_mask ((__v8df) __A,
554e5dd7070Spatrick                  (__v8di) _mm512_setzero_si512(),
555e5dd7070Spatrick                  (__mmask8) -1,
556e5dd7070Spatrick                  _MM_FROUND_CUR_DIRECTION);
557e5dd7070Spatrick }
558e5dd7070Spatrick 
559e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_mask_cvttpd_epi64(__m512i __W,__mmask8 __U,__m512d __A)560e5dd7070Spatrick _mm512_mask_cvttpd_epi64 (__m512i __W, __mmask8 __U, __m512d __A) {
561e5dd7070Spatrick   return (__m512i) __builtin_ia32_cvttpd2qq512_mask ((__v8df) __A,
562e5dd7070Spatrick                  (__v8di) __W,
563e5dd7070Spatrick                  (__mmask8) __U,
564e5dd7070Spatrick                  _MM_FROUND_CUR_DIRECTION);
565e5dd7070Spatrick }
566e5dd7070Spatrick 
567e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_maskz_cvttpd_epi64(__mmask8 __U,__m512d __A)568e5dd7070Spatrick _mm512_maskz_cvttpd_epi64 (__mmask8 __U, __m512d __A) {
569e5dd7070Spatrick   return (__m512i) __builtin_ia32_cvttpd2qq512_mask ((__v8df) __A,
570e5dd7070Spatrick                  (__v8di) _mm512_setzero_si512(),
571e5dd7070Spatrick                  (__mmask8) __U,
572e5dd7070Spatrick                  _MM_FROUND_CUR_DIRECTION);
573e5dd7070Spatrick }
574e5dd7070Spatrick 
575e5dd7070Spatrick #define _mm512_cvtt_roundpd_epi64(A, R) \
576*12c85518Srobert   ((__m512i)__builtin_ia32_cvttpd2qq512_mask((__v8df)(__m512d)(A), \
577e5dd7070Spatrick                                              (__v8di)_mm512_setzero_si512(), \
578*12c85518Srobert                                              (__mmask8)-1, (int)(R)))
579e5dd7070Spatrick 
580e5dd7070Spatrick #define _mm512_mask_cvtt_roundpd_epi64(W, U, A, R) \
581*12c85518Srobert   ((__m512i)__builtin_ia32_cvttpd2qq512_mask((__v8df)(__m512d)(A), \
582e5dd7070Spatrick                                              (__v8di)(__m512i)(W), \
583*12c85518Srobert                                              (__mmask8)(U), (int)(R)))
584e5dd7070Spatrick 
585e5dd7070Spatrick #define _mm512_maskz_cvtt_roundpd_epi64(U, A, R) \
586*12c85518Srobert   ((__m512i)__builtin_ia32_cvttpd2qq512_mask((__v8df)(__m512d)(A), \
587e5dd7070Spatrick                                              (__v8di)_mm512_setzero_si512(), \
588*12c85518Srobert                                              (__mmask8)(U), (int)(R)))
589e5dd7070Spatrick 
590e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_cvttpd_epu64(__m512d __A)591e5dd7070Spatrick _mm512_cvttpd_epu64 (__m512d __A) {
592e5dd7070Spatrick   return (__m512i) __builtin_ia32_cvttpd2uqq512_mask ((__v8df) __A,
593e5dd7070Spatrick                   (__v8di) _mm512_setzero_si512(),
594e5dd7070Spatrick                   (__mmask8) -1,
595e5dd7070Spatrick                   _MM_FROUND_CUR_DIRECTION);
596e5dd7070Spatrick }
597e5dd7070Spatrick 
598e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_mask_cvttpd_epu64(__m512i __W,__mmask8 __U,__m512d __A)599e5dd7070Spatrick _mm512_mask_cvttpd_epu64 (__m512i __W, __mmask8 __U, __m512d __A) {
600e5dd7070Spatrick   return (__m512i) __builtin_ia32_cvttpd2uqq512_mask ((__v8df) __A,
601e5dd7070Spatrick                   (__v8di) __W,
602e5dd7070Spatrick                   (__mmask8) __U,
603e5dd7070Spatrick                   _MM_FROUND_CUR_DIRECTION);
604e5dd7070Spatrick }
605e5dd7070Spatrick 
606e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_maskz_cvttpd_epu64(__mmask8 __U,__m512d __A)607e5dd7070Spatrick _mm512_maskz_cvttpd_epu64 (__mmask8 __U, __m512d __A) {
608e5dd7070Spatrick   return (__m512i) __builtin_ia32_cvttpd2uqq512_mask ((__v8df) __A,
609e5dd7070Spatrick                   (__v8di) _mm512_setzero_si512(),
610e5dd7070Spatrick                   (__mmask8) __U,
611e5dd7070Spatrick                   _MM_FROUND_CUR_DIRECTION);
612e5dd7070Spatrick }
613e5dd7070Spatrick 
614e5dd7070Spatrick #define _mm512_cvtt_roundpd_epu64(A, R) \
615*12c85518Srobert   ((__m512i)__builtin_ia32_cvttpd2uqq512_mask((__v8df)(__m512d)(A), \
616e5dd7070Spatrick                                               (__v8di)_mm512_setzero_si512(), \
617*12c85518Srobert                                               (__mmask8)-1, (int)(R)))
618e5dd7070Spatrick 
619e5dd7070Spatrick #define _mm512_mask_cvtt_roundpd_epu64(W, U, A, R) \
620*12c85518Srobert   ((__m512i)__builtin_ia32_cvttpd2uqq512_mask((__v8df)(__m512d)(A), \
621e5dd7070Spatrick                                               (__v8di)(__m512i)(W), \
622*12c85518Srobert                                               (__mmask8)(U), (int)(R)))
623e5dd7070Spatrick 
624e5dd7070Spatrick #define _mm512_maskz_cvtt_roundpd_epu64(U, A, R) \
625*12c85518Srobert   ((__m512i)__builtin_ia32_cvttpd2uqq512_mask((__v8df)(__m512d)(A), \
626e5dd7070Spatrick                                               (__v8di)_mm512_setzero_si512(), \
627*12c85518Srobert                                               (__mmask8)(U), (int)(R)))
628e5dd7070Spatrick 
629e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_cvttps_epi64(__m256 __A)630e5dd7070Spatrick _mm512_cvttps_epi64 (__m256 __A) {
631e5dd7070Spatrick   return (__m512i) __builtin_ia32_cvttps2qq512_mask ((__v8sf) __A,
632e5dd7070Spatrick                  (__v8di) _mm512_setzero_si512(),
633e5dd7070Spatrick                  (__mmask8) -1,
634e5dd7070Spatrick                  _MM_FROUND_CUR_DIRECTION);
635e5dd7070Spatrick }
636e5dd7070Spatrick 
637e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_mask_cvttps_epi64(__m512i __W,__mmask8 __U,__m256 __A)638e5dd7070Spatrick _mm512_mask_cvttps_epi64 (__m512i __W, __mmask8 __U, __m256 __A) {
639e5dd7070Spatrick   return (__m512i) __builtin_ia32_cvttps2qq512_mask ((__v8sf) __A,
640e5dd7070Spatrick                  (__v8di) __W,
641e5dd7070Spatrick                  (__mmask8) __U,
642e5dd7070Spatrick                  _MM_FROUND_CUR_DIRECTION);
643e5dd7070Spatrick }
644e5dd7070Spatrick 
645e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_maskz_cvttps_epi64(__mmask8 __U,__m256 __A)646e5dd7070Spatrick _mm512_maskz_cvttps_epi64 (__mmask8 __U, __m256 __A) {
647e5dd7070Spatrick   return (__m512i) __builtin_ia32_cvttps2qq512_mask ((__v8sf) __A,
648e5dd7070Spatrick                  (__v8di) _mm512_setzero_si512(),
649e5dd7070Spatrick                  (__mmask8) __U,
650e5dd7070Spatrick                  _MM_FROUND_CUR_DIRECTION);
651e5dd7070Spatrick }
652e5dd7070Spatrick 
653e5dd7070Spatrick #define _mm512_cvtt_roundps_epi64(A, R) \
654*12c85518Srobert   ((__m512i)__builtin_ia32_cvttps2qq512_mask((__v8sf)(__m256)(A), \
655e5dd7070Spatrick                                              (__v8di)_mm512_setzero_si512(), \
656*12c85518Srobert                                              (__mmask8)-1, (int)(R)))
657e5dd7070Spatrick 
658e5dd7070Spatrick #define _mm512_mask_cvtt_roundps_epi64(W, U, A, R) \
659*12c85518Srobert   ((__m512i)__builtin_ia32_cvttps2qq512_mask((__v8sf)(__m256)(A), \
660e5dd7070Spatrick                                              (__v8di)(__m512i)(W), \
661*12c85518Srobert                                              (__mmask8)(U), (int)(R)))
662e5dd7070Spatrick 
663e5dd7070Spatrick #define _mm512_maskz_cvtt_roundps_epi64(U, A, R) \
664*12c85518Srobert   ((__m512i)__builtin_ia32_cvttps2qq512_mask((__v8sf)(__m256)(A), \
665e5dd7070Spatrick                                              (__v8di)_mm512_setzero_si512(), \
666*12c85518Srobert                                              (__mmask8)(U), (int)(R)))
667e5dd7070Spatrick 
668e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_cvttps_epu64(__m256 __A)669e5dd7070Spatrick _mm512_cvttps_epu64 (__m256 __A) {
670e5dd7070Spatrick   return (__m512i) __builtin_ia32_cvttps2uqq512_mask ((__v8sf) __A,
671e5dd7070Spatrick                   (__v8di) _mm512_setzero_si512(),
672e5dd7070Spatrick                   (__mmask8) -1,
673e5dd7070Spatrick                   _MM_FROUND_CUR_DIRECTION);
674e5dd7070Spatrick }
675e5dd7070Spatrick 
676e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_mask_cvttps_epu64(__m512i __W,__mmask8 __U,__m256 __A)677e5dd7070Spatrick _mm512_mask_cvttps_epu64 (__m512i __W, __mmask8 __U, __m256 __A) {
678e5dd7070Spatrick   return (__m512i) __builtin_ia32_cvttps2uqq512_mask ((__v8sf) __A,
679e5dd7070Spatrick                   (__v8di) __W,
680e5dd7070Spatrick                   (__mmask8) __U,
681e5dd7070Spatrick                   _MM_FROUND_CUR_DIRECTION);
682e5dd7070Spatrick }
683e5dd7070Spatrick 
684e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_maskz_cvttps_epu64(__mmask8 __U,__m256 __A)685e5dd7070Spatrick _mm512_maskz_cvttps_epu64 (__mmask8 __U, __m256 __A) {
686e5dd7070Spatrick   return (__m512i) __builtin_ia32_cvttps2uqq512_mask ((__v8sf) __A,
687e5dd7070Spatrick                   (__v8di) _mm512_setzero_si512(),
688e5dd7070Spatrick                   (__mmask8) __U,
689e5dd7070Spatrick                   _MM_FROUND_CUR_DIRECTION);
690e5dd7070Spatrick }
691e5dd7070Spatrick 
692e5dd7070Spatrick #define _mm512_cvtt_roundps_epu64(A, R) \
693*12c85518Srobert   ((__m512i)__builtin_ia32_cvttps2uqq512_mask((__v8sf)(__m256)(A), \
694e5dd7070Spatrick                                               (__v8di)_mm512_setzero_si512(), \
695*12c85518Srobert                                               (__mmask8)-1, (int)(R)))
696e5dd7070Spatrick 
697e5dd7070Spatrick #define _mm512_mask_cvtt_roundps_epu64(W, U, A, R) \
698*12c85518Srobert   ((__m512i)__builtin_ia32_cvttps2uqq512_mask((__v8sf)(__m256)(A), \
699e5dd7070Spatrick                                               (__v8di)(__m512i)(W), \
700*12c85518Srobert                                               (__mmask8)(U), (int)(R)))
701e5dd7070Spatrick 
702e5dd7070Spatrick #define _mm512_maskz_cvtt_roundps_epu64(U, A, R) \
703*12c85518Srobert   ((__m512i)__builtin_ia32_cvttps2uqq512_mask((__v8sf)(__m256)(A), \
704e5dd7070Spatrick                                               (__v8di)_mm512_setzero_si512(), \
705*12c85518Srobert                                               (__mmask8)(U), (int)(R)))
706e5dd7070Spatrick 
707e5dd7070Spatrick static __inline__ __m512d __DEFAULT_FN_ATTRS512
_mm512_cvtepu64_pd(__m512i __A)708e5dd7070Spatrick _mm512_cvtepu64_pd (__m512i __A) {
709e5dd7070Spatrick   return (__m512d)__builtin_convertvector((__v8du)__A, __v8df);
710e5dd7070Spatrick }
711e5dd7070Spatrick 
712e5dd7070Spatrick static __inline__ __m512d __DEFAULT_FN_ATTRS512
_mm512_mask_cvtepu64_pd(__m512d __W,__mmask8 __U,__m512i __A)713e5dd7070Spatrick _mm512_mask_cvtepu64_pd (__m512d __W, __mmask8 __U, __m512i __A) {
714e5dd7070Spatrick   return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
715e5dd7070Spatrick                                               (__v8df)_mm512_cvtepu64_pd(__A),
716e5dd7070Spatrick                                               (__v8df)__W);
717e5dd7070Spatrick }
718e5dd7070Spatrick 
719e5dd7070Spatrick static __inline__ __m512d __DEFAULT_FN_ATTRS512
_mm512_maskz_cvtepu64_pd(__mmask8 __U,__m512i __A)720e5dd7070Spatrick _mm512_maskz_cvtepu64_pd (__mmask8 __U, __m512i __A) {
721e5dd7070Spatrick   return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__U,
722e5dd7070Spatrick                                               (__v8df)_mm512_cvtepu64_pd(__A),
723e5dd7070Spatrick                                               (__v8df)_mm512_setzero_pd());
724e5dd7070Spatrick }
725e5dd7070Spatrick 
726e5dd7070Spatrick #define _mm512_cvt_roundepu64_pd(A, R) \
727*12c85518Srobert   ((__m512d)__builtin_ia32_cvtuqq2pd512_mask((__v8di)(__m512i)(A), \
728e5dd7070Spatrick                                              (__v8df)_mm512_setzero_pd(), \
729*12c85518Srobert                                              (__mmask8)-1, (int)(R)))
730e5dd7070Spatrick 
731e5dd7070Spatrick #define _mm512_mask_cvt_roundepu64_pd(W, U, A, R) \
732*12c85518Srobert   ((__m512d)__builtin_ia32_cvtuqq2pd512_mask((__v8di)(__m512i)(A), \
733e5dd7070Spatrick                                              (__v8df)(__m512d)(W), \
734*12c85518Srobert                                              (__mmask8)(U), (int)(R)))
735e5dd7070Spatrick 
736e5dd7070Spatrick 
737e5dd7070Spatrick #define _mm512_maskz_cvt_roundepu64_pd(U, A, R) \
738*12c85518Srobert   ((__m512d)__builtin_ia32_cvtuqq2pd512_mask((__v8di)(__m512i)(A), \
739e5dd7070Spatrick                                              (__v8df)_mm512_setzero_pd(), \
740*12c85518Srobert                                              (__mmask8)(U), (int)(R)))
741e5dd7070Spatrick 
742e5dd7070Spatrick 
743e5dd7070Spatrick static __inline__ __m256 __DEFAULT_FN_ATTRS512
_mm512_cvtepu64_ps(__m512i __A)744e5dd7070Spatrick _mm512_cvtepu64_ps (__m512i __A) {
745e5dd7070Spatrick   return (__m256) __builtin_ia32_cvtuqq2ps512_mask ((__v8di) __A,
746e5dd7070Spatrick                 (__v8sf) _mm256_setzero_ps(),
747e5dd7070Spatrick                 (__mmask8) -1,
748e5dd7070Spatrick                 _MM_FROUND_CUR_DIRECTION);
749e5dd7070Spatrick }
750e5dd7070Spatrick 
751e5dd7070Spatrick static __inline__ __m256 __DEFAULT_FN_ATTRS512
_mm512_mask_cvtepu64_ps(__m256 __W,__mmask8 __U,__m512i __A)752e5dd7070Spatrick _mm512_mask_cvtepu64_ps (__m256 __W, __mmask8 __U, __m512i __A) {
753e5dd7070Spatrick   return (__m256) __builtin_ia32_cvtuqq2ps512_mask ((__v8di) __A,
754e5dd7070Spatrick                 (__v8sf) __W,
755e5dd7070Spatrick                 (__mmask8) __U,
756e5dd7070Spatrick                 _MM_FROUND_CUR_DIRECTION);
757e5dd7070Spatrick }
758e5dd7070Spatrick 
759e5dd7070Spatrick static __inline__ __m256 __DEFAULT_FN_ATTRS512
_mm512_maskz_cvtepu64_ps(__mmask8 __U,__m512i __A)760e5dd7070Spatrick _mm512_maskz_cvtepu64_ps (__mmask8 __U, __m512i __A) {
761e5dd7070Spatrick   return (__m256) __builtin_ia32_cvtuqq2ps512_mask ((__v8di) __A,
762e5dd7070Spatrick                 (__v8sf) _mm256_setzero_ps(),
763e5dd7070Spatrick                 (__mmask8) __U,
764e5dd7070Spatrick                 _MM_FROUND_CUR_DIRECTION);
765e5dd7070Spatrick }
766e5dd7070Spatrick 
767e5dd7070Spatrick #define _mm512_cvt_roundepu64_ps(A, R) \
768*12c85518Srobert   ((__m256)__builtin_ia32_cvtuqq2ps512_mask((__v8di)(__m512i)(A), \
769e5dd7070Spatrick                                             (__v8sf)_mm256_setzero_ps(), \
770*12c85518Srobert                                             (__mmask8)-1, (int)(R)))
771e5dd7070Spatrick 
772e5dd7070Spatrick #define _mm512_mask_cvt_roundepu64_ps(W, U, A, R) \
773*12c85518Srobert   ((__m256)__builtin_ia32_cvtuqq2ps512_mask((__v8di)(__m512i)(A), \
774e5dd7070Spatrick                                             (__v8sf)(__m256)(W), (__mmask8)(U), \
775*12c85518Srobert                                             (int)(R)))
776e5dd7070Spatrick 
777e5dd7070Spatrick #define _mm512_maskz_cvt_roundepu64_ps(U, A, R) \
778*12c85518Srobert   ((__m256)__builtin_ia32_cvtuqq2ps512_mask((__v8di)(__m512i)(A), \
779e5dd7070Spatrick                                             (__v8sf)_mm256_setzero_ps(), \
780*12c85518Srobert                                             (__mmask8)(U), (int)(R)))
781e5dd7070Spatrick 
782e5dd7070Spatrick #define _mm512_range_pd(A, B, C) \
783*12c85518Srobert   ((__m512d)__builtin_ia32_rangepd512_mask((__v8df)(__m512d)(A), \
784e5dd7070Spatrick                                            (__v8df)(__m512d)(B), (int)(C), \
785e5dd7070Spatrick                                            (__v8df)_mm512_setzero_pd(), \
786e5dd7070Spatrick                                            (__mmask8)-1, \
787*12c85518Srobert                                            _MM_FROUND_CUR_DIRECTION))
788e5dd7070Spatrick 
789e5dd7070Spatrick #define _mm512_mask_range_pd(W, U, A, B, C) \
790*12c85518Srobert   ((__m512d)__builtin_ia32_rangepd512_mask((__v8df)(__m512d)(A), \
791e5dd7070Spatrick                                            (__v8df)(__m512d)(B), (int)(C), \
792e5dd7070Spatrick                                            (__v8df)(__m512d)(W), (__mmask8)(U), \
793*12c85518Srobert                                            _MM_FROUND_CUR_DIRECTION))
794e5dd7070Spatrick 
795e5dd7070Spatrick #define _mm512_maskz_range_pd(U, A, B, C) \
796*12c85518Srobert   ((__m512d)__builtin_ia32_rangepd512_mask((__v8df)(__m512d)(A), \
797e5dd7070Spatrick                                            (__v8df)(__m512d)(B), (int)(C), \
798e5dd7070Spatrick                                            (__v8df)_mm512_setzero_pd(), \
799e5dd7070Spatrick                                            (__mmask8)(U), \
800*12c85518Srobert                                            _MM_FROUND_CUR_DIRECTION))
801e5dd7070Spatrick 
802e5dd7070Spatrick #define _mm512_range_round_pd(A, B, C, R) \
803*12c85518Srobert   ((__m512d)__builtin_ia32_rangepd512_mask((__v8df)(__m512d)(A), \
804e5dd7070Spatrick                                            (__v8df)(__m512d)(B), (int)(C), \
805e5dd7070Spatrick                                            (__v8df)_mm512_setzero_pd(), \
806*12c85518Srobert                                            (__mmask8)-1, (int)(R)))
807e5dd7070Spatrick 
808e5dd7070Spatrick #define _mm512_mask_range_round_pd(W, U, A, B, C, R) \
809*12c85518Srobert   ((__m512d)__builtin_ia32_rangepd512_mask((__v8df)(__m512d)(A), \
810e5dd7070Spatrick                                            (__v8df)(__m512d)(B), (int)(C), \
811e5dd7070Spatrick                                            (__v8df)(__m512d)(W), (__mmask8)(U), \
812*12c85518Srobert                                            (int)(R)))
813e5dd7070Spatrick 
814e5dd7070Spatrick #define _mm512_maskz_range_round_pd(U, A, B, C, R) \
815*12c85518Srobert   ((__m512d)__builtin_ia32_rangepd512_mask((__v8df)(__m512d)(A), \
816e5dd7070Spatrick                                            (__v8df)(__m512d)(B), (int)(C), \
817e5dd7070Spatrick                                            (__v8df)_mm512_setzero_pd(), \
818*12c85518Srobert                                            (__mmask8)(U), (int)(R)))
819e5dd7070Spatrick 
820e5dd7070Spatrick #define _mm512_range_ps(A, B, C) \
821*12c85518Srobert   ((__m512)__builtin_ia32_rangeps512_mask((__v16sf)(__m512)(A), \
822e5dd7070Spatrick                                           (__v16sf)(__m512)(B), (int)(C), \
823e5dd7070Spatrick                                           (__v16sf)_mm512_setzero_ps(), \
824e5dd7070Spatrick                                           (__mmask16)-1, \
825*12c85518Srobert                                           _MM_FROUND_CUR_DIRECTION))
826e5dd7070Spatrick 
827e5dd7070Spatrick #define _mm512_mask_range_ps(W, U, A, B, C) \
828*12c85518Srobert   ((__m512)__builtin_ia32_rangeps512_mask((__v16sf)(__m512)(A), \
829e5dd7070Spatrick                                           (__v16sf)(__m512)(B), (int)(C), \
830e5dd7070Spatrick                                           (__v16sf)(__m512)(W), (__mmask16)(U), \
831*12c85518Srobert                                           _MM_FROUND_CUR_DIRECTION))
832e5dd7070Spatrick 
833e5dd7070Spatrick #define _mm512_maskz_range_ps(U, A, B, C) \
834*12c85518Srobert   ((__m512)__builtin_ia32_rangeps512_mask((__v16sf)(__m512)(A), \
835e5dd7070Spatrick                                           (__v16sf)(__m512)(B), (int)(C), \
836e5dd7070Spatrick                                           (__v16sf)_mm512_setzero_ps(), \
837e5dd7070Spatrick                                           (__mmask16)(U), \
838*12c85518Srobert                                           _MM_FROUND_CUR_DIRECTION))
839e5dd7070Spatrick 
840e5dd7070Spatrick #define _mm512_range_round_ps(A, B, C, R) \
841*12c85518Srobert   ((__m512)__builtin_ia32_rangeps512_mask((__v16sf)(__m512)(A), \
842e5dd7070Spatrick                                           (__v16sf)(__m512)(B), (int)(C), \
843e5dd7070Spatrick                                           (__v16sf)_mm512_setzero_ps(), \
844*12c85518Srobert                                           (__mmask16)-1, (int)(R)))
845e5dd7070Spatrick 
846e5dd7070Spatrick #define _mm512_mask_range_round_ps(W, U, A, B, C, R) \
847*12c85518Srobert   ((__m512)__builtin_ia32_rangeps512_mask((__v16sf)(__m512)(A), \
848e5dd7070Spatrick                                           (__v16sf)(__m512)(B), (int)(C), \
849e5dd7070Spatrick                                           (__v16sf)(__m512)(W), (__mmask16)(U), \
850*12c85518Srobert                                           (int)(R)))
851e5dd7070Spatrick 
852e5dd7070Spatrick #define _mm512_maskz_range_round_ps(U, A, B, C, R) \
853*12c85518Srobert   ((__m512)__builtin_ia32_rangeps512_mask((__v16sf)(__m512)(A), \
854e5dd7070Spatrick                                           (__v16sf)(__m512)(B), (int)(C), \
855e5dd7070Spatrick                                           (__v16sf)_mm512_setzero_ps(), \
856*12c85518Srobert                                           (__mmask16)(U), (int)(R)))
857e5dd7070Spatrick 
858e5dd7070Spatrick #define _mm_range_round_ss(A, B, C, R) \
859*12c85518Srobert   ((__m128)__builtin_ia32_rangess128_round_mask((__v4sf)(__m128)(A), \
860e5dd7070Spatrick                                                 (__v4sf)(__m128)(B), \
861e5dd7070Spatrick                                                 (__v4sf)_mm_setzero_ps(), \
862e5dd7070Spatrick                                                 (__mmask8) -1, (int)(C),\
863*12c85518Srobert                                                 (int)(R)))
864e5dd7070Spatrick 
865e5dd7070Spatrick #define _mm_range_ss(A ,B , C) _mm_range_round_ss(A, B, C ,_MM_FROUND_CUR_DIRECTION)
866e5dd7070Spatrick 
867e5dd7070Spatrick #define _mm_mask_range_round_ss(W, U, A, B, C, R) \
868*12c85518Srobert   ((__m128)__builtin_ia32_rangess128_round_mask((__v4sf)(__m128)(A), \
869e5dd7070Spatrick                                                 (__v4sf)(__m128)(B), \
870e5dd7070Spatrick                                                 (__v4sf)(__m128)(W),\
871e5dd7070Spatrick                                                 (__mmask8)(U), (int)(C),\
872*12c85518Srobert                                                 (int)(R)))
873e5dd7070Spatrick 
874e5dd7070Spatrick #define _mm_mask_range_ss(W , U, A, B, C) _mm_mask_range_round_ss(W, U, A, B, C , _MM_FROUND_CUR_DIRECTION)
875e5dd7070Spatrick 
876e5dd7070Spatrick #define _mm_maskz_range_round_ss(U, A, B, C, R) \
877*12c85518Srobert   ((__m128)__builtin_ia32_rangess128_round_mask((__v4sf)(__m128)(A), \
878e5dd7070Spatrick                                                 (__v4sf)(__m128)(B), \
879e5dd7070Spatrick                                                 (__v4sf)_mm_setzero_ps(), \
880e5dd7070Spatrick                                                 (__mmask8)(U), (int)(C),\
881*12c85518Srobert                                                 (int)(R)))
882e5dd7070Spatrick 
883e5dd7070Spatrick #define _mm_maskz_range_ss(U, A ,B , C) _mm_maskz_range_round_ss(U, A, B, C ,_MM_FROUND_CUR_DIRECTION)
884e5dd7070Spatrick 
885e5dd7070Spatrick #define _mm_range_round_sd(A, B, C, R) \
886*12c85518Srobert   ((__m128d)__builtin_ia32_rangesd128_round_mask((__v2df)(__m128d)(A), \
887e5dd7070Spatrick                                                  (__v2df)(__m128d)(B), \
888e5dd7070Spatrick                                                  (__v2df)_mm_setzero_pd(), \
889e5dd7070Spatrick                                                  (__mmask8) -1, (int)(C),\
890*12c85518Srobert                                                  (int)(R)))
891e5dd7070Spatrick 
892e5dd7070Spatrick #define _mm_range_sd(A ,B , C) _mm_range_round_sd(A, B, C ,_MM_FROUND_CUR_DIRECTION)
893e5dd7070Spatrick 
894e5dd7070Spatrick #define _mm_mask_range_round_sd(W, U, A, B, C, R) \
895*12c85518Srobert   ((__m128d)__builtin_ia32_rangesd128_round_mask((__v2df)(__m128d)(A), \
896e5dd7070Spatrick                                                  (__v2df)(__m128d)(B), \
897e5dd7070Spatrick                                                  (__v2df)(__m128d)(W),\
898e5dd7070Spatrick                                                  (__mmask8)(U), (int)(C),\
899*12c85518Srobert                                                  (int)(R)))
900e5dd7070Spatrick 
901e5dd7070Spatrick #define _mm_mask_range_sd(W, U, A, B, C) _mm_mask_range_round_sd(W, U, A, B, C ,_MM_FROUND_CUR_DIRECTION)
902e5dd7070Spatrick 
903e5dd7070Spatrick #define _mm_maskz_range_round_sd(U, A, B, C, R) \
904*12c85518Srobert   ((__m128d)__builtin_ia32_rangesd128_round_mask((__v2df)(__m128d)(A), \
905e5dd7070Spatrick                                                  (__v2df)(__m128d)(B), \
906e5dd7070Spatrick                                                  (__v2df)_mm_setzero_pd(), \
907e5dd7070Spatrick                                                  (__mmask8)(U), (int)(C),\
908*12c85518Srobert                                                  (int)(R)))
909e5dd7070Spatrick 
910e5dd7070Spatrick #define _mm_maskz_range_sd(U, A, B, C) _mm_maskz_range_round_sd(U, A, B, C ,_MM_FROUND_CUR_DIRECTION)
911e5dd7070Spatrick 
912e5dd7070Spatrick #define _mm512_reduce_pd(A, B) \
913*12c85518Srobert   ((__m512d)__builtin_ia32_reducepd512_mask((__v8df)(__m512d)(A), (int)(B), \
914e5dd7070Spatrick                                             (__v8df)_mm512_setzero_pd(), \
915e5dd7070Spatrick                                             (__mmask8)-1, \
916*12c85518Srobert                                             _MM_FROUND_CUR_DIRECTION))
917e5dd7070Spatrick 
918e5dd7070Spatrick #define _mm512_mask_reduce_pd(W, U, A, B) \
919*12c85518Srobert   ((__m512d)__builtin_ia32_reducepd512_mask((__v8df)(__m512d)(A), (int)(B), \
920e5dd7070Spatrick                                             (__v8df)(__m512d)(W), \
921e5dd7070Spatrick                                             (__mmask8)(U), \
922*12c85518Srobert                                             _MM_FROUND_CUR_DIRECTION))
923e5dd7070Spatrick 
924e5dd7070Spatrick #define _mm512_maskz_reduce_pd(U, A, B) \
925*12c85518Srobert   ((__m512d)__builtin_ia32_reducepd512_mask((__v8df)(__m512d)(A), (int)(B), \
926e5dd7070Spatrick                                             (__v8df)_mm512_setzero_pd(), \
927e5dd7070Spatrick                                             (__mmask8)(U), \
928*12c85518Srobert                                             _MM_FROUND_CUR_DIRECTION))
929e5dd7070Spatrick 
930e5dd7070Spatrick #define _mm512_reduce_ps(A, B) \
931*12c85518Srobert   ((__m512)__builtin_ia32_reduceps512_mask((__v16sf)(__m512)(A), (int)(B), \
932e5dd7070Spatrick                                            (__v16sf)_mm512_setzero_ps(), \
933e5dd7070Spatrick                                            (__mmask16)-1, \
934*12c85518Srobert                                            _MM_FROUND_CUR_DIRECTION))
935e5dd7070Spatrick 
936e5dd7070Spatrick #define _mm512_mask_reduce_ps(W, U, A, B) \
937*12c85518Srobert   ((__m512)__builtin_ia32_reduceps512_mask((__v16sf)(__m512)(A), (int)(B), \
938e5dd7070Spatrick                                            (__v16sf)(__m512)(W), \
939e5dd7070Spatrick                                            (__mmask16)(U), \
940*12c85518Srobert                                            _MM_FROUND_CUR_DIRECTION))
941e5dd7070Spatrick 
942e5dd7070Spatrick #define _mm512_maskz_reduce_ps(U, A, B) \
943*12c85518Srobert   ((__m512)__builtin_ia32_reduceps512_mask((__v16sf)(__m512)(A), (int)(B), \
944e5dd7070Spatrick                                            (__v16sf)_mm512_setzero_ps(), \
945e5dd7070Spatrick                                            (__mmask16)(U), \
946*12c85518Srobert                                            _MM_FROUND_CUR_DIRECTION))
947e5dd7070Spatrick 
948e5dd7070Spatrick #define _mm512_reduce_round_pd(A, B, R) \
949*12c85518Srobert   ((__m512d)__builtin_ia32_reducepd512_mask((__v8df)(__m512d)(A), (int)(B), \
950e5dd7070Spatrick                                             (__v8df)_mm512_setzero_pd(), \
951*12c85518Srobert                                             (__mmask8)-1, (int)(R)))
952e5dd7070Spatrick 
953e5dd7070Spatrick #define _mm512_mask_reduce_round_pd(W, U, A, B, R) \
954*12c85518Srobert   ((__m512d)__builtin_ia32_reducepd512_mask((__v8df)(__m512d)(A), (int)(B), \
955e5dd7070Spatrick                                             (__v8df)(__m512d)(W), \
956*12c85518Srobert                                             (__mmask8)(U), (int)(R)))
957e5dd7070Spatrick 
958e5dd7070Spatrick #define _mm512_maskz_reduce_round_pd(U, A, B, R) \
959*12c85518Srobert   ((__m512d)__builtin_ia32_reducepd512_mask((__v8df)(__m512d)(A), (int)(B), \
960e5dd7070Spatrick                                             (__v8df)_mm512_setzero_pd(), \
961*12c85518Srobert                                             (__mmask8)(U), (int)(R)))
962e5dd7070Spatrick 
963e5dd7070Spatrick #define _mm512_reduce_round_ps(A, B, R) \
964*12c85518Srobert   ((__m512)__builtin_ia32_reduceps512_mask((__v16sf)(__m512)(A), (int)(B), \
965e5dd7070Spatrick                                            (__v16sf)_mm512_setzero_ps(), \
966*12c85518Srobert                                            (__mmask16)-1, (int)(R)))
967e5dd7070Spatrick 
968e5dd7070Spatrick #define _mm512_mask_reduce_round_ps(W, U, A, B, R) \
969*12c85518Srobert   ((__m512)__builtin_ia32_reduceps512_mask((__v16sf)(__m512)(A), (int)(B), \
970e5dd7070Spatrick                                            (__v16sf)(__m512)(W), \
971*12c85518Srobert                                            (__mmask16)(U), (int)(R)))
972e5dd7070Spatrick 
973e5dd7070Spatrick #define _mm512_maskz_reduce_round_ps(U, A, B, R) \
974*12c85518Srobert   ((__m512)__builtin_ia32_reduceps512_mask((__v16sf)(__m512)(A), (int)(B), \
975e5dd7070Spatrick                                            (__v16sf)_mm512_setzero_ps(), \
976*12c85518Srobert                                            (__mmask16)(U), (int)(R)))
977e5dd7070Spatrick 
978e5dd7070Spatrick #define _mm_reduce_ss(A, B, C) \
979*12c85518Srobert   ((__m128)__builtin_ia32_reducess_mask((__v4sf)(__m128)(A), \
980e5dd7070Spatrick                                         (__v4sf)(__m128)(B), \
981e5dd7070Spatrick                                         (__v4sf)_mm_setzero_ps(), (__mmask8)-1, \
982*12c85518Srobert                                         (int)(C), _MM_FROUND_CUR_DIRECTION))
983e5dd7070Spatrick 
984e5dd7070Spatrick #define _mm_mask_reduce_ss(W, U, A, B, C) \
985*12c85518Srobert   ((__m128)__builtin_ia32_reducess_mask((__v4sf)(__m128)(A), \
986e5dd7070Spatrick                                         (__v4sf)(__m128)(B), \
987e5dd7070Spatrick                                         (__v4sf)(__m128)(W), (__mmask8)(U), \
988*12c85518Srobert                                         (int)(C), _MM_FROUND_CUR_DIRECTION))
989e5dd7070Spatrick 
990e5dd7070Spatrick #define _mm_maskz_reduce_ss(U, A, B, C) \
991*12c85518Srobert   ((__m128)__builtin_ia32_reducess_mask((__v4sf)(__m128)(A), \
992e5dd7070Spatrick                                         (__v4sf)(__m128)(B), \
993e5dd7070Spatrick                                         (__v4sf)_mm_setzero_ps(), \
994e5dd7070Spatrick                                         (__mmask8)(U), (int)(C), \
995*12c85518Srobert                                         _MM_FROUND_CUR_DIRECTION))
996e5dd7070Spatrick 
997e5dd7070Spatrick #define _mm_reduce_round_ss(A, B, C, R) \
998*12c85518Srobert   ((__m128)__builtin_ia32_reducess_mask((__v4sf)(__m128)(A), \
999e5dd7070Spatrick                                         (__v4sf)(__m128)(B), \
1000e5dd7070Spatrick                                         (__v4sf)_mm_setzero_ps(), (__mmask8)-1, \
1001*12c85518Srobert                                         (int)(C), (int)(R)))
1002e5dd7070Spatrick 
1003e5dd7070Spatrick #define _mm_mask_reduce_round_ss(W, U, A, B, C, R) \
1004*12c85518Srobert   ((__m128)__builtin_ia32_reducess_mask((__v4sf)(__m128)(A), \
1005e5dd7070Spatrick                                         (__v4sf)(__m128)(B), \
1006e5dd7070Spatrick                                         (__v4sf)(__m128)(W), (__mmask8)(U), \
1007*12c85518Srobert                                         (int)(C), (int)(R)))
1008e5dd7070Spatrick 
1009e5dd7070Spatrick #define _mm_maskz_reduce_round_ss(U, A, B, C, R) \
1010*12c85518Srobert   ((__m128)__builtin_ia32_reducess_mask((__v4sf)(__m128)(A), \
1011e5dd7070Spatrick                                         (__v4sf)(__m128)(B), \
1012e5dd7070Spatrick                                         (__v4sf)_mm_setzero_ps(), \
1013*12c85518Srobert                                         (__mmask8)(U), (int)(C), (int)(R)))
1014e5dd7070Spatrick 
1015e5dd7070Spatrick #define _mm_reduce_sd(A, B, C) \
1016*12c85518Srobert   ((__m128d)__builtin_ia32_reducesd_mask((__v2df)(__m128d)(A), \
1017e5dd7070Spatrick                                          (__v2df)(__m128d)(B), \
1018e5dd7070Spatrick                                          (__v2df)_mm_setzero_pd(), \
1019e5dd7070Spatrick                                          (__mmask8)-1, (int)(C), \
1020*12c85518Srobert                                          _MM_FROUND_CUR_DIRECTION))
1021e5dd7070Spatrick 
1022e5dd7070Spatrick #define _mm_mask_reduce_sd(W, U, A, B, C) \
1023*12c85518Srobert   ((__m128d)__builtin_ia32_reducesd_mask((__v2df)(__m128d)(A), \
1024e5dd7070Spatrick                                          (__v2df)(__m128d)(B), \
1025e5dd7070Spatrick                                          (__v2df)(__m128d)(W), (__mmask8)(U), \
1026*12c85518Srobert                                          (int)(C), _MM_FROUND_CUR_DIRECTION))
1027e5dd7070Spatrick 
1028e5dd7070Spatrick #define _mm_maskz_reduce_sd(U, A, B, C) \
1029*12c85518Srobert   ((__m128d)__builtin_ia32_reducesd_mask((__v2df)(__m128d)(A), \
1030e5dd7070Spatrick                                          (__v2df)(__m128d)(B), \
1031e5dd7070Spatrick                                          (__v2df)_mm_setzero_pd(), \
1032e5dd7070Spatrick                                          (__mmask8)(U), (int)(C), \
1033*12c85518Srobert                                          _MM_FROUND_CUR_DIRECTION))
1034e5dd7070Spatrick 
1035e5dd7070Spatrick #define _mm_reduce_round_sd(A, B, C, R) \
1036*12c85518Srobert   ((__m128d)__builtin_ia32_reducesd_mask((__v2df)(__m128d)(A), \
1037e5dd7070Spatrick                                          (__v2df)(__m128d)(B), \
1038e5dd7070Spatrick                                          (__v2df)_mm_setzero_pd(), \
1039*12c85518Srobert                                          (__mmask8)-1, (int)(C), (int)(R)))
1040e5dd7070Spatrick 
1041e5dd7070Spatrick #define _mm_mask_reduce_round_sd(W, U, A, B, C, R) \
1042*12c85518Srobert   ((__m128d)__builtin_ia32_reducesd_mask((__v2df)(__m128d)(A), \
1043e5dd7070Spatrick                                          (__v2df)(__m128d)(B), \
1044e5dd7070Spatrick                                          (__v2df)(__m128d)(W), (__mmask8)(U), \
1045*12c85518Srobert                                          (int)(C), (int)(R)))
1046e5dd7070Spatrick 
1047e5dd7070Spatrick #define _mm_maskz_reduce_round_sd(U, A, B, C, R) \
1048*12c85518Srobert   ((__m128d)__builtin_ia32_reducesd_mask((__v2df)(__m128d)(A), \
1049e5dd7070Spatrick                                          (__v2df)(__m128d)(B), \
1050e5dd7070Spatrick                                          (__v2df)_mm_setzero_pd(), \
1051*12c85518Srobert                                          (__mmask8)(U), (int)(C), (int)(R)))
1052e5dd7070Spatrick 
1053e5dd7070Spatrick static __inline__ __mmask16 __DEFAULT_FN_ATTRS512
_mm512_movepi32_mask(__m512i __A)1054e5dd7070Spatrick _mm512_movepi32_mask (__m512i __A)
1055e5dd7070Spatrick {
1056e5dd7070Spatrick   return (__mmask16) __builtin_ia32_cvtd2mask512 ((__v16si) __A);
1057e5dd7070Spatrick }
1058e5dd7070Spatrick 
1059e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_movm_epi32(__mmask16 __A)1060e5dd7070Spatrick _mm512_movm_epi32 (__mmask16 __A)
1061e5dd7070Spatrick {
1062e5dd7070Spatrick   return (__m512i) __builtin_ia32_cvtmask2d512 (__A);
1063e5dd7070Spatrick }
1064e5dd7070Spatrick 
1065e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_movm_epi64(__mmask8 __A)1066e5dd7070Spatrick _mm512_movm_epi64 (__mmask8 __A)
1067e5dd7070Spatrick {
1068e5dd7070Spatrick   return (__m512i) __builtin_ia32_cvtmask2q512 (__A);
1069e5dd7070Spatrick }
1070e5dd7070Spatrick 
1071e5dd7070Spatrick static __inline__ __mmask8 __DEFAULT_FN_ATTRS512
_mm512_movepi64_mask(__m512i __A)1072e5dd7070Spatrick _mm512_movepi64_mask (__m512i __A)
1073e5dd7070Spatrick {
1074e5dd7070Spatrick   return (__mmask8) __builtin_ia32_cvtq2mask512 ((__v8di) __A);
1075e5dd7070Spatrick }
1076e5dd7070Spatrick 
1077e5dd7070Spatrick 
1078e5dd7070Spatrick static __inline__ __m512 __DEFAULT_FN_ATTRS512
_mm512_broadcast_f32x2(__m128 __A)1079e5dd7070Spatrick _mm512_broadcast_f32x2 (__m128 __A)
1080e5dd7070Spatrick {
1081e5dd7070Spatrick   return (__m512)__builtin_shufflevector((__v4sf)__A, (__v4sf)__A,
1082e5dd7070Spatrick                                          0, 1, 0, 1, 0, 1, 0, 1,
1083e5dd7070Spatrick                                          0, 1, 0, 1, 0, 1, 0, 1);
1084e5dd7070Spatrick }
1085e5dd7070Spatrick 
1086e5dd7070Spatrick static __inline__ __m512 __DEFAULT_FN_ATTRS512
_mm512_mask_broadcast_f32x2(__m512 __O,__mmask16 __M,__m128 __A)1087e5dd7070Spatrick _mm512_mask_broadcast_f32x2 (__m512 __O, __mmask16 __M, __m128 __A)
1088e5dd7070Spatrick {
1089e5dd7070Spatrick   return (__m512)__builtin_ia32_selectps_512((__mmask16)__M,
1090e5dd7070Spatrick                                              (__v16sf)_mm512_broadcast_f32x2(__A),
1091e5dd7070Spatrick                                              (__v16sf)__O);
1092e5dd7070Spatrick }
1093e5dd7070Spatrick 
1094e5dd7070Spatrick static __inline__ __m512 __DEFAULT_FN_ATTRS512
_mm512_maskz_broadcast_f32x2(__mmask16 __M,__m128 __A)1095e5dd7070Spatrick _mm512_maskz_broadcast_f32x2 (__mmask16 __M, __m128 __A)
1096e5dd7070Spatrick {
1097e5dd7070Spatrick   return (__m512)__builtin_ia32_selectps_512((__mmask16)__M,
1098e5dd7070Spatrick                                              (__v16sf)_mm512_broadcast_f32x2(__A),
1099e5dd7070Spatrick                                              (__v16sf)_mm512_setzero_ps());
1100e5dd7070Spatrick }
1101e5dd7070Spatrick 
1102e5dd7070Spatrick static __inline__ __m512 __DEFAULT_FN_ATTRS512
_mm512_broadcast_f32x8(__m256 __A)1103e5dd7070Spatrick _mm512_broadcast_f32x8(__m256 __A)
1104e5dd7070Spatrick {
1105e5dd7070Spatrick   return (__m512)__builtin_shufflevector((__v8sf)__A, (__v8sf)__A,
1106e5dd7070Spatrick                                          0, 1, 2, 3, 4, 5, 6, 7,
1107e5dd7070Spatrick                                          0, 1, 2, 3, 4, 5, 6, 7);
1108e5dd7070Spatrick }
1109e5dd7070Spatrick 
1110e5dd7070Spatrick static __inline__ __m512 __DEFAULT_FN_ATTRS512
_mm512_mask_broadcast_f32x8(__m512 __O,__mmask16 __M,__m256 __A)1111e5dd7070Spatrick _mm512_mask_broadcast_f32x8(__m512 __O, __mmask16 __M, __m256 __A)
1112e5dd7070Spatrick {
1113e5dd7070Spatrick   return (__m512)__builtin_ia32_selectps_512((__mmask16)__M,
1114e5dd7070Spatrick                                            (__v16sf)_mm512_broadcast_f32x8(__A),
1115e5dd7070Spatrick                                            (__v16sf)__O);
1116e5dd7070Spatrick }
1117e5dd7070Spatrick 
1118e5dd7070Spatrick static __inline__ __m512 __DEFAULT_FN_ATTRS512
_mm512_maskz_broadcast_f32x8(__mmask16 __M,__m256 __A)1119e5dd7070Spatrick _mm512_maskz_broadcast_f32x8(__mmask16 __M, __m256 __A)
1120e5dd7070Spatrick {
1121e5dd7070Spatrick   return (__m512)__builtin_ia32_selectps_512((__mmask16)__M,
1122e5dd7070Spatrick                                            (__v16sf)_mm512_broadcast_f32x8(__A),
1123e5dd7070Spatrick                                            (__v16sf)_mm512_setzero_ps());
1124e5dd7070Spatrick }
1125e5dd7070Spatrick 
1126e5dd7070Spatrick static __inline__ __m512d __DEFAULT_FN_ATTRS512
_mm512_broadcast_f64x2(__m128d __A)1127e5dd7070Spatrick _mm512_broadcast_f64x2(__m128d __A)
1128e5dd7070Spatrick {
1129e5dd7070Spatrick   return (__m512d)__builtin_shufflevector((__v2df)__A, (__v2df)__A,
1130e5dd7070Spatrick                                           0, 1, 0, 1, 0, 1, 0, 1);
1131e5dd7070Spatrick }
1132e5dd7070Spatrick 
1133e5dd7070Spatrick static __inline__ __m512d __DEFAULT_FN_ATTRS512
_mm512_mask_broadcast_f64x2(__m512d __O,__mmask8 __M,__m128d __A)1134e5dd7070Spatrick _mm512_mask_broadcast_f64x2(__m512d __O, __mmask8 __M, __m128d __A)
1135e5dd7070Spatrick {
1136e5dd7070Spatrick   return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__M,
1137e5dd7070Spatrick                                             (__v8df)_mm512_broadcast_f64x2(__A),
1138e5dd7070Spatrick                                             (__v8df)__O);
1139e5dd7070Spatrick }
1140e5dd7070Spatrick 
1141e5dd7070Spatrick static __inline__ __m512d __DEFAULT_FN_ATTRS512
_mm512_maskz_broadcast_f64x2(__mmask8 __M,__m128d __A)1142e5dd7070Spatrick _mm512_maskz_broadcast_f64x2(__mmask8 __M, __m128d __A)
1143e5dd7070Spatrick {
1144e5dd7070Spatrick   return (__m512d)__builtin_ia32_selectpd_512((__mmask8)__M,
1145e5dd7070Spatrick                                             (__v8df)_mm512_broadcast_f64x2(__A),
1146e5dd7070Spatrick                                             (__v8df)_mm512_setzero_pd());
1147e5dd7070Spatrick }
1148e5dd7070Spatrick 
1149e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_broadcast_i32x2(__m128i __A)1150e5dd7070Spatrick _mm512_broadcast_i32x2 (__m128i __A)
1151e5dd7070Spatrick {
1152e5dd7070Spatrick   return (__m512i)__builtin_shufflevector((__v4si)__A, (__v4si)__A,
1153e5dd7070Spatrick                                           0, 1, 0, 1, 0, 1, 0, 1,
1154e5dd7070Spatrick                                           0, 1, 0, 1, 0, 1, 0, 1);
1155e5dd7070Spatrick }
1156e5dd7070Spatrick 
1157e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_mask_broadcast_i32x2(__m512i __O,__mmask16 __M,__m128i __A)1158e5dd7070Spatrick _mm512_mask_broadcast_i32x2 (__m512i __O, __mmask16 __M, __m128i __A)
1159e5dd7070Spatrick {
1160e5dd7070Spatrick   return (__m512i)__builtin_ia32_selectd_512((__mmask16)__M,
1161e5dd7070Spatrick                                              (__v16si)_mm512_broadcast_i32x2(__A),
1162e5dd7070Spatrick                                              (__v16si)__O);
1163e5dd7070Spatrick }
1164e5dd7070Spatrick 
1165e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_maskz_broadcast_i32x2(__mmask16 __M,__m128i __A)1166e5dd7070Spatrick _mm512_maskz_broadcast_i32x2 (__mmask16 __M, __m128i __A)
1167e5dd7070Spatrick {
1168e5dd7070Spatrick   return (__m512i)__builtin_ia32_selectd_512((__mmask16)__M,
1169e5dd7070Spatrick                                              (__v16si)_mm512_broadcast_i32x2(__A),
1170e5dd7070Spatrick                                              (__v16si)_mm512_setzero_si512());
1171e5dd7070Spatrick }
1172e5dd7070Spatrick 
1173e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_broadcast_i32x8(__m256i __A)1174e5dd7070Spatrick _mm512_broadcast_i32x8(__m256i __A)
1175e5dd7070Spatrick {
1176e5dd7070Spatrick   return (__m512i)__builtin_shufflevector((__v8si)__A, (__v8si)__A,
1177e5dd7070Spatrick                                           0, 1, 2, 3, 4, 5, 6, 7,
1178e5dd7070Spatrick                                           0, 1, 2, 3, 4, 5, 6, 7);
1179e5dd7070Spatrick }
1180e5dd7070Spatrick 
1181e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_mask_broadcast_i32x8(__m512i __O,__mmask16 __M,__m256i __A)1182e5dd7070Spatrick _mm512_mask_broadcast_i32x8(__m512i __O, __mmask16 __M, __m256i __A)
1183e5dd7070Spatrick {
1184e5dd7070Spatrick   return (__m512i)__builtin_ia32_selectd_512((__mmask16)__M,
1185e5dd7070Spatrick                                            (__v16si)_mm512_broadcast_i32x8(__A),
1186e5dd7070Spatrick                                            (__v16si)__O);
1187e5dd7070Spatrick }
1188e5dd7070Spatrick 
1189e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_maskz_broadcast_i32x8(__mmask16 __M,__m256i __A)1190e5dd7070Spatrick _mm512_maskz_broadcast_i32x8(__mmask16 __M, __m256i __A)
1191e5dd7070Spatrick {
1192e5dd7070Spatrick   return (__m512i)__builtin_ia32_selectd_512((__mmask16)__M,
1193e5dd7070Spatrick                                            (__v16si)_mm512_broadcast_i32x8(__A),
1194e5dd7070Spatrick                                            (__v16si)_mm512_setzero_si512());
1195e5dd7070Spatrick }
1196e5dd7070Spatrick 
1197e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_broadcast_i64x2(__m128i __A)1198e5dd7070Spatrick _mm512_broadcast_i64x2(__m128i __A)
1199e5dd7070Spatrick {
1200e5dd7070Spatrick   return (__m512i)__builtin_shufflevector((__v2di)__A, (__v2di)__A,
1201e5dd7070Spatrick                                           0, 1, 0, 1, 0, 1, 0, 1);
1202e5dd7070Spatrick }
1203e5dd7070Spatrick 
1204e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_mask_broadcast_i64x2(__m512i __O,__mmask8 __M,__m128i __A)1205e5dd7070Spatrick _mm512_mask_broadcast_i64x2(__m512i __O, __mmask8 __M, __m128i __A)
1206e5dd7070Spatrick {
1207e5dd7070Spatrick   return (__m512i)__builtin_ia32_selectq_512((__mmask8)__M,
1208e5dd7070Spatrick                                             (__v8di)_mm512_broadcast_i64x2(__A),
1209e5dd7070Spatrick                                             (__v8di)__O);
1210e5dd7070Spatrick }
1211e5dd7070Spatrick 
1212e5dd7070Spatrick static __inline__ __m512i __DEFAULT_FN_ATTRS512
_mm512_maskz_broadcast_i64x2(__mmask8 __M,__m128i __A)1213e5dd7070Spatrick _mm512_maskz_broadcast_i64x2(__mmask8 __M, __m128i __A)
1214e5dd7070Spatrick {
1215e5dd7070Spatrick   return (__m512i)__builtin_ia32_selectq_512((__mmask8)__M,
1216e5dd7070Spatrick                                             (__v8di)_mm512_broadcast_i64x2(__A),
1217e5dd7070Spatrick                                             (__v8di)_mm512_setzero_si512());
1218e5dd7070Spatrick }
1219e5dd7070Spatrick 
1220e5dd7070Spatrick #define _mm512_extractf32x8_ps(A, imm) \
1221*12c85518Srobert   ((__m256)__builtin_ia32_extractf32x8_mask((__v16sf)(__m512)(A), (int)(imm), \
1222e5dd7070Spatrick                                             (__v8sf)_mm256_undefined_ps(), \
1223*12c85518Srobert                                             (__mmask8)-1))
1224e5dd7070Spatrick 
1225e5dd7070Spatrick #define _mm512_mask_extractf32x8_ps(W, U, A, imm) \
1226*12c85518Srobert   ((__m256)__builtin_ia32_extractf32x8_mask((__v16sf)(__m512)(A), (int)(imm), \
1227e5dd7070Spatrick                                             (__v8sf)(__m256)(W), \
1228*12c85518Srobert                                             (__mmask8)(U)))
1229e5dd7070Spatrick 
1230e5dd7070Spatrick #define _mm512_maskz_extractf32x8_ps(U, A, imm) \
1231*12c85518Srobert   ((__m256)__builtin_ia32_extractf32x8_mask((__v16sf)(__m512)(A), (int)(imm), \
1232e5dd7070Spatrick                                             (__v8sf)_mm256_setzero_ps(), \
1233*12c85518Srobert                                             (__mmask8)(U)))
1234e5dd7070Spatrick 
1235e5dd7070Spatrick #define _mm512_extractf64x2_pd(A, imm) \
1236*12c85518Srobert   ((__m128d)__builtin_ia32_extractf64x2_512_mask((__v8df)(__m512d)(A), \
1237e5dd7070Spatrick                                                  (int)(imm), \
1238e5dd7070Spatrick                                                  (__v2df)_mm_undefined_pd(), \
1239*12c85518Srobert                                                  (__mmask8)-1))
1240e5dd7070Spatrick 
1241e5dd7070Spatrick #define _mm512_mask_extractf64x2_pd(W, U, A, imm) \
1242*12c85518Srobert   ((__m128d)__builtin_ia32_extractf64x2_512_mask((__v8df)(__m512d)(A), \
1243e5dd7070Spatrick                                                  (int)(imm), \
1244e5dd7070Spatrick                                                  (__v2df)(__m128d)(W), \
1245*12c85518Srobert                                                  (__mmask8)(U)))
1246e5dd7070Spatrick 
1247e5dd7070Spatrick #define _mm512_maskz_extractf64x2_pd(U, A, imm) \
1248*12c85518Srobert   ((__m128d)__builtin_ia32_extractf64x2_512_mask((__v8df)(__m512d)(A), \
1249e5dd7070Spatrick                                                  (int)(imm), \
1250e5dd7070Spatrick                                                  (__v2df)_mm_setzero_pd(), \
1251*12c85518Srobert                                                  (__mmask8)(U)))
1252e5dd7070Spatrick 
1253e5dd7070Spatrick #define _mm512_extracti32x8_epi32(A, imm) \
1254*12c85518Srobert   ((__m256i)__builtin_ia32_extracti32x8_mask((__v16si)(__m512i)(A), (int)(imm), \
1255e5dd7070Spatrick                                              (__v8si)_mm256_undefined_si256(), \
1256*12c85518Srobert                                              (__mmask8)-1))
1257e5dd7070Spatrick 
1258e5dd7070Spatrick #define _mm512_mask_extracti32x8_epi32(W, U, A, imm) \
1259*12c85518Srobert   ((__m256i)__builtin_ia32_extracti32x8_mask((__v16si)(__m512i)(A), (int)(imm), \
1260e5dd7070Spatrick                                              (__v8si)(__m256i)(W), \
1261*12c85518Srobert                                              (__mmask8)(U)))
1262e5dd7070Spatrick 
1263e5dd7070Spatrick #define _mm512_maskz_extracti32x8_epi32(U, A, imm) \
1264*12c85518Srobert   ((__m256i)__builtin_ia32_extracti32x8_mask((__v16si)(__m512i)(A), (int)(imm), \
1265e5dd7070Spatrick                                              (__v8si)_mm256_setzero_si256(), \
1266*12c85518Srobert                                              (__mmask8)(U)))
1267e5dd7070Spatrick 
1268e5dd7070Spatrick #define _mm512_extracti64x2_epi64(A, imm) \
1269*12c85518Srobert   ((__m128i)__builtin_ia32_extracti64x2_512_mask((__v8di)(__m512i)(A), \
1270e5dd7070Spatrick                                                 (int)(imm), \
1271e5dd7070Spatrick                                                 (__v2di)_mm_undefined_si128(), \
1272*12c85518Srobert                                                 (__mmask8)-1))
1273e5dd7070Spatrick 
1274e5dd7070Spatrick #define _mm512_mask_extracti64x2_epi64(W, U, A, imm) \
1275*12c85518Srobert   ((__m128i)__builtin_ia32_extracti64x2_512_mask((__v8di)(__m512i)(A), \
1276e5dd7070Spatrick                                                  (int)(imm), \
1277e5dd7070Spatrick                                                  (__v2di)(__m128i)(W), \
1278*12c85518Srobert                                                  (__mmask8)(U)))
1279e5dd7070Spatrick 
1280e5dd7070Spatrick #define _mm512_maskz_extracti64x2_epi64(U, A, imm) \
1281*12c85518Srobert   ((__m128i)__builtin_ia32_extracti64x2_512_mask((__v8di)(__m512i)(A), \
1282e5dd7070Spatrick                                                  (int)(imm), \
1283e5dd7070Spatrick                                                  (__v2di)_mm_setzero_si128(), \
1284*12c85518Srobert                                                  (__mmask8)(U)))
1285e5dd7070Spatrick 
1286e5dd7070Spatrick #define _mm512_insertf32x8(A, B, imm) \
1287*12c85518Srobert   ((__m512)__builtin_ia32_insertf32x8((__v16sf)(__m512)(A), \
1288*12c85518Srobert                                       (__v8sf)(__m256)(B), (int)(imm)))
1289e5dd7070Spatrick 
1290e5dd7070Spatrick #define _mm512_mask_insertf32x8(W, U, A, B, imm) \
1291*12c85518Srobert   ((__m512)__builtin_ia32_selectps_512((__mmask16)(U), \
1292e5dd7070Spatrick                                  (__v16sf)_mm512_insertf32x8((A), (B), (imm)), \
1293*12c85518Srobert                                  (__v16sf)(__m512)(W)))
1294e5dd7070Spatrick 
1295e5dd7070Spatrick #define _mm512_maskz_insertf32x8(U, A, B, imm) \
1296*12c85518Srobert   ((__m512)__builtin_ia32_selectps_512((__mmask16)(U), \
1297e5dd7070Spatrick                                  (__v16sf)_mm512_insertf32x8((A), (B), (imm)), \
1298*12c85518Srobert                                  (__v16sf)_mm512_setzero_ps()))
1299e5dd7070Spatrick 
1300e5dd7070Spatrick #define _mm512_insertf64x2(A, B, imm) \
1301*12c85518Srobert   ((__m512d)__builtin_ia32_insertf64x2_512((__v8df)(__m512d)(A), \
1302*12c85518Srobert                                            (__v2df)(__m128d)(B), (int)(imm)))
1303e5dd7070Spatrick 
1304e5dd7070Spatrick #define _mm512_mask_insertf64x2(W, U, A, B, imm) \
1305*12c85518Srobert   ((__m512d)__builtin_ia32_selectpd_512((__mmask8)(U), \
1306e5dd7070Spatrick                                   (__v8df)_mm512_insertf64x2((A), (B), (imm)), \
1307*12c85518Srobert                                   (__v8df)(__m512d)(W)))
1308e5dd7070Spatrick 
1309e5dd7070Spatrick #define _mm512_maskz_insertf64x2(U, A, B, imm) \
1310*12c85518Srobert   ((__m512d)__builtin_ia32_selectpd_512((__mmask8)(U), \
1311e5dd7070Spatrick                                   (__v8df)_mm512_insertf64x2((A), (B), (imm)), \
1312*12c85518Srobert                                   (__v8df)_mm512_setzero_pd()))
1313e5dd7070Spatrick 
1314e5dd7070Spatrick #define _mm512_inserti32x8(A, B, imm) \
1315*12c85518Srobert   ((__m512i)__builtin_ia32_inserti32x8((__v16si)(__m512i)(A), \
1316*12c85518Srobert                                        (__v8si)(__m256i)(B), (int)(imm)))
1317e5dd7070Spatrick 
1318e5dd7070Spatrick #define _mm512_mask_inserti32x8(W, U, A, B, imm) \
1319*12c85518Srobert   ((__m512i)__builtin_ia32_selectd_512((__mmask16)(U), \
1320e5dd7070Spatrick                                  (__v16si)_mm512_inserti32x8((A), (B), (imm)), \
1321*12c85518Srobert                                  (__v16si)(__m512i)(W)))
1322e5dd7070Spatrick 
1323e5dd7070Spatrick #define _mm512_maskz_inserti32x8(U, A, B, imm) \
1324*12c85518Srobert   ((__m512i)__builtin_ia32_selectd_512((__mmask16)(U), \
1325e5dd7070Spatrick                                  (__v16si)_mm512_inserti32x8((A), (B), (imm)), \
1326*12c85518Srobert                                  (__v16si)_mm512_setzero_si512()))
1327e5dd7070Spatrick 
1328e5dd7070Spatrick #define _mm512_inserti64x2(A, B, imm) \
1329*12c85518Srobert   ((__m512i)__builtin_ia32_inserti64x2_512((__v8di)(__m512i)(A), \
1330*12c85518Srobert                                            (__v2di)(__m128i)(B), (int)(imm)))
1331e5dd7070Spatrick 
1332e5dd7070Spatrick #define _mm512_mask_inserti64x2(W, U, A, B, imm) \
1333*12c85518Srobert   ((__m512i)__builtin_ia32_selectq_512((__mmask8)(U), \
1334e5dd7070Spatrick                                   (__v8di)_mm512_inserti64x2((A), (B), (imm)), \
1335*12c85518Srobert                                   (__v8di)(__m512i)(W)))
1336e5dd7070Spatrick 
1337e5dd7070Spatrick #define _mm512_maskz_inserti64x2(U, A, B, imm) \
1338*12c85518Srobert   ((__m512i)__builtin_ia32_selectq_512((__mmask8)(U), \
1339e5dd7070Spatrick                                   (__v8di)_mm512_inserti64x2((A), (B), (imm)), \
1340*12c85518Srobert                                   (__v8di)_mm512_setzero_si512()))
1341e5dd7070Spatrick 
1342e5dd7070Spatrick #define _mm512_mask_fpclass_ps_mask(U, A, imm) \
1343*12c85518Srobert   ((__mmask16)__builtin_ia32_fpclassps512_mask((__v16sf)(__m512)(A), \
1344*12c85518Srobert                                                (int)(imm), (__mmask16)(U)))
1345e5dd7070Spatrick 
1346e5dd7070Spatrick #define _mm512_fpclass_ps_mask(A, imm) \
1347*12c85518Srobert   ((__mmask16)__builtin_ia32_fpclassps512_mask((__v16sf)(__m512)(A), \
1348*12c85518Srobert                                                (int)(imm), (__mmask16)-1))
1349e5dd7070Spatrick 
1350e5dd7070Spatrick #define _mm512_mask_fpclass_pd_mask(U, A, imm) \
1351*12c85518Srobert   ((__mmask8)__builtin_ia32_fpclasspd512_mask((__v8df)(__m512d)(A), (int)(imm), \
1352*12c85518Srobert                                               (__mmask8)(U)))
1353e5dd7070Spatrick 
1354e5dd7070Spatrick #define _mm512_fpclass_pd_mask(A, imm) \
1355*12c85518Srobert   ((__mmask8)__builtin_ia32_fpclasspd512_mask((__v8df)(__m512d)(A), (int)(imm), \
1356*12c85518Srobert                                               (__mmask8)-1))
1357e5dd7070Spatrick 
1358e5dd7070Spatrick #define _mm_fpclass_sd_mask(A, imm) \
1359*12c85518Srobert   ((__mmask8)__builtin_ia32_fpclasssd_mask((__v2df)(__m128d)(A), (int)(imm), \
1360*12c85518Srobert                                            (__mmask8)-1))
1361e5dd7070Spatrick 
1362e5dd7070Spatrick #define _mm_mask_fpclass_sd_mask(U, A, imm) \
1363*12c85518Srobert   ((__mmask8)__builtin_ia32_fpclasssd_mask((__v2df)(__m128d)(A), (int)(imm), \
1364*12c85518Srobert                                            (__mmask8)(U)))
1365e5dd7070Spatrick 
1366e5dd7070Spatrick #define _mm_fpclass_ss_mask(A, imm) \
1367*12c85518Srobert   ((__mmask8)__builtin_ia32_fpclassss_mask((__v4sf)(__m128)(A), (int)(imm), \
1368*12c85518Srobert                                            (__mmask8)-1))
1369e5dd7070Spatrick 
1370e5dd7070Spatrick #define _mm_mask_fpclass_ss_mask(U, A, imm) \
1371*12c85518Srobert   ((__mmask8)__builtin_ia32_fpclassss_mask((__v4sf)(__m128)(A), (int)(imm), \
1372*12c85518Srobert                                            (__mmask8)(U)))
1373e5dd7070Spatrick 
1374e5dd7070Spatrick #undef __DEFAULT_FN_ATTRS512
1375e5dd7070Spatrick #undef __DEFAULT_FN_ATTRS
1376e5dd7070Spatrick 
1377e5dd7070Spatrick #endif
1378