avx512ifmavlintrin.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /*===------------- avx512ifmavlintrin.h - IFMA 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 <avx512ifmavlintrin.h> directly; include <immintrin.h> instead."
  26. #endif
  27. #ifndef __IFMAVLINTRIN_H
  28. #define __IFMAVLINTRIN_H
  29. /* Define the default attributes for the functions in this file. */
  30. #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("avx512ifma,avx512vl")))
  31. static __inline__ __m128i __DEFAULT_FN_ATTRS
  32. _mm_madd52hi_epu64 (__m128i __X, __m128i __Y, __m128i __Z)
  33. {
  34. return (__m128i) __builtin_ia32_vpmadd52huq128_mask ((__v2di) __X,
  35. (__v2di) __Y,
  36. (__v2di) __Z,
  37. (__mmask8) -1);
  38. }
  39. static __inline__ __m128i __DEFAULT_FN_ATTRS
  40. _mm_mask_madd52hi_epu64 (__m128i __W, __mmask8 __M, __m128i __X, __m128i __Y)
  41. {
  42. return (__m128i) __builtin_ia32_vpmadd52huq128_mask ((__v2di) __W,
  43. (__v2di) __X,
  44. (__v2di) __Y,
  45. (__mmask8) __M);
  46. }
  47. static __inline__ __m128i __DEFAULT_FN_ATTRS
  48. _mm_maskz_madd52hi_epu64 (__mmask8 __M, __m128i __X, __m128i __Y, __m128i __Z)
  49. {
  50. return (__m128i) __builtin_ia32_vpmadd52huq128_maskz ((__v2di) __X,
  51. (__v2di) __Y,
  52. (__v2di) __Z,
  53. (__mmask8) __M);
  54. }
  55. static __inline__ __m256i __DEFAULT_FN_ATTRS
  56. _mm256_madd52hi_epu64 (__m256i __X, __m256i __Y, __m256i __Z)
  57. {
  58. return (__m256i) __builtin_ia32_vpmadd52huq256_mask ((__v4di) __X,
  59. (__v4di) __Y,
  60. (__v4di) __Z,
  61. (__mmask8) -1);
  62. }
  63. static __inline__ __m256i __DEFAULT_FN_ATTRS
  64. _mm256_mask_madd52hi_epu64 (__m256i __W, __mmask8 __M, __m256i __X,
  65. __m256i __Y)
  66. {
  67. return (__m256i) __builtin_ia32_vpmadd52huq256_mask ((__v4di) __W,
  68. (__v4di) __X,
  69. (__v4di) __Y,
  70. (__mmask8) __M);
  71. }
  72. static __inline__ __m256i __DEFAULT_FN_ATTRS
  73. _mm256_maskz_madd52hi_epu64 (__mmask8 __M, __m256i __X, __m256i __Y, __m256i __Z)
  74. {
  75. return (__m256i) __builtin_ia32_vpmadd52huq256_maskz ((__v4di) __X,
  76. (__v4di) __Y,
  77. (__v4di) __Z,
  78. (__mmask8) __M);
  79. }
  80. static __inline__ __m128i __DEFAULT_FN_ATTRS
  81. _mm_madd52lo_epu64 (__m128i __X, __m128i __Y, __m128i __Z)
  82. {
  83. return (__m128i) __builtin_ia32_vpmadd52luq128_mask ((__v2di) __X,
  84. (__v2di) __Y,
  85. (__v2di) __Z,
  86. (__mmask8) -1);
  87. }
  88. static __inline__ __m128i __DEFAULT_FN_ATTRS
  89. _mm_mask_madd52lo_epu64 (__m128i __W, __mmask8 __M, __m128i __X, __m128i __Y)
  90. {
  91. return (__m128i) __builtin_ia32_vpmadd52luq128_mask ((__v2di) __W,
  92. (__v2di) __X,
  93. (__v2di) __Y,
  94. (__mmask8) __M);
  95. }
  96. static __inline__ __m128i __DEFAULT_FN_ATTRS
  97. _mm_maskz_madd52lo_epu64 (__mmask8 __M, __m128i __X, __m128i __Y, __m128i __Z)
  98. {
  99. return (__m128i) __builtin_ia32_vpmadd52luq128_maskz ((__v2di) __X,
  100. (__v2di) __Y,
  101. (__v2di) __Z,
  102. (__mmask8) __M);
  103. }
  104. static __inline__ __m256i __DEFAULT_FN_ATTRS
  105. _mm256_madd52lo_epu64 (__m256i __X, __m256i __Y, __m256i __Z)
  106. {
  107. return (__m256i) __builtin_ia32_vpmadd52luq256_mask ((__v4di) __X,
  108. (__v4di) __Y,
  109. (__v4di) __Z,
  110. (__mmask8) -1);
  111. }
  112. static __inline__ __m256i __DEFAULT_FN_ATTRS
  113. _mm256_mask_madd52lo_epu64 (__m256i __W, __mmask8 __M, __m256i __X,
  114. __m256i __Y)
  115. {
  116. return (__m256i) __builtin_ia32_vpmadd52luq256_mask ((__v4di) __W,
  117. (__v4di) __X,
  118. (__v4di) __Y,
  119. (__mmask8) __M);
  120. }
  121. static __inline__ __m256i __DEFAULT_FN_ATTRS
  122. _mm256_maskz_madd52lo_epu64 (__mmask8 __M, __m256i __X, __m256i __Y, __m256i __Z)
  123. {
  124. return (__m256i) __builtin_ia32_vpmadd52luq256_maskz ((__v4di) __X,
  125. (__v4di) __Y,
  126. (__v4di) __Z,
  127. (__mmask8) __M);
  128. }
  129. #undef __DEFAULT_FN_ATTRS
  130. #endif