[PATCH] D75723: [X86] Make intrinsics _BitScan* not limited to Windows

Kan Shengchen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 6 01:08:00 PST 2020


skan marked an inline comment as done.
skan 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", "")
----------------
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?


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