Mahesh Attarde via llvm-dev
2019-Aug-16 11:53 UTC
[llvm-dev] Arbitrary Precision Types on Target x8664
Hello, I worked out one of test including i21 type with llc for target x86_64. It appears to create binary without failure. I am curious about how did this work. I would much appreciate if you can point to code in X86 target or it is on IR level? Mahesh -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190816/4141d0e2/attachment.html>
Tim Northover via llvm-dev
2019-Aug-16 12:12 UTC
[llvm-dev] Arbitrary Precision Types on Target x8664
Hi Mahesh, On Fri, 16 Aug 2019 at 12:54, Mahesh Attarde via llvm-dev <llvm-dev at lists.llvm.org> wrote:> I worked out one of test including i21 type with llc for target x86_64. It appears to create binary without failure. I am curious about how did this work. I would much appreciate if you can point to code in X86 target or it is on IR level?The code currently lives in lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp. It generally works pretty well for widening smaller accesses into native ones (though you should still prefer native widths where possible). But you shouldn't think of it as a real arbitrary-precision facility ready to use in LLVM. If you tried to do crypto with an i2048 you'd rapidly enter a world of pain: addition would be implemented with about 32 separate add instructions, and multiplication & division would simply fail. So if you want to expose arbitrary precision in a front-end you're working on, it should almost certainly be based on an external library like GMP. Cheers. Tim.