avx512cdintrin.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /*===------------- avx512cdintrin.h - AVX512CD 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 <avx512cdintrin.h> directly; include <immintrin.h> instead."
  26. #endif
  27. #ifndef __AVX512CDINTRIN_H
  28. #define __AVX512CDINTRIN_H
  29. /* Define the default attributes for the functions in this file. */
  30. #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512cd")))
  31. static __inline__ __m512i __DEFAULT_FN_ATTRS
  32. _mm512_conflict_epi64 (__m512i __A)
  33. {
  34. return (__m512i) __builtin_ia32_vpconflictdi_512_mask ((__v8di) __A,
  35. (__v8di) _mm512_setzero_si512 (),
  36. (__mmask8) -1);
  37. }
  38. static __inline__ __m512i __DEFAULT_FN_ATTRS
  39. _mm512_mask_conflict_epi64 (__m512i __W, __mmask8 __U, __m512i __A)
  40. {
  41. return (__m512i) __builtin_ia32_vpconflictdi_512_mask ((__v8di) __A,
  42. (__v8di) __W,
  43. (__mmask8) __U);
  44. }
  45. static __inline__ __m512i __DEFAULT_FN_ATTRS
  46. _mm512_maskz_conflict_epi64 (__mmask8 __U, __m512i __A)
  47. {
  48. return (__m512i) __builtin_ia32_vpconflictdi_512_mask ((__v8di) __A,
  49. (__v8di) _mm512_setzero_si512 (),
  50. (__mmask8) __U);
  51. }
  52. static __inline__ __m512i __DEFAULT_FN_ATTRS
  53. _mm512_conflict_epi32 (__m512i __A)
  54. {
  55. return (__m512i) __builtin_ia32_vpconflictsi_512_mask ((__v16si) __A,
  56. (__v16si) _mm512_setzero_si512 (),
  57. (__mmask16) -1);
  58. }
  59. static __inline__ __m512i __DEFAULT_FN_ATTRS
  60. _mm512_mask_conflict_epi32 (__m512i __W, __mmask16 __U, __m512i __A)
  61. {
  62. return (__m512i) __builtin_ia32_vpconflictsi_512_mask ((__v16si) __A,
  63. (__v16si) __W,
  64. (__mmask16) __U);
  65. }
  66. static __inline__ __m512i __DEFAULT_FN_ATTRS
  67. _mm512_maskz_conflict_epi32 (__mmask16 __U, __m512i __A)
  68. {
  69. return (__m512i) __builtin_ia32_vpconflictsi_512_mask ((__v16si) __A,
  70. (__v16si) _mm512_setzero_si512 (),
  71. (__mmask16) __U);
  72. }
  73. static __inline__ __m512i __DEFAULT_FN_ATTRS
  74. _mm512_lzcnt_epi32 (__m512i __A)
  75. {
  76. return (__m512i) __builtin_ia32_vplzcntd_512_mask ((__v16si) __A,
  77. (__v16si) _mm512_setzero_si512 (),
  78. (__mmask16) -1);
  79. }
  80. static __inline__ __m512i __DEFAULT_FN_ATTRS
  81. _mm512_mask_lzcnt_epi32 (__m512i __W, __mmask16 __U, __m512i __A)
  82. {
  83. return (__m512i) __builtin_ia32_vplzcntd_512_mask ((__v16si) __A,
  84. (__v16si) __W,
  85. (__mmask16) __U);
  86. }
  87. static __inline__ __m512i __DEFAULT_FN_ATTRS
  88. _mm512_maskz_lzcnt_epi32 (__mmask16 __U, __m512i __A)
  89. {
  90. return (__m512i) __builtin_ia32_vplzcntd_512_mask ((__v16si) __A,
  91. (__v16si) _mm512_setzero_si512 (),
  92. (__mmask16) __U);
  93. }
  94. static __inline__ __m512i __DEFAULT_FN_ATTRS
  95. _mm512_lzcnt_epi64 (__m512i __A)
  96. {
  97. return (__m512i) __builtin_ia32_vplzcntq_512_mask ((__v8di) __A,
  98. (__v8di) _mm512_setzero_si512 (),
  99. (__mmask8) -1);
  100. }
  101. static __inline__ __m512i __DEFAULT_FN_ATTRS
  102. _mm512_mask_lzcnt_epi64 (__m512i __W, __mmask8 __U, __m512i __A)
  103. {
  104. return (__m512i) __builtin_ia32_vplzcntq_512_mask ((__v8di) __A,
  105. (__v8di) __W,
  106. (__mmask8) __U);
  107. }
  108. static __inline__ __m512i __DEFAULT_FN_ATTRS
  109. _mm512_maskz_lzcnt_epi64 (__mmask8 __U, __m512i __A)
  110. {
  111. return (__m512i) __builtin_ia32_vplzcntq_512_mask ((__v8di) __A,
  112. (__v8di) _mm512_setzero_si512 (),
  113. (__mmask8) __U);
  114. }
  115. static __inline__ __m512i __DEFAULT_FN_ATTRS
  116. _mm512_broadcastmb_epi64 (__mmask8 __A)
  117. {
  118. return (__m512i) _mm512_set1_epi64((long long) __A);
  119. }
  120. static __inline__ __m512i __DEFAULT_FN_ATTRS
  121. _mm512_broadcastmw_epi32 (__mmask16 __A)
  122. {
  123. return (__m512i) _mm512_set1_epi32((int) __A);
  124. }
  125. #undef __DEFAULT_FN_ATTRS
  126. #endif