[LLVMdev] Mul & div support for wider-than-legal types

Joerg Sonnenberger joerg at britannica.bec.de
Fri Mar 20 19:15:08 PDT 2015


On Fri, Mar 20, 2015 at 09:06:24AM +0000, PaweĊ‚ Bylica wrote:
> Hi LLVM,
> 
>    1. Can mul and/or div support be added for big integer types like i256?
>    2. What are the limits?
>    3. If yes, how should it be done?
> 
> I have experience only with X86 target and know that mul i128 works and div
> i128 is lowered to function call from compile-rt like library (what works
> only if you link with such library). Can that support be extended?

mul can be inlined easily if necessary for arbitrary sizes, but div is
very expensive. Note that div can be expanded to calls even for smaller
sizes, since many (older) architectures don't have hardware division.

What's your use case?

Joerg




More information about the llvm-dev mailing list