[Gmp-commit] /var/hg/gmp: 3 new changesets

mercurial at gmplib.org mercurial at gmplib.org
Fri Oct 7 18:25:49 CEST 2011


details:   /var/hg/gmp/rev/c00b02e56f6a
changeset: 14277:c00b02e56f6a
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Fri Oct 07 13:55:54 2011 +0200
description:
(s390): Add 32-bit zarch umul_ppmm and udiv_qrnnd.

details:   /var/hg/gmp/rev/b9511bbbcde8
changeset: 14278:b9511bbbcde8
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Fri Oct 07 13:56:10 2011 +0200
description:
*** empty log message ***

details:   /var/hg/gmp/rev/d9cbbb07c55c
changeset: 14279:d9cbbb07c55c
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Fri Oct 07 15:35:38 2011 +0200
description:
Misc additional s390 changes.

diffstat:

 ChangeLog  |   9 ++++++
 longlong.h |  93 ++++++++++++++++++++++++++++++++++++++++++++++----------------
 2 files changed, 78 insertions(+), 24 deletions(-)

diffs (172 lines):

diff -r 2352c23fca8a -r d9cbbb07c55c ChangeLog
--- a/ChangeLog	Fri Oct 07 13:39:40 2011 +0200
+++ b/ChangeLog	Fri Oct 07 15:35:38 2011 +0200
@@ -1,3 +1,8 @@
+2011-10-07  Torbjorn Granlund  <tege at gmplib.org>
+
+	* longlong.h (s390): Add 32-bit zarch umul_ppmm and udiv_qrnnd.
+	(s390): Overhaul 32-bit and 64-bit code.
+
 2011-10-07  Niels Möller  <nisse at lysator.liu.se>
 
 	* tune/speed.h (speed_mpn_hgcd_appr): New prototype.
@@ -22,6 +27,10 @@
 	(hgcd_hook): Also moved to hgcd_step.c.
 	(mpn_hgcd): Updated for hgcd_step renaming.
 
+2011-10-06  Torbjorn Granlund  <tege at gmplib.org>
+
+	* mpn/s390_64/invert_limb.asm: New file.
+
 2011-10-04  Torbjorn Granlund  <tege at gmplib.org>
 
 	* mpn/s390_64/submul_1.asm: New file.
diff -r 2352c23fca8a -r d9cbbb07c55c longlong.h
--- a/longlong.h	Fri Oct 07 13:39:40 2011 +0200
+++ b/longlong.h	Fri Oct 07 15:35:38 2011 +0200
@@ -654,14 +654,59 @@
 #endif /* hppa */
 
 #if (defined (__i370__) || defined (__s390__) || defined (__mvs__)) && W_TYPE_SIZE == 32
+#if defined (__zarch__)
+#define add_ssaaaa(sh, sl, ah, al, bh, bl)				\
+  do {									\
+    if (__builtin_constant_p (bl))					\
+      __asm__ ("alfi\t%1,%o5\n\talcr\t%0,%3"				\
+	       : "=r" (sh), "=&r" (sl)					\
+	       : "0"  (ah), "r" (bh), "%1" (al), "n" (bl));		\
+    else								\
+      __asm__ ("alr\t%1,%5\n\talcr\t%0,%3"				\
+	       : "=r" (sh), "=&r" (sl)					\
+	       : "0"  (ah), "r" (bh), "%1" (al), "r" (bl));		\
+  } while (0)
+#define sub_ddmmss(sh, sl, ah, al, bh, bl)				\
+  do {									\
+    if (__builtin_constant_p (bl))					\
+      __asm__ ("slfi\t%1,%o5\n\tslbr\t%0,%3"				\
+	       : "=r" (sh), "=&r" (sl)					\
+	       : "0" (ah), "r" (bh), "1" (al), "n" (bl));		\
+    else								\
+      __asm__ ("slr\t%1,%5\n\tslbr\t%0,%3"				\
+	       : "=r" (sh), "=&r" (sl)					\
+	       : "0" (ah), "r" (bh), "1" (al), "r" (bl));		\
+  } while (0)
+#define umul_ppmm(xh, xl, m0, m1)					\
+  do {									\
+    union {UDItype __ll;						\
+	   struct {USItype __h, __l;} __i;				\
+	  } __x;							\
+    __asm__ ("mlr\t%0,%2"						\
+	     : "=r" (__x.__ll)						\
+	     : "%0" (m0), "r" (m1));					\
+    (xh) = __x.__i.__h; (xl) = __x.__i.__l;				\
+  } while (0)
+#define udiv_qrnnd(q, r, n1, n0, d)					\
+  do {									\
+    union {UDItype __ll;						\
+	   struct {USItype __h, __l;} __i;				\
+	  } __x;							\
+    __x.__i.__h = n1; __x.__i.__l = n0;					\
+    __asm__ ("dlr\t%0,%2"						\
+	     : "=r" (__x.__ll)						\
+	     : "0" (__x.__ll), "r" (d));				\
+    (q) = __x.__i.__l; (r) = __x.__i.__h;				\
+  } while (0)
+#else
 #define smul_ppmm(xh, xl, m0, m1) \
   do {									\
     union {DItype __ll;							\
 	   struct {USItype __h, __l;} __i;				\
 	  } __x;							\
-    __asm__ ("lr %N0,%1\n\tmr %0,%2"					\
-	     : "=&r" (__x.__ll)						\
-	     : "r" (m0), "r" (m1));					\
+    __asm__ ("mr\t%0,%2"						\
+	     : "=r" (__x.__ll)						\
+	     : "%0" (m0), "r" (m1));					\
     (xh) = __x.__i.__h; (xl) = __x.__i.__l;				\
   } while (0)
 #define sdiv_qrnnd(q, r, n1, n0, d) \
