1 /* Shift a limb left, low level routine.
2 Copyright (C) 1996, 1997, 1999, 2000, 2006 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
23 /* mp_limb_t mpn_lshift (mp_ptr wp, mp_srcptr up, mp_size_t usize,
26 EALIGN (BP_SYM (__mpn_lshift), 3, 0)
28 #if __BOUNDED_POINTERS__
29 slwi r10,r5,2 /* convert limbs to bytes */
30 CHECK_BOUNDS_BOTH_WIDE (r3, r8, r9, r10)
31 CHECK_BOUNDS_BOTH_WIDE (r4, r8, r9, r10)
33 mtctr r5 # copy size into CTR
34 cmplwi cr0,r5,16 # is size < 16
36 add r7,r3,r0 # make r7 point at end of res
37 add r4,r4,r0 # make r4 point at end of s1
38 lwzu r11,-4(r4) # load first s1 limb
40 srw r3,r11,r8 # compute function return value
41 bge cr0,L(big) # branch if size >= 16
63 /* Guaranteed not to succeed. */
66 /* We imitate a case statement, by using (yuk!) fixed-length code chunks,
67 of size 4*12 bytes. We have to do this (or something) to make this PIC. */
70 bltl- cr0,L(boom) # Never taken, only used to set LR.
86 #define DO_LSHIFT(n) \
88 L(n): lwzu r10,-4(r4); \
90 inslwi r9,r10,n,32-n; \
95 inslwi r9,r11,n,32-n; \
132 END (BP_SYM (__mpn_lshift))