1dnl HP-PA 2.0 mpn_rshift -- Right shift. 2 3dnl Copyright 1997, 2000, 2002, 2003 Free Software Foundation, Inc. 4 5dnl This file is part of the GNU MP Library. 6 7dnl The GNU MP Library is free software; you can redistribute it and/or modify 8dnl it under the terms of the GNU Lesser General Public License as published 9dnl by the Free Software Foundation; either version 3 of the License, or (at 10dnl your option) any later version. 11 12dnl The GNU MP Library is distributed in the hope that it will be useful, but 13dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 15dnl License for more details. 16 17dnl You should have received a copy of the GNU Lesser General Public License 18dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. 19 20 21dnl This runs at 1.5 cycles/limb on PA8000 and 1.0 cycles/limb on PA8500. 22 23include(`../config.m4') 24 25dnl INPUT PARAMETERS 26define(`rp',`%r26') 27define(`up',`%r25') 28define(`n',`%r24') 29define(`cnt',`%r23') 30 31ifdef(`HAVE_ABI_2_0w', 32` .level 2.0w 33',` .level 2.0 34') 35PROLOGUE(mpn_rshift) 36 mtsar cnt 37 ldd 0(up), %r21 38 addib,= -1, n, L(end) 39 shrpd %r21, %r0, %sar, %r29 C compute carry out limb 40 depw,z n, 31, 3, %r28 C r28 = (size & 7) 41 sub %r0, n, %r22 42 depw,z %r22, 28, 3, %r22 C r22 = 8 * (-size & 7) 43 sub up, %r22, up C offset up 44 blr %r28, %r0 C branch into jump table 45 sub rp, %r22, rp C offset rp 46 b L(0) 47 nop 48 b L(1) 49 copy %r21, %r20 50 b L(2) 51 nop 52 b L(3) 53 copy %r21, %r20 54 b L(4) 55 nop 56 b L(5) 57 copy %r21, %r20 58 b L(6) 59 nop 60 b L(7) 61 copy %r21, %r20 62 63LDEF(loop) 64LDEF(0) ldd 8(up), %r20 65 shrpd %r20, %r21, %sar, %r21 66 std %r21, 0(rp) 67LDEF(7) ldd 16(up), %r21 68 shrpd %r21, %r20, %sar, %r20 69 std %r20, 8(rp) 70LDEF(6) ldd 24(up), %r20 71 shrpd %r20, %r21, %sar, %r21 72 std %r21, 16(rp) 73LDEF(5) ldd 32(up), %r21 74 shrpd %r21, %r20, %sar, %r20 75 std %r20, 24(rp) 76LDEF(4) ldd 40(up), %r20 77 shrpd %r20, %r21, %sar, %r21 78 std %r21, 32(rp) 79LDEF(3) ldd 48(up), %r21 80 shrpd %r21, %r20, %sar, %r20 81 std %r20, 40(rp) 82LDEF(2) ldd 56(up), %r20 83 shrpd %r20, %r21, %sar, %r21 84 std %r21, 48(rp) 85LDEF(1) ldd 64(up), %r21 86 ldo 64(up), up 87 shrpd %r21, %r20, %sar, %r20 88 std %r20, 56(rp) 89 addib,> -8, n, L(loop) 90 ldo 64(rp), rp 91 92LDEF(end) 93 shrpd %r0, %r21, %sar, %r21 94 std %r21, 0(rp) 95 bve (%r2) 96ifdef(`HAVE_ABI_2_0w', 97` copy %r29,%r28 98',` extrd,u %r29, 31, 32, %r28 99') 100EPILOGUE(mpn_rshift) 101