[PATCH v2 15/32] mpi: Sync the i960 longlong.h with GCC.

Matt Turner mattst88 at gmail.com
Wed Nov 25 21:19:52 CET 2026


* mpi/longlong.h [__i960__] (add_ssaaaa, sub_ddmmss, udiv_qrnnd)
(count_leading_zeros, COUNT_LEADING_ZEROS_0, rshift_rhlc): Remove.

--

Reduce the i960 block to the umul_ppmm and __umulsidi3 that GCC's
copy of longlong.h has.  The rest came from GMP and does not compile:
udiv_qrnnd writes to __rq, which it never declares, and rshift_rhlc
opens a do without a while (0).  GCC removed its i960 port in commit
a4a4b1d3647, so none of this can be tested.

Signed-off-by: Matt Turner <mattst88 at gmail.com>
---
 mpi/longlong.h | 74 +++++++++-------------------------------------------------
 1 file changed, 11 insertions(+), 63 deletions(-)

diff --git a/mpi/longlong.h b/mpi/longlong.h
index 2bcd967d..a6532eca 100644
--- a/mpi/longlong.h
+++ b/mpi/longlong.h
@@ -547,75 +547,23 @@ extern USItype __udiv_qrnnd (USItype *, USItype, USItype, USItype);
  **************  I960  *****************
  ***************************************/
 #if defined (__i960__) && W_TYPE_SIZE == 32
-# define add_ssaaaa(sh, sl, ah, al, bh, bl) \
-  __asm__ ("cmpo 1,0\n"      \
-           "addc %5,%4,%1\n" \
-           "addc %3,%2,%0"   \
-	   : "=r" __ll_check_output (USItype, sh),                      \
-	     "=&r" __ll_check_output (USItype, sl)                      \
-	   : "%dI" ((USItype)(ah)),                                     \
-	     "dI" ((USItype)(bh)),                                      \
-	     "%dI" ((USItype)(al)),                                     \
-	     "dI" ((USItype)(bl)))
-# define sub_ddmmss(sh, sl, ah, al, bh, bl) \
-  __asm__ ("cmpo 0,0\n"      \
-           "subc %5,%4,%1\n" \
-           "subc %3,%2,%0"   \
-	   : "=r" __ll_check_output (USItype, sh),                      \
-	     "=&r" __ll_check_output (USItype, sl)                      \
-	   : "dI" ((USItype)(ah)),                                      \
-	     "dI" ((USItype)(bh)),                                      \
-	     "dI" ((USItype)(al)),                                      \
-	     "dI" ((USItype)(bl)))
-# define umul_ppmm(w1, w0, u, v) \
+#define umul_ppmm(w1, w0, u, v) \
   ({union {UDItype __ll;						\
 	   struct {USItype __l, __h;} __i;				\
 	  } __xx;							\
-  __asm__ ("emul        %2,%1,%0"                                       \
-	   : "=d" (__xx.__ll)                                           \
-	   : "%dI" ((USItype)(u)),                                      \
-	     "dI" ((USItype)(v)));                                      \
+  __asm__ ("emul	%2,%1,%0"					\
+	   : "=d" (__xx.__ll)						\
+	   : "%dI" ((USItype) (u)),					\
+	     "dI" ((USItype) (v)));					\
   (w1) = __xx.__i.__h; (w0) = __xx.__i.__l;})
-# define __umulsidi3(u, v) \
+#define __umulsidi3(u, v) \
   ({UDItype __w;							\
-    __asm__ ("emul      %2,%1,%0"                                       \
-	     : "=d" (__w)                                               \
-	     : "%dI" ((USItype)(u)),                                    \
-	       "dI" ((USItype)(v)));                                    \
+    __asm__ ("emul	%2,%1,%0"					\
+	     : "=d" (__w)						\
+	     : "%dI" ((USItype) (u)),					\
+	       "dI" ((USItype) (v)));					\
     __w; })
-# define udiv_qrnnd(q, r, nh, nl, d) \
-  do {									\
-    union {UDItype __ll;						\
-	   struct {USItype __l, __h;} __i;				\
-	  } __nn;							\
-    __nn.__i.__h = (nh); __nn.__i.__l = (nl);				\
-    __asm__ ("ediv %d,%n,%0"                                            \
-	   : "=d" (__rq.__ll)                                           \
-	   : "dI" (__nn.__ll),                                          \
-	     "dI" ((USItype)(d)));                                      \
-    (r) = __rq.__i.__l; (q) = __rq.__i.__h;				\
-  } while (0)
-# define count_leading_zeros(count, x) \
-  do {									\
-    USItype __cbtmp;							\
-    __asm__ ("scanbit %1,%0"                                            \
-	     : "=r" (__cbtmp)                                           \
-	     : "r" ((USItype)(x)));                                     \
-    (count) = __cbtmp ^ 31;						\
-  } while (0)
-# define COUNT_LEADING_ZEROS_0 (-32) /* sic */
-# if defined (__i960mx)  /* what is the proper symbol to test??? */
-#  define rshift_rhlc(r,h,l,c) \
-  do {									\
-    union {UDItype __ll;						\
-	   struct {USItype __l, __h;} __i;				\
-	  } __nn;							\
-    __nn.__i.__h = (h); __nn.__i.__l = (l);				\
-    __asm__ ("shre %2,%1,%0"                                            \
-	     : "=d" (r) : "dI" (__nn.__ll), "dI" (c));                  \
-  }
-# endif /* i960mx */
-#endif /* i960 */
+#endif /* __i960__ */
 
 
 /***************************************

-- 
2.56.1



More information about the Gcrypt-devel mailing list