[PATCH] D14327: IR: Add llvm.ldexp and llvm.experimental.constrained.ldexp intrinsics

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 3 11:07:43 PDT 2023


arsenm added a comment.

In D14327#4313028 <https://reviews.llvm.org/D14327#4313028>, @tra wrote:

> In D14327#4312048 <https://reviews.llvm.org/D14327#4312048>, @arsenm wrote:
>
>> The TargetLibraryInfo query says there is ldexp and then it doesn't work
>
> Interesting. How exactly does it fail?

LLVM ERROR: Undefined external symbol "ldexpf"



================
Comment at: llvm/test/CodeGen/AMDGPU/llvm.ldexp.ll:259
+; GFX8-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
+; GFX8-NEXT:    v_ldexp_f16_e32 v0, v0, v1
+; GFX8-NEXT:    s_setpc_b64 s[30:31]
----------------
foad wrote:
> This doesn't quite work because the instruction truncates v1 to 16 bits, so if you wanted ldexp(1.0, 0x10000) aka +inf you'll actually get ldexp(1.0, 0) aka 1.0.
Ugh, the library does have clamp code for this. The tablegen definition claims this is VOP_F16_F16_I32 though 


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

https://reviews.llvm.org/D14327



More information about the llvm-commits mailing list