Package: ntl
Version: 5.4.2-4
Severity: serious

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. I have also included the code for MIPS64 using
128-bit hints for reference (the second hunk), though it is not used in
Debian.

--- ntl-5.4.2.orig/include/NTL/SPMM_ASM.h
+++ ntl-5.4.2/include/NTL/SPMM_ASM.h
@@ -147,8 +147,8 @@
 
 static inline unsigned long MulHiUL(unsigned long a, unsigned long b)
 {
-   unsigned long hi, lo;
-   __asm__ ("multu %2,%3" : "=l" (lo), "=h" (hi) : "d" (a), "d" (b));
+   unsigned long hi;
+   hi = ((unsigned long long) a * b) >> 32;
    return hi;
 } 
 
@@ -159,8 +159,9 @@
 
 static inline unsigned long MulHiUL(unsigned long a, unsigned long b)
 {
-   unsigned long hi, lo;
-   __asm__ ("dmultu %2,%3" : "=l" (lo), "=h" (hi) : "d" (a), "d" (b));
+   typedef unsigned int uint128_t __attribute__((mode(TI)));
+   unsigned long hi;
+   hi = ((uint128_t) a * b) >> 64;
    return hi;
 }
 

-- 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