Reorganisation of the source tree
[ghc-hetmet.git] / rts / gmp / mpn / powerpc32 / rshift.asm
1 dnl PowerPC-32 mpn_rshift -- Shift a number right.
2
3 dnl Copyright (C) 1995, 2000 Free Software Foundation, Inc.
4
5 dnl This file is part of the GNU MP Library.
6
7 dnl The GNU MP Library is free software; you can redistribute it and/or modify
8 dnl it under the terms of the GNU Lesser General Public License as published by
9 dnl the Free Software Foundation; either version 2.1 of the License, or (at your
10 dnl option) any later version.
11
12 dnl The GNU MP Library is distributed in the hope that it will be useful, but
13 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 dnl or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
15 dnl License for more details.
16
17 dnl You should have received a copy of the GNU Lesser General Public License
18 dnl along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
19 dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
20 dnl MA 02111-1307, USA.
21
22
23 dnl INPUT PARAMETERS
24 dnl res_ptr     r3
25 dnl s1_ptr      r4
26 dnl size        r5
27 dnl cnt         r6
28
29 include(`../config.m4')
30
31 ASM_START()
32 PROLOGUE(mpn_rshift)
33         mtctr   r5              C copy size into CTR
34         addi    r7,r3,-4        C move adjusted res_ptr to free return reg
35         subfic  r8,r6,32
36         lwz     r11,0(r4)       C load first s1 limb
37         slw     r3,r11,r8       C compute function return value
38         bdz     .Lend1
39
40 .Loop:  lwzu    r10,4(r4)
41         srw     r9,r11,r6
42         slw     r12,r10,r8
43         or      r9,r9,r12
44         stwu    r9,4(r7)
45         bdz     .Lend2
46         lwzu    r11,4(r4)
47         srw     r9,r10,r6
48         slw     r12,r11,r8
49         or      r9,r9,r12
50         stwu    r9,4(r7)
51         bdnz    .Loop
52
53 .Lend1: srw     r0,r11,r6
54         stw     r0,4(r7)
55         blr
56
57 .Lend2: srw     r0,r10,r6
58         stw     r0,4(r7)
59         blr
60 EPILOGUE(mpn_rshift)