summaryrefslogtreecommitdiff
path: root/mpn/m68k
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2003-10-24 22:11:38 +0200
committerKevin Ryde <user42@zip.com.au>2003-10-24 22:11:38 +0200
commitf0929cf19c03e4cb976fcba57f73e187a5234652 (patch)
tree418fc33066d93c468e0f355958c75a2adacb3573 /mpn/m68k
parentd7decdf6ba9bceba470a48e266e4784b7e07256b (diff)
downloadgmp-f0929cf19c03e4cb976fcba57f73e187a5234652.tar.gz
* mpn/m68k/lshift.asm, mpn/m68k/lshift.asm: Support 16-bit int and
stack alignment.
Diffstat (limited to 'mpn/m68k')
-rw-r--r--mpn/m68k/rshift.asm23
1 files changed, 20 insertions, 3 deletions
diff --git a/mpn/m68k/rshift.asm b/mpn/m68k/rshift.asm
index 12546db43..c3243f50f 100644
--- a/mpn/m68k/rshift.asm
+++ b/mpn/m68k/rshift.asm
@@ -1,6 +1,7 @@
dnl mc68020 mpn_rshift -- mpn right shift.
-dnl Copyright 1996, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+dnl Copyright 1996, 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
+dnl Inc.
dnl
dnl This file is part of the GNU MP Library.
dnl
@@ -27,6 +28,16 @@ C shift==1 shift>1
C 68040: 9 12
+C mp_limb_t mpn_rshift (mp_ptr res_ptr, mp_srcptr s_ptr, mp_size_t s_size,
+C unsigned cnt);
+C
+C The "cnt" parameter is either 16 bits or 32 bits depending on
+C SIZEOF_UNSIGNED (see ABI notes in mpn/m68k/README). The value is of
+C course only 1 to 31. When loaded as 16 bits there's garbage in the upper
+C half, hence the use of cmpw. The shift instructions take the their count
+C modulo 64, so the upper part doesn't matter to them either.
+C
+
C INPUT PARAMETERS
C res_ptr (sp + 4)
C s_ptr (sp + 8)
@@ -38,6 +49,10 @@ define(s_ptr, `a0')
define(s_size, `d6')
define(cnt, `d4')
+ifdef(`SIZEOF_UNSIGNED',,
+`m4_error(`SIZEOF_UNSIGNED not defined, should be in config.m4
+')')
+
PROLOGUE(mpn_rshift)
C Save used registers on the stack.
moveml d2-d6/a2, M(-,sp)
@@ -46,10 +61,12 @@ C Copy the arguments to registers.
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_UNSIGNED,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