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

via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 7 12:44:52 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- clang/lib/AST/ByteCode/InterpBuiltin.cpp
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index 3792588a2..b1e7929ab 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -3204,7 +3204,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_elementwise_int_unaryop(S, OpPC, Call, [](const APSInt& Val){ return APInt(Val.getBitWidth(), (Val.countTrailingZeros()==Val.getBitWidth()) ? 0u : (Val.countTrailingZeros()+1u)); });
+    return interp__builtin_elementwise_int_unaryop(
+        S, OpPC, Call, [](const APSInt &Val) {
+          return APInt(Val.getBitWidth(),
+                       (Val.countTrailingZeros() == Val.getBitWidth())
+                           ? 0u
+                           : (Val.countTrailingZeros() + 1u));
+        });
 
   case Builtin::BIaddressof:
   case Builtin::BI__addressof:

``````````

</details>


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


More information about the cfe-commits mailing list