Annotation of OpenXM_contrib/gmp/mpn/m68k/lshift.asm, Revision 1.1
1.1 ! ohara 1: dnl mc68020 mpn_lshift -- mpn left shift.
! 2: dnl
! 3: dnl cycles/limb
! 4: dnl shift==1 shift>1
! 5: dnl 68040: 3.5 9.5
! 6:
! 7: dnl Copyright 1996, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
! 8: dnl
! 9: dnl This file is part of the GNU MP Library.
! 10: dnl
! 11: dnl The GNU MP Library is free software; you can redistribute it and/or
! 12: dnl modify it under the terms of the GNU Lesser General Public License as
! 13: dnl published by the Free Software Foundation; either version 2.1 of the
! 14: dnl License, or (at your option) any later version.
! 15: dnl
! 16: dnl The GNU MP Library is distributed in the hope that it will be useful,
! 17: dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
! 18: dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
! 19: dnl Lesser General Public License for more details.
! 20: dnl
! 21: dnl You should have received a copy of the GNU Lesser General Public
! 22: dnl License along with the GNU MP Library; see the file COPYING.LIB. If
! 23: dnl not, write to the Free Software Foundation, Inc., 59 Temple Place -
! 24: dnl Suite 330, Boston, MA 02111-1307, USA.
! 25:
! 26: include(`../config.m4')
! 27:
! 28:
! 29: C INPUT PARAMETERS
! 30: C res_ptr (sp + 4)
! 31: C s_ptr (sp + 8)
! 32: C s_size (sp + 16)
! 33: C cnt (sp + 12)
! 34:
! 35: define(res_ptr, `a1')
! 36: define(s_ptr, `a0')
! 37: define(s_size, `d6')
! 38: define(cnt, `d4')
! 39:
! 40: PROLOGUE(mpn_lshift)
! 41: C Save used registers on the stack.
! 42: moveml d2-d6/a2, M(-,sp)
! 43:
! 44: C Copy the arguments to registers.
! 45: movel M(sp,28), res_ptr
! 46: movel M(sp,32), s_ptr
! 47: movel M(sp,36), s_size
! 48: movel M(sp,40), cnt
! 49:
! 50: moveql #1, d5
! 51: cmpl d5, cnt
! 52: bne L(Lnormal)
! 53: cmpl s_ptr, res_ptr
! 54: bls L(Lspecial) C jump if s_ptr >= res_ptr
! 55:
! 56: ifelse(scale_available_p,1,`
! 57: lea M(s_ptr,s_size,l,4), a2
! 58: ',`
! 59: movel s_size, d0
! 60: asll #2, d0
! 61: lea M(s_ptr,d0,l), a2
! 62: ')
! 63: cmpl res_ptr, a2
! 64: bls L(Lspecial) C jump if res_ptr >= s_ptr + s_size
! 65:
! 66: L(Lnormal):
! 67: moveql #32, d5
! 68: subl cnt, d5
! 69:
! 70: ifelse(scale_available_p,1,`
! 71: lea M(s_ptr,s_size,l,4), s_ptr
! 72: lea M(res_ptr,s_size,l,4), res_ptr
! 73: ',`
! 74: movel s_size, d0
! 75: asll #2, d0
! 76: addl d0, s_ptr
! 77: addl d0, res_ptr
! 78: ')
! 79: movel M(-,s_ptr), d2
! 80: movel d2, d0
! 81: lsrl d5, d0 C compute carry limb
! 82:
! 83: lsll cnt, d2
! 84: movel d2, d1
! 85: subql #1, s_size
! 86: beq L(Lend)
! 87: lsrl #1, s_size
! 88: bcs L(L1)
! 89: subql #1, s_size
! 90:
! 91: L(Loop:)
! 92: movel M(-,s_ptr), d2
! 93: movel d2, d3
! 94: lsrl d5, d3
! 95: orl d3, d1
! 96: movel d1, M(-,res_ptr)
! 97: lsll cnt, d2
! 98: L(L1:)
! 99: movel M(-,s_ptr), d1
! 100: movel d1, d3
! 101: lsrl d5, d3
! 102: orl d3, d2
! 103: movel d2, M(-,res_ptr)
! 104: lsll cnt, d1
! 105:
! 106: dbf s_size, L(Loop)
! 107: subl #0x10000, s_size
! 108: bcc L(Loop)
! 109:
! 110: L(Lend:)
! 111: movel d1, M(-,res_ptr) C store least significant limb
! 112:
! 113: C Restore used registers from stack frame.
! 114: moveml M(sp,+), d2-d6/a2
! 115: rts
! 116:
! 117: C We loop from least significant end of the arrays, which is only
! 118: C permissable if the source and destination don't overlap, since the
! 119: C function is documented to work for overlapping source and destination.
! 120:
! 121: L(Lspecial):
! 122: clrl d0 C initialize carry
! 123: eorw #1, s_size
! 124: lsrl #1, s_size
! 125: bcc L(LL1)
! 126: subql #1, s_size
! 127:
! 128: L(LLoop):
! 129: movel M(s_ptr,+), d2
! 130: addxl d2, d2
! 131: movel d2, M(res_ptr,+)
! 132: L(LL1):
! 133: movel M(s_ptr,+), d2
! 134: addxl d2, d2
! 135: movel d2, M(res_ptr,+)
! 136:
! 137: dbf s_size, L(LLoop)
! 138: addxl d0, d0 C save cy in lsb
! 139: subl #0x10000, s_size
! 140: bcs L(LLend)
! 141: lsrl #1, d0 C restore cy
! 142: bra L(LLoop)
! 143:
! 144: L(LLend):
! 145: C Restore used registers from stack frame.
! 146: moveml M(sp,+), d2-d6/a2
! 147: rts
! 148:
! 149: EPILOGUE(mpn_lshift)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>