1 dnl PowerPC 750 mpn_rshift -- mpn right shift.
3 dnl Copyright 2002, 2003 Free Software Foundation, Inc.
5 dnl This file is part of the GNU MP Library.
7 dnl The GNU MP Library is free software; you can redistribute it and/or modify
8 dnl it under the terms of the GNU Lesser General Public License as published
9 dnl by the Free Software Foundation; either version 3 of the License, or (at
10 dnl your option) any later version.
12 dnl The GNU MP Library is distributed in the hope that it will be useful, but
13 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 dnl License for more details.
17 dnl You should have received a copy of the GNU Lesser General Public License
18 dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
20 include(`../config.m4')
28 C mp_limb_t mpn_rshift (mp_ptr dst, mp_srcptr src, mp_size_t size,
31 C This code is the same per-limb speed as mpn/powerpc32/rshift.asm, but
32 C smaller and saving about 30 or so cycles of overhead.
43 lwz r8, 0(r4) C src[0]
45 subfic r7, r6, 32 C 32-shift
46 addi r5, r3, -4 C dst-4
48 slw r3, r8, r7 C return value
51 lwzu r9, 4(r4) C src[1]
52 srw r8, r8, r6 C src[0] >> shift
58 C r4 src, incrementing
59 C r5 dst, incrementing
62 C r8 src[i-1] >> shift
75 C r8 src[i-1] >> shift
95 C r8 src[size-2] >> shift
100 srw r12, r9, r6 C src[size-1] >> shift
103 stw r12, 8(r5) C dst[size-1]
105 stw r8, 4(r5) C dst[size-2]
115 C r8 src[size-2] >> shift
123 stw r12, 8(r5) C dst[size-1]
125 stw r8, 4(r5) C dst[size-2]
139 stw r8, 4(r5) C dst[0]