[libntl] 03/07: gcc-4.5-mips
Julien Puydt
julien.puydt at laposte.net
Fri Aug 15 08:23:03 UTC 2014
This is an automated email from the git hooks/post-receive script.
jpuydt-guest pushed a commit to branch Snark_NTL6
in repository libntl.
commit 9e42f8558d9f3c8f8999b1dd420607ccb83a8939
Author: Aurelien Jarno <aurel32 at debian.org>
Date: Sun Apr 17 23:41:31 2011 +0200
gcc-4.5-mips
Bug-Debian: 623162
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.
---
include/NTL/SPMM_ASM.h | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/include/NTL/SPMM_ASM.h b/include/NTL/SPMM_ASM.h
index dc0bfb9..9ff7942 100644
--- a/include/NTL/SPMM_ASM.h
+++ b/include/NTL/SPMM_ASM.h
@@ -147,8 +147,8 @@ static inline unsigned long MulHiUL(unsigned long a, unsigned long b)
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)
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;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/libntl.git
More information about the debian-science-commits
mailing list