[PATCH] Fix carry bug in 128-bit unsigned integer adding

Kumar Gala galak at kernel.crashing.org
Wed Jan 16 01:37:55 EST 2008

On Jan 8, 2008, at 9:05 PM, Liu Yu wrote:

>> take a look at how include/math-emu/op-4.h implements
>> __FP_FRAC_ADD_4 & __FP_FRAC_SUB_4.  Will that fix the bug, if
>> so we should make the code match how its done there.
>> - k
> The macro define __FP_FRAC_ADD_4 is below. It can fix the carry bug.
> But still exist a problem that r[0-2] and x[0-2] cannot be referred to
> the same variable.
> If r0 and x0 are the same variable, the comparison ( r0 < x0 ) will
> always fail.
> I don't know whether we need to fix this problem.

Not sure.  Probably worth asking this on the glibc list and see if  
they have theories.  (For the short term I'd say lets use the version  
from include/math-emu/op-4.h as a fix.  If r0 & x0 can be the same  
variable the bug exists in a lot more places (glibc soft-fp and  
generic kernel mathemu)

- k

More information about the Linuxppc-dev mailing list