[clang] Issue #162051: [X86][Clang] VectorExprEvaluator::VisitCallExpr / InterpretBuiltin - add AVX512 KTEST/KORTEST intrinsics to be used in constexpr (PR #166103)

Simon Pilgrim via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 3 02:04:47 PST 2025


================
@@ -242,6 +250,16 @@ unsigned char test_kortest_mask32_u8(__m512i __A, __m512i __B, __m512i __C, __m5
                             _mm512_cmpneq_epu16_mask(__C, __D), CF);
 }
 
+#if TEST_STD_VER > 17
+TEST_CONSTEXPR bool test_kortest_mask32_u8() {
+  unsigned char all_ones = 0;
+  return (_kortest_mask32_u8(0x0000'0000, 0x0000'0000, &all_ones) == 1) && (all_ones == 0)
+      && (_kortest_mask32_u8(0x0000'0000, 0x8000'0000, &all_ones) == 0) && (all_ones == 0)
+      && (_kortest_mask32_u8(0x0123'4567, 0xFEDC'BA98, &all_ones) == 0) && (all_ones == 1)
+      ;
+}
----------------
RKSimon wrote:

Just create a small stub constexpr function and wrap inside a static_assert - same as we do bmi2-builtins.c

https://github.com/llvm/llvm-project/pull/166103


More information about the cfe-commits mailing list