Skip to content

Commit e91be48

Browse files
[clang] Add _mm512_kunpackd and _mm512_kunpackw to avx512fintrin.h
Add AVX-512 mask unpack intrinsics _mm512_kunpackd and _mm512_kunpackw to avx512fintrin.h alongside the existing _mm512_kunpackb intrinsic. These intrinsics extract and concatenate the lower halves of mask registers, using the existing backend support for __builtin_ia32_kunpckdi and __builtin_ia32_kunpcksi builtins. Also adds __mmask32 and __mmask64 type definitions to avx512fintrin.h for completeness. Tests already exist in clang/test/CodeGen/X86/avx512bw-builtins.c.
1 parent 3c52f53 commit e91be48

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

clang/lib/Headers/avx512fintrin.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ typedef long long __m512i_u __attribute__((__vector_size__(64), __aligned__(1)))
4040

4141
typedef unsigned char __mmask8;
4242
typedef unsigned short __mmask16;
43+
typedef unsigned int __mmask32;
44+
typedef unsigned long long __mmask64;
4345

4446
/* Rounding mode macros. */
4547
#define _MM_FROUND_TO_NEAREST_INT 0x00
@@ -8100,6 +8102,18 @@ _mm512_kunpackb (__mmask16 __A, __mmask16 __B)
81008102
return (__mmask16) __builtin_ia32_kunpckhi ((__mmask16) __A, (__mmask16) __B);
81018103
}
81028104

8105+
static __inline__ __mmask64 __DEFAULT_FN_ATTRS
8106+
_mm512_kunpackd (__mmask64 __A, __mmask64 __B)
8107+
{
8108+
return (__mmask64) __builtin_ia32_kunpckdi ((__mmask64) __A, (__mmask64) __B);
8109+
}
8110+
8111+
static __inline__ __mmask32 __DEFAULT_FN_ATTRS
8112+
_mm512_kunpackw (__mmask32 __A, __mmask32 __B)
8113+
{
8114+
return (__mmask32) __builtin_ia32_kunpcksi ((__mmask32) __A, (__mmask32) __B);
8115+
}
8116+
81038117
static __inline__ __mmask16 __DEFAULT_FN_ATTRS_CONSTEXPR
81048118
_mm512_kxnor(__mmask16 __A, __mmask16 __B) {
81058119
return (__mmask16) __builtin_ia32_kxnorhi ((__mmask16) __A, (__mmask16) __B);

0 commit comments

Comments
 (0)