[PATCH] D102443: [PowerPC] Added multiple PowerPC builtins

Nemanja Ivanovic via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 17 05:27:42 PDT 2021


nemanjai added subscribers: rjmccall, rsmith.
nemanjai added a comment.

In terms of the motivation for this, the description of the patch should include something along the lines of:

"This is the first in a series of patches to provide builtins for compatibility with the XL compiler."

Since these builtins don't really conform to the typical naming in clang (i.e. using the `__builtin` prefix), perhaps @rjmccall or @rsmith have a suggestion as to how we should proceed here.
If the names with two underscores are acceptable, great (there won't be any name clashes with existing builtins).
However if those names are not acceptable, we might be able to implement some sort of compatibility layer in Clang where the names are intercepted if compiling for a PPC target and handled in `CGBuiltin.cpp`.



================
Comment at: clang/include/clang/Basic/BuiltinsPPC.def:28
 
+BUILTIN(__popcntb, "ULiULi", "")
+BUILTIN(__eieio, "v", "")
----------------
qiucf wrote:
> On PPC we have `__builtin_popcount`, but I only saw `popcntw` and `popcntd` generated. (I didn't verify it carefully)
There isn't really a good candidate builtin for this since this does a popcount in each byte separately. Of course, it could be used for a popcount of `i8`, but that is just a subset of what the builtin/instruction do.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102443/new/

https://reviews.llvm.org/D102443



More information about the cfe-commits mailing list