1 dnl PowerPC
750 mpn_lshift
-- mpn left 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
either:
10 dnl
* the GNU Lesser General
Public License as published by the Free
11 dnl Software Foundation
; either version 3 of the License, or (at your
12 dnl option
) any later version.
16 dnl
* the GNU General
Public License as published by the Free Software
17 dnl Foundation
; either version 2 of the License, or (at your option) any
20 dnl
or both
in parallel
, as here.
22 dnl The GNU MP Library is distributed
in the hope that it will be useful
, but
23 dnl WITHOUT ANY WARRANTY
; without even the implied warranty of MERCHANTABILITY
24 dnl
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License
27 dnl You should have received copies of the GNU General
Public License
and the
28 dnl GNU Lesser General
Public License along with the GNU MP Library. If
not,
29 dnl see
https://www.gnu.
org/licenses
/.
31 include(`..
/config.m4
')
39 C mp_limb_t mpn_lshift (mp_ptr dst, mp_srcptr src, mp_size_t size,
42 C This code is the same per-limb speed as mpn/powerpc32/lshift.asm, but
43 C smaller and saving about 30 or so cycles of overhead.
54 slwi r5, r5, 2 C 4*size
56 subfic r7, r6, 32 C 32-shift
57 add r4, r4, r5 C &src[size]
59 add r5, r3, r5 C &dst[size]
60 lwz r8, -4(r4) C src[size-1]
63 lwzu r9, -8(r4) C src[size-2]
65 srw r3, r8, r7 C return value
66 slw r8, r8, r6 C src[size-1] << shift
72 C r4 src, incrementing
73 C r5 dst, incrementing
76 C r8 src[i+1] << shift
89 C r8 src[i+1] << shift
114 slw r12, r9, r6 C src[0] << shift
117 stw r12, -8(r5) C dst[0]
119 stw r8, -4(r5) C dst[1]
137 stw r12, -8(r5) C dst[0]
139 stw r8, -4(r5) C dst[1]
149 srw r3, r8, r7 C return value
150 slw r8, r8, r6 C src[size-1] << shift
152 stw r8, -4(r5) C dst[0]