Annotation of OpenXM_contrib/gmp/mpn/powerpc32/lshift.asm, Revision 1.1.1.1
1.1 maekawa 1: dnl PowerPC-32 mpn_lshift -- Shift a number left.
2:
3: dnl Copyright (C) 1995, 1998, 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_lshift)
33: cmpi cr0,r5,12 C more than 12 limbs?
34: slwi r0,r5,2
35: add r4,r4,r0 C make r4 point at end of s1
36: add r7,r3,r0 C make r7 point at end of res
37: bgt .LBIG C branch if more than 12 limbs
38:
39: mtctr r5 C copy size into CTR
40: subfic r8,r6,32
41: lwzu r11,-4(r4) C load first s1 limb
42: srw r3,r11,r8 C compute function return value
43: bdz .Lend1
44:
45: .Loop: lwzu r10,-4(r4)
46: slw r9,r11,r6
47: srw r12,r10,r8
48: or r9,r9,r12
49: stwu r9,-4(r7)
50: bdz .Lend2
51: lwzu r11,-4(r4)
52: slw r9,r10,r6
53: srw r12,r11,r8
54: or r9,r9,r12
55: stwu r9,-4(r7)
56: bdnz .Loop
57:
58: .Lend1: slw r0,r11,r6
59: stw r0,-4(r7)
60: blr
61: .Lend2: slw r0,r10,r6
62: stw r0,-4(r7)
63: blr
64:
65: .LBIG:
66: stmw r24,-32(r1) C save registers we are supposed to preserve
67: lwzu r9,-4(r4)
68: subfic r8,r6,32
69: srw r3,r9,r8 C compute function return value
70: slw r0,r9,r6
71: addi r5,r5,-1
72:
73: andi. r10,r5,3 C count for spill loop
74: beq .Le
75: mtctr r10
76: lwzu r28,-4(r4)
77: bdz .Lxe0
78:
79: .Loop0: slw r12,r28,r6
80: srw r24,r28,r8
81: lwzu r28,-4(r4)
82: or r24,r0,r24
83: stwu r24,-4(r7)
84: mr r0,r12
85: bdnz .Loop0 C taken at most once!
86:
87: .Lxe0: slw r12,r28,r6
88: srw r24,r28,r8
89: or r24,r0,r24
90: stwu r24,-4(r7)
91: mr r0,r12
92:
93: .Le: srwi r5,r5,2 C count for unrolled loop
94: addi r5,r5,-1
95: mtctr r5
96: lwz r28,-4(r4)
97: lwz r29,-8(r4)
98: lwz r30,-12(r4)
99: lwzu r31,-16(r4)
100:
101: .LoopU: slw r9,r28,r6
102: srw r24,r28,r8
103: lwz r28,-4(r4)
104: slw r10,r29,r6
105: srw r25,r29,r8
106: lwz r29,-8(r4)
107: slw r11,r30,r6
108: srw r26,r30,r8
109: lwz r30,-12(r4)
110: slw r12,r31,r6
111: srw r27,r31,r8
112: lwzu r31,-16(r4)
113: or r24,r0,r24
114: stw r24,-4(r7)
115: or r25,r9,r25
116: stw r25,-8(r7)
117: or r26,r10,r26
118: stw r26,-12(r7)
119: or r27,r11,r27
120: stwu r27,-16(r7)
121: mr r0,r12
122: bdnz .LoopU
123:
124: slw r9,r28,r6
125: srw r24,r28,r8
126: slw r10,r29,r6
127: srw r25,r29,r8
128: slw r11,r30,r6
129: srw r26,r30,r8
130: slw r12,r31,r6
131: srw r27,r31,r8
132: or r24,r0,r24
133: stw r24,-4(r7)
134: or r25,r9,r25
135: stw r25,-8(r7)
136: or r26,r10,r26
137: stw r26,-12(r7)
138: or r27,r11,r27
139: stwu r27,-16(r7)
140: mr r0,r12
141:
142: stw r0,-4(r7)
143: lmw r24,-32(r1) C restore registers
144: blr
145: EPILOGUE(mpn_lshift)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>