[clang] [CIR][X86] Add support for kunpck builtins (PR #168757)
Ahmed Nour via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 20 07:07:42 PST 2025
================
@@ -3152,3 +3152,25 @@ void test_mm512_mask_cvtusepi16_storeu_epi8 (void * __P, __mmask32 __M, __m512i
// CHECK: @llvm.x86.avx512.mask.pmovus.wb.mem.512
_mm512_mask_cvtusepi16_storeu_epi8 ( __P, __M, __A);
}
+
+__mmask32 test_mm512_kunpackw(__mmask32 a, __mmask32 b) {
+ // CHECK-LABEL: test_mm512_kunpackw
+ // CHECK: [[A_BITCAST:%.*]] = bitcast i32 %{{.*}} to <32 x i1>
+ // CHECK: [[A_SHUFFLE:%.*]] = shufflevector <32 x i1> [[A_BITCAST]], <32 x i1> [[A_BITCAST]], <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
+ // CHECK: [[B_BITCAST:%.*]] = bitcast i32 %{{.*}} to <32 x i1>
+ // CHECK: [[B_SHUFFLE:%.*]] = shufflevector <32 x i1> [[B_BITCAST]], <32 x i1> [[B_BITCAST]], <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
+ // CHECK: [[CONCAT:%.*]] = shufflevector <16 x i1> [[B_SHUFFLE]], <16 x i1> [[A_SHUFFLE]], <32 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31>
+ // CHECK: bitcast <32 x i1> [[CONCAT]] to i32
+ return _mm512_kunpackw(a, b);
+}
----------------
ahmednoursphinx wrote:
Removed. You're right - the existing test_mm512_kunpackw/d tests already cover this. I verified they pass with CIR backend enabled, confirming the implementation works correctly
https://github.com/llvm/llvm-project/pull/168757
More information about the cfe-commits
mailing list