[clang] [clang] Introduce elementwise clz/ctz builtins (PR #131995)

Fraser Cormack via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 19 04:50:51 PDT 2025


================
@@ -1484,6 +1484,18 @@ def ElementwiseSubSat : Builtin {
   let Prototype = "void(...)";
 }
 
+def ElementwiseClz : Builtin {
+  let Spellings = ["__builtin_elementwise_clz"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr];
+  let Prototype = "void(...)";
+}
+
+def ElementwiseCtz : Builtin {
+  let Spellings = ["__builtin_elementwise_ctz"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr];
----------------
frasercrmck wrote:

Ah no, the documentation says that the integer builtins may be called in a constexpr context, so `Constexpr` is correct and the patch needs to account for that. Will update.

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


More information about the cfe-commits mailing list