@@ -670,53 +715,53 @@
 	   struct {USItype __h, __l;} __i;				\
 	  } __x;							\
     __x.__i.__h = n1; __x.__i.__l = n0;					\
-    __asm__ ("dr %0,%2"							\
+    __asm__ ("dr\t%0,%2"						\
 	     : "=r" (__x.__ll)						\
 	     : "0" (__x.__ll), "r" (d));				\
     (q) = __x.__i.__l; (r) = __x.__i.__h;				\
   } while (0)
 #endif
+#endif
 
 #if defined (__s390x__) && W_TYPE_SIZE == 64
 #define add_ssaaaa(sh, sl, ah, al, bh, bl)				\
   do {									\
     if (__builtin_constant_p (bl) && (UDItype)(bl) < 0x100000000ul)	\
-      __asm__ ("algfi\t%1, %5\n\talcgr\t%0, %3"				\
+      __asm__ ("algfi\t%1,%5\n\talcgr\t%0,%3"				\
 	       : "=r" (sh), "=&r" (sl)					\
-	       : "0"  ((UDItype)(ah)), "r" ((UDItype)(bh)),		\
-		 "%1" ((UDItype)(al)), "n" ((UDItype)(bl)));		\
+	       : "0"  (ah), "r" (bh), "%1" (al), "n" (bl));		\
+    else if (__builtin_constant_p (bl) && -(UDItype)(bl) < 0x100000000ul) \
+      __asm__ ("slgfi\t%1,%n5\n\talcgr\t%0,%3"				\
+	       : "=r" (sh), "=&r" (sl)					\
+	       : "0"  (ah), "r" (bh), "%1" (al), "n" (bl));		\
     else								\
-      __asm__ ("algr\t%1, %5\n\talcgr\t%0, %3"				\
+      __asm__ ("algr\t%1,%5\n\talcgr\t%0,%3"				\
 	       : "=r" (sh), "=&r" (sl)					\
-	       : "0"  ((UDItype)(ah)), "r" ((UDItype)(bh)),		\
-		 "%1" ((UDItype)(al)), "r" ((UDItype)(bl)));		\
+	       : "0"  (ah), "r" (bh), "%1" (al), "r" (bl));		\
   } while (0)
 #define sub_ddmmss(sh, sl, ah, al, bh, bl)				\
   do {									\
-  if (__builtin_constant_p (bl) && (UDItype)(bl) < 0x100000000ul)	\
-      __asm__ ("slgfi\t%1, %n5\n\tslbgr\t%0, %3"			\
+    if (__builtin_constant_p (bl) && (UDItype)(bl) < 0x100000000ul)	\
+      __asm__ ("slgfi\t%1,%5\n\tslbgr\t%0,%3"				\
 	       : "=r" (sh), "=&r" (sl)					\
-	       : "0" ((UDItype)(ah)), "r" ((UDItype)(bh)),		\
-		 "1" ((UDItype)(al)), "n" ((UDItype)(bl)));		\
+	       : "0" (ah), "r" (bh), "1" (al), "n" (bl));		\
     else if (__builtin_constant_p (bl) && -(UDItype)(bl) < 0x100000000ul) \
-      __asm__ ("algfi\t%1, %n5\n\tslbgr\t%0, %3"			\
+      __asm__ ("algfi\t%1,%n5\n\tslbgr\t%0,%3"				\
 	       : "=r" (sh), "=&r" (sl)					\
-	       : "0" ((UDItype)(ah)), "r" ((UDItype)(bh)),		\
-		 "1" ((UDItype)(al)), "n" (-(UDItype)(bl)));		\
+	       : "0" (ah), "r" (bh), "1" (al), "n" (bl));		\
     else								\
-      __asm__ ("slgr\t%1, %5\n\tslbgr\t%0, %3"				\
+      __asm__ ("slgr\t%1,%5\n\tslbgr\t%0,%3"				\
 	       : "=r" (sh), "=&r" (sl)					\
-	       : "0" ((UDItype)(ah)), "r" ((UDItype)(bh)),		\
-		 "1" ((UDItype)(al)), "r" ((UDItype)(bl)));		\
+	       : "0" (ah), "r" (bh), "1" (al), "r" (bl));		\
   } while (0)
 #define umul_ppmm(xh, xl, m0, m1)					\
   do {									\
     union {unsigned int __attribute__ ((mode(TI))) __ll;		\
 	   struct {UDItype __h, __l;} __i;				\
 	  } __x;							\
-    __asm__ ("mlgr\t%0, %2"						\
-	     : "=&r" (__x.__ll)						\
-	     : "%0" ((UDItype)(m0)), "r" ((UDItype)(m1)));		\
+    __asm__ ("mlgr\t%0,%2"						\
+	     : "=r" (__x.__ll)						\
+	     : "%0" (m0), "r" (m1));					\
     (xh) = __x.__i.__h; (xl) = __x.__i.__l;				\
   } while (0)
 #define udiv_qrnnd(q, r, n1, n0, d)					\
@@ -725,7 +770,7 @@
 	   struct {UDItype __h, __l;} __i;				\
 	  } __x;							\
     __x.__i.__h = n1; __x.__i.__l = n0;					\
-    __asm__ ("dlgr\t%0, %2"						\
+    __asm__ ("dlgr\t%0,%2"						\
 	     : "=r" (__x.__ll)						\
 	     : "0" (__x.__ll), "r" (d));				\
     (q) = __x.__i.__l; (r) = __x.__i.__h;				\


More information about the gmp-commit mailing list