blob: a2c3b8f2bf92b83a0fa2c955d4fe7ae59a69463f [file] [log] [blame]
Ben Murdoch097c5b22016-05-18 11:27:45 +01001/*===------------- avx512vbmiintrin.h - VBMI intrinsics ------------------===
2 *
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 *
22 *===-----------------------------------------------------------------------===
23 */
24#ifndef __IMMINTRIN_H
25#error "Never use <avx512vbmiintrin.h> directly; include <immintrin.h> instead."
26#endif
27
28#ifndef __VBMIINTRIN_H
29#define __VBMIINTRIN_H
30
31/* Define the default attributes for the functions in this file. */
32#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512vbmi")))
33
34
35static __inline__ __m512i __DEFAULT_FN_ATTRS
36_mm512_mask2_permutex2var_epi8 (__m512i __A, __m512i __I,
37 __mmask64 __U, __m512i __B)
38{
39 return (__m512i) __builtin_ia32_vpermi2varqi512_mask ((__v64qi) __A,
40 (__v64qi) __I
41 /* idx */ ,
42 (__v64qi) __B,
43 (__mmask64)
44 __U);
45}
46
47static __inline__ __m512i __DEFAULT_FN_ATTRS
48_mm512_permutex2var_epi8 (__m512i __A, __m512i __I, __m512i __B)
49{
50 return (__m512i) __builtin_ia32_vpermt2varqi512_mask ((__v64qi) __I
51 /* idx */ ,
52 (__v64qi) __A,
53 (__v64qi) __B,
54 (__mmask64) -
55 1);
56}
57
58static __inline__ __m512i __DEFAULT_FN_ATTRS
59_mm512_mask_permutex2var_epi8 (__m512i __A, __mmask64 __U,
60 __m512i __I, __m512i __B)
61{
62 return (__m512i) __builtin_ia32_vpermt2varqi512_mask ((__v64qi) __I
63 /* idx */ ,
64 (__v64qi) __A,
65 (__v64qi) __B,
66 (__mmask64)
67 __U);
68}
69
70static __inline__ __m512i __DEFAULT_FN_ATTRS
71_mm512_maskz_permutex2var_epi8 (__mmask64 __U, __m512i __A,
72 __m512i __I, __m512i __B)
73{
74 return (__m512i) __builtin_ia32_vpermt2varqi512_maskz ((__v64qi) __I
75 /* idx */ ,
76 (__v64qi) __A,
77 (__v64qi) __B,
78 (__mmask64)
79 __U);
80}
81
Ben Murdoch61f157c2016-09-16 13:49:30 +010082static __inline__ __m512i __DEFAULT_FN_ATTRS
83_mm512_permutexvar_epi8 (__m512i __A, __m512i __B)
84{
85 return (__m512i) __builtin_ia32_permvarqi512_mask ((__v64qi) __B,
86 (__v64qi) __A,
87 (__v64qi) _mm512_undefined_epi32 (),
88 (__mmask64) -1);
89}
90
91static __inline__ __m512i __DEFAULT_FN_ATTRS
92_mm512_maskz_permutexvar_epi8 (__mmask64 __M, __m512i __A,
93 __m512i __B)
94{
95 return (__m512i) __builtin_ia32_permvarqi512_mask ((__v64qi) __B,
96 (__v64qi) __A,
97 (__v64qi) _mm512_setzero_si512(),
98 (__mmask64) __M);
99}
100
101static __inline__ __m512i __DEFAULT_FN_ATTRS
102_mm512_mask_permutexvar_epi8 (__m512i __W, __mmask64 __M, __m512i __A,
103 __m512i __B)
104{
105 return (__m512i) __builtin_ia32_permvarqi512_mask ((__v64qi) __B,
106 (__v64qi) __A,
107 (__v64qi) __W,
108 (__mmask64) __M);
109}
110
Ben Murdoch097c5b22016-05-18 11:27:45 +0100111#undef __DEFAULT_FN_ATTRS
112
113#endif