[clang] [X86][Clang] Add constexpr support for AVX512 kshift intrinsics (PR #170480)

Medha Tiwari via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 3 08:38:46 PST 2025


================
@@ -4255,6 +4255,28 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
           return APInt(sizeof(unsigned char) * 8, (A | B) == 0);
         });
 
+  case clang::X86::BI__builtin_ia32_kshiftliqi:
+  case clang::X86::BI__builtin_ia32_kshiftlihi:
+  case clang::X86::BI__builtin_ia32_kshiftlisi:
+  case clang::X86::BI__builtin_ia32_kshiftlidi:
+    return interp__builtin_elementwise_int_binop(
+        S, OpPC, Call, [](const APSInt &LHS, const APSInt &RHS) {
+          if (RHS.uge(LHS.getBitWidth()))
----------------
medhatiwari wrote:

 Done! Updated to mask the shift amount with & 0xFF to match CodeGenFunction.EmitX86BuiltinExpr behavior. Thanks for catching this!

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


More information about the cfe-commits mailing list