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.
20 # mp_limb_t mpn_lshift (mp_ptr wp, mp_srcptr up, mp_size_t usize,
25 .type __mpn_lshift,@function
27 mtctr %r5 # copy size into CTR
28 cmplwi %cr0,%r5,16 # is size < 16
30 add %r7,%r3,%r0 # make r7 point at end of res
31 add %r4,%r4,%r0 # make r4 point at end of s1
32 lwzu %r11,-4(%r4) # load first s1 limb
34 srw %r3,%r11,%r8 # compute function return value
35 bge %cr0,Lbig # branch if size >= 16
39 Loop: lwzu %r10,-4(%r4)
53 # Guaranteed not to succeed.
56 # We imitate a case statement, by using (yuk!) fixed-length code chunks,
57 # of size 4*12 bytes. We have to do this (or something) to make this PIC.
59 bltl %cr0,LBoom # Never taken, only used to set LR.
70 Lend1: slw %r0,%r11,%r6
75 Loop1: lwzu %r10,-4(%r4)
88 Loop2: lwzu %r10,-4(%r4)
101 Loop3: lwzu %r10,-4(%r4)
114 Loop4: lwzu %r10,-4(%r4)
127 Loop5: lwzu %r10,-4(%r4)
140 Loop6: lwzu %r10,-4(%r4)
153 Loop7: lwzu %r10,-4(%r4)
166 Loop8: lwzu %r10,-4(%r4)
179 Loop9: lwzu %r10,-4(%r4)
192 Loop10: lwzu %r10,-4(%r4)
194 inslwi %r9,%r10,10,22
199 inslwi %r9,%r11,10,22
205 Loop11: lwzu %r10,-4(%r4)
207 inslwi %r9,%r10,11,21
212 inslwi %r9,%r11,11,21
218 Loop12: lwzu %r10,-4(%r4)
220 inslwi %r9,%r10,12,20
225 inslwi %r9,%r11,12,20
231 Loop13: lwzu %r10,-4(%r4)
233 inslwi %r9,%r10,13,19
238 inslwi %r9,%r11,13,19
244 Loop14: lwzu %r10,-4(%r4)
246 inslwi %r9,%r10,14,18
251 inslwi %r9,%r11,14,18
257 Loop15: lwzu %r10,-4(%r4)
259 inslwi %r9,%r10,15,17
264 inslwi %r9,%r11,15,17
270 Loop16: lwzu %r10,-4(%r4)
272 inslwi %r9,%r10,16,16
277 inslwi %r9,%r11,16,16
283 Loop17: lwzu %r10,-4(%r4)
285 inslwi %r9,%r10,17,15
290 inslwi %r9,%r11,17,15
296 Loop18: lwzu %r10,-4(%r4)
298 inslwi %r9,%r10,18,14
303 inslwi %r9,%r11,18,14
309 Loop19: lwzu %r10,-4(%r4)
311 inslwi %r9,%r10,19,13
316 inslwi %r9,%r11,19,13
322 Loop20: lwzu %r10,-4(%r4)
324 inslwi %r9,%r10,20,12
329 inslwi %r9,%r11,20,12
335 Loop21: lwzu %r10,-4(%r4)
337 inslwi %r9,%r10,21,11
342 inslwi %r9,%r11,21,11
348 Loop22: lwzu %r10,-4(%r4)
350 inslwi %r9,%r10,22,10
355 inslwi %r9,%r11,22,10
361 Loop23: lwzu %r10,-4(%r4)
374 Loop24: lwzu %r10,-4(%r4)
387 Loop25: lwzu %r10,-4(%r4)
400 Loop26: lwzu %r10,-4(%r4)
413 Loop27: lwzu %r10,-4(%r4)
426 Loop28: lwzu %r10,-4(%r4)
439 Loop29: lwzu %r10,-4(%r4)
452 Loop30: lwzu %r10,-4(%r4)
465 Loop31: lwzu %r10,-4(%r4)
477 Lend2: slw %r0,%r10,%r6