Torbjorn Granlund tg at
Sun Dec 13 10:35:56 CET 2009

nisse at (Niels Möller) writes:

  Estetic considerations aside, the only obvious drawback is that the
  function call overhead will be a cycle or two less for passing the limb
  directly in a register, than for storing it in memory and passing a
  poiter to it. But I don't know if that difference is going to be
  (In recent years I've been under some influence of "extreme programming"
  thinking, so I'm suspicious to adding abstractings that do nothing
  useful today but are supposed to be useful in some future version).

I think a saved normalisation count will be useful very soon...

  > I expect more gmp_piX_t structures in the future, BTW.
  Anyway, I think structures like these should be const declared in the
  prototypes, for both clarity and performance. So that code like
    gmp_pi1_t inv;
    ... inv->inv32 ...;
    foo (..., &inv);
    ... inv->inv32 ...;
  can keep the value of inv32 in a register over the function call. Are
  gcc or other compilers clever enough to do that optimization?
I think that is not allowed.  Just because a pointer i declared to
"const" data, doesn't mean that other pointers cannot modify the data.
There is a C99 feature, "restrict", that should do what we want.


More information about the gmp-devel mailing list