[llvm-dev] Arbitrary Precision Types on Target x8664
Tim Northover via llvm-dev
llvm-dev at lists.llvm.org
Fri Aug 16 05:12:17 PDT 2019
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.
More information about the llvm-dev