[PATCH] D134958: [clang][Interp] Support __builtin_clz calls

2022-10-22 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder abandoned this revision. tbaeder added a comment. Let's shelve this until later. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D134958/new/ https://reviews.llvm.org/D134958 ___ cfe-commits mailing

[PATCH] D134958: [clang][Interp] Support __builtin_clz calls

2022-09-30 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D134958#3827038 , @tbaeder wrote: > In D134958#3827024 , @erichkeane > wrote: > >> This seems right enough to me, though you might consider CTZ as well since >> it is equally a

[PATCH] D134958: [clang][Interp] Support __builtin_clz calls

2022-09-30 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment. In D134958#3827038 , @tbaeder wrote: > In D134958#3827024 , @erichkeane > wrote: > >> This seems right enough to me, though you might consider CTZ as well since >> it is equally as e

[PATCH] D134958: [clang][Interp] Support __builtin_clz calls

2022-09-30 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added a comment. In D134958#3827024 , @erichkeane wrote: > This seems right enough to me, though you might consider CTZ as well since > it is equally as easy. A better/more useful attempt is going to be > builtin_strlen. Note that with built

[PATCH] D134958: [clang][Interp] Support __builtin_clz calls

2022-09-30 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment. This seems right enough to me, though you might consider CTZ as well since it is equally as easy. A better/more useful attempt is going to be builtin_strlen. Note that with builtins they are going to be particularly difficult because you can't execute them on the

[PATCH] D134958: [clang][Interp] Support __builtin_clz calls

2022-09-30 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added inline comments. Comment at: clang/lib/AST/Interp/InterpBuiltin.cpp:16-19 + auto Arg = S.Stk.pop>(); + auto Result = Arg.countLeadingZeros(); + S.Stk.push>(Integral<32, true>::from(Result)); + return true; This would also work as: ``` auto Ar

[PATCH] D134958: [clang][Interp] Support __builtin_clz calls

2022-09-30 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder created this revision. tbaeder added reviewers: aaron.ballman, erichkeane, tahonermann, shafik. Herald added a project: All. tbaeder requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. I was wondering how to best implement builtin funct