1 /* Shift a limb left, low level routine.
2 Copyright (C) 1996, 1997, 1999, 2000 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, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
24 /* mp_limb_t mpn_lshift (mp_ptr wp, mp_srcptr up, mp_size_t usize,
27 EALIGN (BP_SYM (__mpn_lshift), 3, 0)
29 #if __BOUNDED_POINTERS__
30 slwi r10,r5,2 /* convert limbs to bytes */
31 CHECK_BOUNDS_BOTH_WIDE (r3, r8, r9, r10)
32 CHECK_BOUNDS_BOTH_WIDE (r4, r8, r9, r10)
34 mtctr r5 # copy size into CTR
35 cmplwi cr0,r5,16 # is size < 16
37 add r7,r3,r0 # make r7 point at end of res
38 add r4,r4,r0 # make r4 point at end of s1
39 lwzu r11,-4(r4) # load first s1 limb
41 srw r3,r11,r8 # compute function return value
42 bge cr0,L(big) # branch if size >= 16
64 /* Guaranteed not to succeed. */
67 /* We imitate a case statement, by using (yuk!) fixed-length code chunks,
68 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.
85 #define DO_LSHIFT(n) \
87 L(n): lwzu r10,-4(r4); \
89 inslwi r9,r10,n,32-n; \
94 inslwi r9,r11,n,32-n; \
131 END (BP_SYM (__mpn_lshift))