Fix for gcc 4.4 on mips
authorWerner Koch <wk@gnupg.org>
Mon, 22 Feb 2010 11:35:38 +0000 (11:35 +0000)
committerWerner Koch <wk@gnupg.org>
Mon, 22 Feb 2010 11:35:38 +0000 (11:35 +0000)
mpi/ChangeLog
mpi/longlong.h

index 48010a5..07f4223 100644 (file)
@@ -1,3 +1,8 @@
+2010-02-22  Aurelien Jarno <aurel32@debian.org>  (wk)
+
+       * longlong.h (umul_ppmm) <mips> [__GNUC__ >= 4.4]: Patch according
+       to recommended gcc 4.4 changes.
+
 2009-12-09  Werner Koch  <wk@g10code.com>
 
        * config.links: Remove asm modules for all sparc64.  This is
index 34bd50c..b736d49 100644 (file)
@@ -714,7 +714,15 @@ extern USItype __udiv_qrnnd ();
  **************  MIPS  *****************
  ***************************************/
 #if defined (__mips__) && W_TYPE_SIZE == 32
-#if __GNUC__ > 2 || __GNUC_MINOR__ >= 7
+#if (__GNUC__ >= 5) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
+#define umul_ppmm(w1, w0, u, v) \
+  do {                                                                  \
+    UDItype _r;                                                         \
+    _r = (UDItype) u * v;                                               \
+    (w1) = _r >> 32;                                                    \
+    (w0) = (USItype) _r;                                                \
+  } while (0)
+#elif __GNUC__ > 2 || __GNUC_MINOR__ >= 7
 #define umul_ppmm(w1, w0, u, v) \
   __asm__ ("multu %2,%3"                                                \
           : "=l" ((USItype)(w0)),                                      \
@@ -739,7 +747,16 @@ extern USItype __udiv_qrnnd ();
  **************  MIPS/64  **************
  ***************************************/
 #if (defined (__mips) && __mips >= 3) && W_TYPE_SIZE == 64
-#if __GNUC__ > 2 || __GNUC_MINOR__ >= 7
+#if (__GNUC__ >= 5) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
+typedef unsigned int UTItype __attribute__ ((mode (TI)));
+#define umul_ppmm(w1, w0, u, v) \
+  do {                                                                 \
+    UTItype _r;                                                        \
+    _r = (UTItype) u * v;                                              \
+    (w1) = _r >> 64;                                                   \
+    (w0) = (UDItype) _r;                                               \
+  } while (0)
+#elif __GNUC__ > 2 || __GNUC_MINOR__ >= 7
 #define umul_ppmm(w1, w0, u, v) \
   __asm__ ("dmultu %2,%3"                                               \
           : "=l" ((UDItype)(w0)),                                      \