1 /* Shift a limb left, low level routine.
2 Copyright (C) 1996, 1997 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 Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 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 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
22 /* mp_limb_t mpn_lshift (mp_ptr wp, mp_srcptr up, mp_size_t usize,
25 EALIGN(__mpn_lshift,3,0)
26 mtctr %r5 # copy size into CTR
27 cmplwi %cr0,%r5,16 # is size < 16
29 add %r7,%r3,%r0 # make r7 point at end of res
30 add %r4,%r4,%r0 # make r4 point at end of s1
31 lwzu %r11,-4(%r4) # load first s1 limb
33 srw %r3,%r11,%r8 # compute function return value
34 bge %cr0,L(big) # branch if size >= 16
51 L(end1):slw %r0,%r11,%r6
56 /* Guaranteed not to succeed. */
59 /* We imitate a case statement, by using (yuk!) fixed-length code chunks,
60 of size 4*12 bytes. We have to do this (or something) to make this PIC. */
62 bltl- %cr0,L(boom) # Never taken, only used to set LR.
73 L(end2):slw %r0,%r10,%r6
77 #define DO_LSHIFT(n) \
79 0: lwzu %r10,-4(%r4); \
81 inslwi %r9,%r10,n,32-n; \
86 inslwi %r9,%r11,n,32-n; \