No subject


Tue Oct 7 21:23:11 CEST 2003


--=-=-=
Content-Type: message/rfc822
Content-Disposition: inline

From: Philip Blundell <philb at gnu.org>
To: submit at bugs.debian.org
Subject: Bug#87487: long long arithmetic is broken on ARM
Date: Sat, 24 Feb 2001 22:25:44 +0000
Message-Id: <E14Wn8K-00038x-00 at kings-cross.london.uk.eu.org>
Reply-To: Philip Blundell <philb at gnu.org>, 87487 at bugs.debian.org
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii

Package: gnupg
Version: 1.0.4-2
Severity: important

The ARM version of one of the macros for 64-bit arithmetic produces wrong 
results.  This patch seems to fix it, and should produce slightly better code 
into the bargain.

--- gnupg-1.0.4/mpi/longlong.h	Wed Mar  8 17:34:34 2000
+++ gnupg-1.0.4-pb/mpi/longlong.h	Sat Feb 24 21:54:30 2001
@@ -199,28 +199,27 @@
 	     "rI" ((USItype)(bh)),                                      \
 	     "r" ((USItype)(al)),                                       \
 	     "rI" ((USItype)(bl)))
-#ifdef __ARM_ARCH_3__
-/* SAM This does not work on arm4 */
+#if defined __ARM_ARCH_2__ || defined __ARM_ARCH_3__
 #define umul_ppmm(xh, xl, a, b) \
   __asm__ ("%@ Inlined umul_ppmm
-	mov	%|r0, %2, lsr #16
-	mov	%|r2, %3, lsr #16
-	bic	%|r1, %2, %|r0, lsl #16
-	bic	%|r2, %3, %|r2, lsl #16
-	mul	%1, %|r1, %|r2
-	mul	%|r2, %|r0, %|r2
-	mul	%|r1, %0, %|r1
-	mul	%0, %|r0, %0
-	adds	%|r1, %|r2, %|r1
-	addcs	%0, %0, #65536
-	adds	%1, %1, %|r1, lsl #16
-	adc	%0, %0, %|r1, lsr #16"                                  \
+	mov	%|r0, %2, lsr #16		@ AAAA
+	mov	%|r2, %3, lsr #16		@ BBBB
+	bic	%|r1, %2, %|r0, lsl #16		@ aaaa
+	bic	%0, %3, %|r2, lsl #16		@ bbbb
+	mul	%1, %|r1, %|r2			@ aaaa * BBBB
+	mul	%|r2, %|r0, %|r2		@ AAAA * BBBB
+	mul	%|r1, %0, %|r1			@ aaaa * bbbb
+	mul	%0, %|r0, %0			@ AAAA * bbbb
+	adds	%|r0, %1, %0			@ central sum
+	addcs	%|r2, %|r2, #65536
+	adds	%1, %|r1, %|r0, lsl #16
+	adc	%0, %|r2, %|r0, lsr #16"                                \
 	   : "=&r" ((USItype)(xh)),                                     \
 	     "=r" ((USItype)(xl))                                       \
 	   : "r" ((USItype)(a)),                                        \
 	     "r" ((USItype)(b))                                         \
 	   : "r0", "r1", "r2")
-#elif __ARM_ARCH_4__
+#else
 #define umul_ppmm(xh, xl, a, b) \
   __asm__ ("%@ Inlined umul_ppmm
 	umull	%r1, %r0, %r2, %r3" \
@@ -229,8 +228,6 @@
 		   : "r" ((USItype)(a)), \
 		     "r" ((USItype)(b)) \
 		   : "r0", "r1")
-#else
-#error Untested architecture
 #endif
 #define UMUL_TIME 20
 #define UDIV_TIME 100




--  
To UNSUBSCRIBE, email to debian-bugs-dist-request at lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster at lists.debian.org

--=-=-=



-- 
James

--=-=-=--



More information about the Gnupg-devel mailing list