1 /* Copyright (C) 2013-2018 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. */ 38 typedef long long __v8di __attribute__ ((__vector_size__ (64))); 39 typedef 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. */ 43 typedef long long __m512i __attribute__ ((__vector_size__ (64), __may_alias__)); 44 typedef double __m512d __attribute__ ((__vector_size__ (64), __may_alias__)); 45 46 typedef unsigned char __mmask8; 47 typedef unsigned short __mmask16; 48 49 extern __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 59 extern __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 68 extern __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 78 extern __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 88 extern __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 97 extern __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 107 extern __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 117 extern __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 126 extern __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 136 extern __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 146 extern __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 155 extern __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 165 extern __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 172 extern __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