[PATCH] D75723: [X86] Make intrinsics _BitScan* not limited to Windows
Craig Topper via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 6 09:21:37 PST 2020
craig.topper added inline comments.
================
Comment at: clang/include/clang/Basic/BuiltinsX86.def:1904
+// BITSCAN
+TARGET_BUILTIN(_BitScanForward, "UcUNi*UNi", "n", "")
+TARGET_BUILTIN(_BitScanReverse, "UcUNi*UNi", "n", "")
----------------
skan wrote:
> craig.topper wrote:
> > The N specifier here is sort of MSVC mode specific. I need to think about this.
> >
> > This also makes this available without including a header file which isn't good if it doesn't start with __builtin.
> I think we can define a new builtin `__builtin_ia32_BitScanForward` in BuiltinsX86.def. And when macro `_MSC_VER` is not defined, define `_BitScanForward` in ia32intrin.h by calling the `__builtin_ia32_BitScanForward`. Then we can avoid the N specifier and the name issue. Do you think it's appropriate?
Instead of new builtins, can we use __builtin_clz, __builtin_clzl, __builin_ctz, __builtin_ctzl?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75723/new/
https://reviews.llvm.org/D75723
More information about the cfe-commits
mailing list