[llvm-dev] Code generation option for wide integers on x86_64?

Riyaz Puthiyapurayil via llvm-dev llvm-dev at lists.llvm.org
Mon Aug 17 11:53:42 PDT 2020


Is there an existing option in X86_64 target code generator to emit a loop for the following code:

define i4096 @add(i4096 %a, i4096 %b) alwaysinline {
    %c = add i4096 %a, %b
    ret i4096 %c
}

instead of:

     movq %rdi, %rax
     addq 96(%rsp), %rsi
     adcq 104(%rsp), %rdx
     movq %rdx, 8(%rdi)
     movq %rsi, (%rdi)
     adcq 112(%rsp), %rcx
     movq %rcx, 16(%rdi)
     adcq 120(%rsp), %r8
     movq %r8, 24(%rdi)
     adcq 128(%rsp), %r9
     movq %r9, 32(%rdi)
     movq 8(%rsp), %rcx
     adcq 136(%rsp), %rcx
     movq %rcx, 40(%rdi)
     movq 16(%rsp), %rcx
           :
     :
     :

What is the best strategy for lowering wide integer types/operations on x86_64 without causing code blow up? Should we the code run through a custom pass that replaces wide operations with a library function call (or alternatively a loop) before code generation? Is there any existing code that can be reused?

Is there any documentation that describe strategies for lowering from languages that support arbitrarily wide integers?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200817/d686e758/attachment.html>


More information about the llvm-dev mailing list