Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 1 | /*===------------- avx512ifmavlintrin.h - IFMA intrinsics ------------------=== |
| 2 | * |
| 3 | * |
Chandler Carruth | 4cf5743 | 2019-04-08 20:51:30 +0000 | [diff] [blame] | 4 | * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 | * See https://llvm.org/LICENSE.txt for license information. |
| 6 | * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 7 | * |
| 8 | *===-----------------------------------------------------------------------=== |
| 9 | */ |
| 10 | #ifndef __IMMINTRIN_H |
| 11 | #error "Never use <avx512ifmavlintrin.h> directly; include <immintrin.h> instead." |
| 12 | #endif |
| 13 | |
| 14 | #ifndef __IFMAVLINTRIN_H |
| 15 | #define __IFMAVLINTRIN_H |
| 16 | |
| 17 | /* Define the default attributes for the functions in this file. */ |
Craig Topper | 74c10e3 | 2018-07-09 19:00:16 +0000 | [diff] [blame] | 18 | #define __DEFAULT_FN_ATTRS128 __attribute__((__always_inline__, __nodebug__, __target__("avx512ifma,avx512vl"), __min_vector_width__(128))) |
| 19 | #define __DEFAULT_FN_ATTRS256 __attribute__((__always_inline__, __nodebug__, __target__("avx512ifma,avx512vl"), __min_vector_width__(256))) |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 20 | |
| 21 | |
| 22 | |
Craig Topper | 74c10e3 | 2018-07-09 19:00:16 +0000 | [diff] [blame] | 23 | static __inline__ __m128i __DEFAULT_FN_ATTRS128 |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 24 | _mm_madd52hi_epu64 (__m128i __X, __m128i __Y, __m128i __Z) |
| 25 | { |
Craig Topper | 387b142 | 2018-05-26 18:55:26 +0000 | [diff] [blame] | 26 | return (__m128i)__builtin_ia32_vpmadd52huq128((__v2di) __X, (__v2di) __Y, |
| 27 | (__v2di) __Z); |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 28 | } |
| 29 | |
Craig Topper | 74c10e3 | 2018-07-09 19:00:16 +0000 | [diff] [blame] | 30 | static __inline__ __m128i __DEFAULT_FN_ATTRS128 |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 31 | _mm_mask_madd52hi_epu64 (__m128i __W, __mmask8 __M, __m128i __X, __m128i __Y) |
| 32 | { |
Craig Topper | 387b142 | 2018-05-26 18:55:26 +0000 | [diff] [blame] | 33 | return (__m128i)__builtin_ia32_selectq_128(__M, |
| 34 | (__v2di)_mm_madd52hi_epu64(__W, __X, __Y), |
| 35 | (__v2di)__W); |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 36 | } |
| 37 | |
Craig Topper | 74c10e3 | 2018-07-09 19:00:16 +0000 | [diff] [blame] | 38 | static __inline__ __m128i __DEFAULT_FN_ATTRS128 |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 39 | _mm_maskz_madd52hi_epu64 (__mmask8 __M, __m128i __X, __m128i __Y, __m128i __Z) |
| 40 | { |
Craig Topper | 387b142 | 2018-05-26 18:55:26 +0000 | [diff] [blame] | 41 | return (__m128i)__builtin_ia32_selectq_128(__M, |
| 42 | (__v2di)_mm_madd52hi_epu64(__X, __Y, __Z), |
| 43 | (__v2di)_mm_setzero_si128()); |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 44 | } |
| 45 | |
Craig Topper | 74c10e3 | 2018-07-09 19:00:16 +0000 | [diff] [blame] | 46 | static __inline__ __m256i __DEFAULT_FN_ATTRS256 |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 47 | _mm256_madd52hi_epu64 (__m256i __X, __m256i __Y, __m256i __Z) |
| 48 | { |
Craig Topper | 387b142 | 2018-05-26 18:55:26 +0000 | [diff] [blame] | 49 | return (__m256i)__builtin_ia32_vpmadd52huq256((__v4di)__X, (__v4di)__Y, |
| 50 | (__v4di)__Z); |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 51 | } |
| 52 | |
Craig Topper | 74c10e3 | 2018-07-09 19:00:16 +0000 | [diff] [blame] | 53 | static __inline__ __m256i __DEFAULT_FN_ATTRS256 |
Craig Topper | 387b142 | 2018-05-26 18:55:26 +0000 | [diff] [blame] | 54 | _mm256_mask_madd52hi_epu64 (__m256i __W, __mmask8 __M, __m256i __X, __m256i __Y) |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 55 | { |
Craig Topper | 387b142 | 2018-05-26 18:55:26 +0000 | [diff] [blame] | 56 | return (__m256i)__builtin_ia32_selectq_256(__M, |
| 57 | (__v4di)_mm256_madd52hi_epu64(__W, __X, __Y), |
| 58 | (__v4di)__W); |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 59 | } |
| 60 | |
Craig Topper | 74c10e3 | 2018-07-09 19:00:16 +0000 | [diff] [blame] | 61 | static __inline__ __m256i __DEFAULT_FN_ATTRS256 |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 62 | _mm256_maskz_madd52hi_epu64 (__mmask8 __M, __m256i __X, __m256i __Y, __m256i __Z) |
| 63 | { |
Craig Topper | 387b142 | 2018-05-26 18:55:26 +0000 | [diff] [blame] | 64 | return (__m256i)__builtin_ia32_selectq_256(__M, |
| 65 | (__v4di)_mm256_madd52hi_epu64(__X, __Y, __Z), |
| 66 | (__v4di)_mm256_setzero_si256()); |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 67 | } |
| 68 | |
Craig Topper | 74c10e3 | 2018-07-09 19:00:16 +0000 | [diff] [blame] | 69 | static __inline__ __m128i __DEFAULT_FN_ATTRS128 |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 70 | _mm_madd52lo_epu64 (__m128i __X, __m128i __Y, __m128i __Z) |
| 71 | { |
Craig Topper | 387b142 | 2018-05-26 18:55:26 +0000 | [diff] [blame] | 72 | return (__m128i)__builtin_ia32_vpmadd52luq128((__v2di)__X, (__v2di)__Y, |
| 73 | (__v2di)__Z); |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 74 | } |
| 75 | |
Craig Topper | 74c10e3 | 2018-07-09 19:00:16 +0000 | [diff] [blame] | 76 | static __inline__ __m128i __DEFAULT_FN_ATTRS128 |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 77 | _mm_mask_madd52lo_epu64 (__m128i __W, __mmask8 __M, __m128i __X, __m128i __Y) |
| 78 | { |
Craig Topper | 387b142 | 2018-05-26 18:55:26 +0000 | [diff] [blame] | 79 | return (__m128i)__builtin_ia32_selectq_128(__M, |
| 80 | (__v2di)_mm_madd52lo_epu64(__W, __X, __Y), |
| 81 | (__v2di)__W); |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 82 | } |
| 83 | |
Craig Topper | 74c10e3 | 2018-07-09 19:00:16 +0000 | [diff] [blame] | 84 | static __inline__ __m128i __DEFAULT_FN_ATTRS128 |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 85 | _mm_maskz_madd52lo_epu64 (__mmask8 __M, __m128i __X, __m128i __Y, __m128i __Z) |
| 86 | { |
Craig Topper | 387b142 | 2018-05-26 18:55:26 +0000 | [diff] [blame] | 87 | return (__m128i)__builtin_ia32_selectq_128(__M, |
| 88 | (__v2di)_mm_madd52lo_epu64(__X, __Y, __Z), |
| 89 | (__v2di)_mm_setzero_si128()); |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 90 | } |
| 91 | |
Craig Topper | 74c10e3 | 2018-07-09 19:00:16 +0000 | [diff] [blame] | 92 | static __inline__ __m256i __DEFAULT_FN_ATTRS256 |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 93 | _mm256_madd52lo_epu64 (__m256i __X, __m256i __Y, __m256i __Z) |
| 94 | { |
Craig Topper | 387b142 | 2018-05-26 18:55:26 +0000 | [diff] [blame] | 95 | return (__m256i)__builtin_ia32_vpmadd52luq256((__v4di)__X, (__v4di)__Y, |
| 96 | (__v4di)__Z); |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 97 | } |
| 98 | |
Craig Topper | 74c10e3 | 2018-07-09 19:00:16 +0000 | [diff] [blame] | 99 | static __inline__ __m256i __DEFAULT_FN_ATTRS256 |
Craig Topper | 387b142 | 2018-05-26 18:55:26 +0000 | [diff] [blame] | 100 | _mm256_mask_madd52lo_epu64 (__m256i __W, __mmask8 __M, __m256i __X, __m256i __Y) |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 101 | { |
Craig Topper | 387b142 | 2018-05-26 18:55:26 +0000 | [diff] [blame] | 102 | return (__m256i)__builtin_ia32_selectq_256(__M, |
| 103 | (__v4di)_mm256_madd52lo_epu64(__W, __X, __Y), |
| 104 | (__v4di)__W); |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 105 | } |
| 106 | |
Craig Topper | 74c10e3 | 2018-07-09 19:00:16 +0000 | [diff] [blame] | 107 | static __inline__ __m256i __DEFAULT_FN_ATTRS256 |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 108 | _mm256_maskz_madd52lo_epu64 (__mmask8 __M, __m256i __X, __m256i __Y, __m256i __Z) |
| 109 | { |
Craig Topper | 387b142 | 2018-05-26 18:55:26 +0000 | [diff] [blame] | 110 | return (__m256i)__builtin_ia32_selectq_256(__M, |
| 111 | (__v4di)_mm256_madd52lo_epu64(__X, __Y, __Z), |
| 112 | (__v4di)_mm256_setzero_si256()); |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | |
Craig Topper | 74c10e3 | 2018-07-09 19:00:16 +0000 | [diff] [blame] | 116 | #undef __DEFAULT_FN_ATTRS128 |
| 117 | #undef __DEFAULT_FN_ATTRS256 |
Michael Zuckerman | 0190c65 | 2016-03-07 09:55:55 +0000 | [diff] [blame] | 118 | |
| 119 | #endif |