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