bug in longlong.h for aarch64 sub_ddmmss

Torbjörn Granlund tg at gmplib.org
Wed Jun 17 20:56:49 UTC 2020


nisse at lysator.liu.se (Niels Möller) writes:

  Do you agree?

I agree.

  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?

Clearly, longlong.h was too complicated to get right already, so let's
not add an even deeper if-else tree.  (Look at the 64-bit PPC add_ssaaaa
to see what I'm talking about.)

Here is a better patch for 6.2.0.  It actually improves generated code.

* For Arm32/64, we use ADDS in sub_ddmmss whenever the rhs immediate
  value is negative.  We let gcc decide which operands fit and which
  need to go through a temp register.  (This improves code as ADDS
  allows constants 0,1,2,..,4095 and also 0,4096,8192..,4096*4095.  That
  latter interval was not handled before.)

* We improve add_ssaaaa analogously.

* For PPC, we explicitly exclude 0.  Also, we fixed a repeated typo
  causing invalid ADDIC forms to be use.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: diff
Type: application/octet-stream
Size: 7076 bytes
Desc: not available
URL: <https://gmplib.org/list-archives/gmp-bugs/attachments/20200617/addddb1b/attachment.obj>
-------------- next part --------------


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


More information about the gmp-bugs mailing list