1/* Shift a limb right, low level routine.
2 Copyright (C) 1995-2024 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 <https://www.gnu.org/licenses/>. */
18
19#include <sysdep.h>
20
21/* INPUT PARAMETERS
22 res_ptr r3
23 s1_ptr r4
24 size r5
25 cnt r6 */
26
27ENTRY (__mpn_rshift)
28 mtctr r5 # copy size into CTR
29 addi r7,r3,-4 # move adjusted res_ptr to free return reg
30 subfic r8,r6,32
31 lwz r11,0(r4) # load first s1 limb
32 slw r3,r11,r8 # compute function return value
33 bdz L(1)
34
35L(0): lwzu r10,4(r4)
36 srw r9,r11,r6
37 slw r12,r10,r8
38 or r9,r9,r12
39 stwu r9,4(r7)
40 bdz L(2)
41 lwzu r11,4(r4)
42 srw r9,r10,r6
43 slw r12,r11,r8
44 or r9,r9,r12
45 stwu r9,4(r7)
46 bdnz L(0)
47
48L(1): srw r0,r11,r6
49 stw r0,4(r7)
50 blr
51
52L(2): srw r0,r10,r6
53 stw r0,4(r7)
54 blr
55END (__mpn_rshift)
56

source code of glibc/sysdeps/powerpc/powerpc32/rshift.S