Package: sprng
Version: 2.0a-6
Severity: serious
Tags: patch

Since GCC 4.4 it's not possible anymore to use the 'h' constraints for
MIPS inline assembly code when doing a multiplication. That's why sprng
fails to build from source on mips and mipsel.

That said GCC supports 32x32 => 64 multiplication on 32-bit architecture
for a lot of time, so there is no need to use assembly code for that. 
The patch below fixes the problem by using standard multiplication 
instead of assembly code.

diff -u sprng-2.0a/SRC/pmlcg/longlong.h sprng-2.0a/SRC/pmlcg/longlong.h
--- sprng-2.0a/SRC/pmlcg/longlong.h
+++ sprng-2.0a/SRC/pmlcg/longlong.h
@@ -701,23 +701,12 @@
 #endif /* __m88000__ */
 
 #if defined (__mips__) && W_TYPE_SIZE == 32
-#if __GNUC__ > 2 || __GNUC_MINOR__ >= 7
-#define umul_ppmm(w1, w0, u, v) \
-  __asm__ ("multu %2,%3"                                               \
-          : "=l" ((USItype)(w0)),                                      \
-            "=h" ((USItype)(w1))                                       \
-          : "d" ((USItype)(u)),                                        \
-            "d" ((USItype)(v)))
-#else
-#define umul_ppmm(w1, w0, u, v) \
-  __asm__ ("multu %2,%3"
-       "\n mflo %0"
-       "\n mfhi %1"                                                    \
-          : "=d" ((USItype)(w0)),                                      \
-            "=d" ((USItype)(w1))                                       \
-          : "d" ((USItype)(u)),                                        \
-            "d" ((USItype)(v)))
-#endif
+#define umul_ppmm(w1, w0, u, v)                                         \
+  do {                                                                  \
+    UDItype __x = (UDItype) (USItype) (u) * (USItype) (v);              \
+    (w1) = (USItype) (__x >> 32);                                       \
+    (w0) = (USItype) (__x);                                             \
+  } while (0)
 #define UMUL_TIME 10
 #define UDIV_TIME 100
 #endif /* __mips__ */


-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: mips (mips64)

Kernel: Linux 2.6.32-5-5kc-malta
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash



-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to