mpn_rshift / mpn_lshift bug on m68000

Kevin Ryde user42 at zip.com.au
Thu Oct 23 08:42:42 CEST 2003


Patrick Pelissier <Patrick.Pelissier at loria.fr> writes:
>
>   On all systems based on a 68000 (a real 68000, not a 68030, a 68040
> or a 68060), the convention is int=short, and the stack is 16 bits
> aligned.

No, such a convention is an aspect of the system, not of the
processor.

>   I am currently porting GMP to such a system. It is the ti-68k
> calculator (Ti-89, Ti-92+ and V200) using gcc,

You should have included that information in your first message.


Diffs below for the shift routines.  Please test them (including the
shift-by-1 case).  If they work I'll make some autoconfery for
SIZEOF_INT.

-- 
All followups to gmp-bugs at swox.com please.


-------------- next part --------------
--- lshift.asm.~1.7.~	1970-01-01 10:00:01.000000000 +1000
+++ lshift.asm	2003-10-23 07:35:17.000000000 +1000
@@ -21,6 +21,8 @@
 
 include(`../config.m4')
 
+define(SIZEOF_INT,2)
+
 
 C           cycles/limb
 C        shift==1  shift>1
@@ -46,10 +48,12 @@
 	movel	M(sp,28), res_ptr
 	movel	M(sp,32), s_ptr
 	movel	M(sp,36), s_size
-	movel	M(sp,40), cnt
+ifelse(SIZEOF_INT,2,
+`	movew	M(sp,40), cnt',
+`	movel	M(sp,40), cnt')
 
 	moveql	#1, d5
-	cmpl	d5, cnt
+	cmpw	d5, cnt
 	bne	L(Lnormal)
 	cmpl	s_ptr, res_ptr
 	bls	L(Lspecial)		C jump if s_ptr >= res_ptr
-------------- next part --------------
--- rshift.asm.~1.6.~	1970-01-01 10:00:01.000000000 +1000
+++ rshift.asm	2003-10-23 07:31:11.000000000 +1000
@@ -21,6 +21,8 @@
 
 include(`../config.m4')
 
+define(SIZEOF_INT,2)
+
 
 C           cycles/limb
 C        shift==1  shift>1
@@ -46,10 +48,12 @@
 	movel	M(sp,28), res_ptr
 	movel	M(sp,32), s_ptr
 	movel	M(sp,36), s_size
-	movel	M(sp,40), cnt
+ifelse(SIZEOF_INT,2,
+`	movew	M(sp,40), cnt',
+`	movel	M(sp,40), cnt')
 
 	moveql	#1, d5
-	cmpl	d5, cnt
+	cmpw	d5, cnt
 	bne	L(Lnormal)
 	cmpl	res_ptr, s_ptr
 	bls	L(Lspecial)		C jump if res_ptr >= s_ptr


More information about the gmp-bugs mailing list