<div dir="ltr">I'm trying to work out LLVM code which generates something similar to the following when adding large multiword numbers stored as separate words:<div><br></div><div>ADD x1 x1</div><div>ADC x2 y2</div><div>ADC x3 y3</div><div><br></div><div>etc, where such a three argument add like ADC on x86 (which includes a carry in the addition) is available as a machine op.</div><div><br></div><div>The background to this is that I'm trying to implement fast multiword addition in Haskell, which can compile via LLVM, so I thought if I knew what LLVM code generates the ideal assembly I can work backwards and use the appropriate Haskell prim-ops. </div><div><br></div><div>Of course one can use GMP, but I'd suspect with two-four word additions the loss of inlining opportunities and the cost of the external call would be greater than the addition itself. So it would be great to be able to work out how to do it in LLVM and then either implement it with current GHC or add an extra GHC prim-op which allows GHC to access the appropriate LLVM code.</div><div><br></div><div>Sorry I don't know much about LLVM besides my brief readings of the docs, and I've posted here because I couldn't find an llvm-users list. There's a clang-users list, but I didn't think that would be appropriate because GHC compiles via LLVM directly, not via clang.</div><div><br></div><div>Any help or guidance appreciated.</div><div><br></div><div>Clinton</div><div><br></div></div>