1/* Copyright (C) 2013-2015 Free Software Foundation, Inc.
2
3   This file is part of GCC.
4
5   GCC is free software; you can redistribute it and/or modify
6   it under the terms of the GNU General Public License as published by
7   the Free Software Foundation; either version 3, or (at your option)
8   any later version.
9
10   GCC is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   GNU General Public License for more details.
14
15   Under Section 7 of GPL version 3, you are granted additional
16   permissions described in the GCC Runtime Library Exception, version
17   3.1, as published by the Free Software Foundation.
18
19   You should have received a copy of the GNU General Public License and
20   a copy of the GCC Runtime Library Exception along with this program;
21   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
22   <http://www.gnu.org/licenses/>.  */
23
24#ifndef _IMMINTRIN_H_INCLUDED
25#error "Never use <avx512cdintrin.h> directly; include <immintrin.h> instead."
26#endif
27
28#ifndef _AVX512CDINTRIN_H_INCLUDED
29#define _AVX512CDINTRIN_H_INCLUDED
30
31#ifndef __AVX512CD__
32#pragma GCC push_options
33#pragma GCC target("avx512cd")
34#define __DISABLE_AVX512CD__
35#endif /* __AVX512CD__ */
36
37/* Internal data types for implementing the intrinsics.  */
38typedef long long __v8di __attribute__ ((__vector_size__ (64)));
39typedef int __v16si __attribute__ ((__vector_size__ (64)));
40
41/* The Intel API is flexible enough that we must allow aliasing with other
42   vector types, and their scalar components.  */
43typedef long long __m512i __attribute__ ((__vector_size__ (64), __may_alias__));
44typedef double __m512d __attribute__ ((__vector_size__ (64), __may_alias__));
45
46typedef unsigned char  __mmask8;
47typedef unsigned short __mmask16;
48
49extern __inline __m512i
50__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
51_mm512_conflict_epi32 (__m512i __A)
52{
53  return (__m512i)
54	 __builtin_ia32_vpconflictsi_512_mask ((__v16si) __A,
55					       (__v16si) _mm512_setzero_si512 (),
56					       (__mmask16) -1);
57}
58
59extern __inline __m512i
60__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
61_mm512_mask_conflict_epi32 (__m512i __W, __mmask16 __U, __m512i __A)
62{
63  return (__m512i) __builtin_ia32_vpconflictsi_512_mask ((__v16si) __A,
64							 (__v16si) __W,
65							 (__mmask16) __U);
66}
67
68extern __inline __m512i
69__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
70_mm512_maskz_conflict_epi32 (__mmask16 __U, __m512i __A)
71{
72  return (__m512i)
73	 __builtin_ia32_vpconflictsi_512_mask ((__v16si) __A,
74					       (__v16si) _mm512_setzero_si512 (),
75					       (__mmask16) __U);
76}
77
78extern __inline __m512i
79__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
80_mm512_conflict_epi64 (__m512i __A)
81{
82  return (__m512i)
83	 __builtin_ia32_vpconflictdi_512_mask ((__v8di) __A,
84					       (__v8di) _mm512_setzero_si512 (),
85					       (__mmask8) -1);
86}
87
88extern __inline __m512i
89__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
90_mm512_mask_conflict_epi64 (__m512i __W, __mmask8 __U, __m512i __A)
91{
92  return (__m512i) __builtin_ia32_vpconflictdi_512_mask ((__v8di) __A,
93							 (__v8di) __W,
94							 (__mmask8) __U);
95}
96
97extern __inline __m512i
98__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
99_mm512_maskz_conflict_epi64 (__mmask8 __U, __m512i __A)
100{
101  return (__m512i)
102	 __builtin_ia32_vpconflictdi_512_mask ((__v8di) __A,
103					       (__v8di) _mm512_setzero_si512 (),
104					       (__mmask8) __U);
105}
106
107extern __inline __m512i
108__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
109_mm512_lzcnt_epi64 (__m512i __A)
110{
111  return (__m512i)
112	 __builtin_ia32_vplzcntq_512_mask ((__v8di) __A,
113					   (__v8di) _mm512_setzero_si512 (),
114					   (__mmask8) -1);
115}
116
117extern __inline __m512i
118__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
119_mm512_mask_lzcnt_epi64 (__m512i __W, __mmask8 __U, __m512i __A)
120{
121  return (__m512i) __builtin_ia32_vplzcntq_512_mask ((__v8di) __A,
122						     (__v8di) __W,
123						     (__mmask8) __U);
124}
125
126extern __inline __m512i
127__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
128_mm512_maskz_lzcnt_epi64 (__mmask8 __U, __m512i __A)
129{
130  return (__m512i)
131	 __builtin_ia32_vplzcntq_512_mask ((__v8di) __A,
132					   (__v8di) _mm512_setzero_si512 (),
133					   (__mmask8) __U);
134}
135
136extern __inline __m512i
137__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
138_mm512_lzcnt_epi32 (__m512i __A)
139{
140  return (__m512i)
141	 __builtin_ia32_vplzcntd_512_mask ((__v16si) __A,
142					   (__v16si) _mm512_setzero_si512 (),
143					   (__mmask16) -1);
144}
145
146extern __inline __m512i
147__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
148_mm512_mask_lzcnt_epi32 (__m512i __W, __mmask16 __U, __m512i __A)
149{
150  return (__m512i) __builtin_ia32_vplzcntd_512_mask ((__v16si) __A,
151						     (__v16si) __W,
152						     (__mmask16) __U);
153}
154
155extern __inline __m512i
156__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
157_mm512_maskz_lzcnt_epi32 (__mmask16 __U, __m512i __A)
158{
159  return (__m512i)
160	 __builtin_ia32_vplzcntd_512_mask ((__v16si) __A,
161					   (__v16si) _mm512_setzero_si512 (),
162					   (__mmask16) __U);
163}
164
165extern __inline __m512i
166__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
167_mm512_broadcastmb_epi64 (__mmask8 __A)
168{
169  return (__m512i) __builtin_ia32_broadcastmb512 (__A);
170}
171
172extern __inline __m512i
173__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
174_mm512_broadcastmw_epi32 (__mmask16 __A)
175{
176  return (__m512i) __builtin_ia32_broadcastmw512 (__A);
177}
178
179#ifdef __DISABLE_AVX512CD__
180#undef __DISABLE_AVX512CD__
181#pragma GCC pop_options
182#endif /* __DISABLE_AVX512CD__ */
183
184#endif /* _AVX512CDINTRIN_H_INCLUDED */
185