bug in longlong.h for aarch64 sub_ddmmss

Torbjörn Granlund tg at gmplib.org
Tue Jun 16 12:47:23 UTC 2020


Vincent Lefevre <vincent at vinc17.net> writes:

  On 2020-06-16 13:40:14 +0200, Torbjorn Granlund wrote:
  > Vincent Lefevre <vincent at vinc17.net> writes:
  > 
  >   #define sub_ddmmss(sh, sl, ah, al, bh, bl) \
  >     do {                                                                  \
  >       if (__builtin_constant_p (bl) && -(UDItype)(bl) < 0x1000)           \
  >         __asm__ ("adds\t%1, %x4, %5\n\tsbc\t%0, %x2, %x3"                 \
  >                  : "=r,r" (sh), "=&r,&r" (sl)                             \
  >                  : "rZ,rZ" ((UDItype)(ah)), "rZ,rZ" ((UDItype)(bh)),      \
  >                    "r,Z"   ((UDItype)(al)), "rI,r" (-(UDItype)(bl)) __CLOBBER_CC);\
  >       else                                                                \
  >         __asm__ ("subs\t%1, %x4, %5\n\tsbc\t%0, %x2, %x3"                 \
  >                  : "=r,r" (sh), "=&r,&r" (sl)                             \
  >                  : "rZ,rZ" ((UDItype)(ah)), "rZ,rZ" ((UDItype)(bh)),      \
  >                    "r,Z"   ((UDItype)(al)), "rI,r"  ((UDItype)(bl)) __CLOBBER_CC);\
  >     } while(0);
  > 
  > The two - signs ought to be ~, I think.  Let me think a buit more about that.

  Note that the "else" case, which doesn't have a - sign in its
  arguments is affected too, AFAIK.

I cannot follow you here.

Are you saying that the asm in the else clause is broken too?
Please explain.

-- 
Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-bugs mailing list