[PATCH] D79321: [SLC] Allow llvm.pow(2**n,x) -> llvm.exp2(n*x) even if no exp2 lib func

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 5 01:02:23 PDT 2020


foad marked 2 inline comments as done.
foad added a comment.

In D79321#2018473 <https://reviews.llvm.org/D79321#2018473>, @efriedma wrote:

> When we're compiling C code, we can't blindly generate floating-point intrinsics.  Even if we're confident the transform is correct, the backend has limited capabilities.  If the corresponding libfunc doesn't exist, and the target doesn't have any special capabilities, the backed is stuck: we need to generate a function call, but the function doesn't exist.
>
> We could potentially add some TTI query to ask about the intrinsic, specifically, as opposed to the library function.  But we can't just bypass the check.


For background, I'm interested in the AMDGPU target which has no libfuncs at all, but certainly does support intrinsics like llvm.sin/cos/exp/log.f32 because there are hardware instructions for them.

My understanding was that generic (llvm.*) intrinsics were unconditionally supported by all targets, because they're part of the IR almost as much as Instructions are, and it's CodeGen's job to implement them one way or another.

But you're saying that this is not true, and furthermore there is no good way to query whether a particular intrinsic is supported by a particular target? Is there any way forward, short of implementing a new TTI query mechanism like you suggested?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79321





More information about the llvm-commits mailing list