[PATCH] D120327: compiler-rt: Add udivmodei5 to builtins and add bitint library
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 5 09:40:43 PDT 2022
efriedma added a comment.
> And the approach would also increase the size of every object file using the large division and make the linker work harder in removing those duplicated functions.
This is a downside... but I think it's worthwhile anyway.
> Is there an existing intrinsic/LLVM instruction for which LLVM embeds a call in the object file today?
No, we haven't really been doing this; at least, not specifically to lower intrinsics. (There are passes that generate functions as part of other features.) I figured it might be a good opportunity to start using this approach, since it's new functionality.
> In the future we (LLVM) will probably want to switch the algorithm used to Knuth's Algorithm D, which is quite complex...I know I wouldn't want to try writing that in C++ that generates LLVM IR...it would probably be more than 2k lines of nearly incomprehensible code. Also, I expect specialization based on input/output sizes to not have much effect for Algorithm D, imho we should just have the generic functions and call them rather than generating a separate function per bit-width.
It wouldn't necessarily have to be raw C++ calls to IRBuilder. We could, for example, embed textual LLVM IR, and call the LLVM IR parser. Or even use clang to generate LLVM IR ahead of time... we just can't actually call clang at runtime (since clang isn't linked in to LLVM, in general).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120327/new/
https://reviews.llvm.org/D120327
More information about the llvm-commits
mailing list