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

Roberto Turrado Camblor via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 5 11:00:54 PST 2025


rturrado wrote:

> Still missing handling in ExprConstant.cpp VisitBuiltinCallExpr - we currently have 2 expression interpreters to support

Many thanks for the guiding, @RKSimon !

All `constexpr` versions of the `ktest`/`kortest` instructions are recognized.

The only remaining issue is that all the `_m512_kortest` tests are failing. I think that this is related to what I mentioned [above](https://github.com/llvm/llvm-project/pull/166103#issuecomment-3487836520):

1. `__builtin_ia32_kortestchi(A, B)` and `__builtin_ia32_kortestzhi(A, B)` return a `char` with the value `(A | B) == (unsigned short)~0`  and `(A | B) == 0`, respectively.
2. `_m512_kortestc(A, B)` and `_m512_kortestz(A, B)` are implemented in terms of `__builtin_ia32_kortestchi` and `__builtin_ia32_kortestzhi`, respectively.
3. `_m512_kortestc` and `_m512_kortestz` expect and `int` with the value of `A | B` to be returned.

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


More information about the cfe-commits mailing list