[LLVMdev] Optimizing math code

Stephen Checkoway s at pahtak.org
Mon Feb 17 18:38:06 PST 2014


On Feb 17, 2014, at 8:10 PM, Michael Hamburg <mike at shiftleft.org> wrote:

> First, addition.  I have multiprecision integer objects, and I’d like to add them component-wise (likewise, subtract, negate, mask…).  For example:
> 
> struct mp {
> 	int limb[8];
> } __attribute__((aligned(32))) ;
> 
> void add(struct mp *a, const struct mp *b, const struct mp *c) {
>    for (int i=0; i<8; i++) a->limb[i] = b->limb[i] + c->limb[i];
> }

If the struct represents an integer, shouldn't the add take the carry into account?

-- 
Stephen Checkoway









More information about the llvm-dev mailing list