Patch to enable build on s390x

Marc Glisse marc.glisse at inria.fr
Sat Sep 17 17:07:42 CEST 2011


On Fri, 16 Sep 2011, Andreas Krebbel wrote:

>> Do these systems support a 32-bit ABI?  If they do, the compiler
>> should have an option controlling ABI.  Please try it, using something
>> trivial like hello.c.
>
> Yes. The toolchain for System z supports 2 differents ABIs:
> -m31 for 32 bit GPRs, 31 bit addressing - s390 <-- machine id (uname -r)
> -m64 for 64 bit GPRs, 64 bit addressing - s390x

Does something like this work (ie doesn't change anything on s390, works 
on s390x and with ABI=32 works like s390 on s390x)?

--- a/configure.in	Sun Aug 21 20:08:38 2011 +0200
+++ b/configure.in	Sat Sep 17 16:45:31 2011 +0200
@@ -1119,6 +1119,13 @@
      gcc_cflags="$gcc_cflags $fomit_frame_pointer"
      path="s390"
      extra_functions="udiv_w_sdiv"
+    case $host_cpu in
+      s390x)
+        abilist="64 32"
+        gcc_64_cflags="$gcc_cflags"
+        gcc_32_cflags="$gcc_cflags -m31"
+	;;
+    esac
      ;;



(just trying to help you write the patch, and not tested in any way)

>> What 64-bit multiply support do these system provide?  The 32-bit s390
>> systems have a signed 32x32->64 bit multiply.  GMP really needs a
>> 64x64->128 bit multiply, preferably unsigned, to support the s390x
>> well.
>
> s390x has unsigned 64x64 -> 128 integer multiplication in a reg, reg and a reg, mem
> variant. The instructions are mlgr and mlg.

Cool. So umul_ppmm shouldn't be hard to write in longlong.h?

-- 
Marc Glisse


More information about the gmp-bugs mailing list