avx512cdintrin.h 5.7 KB

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