[clang] [clang][x86][bytecode] Replace interp__builtin_parity/clrsb/bitreverse/ffs with static bool interp__builtin_elementwise_int_unaryop callback (PR #162346)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 7 23:14:00 PDT 2025


================
@@ -3209,7 +3182,13 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const CallExpr *Call,
   case Builtin::BI__builtin_ffs:
   case Builtin::BI__builtin_ffsl:
   case Builtin::BI__builtin_ffsll:
-    return interp__builtin_ffs(S, OpPC, Frame, Call);
+    return interp__builtin_elementwise_int_unaryop(
+        S, OpPC, Call, [](const APSInt &Val) {
+          return APInt(Val.getBitWidth(),
----------------
tbaederr wrote:

Use a variable for `Val.countTrainlingZeros()`.

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


More information about the cfe-commits mailing list