GMP patch: MinGW/win64 port

Torbjorn Granlund tg at
Tue Mar 4 16:23:55 CET 2008

  > The ABI for Win64 is much more complicated than just the register allocation 
  > scheme.
  Yes; this is why I made no attempt to fix this. My interest was only in
  getting gmp to a working state. It's performance was a very distant
  secondary concern to me.
All ABI's are complicated, but one need only worry about aspects
relevant to the present situation.

For the GMP assembly code, I'd assume we could get away with just
moving registers around.

  It does support 64 bit pointers in printf. At the time I wrote that
  patch the relevant headers were broken. They have since been fixed. To
  printf a value that is possibly 64 bit, the following will work:
  long long x = 34324;
  printf("blah: %"PRIdMAX"\n", (uintmax_t)x);
  AFAIK, this should be portable to all systems (including mingw/win64).
I strongly doubt it to be portable in the sense we need for GMP.

  > I am troubled by your tests/amd64check.c change, since it
  > unconditionally changes the constants to 'long long'.  Not all
  > compilers might have that type.  Could you please try using the
  > CNST_LIMB mechanism instead?
  amd64check is only for amd64. What amd64 compiler does not have long
  long? AFAIK, none. I doubt such a compiler will ever exist.

Again, I disagree, there might be iso c90 compilers for this target.
Being conservative about this sort of things is better.


More information about the gmp-bugs mailing list