[PATCH] D134958: [clang][Interp] Support __builtin_clz calls
Timm Bäder via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 30 06:36:50 PDT 2022
tbaeder added inline comments.
================
Comment at: clang/lib/AST/Interp/InterpBuiltin.cpp:16-19
+ auto Arg = S.Stk.pop<Integral<32, false>>();
+ auto Result = Arg.countLeadingZeros();
+ S.Stk.push<Integral<32, true>>(Integral<32, true>::from(Result));
+ return true;
----------------
This would also work as:
```
auto Arg = S.Stk.pop<unsigned int>();
auto Result = __builtin_clz(Arg);
S.Stk.push<int>(Result);
return true;
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134958/new/
https://reviews.llvm.org/D134958
More information about the cfe-commits
mailing list