Patch to enable build on s390x

Torbjorn Granlund tg at
Mon Sep 19 11:43:52 CEST 2011

Andreas Krebbel <krebbel at> writes:

  On 09/19/2011 09:57 AM, Torbjorn Granlund wrote:
  > I think we should port GMP properly, not merely apply a patch that works
  > around one observed problem.
  Here is a preliminary version of the patch. I did the tuning for 31 and 64 on the latest
  CPU generation: zEnterprise z196.
I suppose one should ideally identify the various CPU types, otherwise
tuning might not be as beneficial as one might hope.  Does
virtualisation prevent us from such identification?

There seem to be no support for ABI=32 for "s390x", as per Marc Glisse's
patch.  I take it that s390x is an instruction set, and that we will
want either generate sie 32bit code that will also run on "s390", or
generate some 32bit code that takes advantage of any (32bit-)
instructions added to s390x.

GMP aims at supporting all available ABIs for any machine.  We should 

  I've replaced the store clock timing with clock_gettime. stck is not "virtualized" so it
  is almost impossible to get a valid measurement if you don't own a System z yourself :)
  Also there is thread specific variant of clock_gettime which has vdso support starting
  with kernel 2.6.29. That way the time measurement avoids the context switch and therefore
  creates much less overhead. I've changed time.c to always prefer that variant if available.
Your change to tune/time.c seems to affect 32-bit s390 too.  Is that
intensional?  Is it known to be beneficial?  Did you look at change log
history to see any motives for the current code?

  I didn't implement umul_ppmm for s390x yet but I'll try to do soon.


More information about the gmp-bugs mailing list