]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/powerpc/powerpc32/rshift.S
Update copyright notices with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / powerpc / powerpc32 / rshift.S
1 /* Shift a limb right, low level routine.
2 Copyright (C) 1995-2013 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
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.
9
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.
14
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/>. */
18
19 #include <sysdep.h>
20 #include <bp-sym.h>
21 #include <bp-asm.h>
22
23 /* INPUT PARAMETERS
24 res_ptr r3
25 s1_ptr r4
26 size r5
27 cnt r6 */
28
29 ENTRY (BP_SYM (__mpn_rshift))
30 #if __BOUNDED_POINTERS__
31 slwi r10,r5,2 /* convert limbs to bytes */
32 CHECK_BOUNDS_BOTH_WIDE (r3, r8, r9, r10)
33 CHECK_BOUNDS_BOTH_WIDE (r4, r8, r9, r10)
34 #endif
35 mtctr r5 # copy size into CTR
36 addi r7,r3,-4 # move adjusted res_ptr to free return reg
37 subfic r8,r6,32
38 lwz r11,0(r4) # load first s1 limb
39 slw r3,r11,r8 # compute function return value
40 bdz L(1)
41
42 L(0): lwzu r10,4(r4)
43 srw r9,r11,r6
44 slw r12,r10,r8
45 or r9,r9,r12
46 stwu r9,4(r7)
47 bdz L(2)
48 lwzu r11,4(r4)
49 srw r9,r10,r6
50 slw r12,r11,r8
51 or r9,r9,r12
52 stwu r9,4(r7)
53 bdnz L(0)
54
55 L(1): srw r0,r11,r6
56 stw r0,4(r7)
57 blr
58
59 L(2): srw r0,r10,r6
60 stw r0,4(r7)
61 blr
62 END (BP_SYM (__mpn_rshift))