1dnl HP-PA mpn_rshift -- Shift a number right. 2dnl Optimized for the PA7100, where is runs at 3.25 cycles/limb. 3 4dnl Copyright 1992, 1994, 2000, 2001, 2002, 2003 Free Software Foundation, 5dnl Inc. 6 7dnl This file is part of the GNU MP Library. 8 9dnl The GNU MP Library is free software; you can redistribute it and/or modify 10dnl it under the terms of the GNU Lesser General Public License as published 11dnl by the Free Software Foundation; either version 3 of the License, or (at 12dnl your option) any later version. 13 14dnl The GNU MP Library is distributed in the hope that it will be useful, but 15dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 16dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 17dnl License for more details. 18 19dnl You should have received a copy of the GNU Lesser General Public License 20dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. 21 22include(`../config.m4') 23 24C INPUT PARAMETERS 25C res_ptr r26 26C s_ptr r25 27C size r24 28C cnt r23 29 30ASM_START() 31PROLOGUE(mpn_rshift) 32 ldws,ma 4(0,%r25),%r22 33 mtsar %r23 34 addib,= -1,%r24,L(0004) 35 vshd %r22,%r0,%r28 C compute carry out limb 36 ldws,ma 4(0,%r25),%r29 37 addib,<= -5,%r24,L(rest) 38 vshd %r29,%r22,%r20 39 40LDEF(loop) 41 ldws,ma 4(0,%r25),%r22 42 stws,ma %r20,4(0,%r26) 43 vshd %r22,%r29,%r20 44 ldws,ma 4(0,%r25),%r29 45 stws,ma %r20,4(0,%r26) 46 vshd %r29,%r22,%r20 47 ldws,ma 4(0,%r25),%r22 48 stws,ma %r20,4(0,%r26) 49 vshd %r22,%r29,%r20 50 ldws,ma 4(0,%r25),%r29 51 stws,ma %r20,4(0,%r26) 52 addib,> -4,%r24,L(loop) 53 vshd %r29,%r22,%r20 54 55LDEF(rest) 56 addib,= 4,%r24,L(end1) 57 nop 58 59LDEF(eloop) 60 ldws,ma 4(0,%r25),%r22 61 stws,ma %r20,4(0,%r26) 62 addib,<= -1,%r24,L(end2) 63 vshd %r22,%r29,%r20 64 ldws,ma 4(0,%r25),%r29 65 stws,ma %r20,4(0,%r26) 66 addib,> -1,%r24,L(eloop) 67 vshd %r29,%r22,%r20 68 69LDEF(end1) 70 stws,ma %r20,4(0,%r26) 71 vshd %r0,%r29,%r20 72 bv 0(%r2) 73 stw %r20,0(0,%r26) 74 75LDEF(end2) 76 stws,ma %r20,4(0,%r26) 77 78LDEF(0004) 79 vshd %r0,%r22,%r20 80 bv 0(%r2) 81 stw %r20,0(0,%r26) 82EPILOGUE() 83