[clang] [clang] Implement __builtin_{clzg,ctzg} (PR #83431)

via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 25 11:03:04 PDT 2024


================
@@ -660,15 +660,23 @@ def Clz : Builtin, BitShort_Int_Long_LongLongTemplate {
   let Prototype = "int(unsigned T)";
 }
 
-// FIXME: Add int clzimax(uintmax_t)
+def Clzg : Builtin {
+  let Spellings = ["__builtin_clzg"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
----------------
overmighty wrote:

I will implement `constexpr` support. It requires adding a few lines in clang/lib/AST/ExprConstant.cpp and clang/lib/AST/Interp/InterpBuiltin.cpp.

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


More information about the cfe-commits mailing list