bug in longlong.h for aarch64 sub_ddmmss

Paul Zimmermann Paul.Zimmermann at inria.fr
Wed Jun 17 12:37:15 UTC 2020


       Dear Niels,

> The excluded case,
> 
>   sub_ddmmss(ah, al, bh, /*compile time constant*/0) 
> 
> could clearly be optimized, in a different way, but I'd guess it's rare
> enough in real code to not be worth the effort?

in MPFR we have 15 places where we call sub_ddmmss, among which 8 have bl=0:

$ grep sub_ddmmss *.[ch] | grep -v "mpfr-longlong" | grep -v "mpfr-gmp"
div.c:      sub_ddmmss (h, l, u0, 0, h, l);
div.c:    sub_ddmmss (h, l, u0, 0, h, l);
div.c:    sub_ddmmss (r3, r2, r3, r2, v1, v0);
div.c:          sub_ddmmss (s1, s0, s1, s0, v1, v0);
invsqrt_limb.h:    sub_ddmmss (_h, _l, _u, 0, _h, _l);                         \
invsqrt_limb.h:        sub_ddmmss (_h, _l, _h, _l, _r >> 60, _r << 4);         \
invsqrt_limb.h:        sub_ddmmss (_h, _l, _h, _l, 0, 64);                     \
invsqrt_limb.h:        sub_ddmmss (_h, _l, _h, _l, _r >> 61, _r << 3);         \
invsqrt_limb.h:        sub_ddmmss (_h, _l, _h, _l, 0, 16);                     \
invsqrt_limb.h:        sub_ddmmss (_h, _l, _h, _l, _r >> 62, _r << 2);         \
invsqrt_limb.h:        sub_ddmmss (_h, _l, _h, _l, 0, 4);                      \
invsqrt_limb.h:        sub_ddmmss (_h, _l, _h, _l, _r >> 63, (_r << 1) + 1);   \
rec_sqrt_limb.h:    sub_ddmmss (_h, _l, 0x4000000000000000UL, 0, _h, _l);               \
sqrt.c:      sub_ddmmss (rb, sb, u0, 0, rb, sb);
sqrt.c:  sub_ddmmss (rb, sb, u0, low, rb, sb);

Best regards,
Paul


More information about the gmp-bugs mailing list