Annotation of OpenXM_contrib/pari-2.2/src/kernel/ppc/kerPPC.s, Revision 1.1.1.1
1.1 noro 1: ; $Id: kerPPC.s,v 1.2 2000/11/03 21:00:26 karim Exp $
2: ;
3: ; Copyright (C) 2000 The PARI group.
4: ;
5: ; This file is part of the PARI/GP package.
6: ;
7: ; PARI/GP is free software; you can redistribute it and/or modify it under the
8: ; terms of the GNU General Public License as published by the Free Software
9: ; Foundation. It is distributed in the hope that it will be useful, but WITHOUT
10: ; ANY WARRANTY WHATSOEVER.
11: ;
12: ; Check the License for details. You should have received a copy of it, along
13: ; with the package; see the file 'COPYING'. If not, write to the Free Software
14: ; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
15:
16: import hiremainder,overflow
17:
18: toc
19: tc hiremainder[TC], hiremainder
20: tc overflow[TC], overflow
21:
22: export addll[DS],.addll[PR],addllx[DS],.addllx[PR]
23: export subll[DS],.subll[PR],subllx[DS],.subllx[PR]
24: export mulll[DS],.mulll[PR],addmul[DS],.addmul[PR]
25: export divll[DS],.divll[PR],bfffo[DS],.bfffo[PR]
26:
27: toc
28: tc addll[TC], addll[DS]
29: tc addllx[TC], addllx[DS]
30: tc subll[TC], subll[DS]
31: tc subllx[TC], subllx[DS]
32: tc mulll[TC], mulll[DS]
33: tc addmul[TC], addmul[DS]
34: tc divll[TC], divll[DS]
35: tc bfffo[TC], bfffo[DS]
36:
37: csect addll[DS]
38: dc.l .addll[PR]
39: dc.l TOC[tc0]
40: dc.l 0
41:
42: csect .addll[PR]
43: addc r3,r3,r4
44: subfe r5,r5,r5
45: addi r5,r5,1
46: lwz r6,overflow{TC}(RTOC)
47: stw r5,0x0000(r6)
48: blr
49:
50: csect addllx[DS]
51: dc.l .addllx[PR]
52: dc.l TOC[tc0]
53: dc.l 0
54:
55: csect .addllx[PR]
56: addc r3,r3,r4
57: subfe r5,r5,r5
58: lwz r6,overflow{TC}(RTOC)
59: lwz r7,0x0000(r6)
60: addc r3,r7,r3
61: subfe r8,r8,r8
62: addc r5,r8,r5
63: addi r5,r5,2
64: stw r5,0x0000(r6)
65: blr
66:
67: csect subll[DS]
68: dc.l .subll[PR]
69: dc.l TOC[tc0]
70: dc.l 0
71:
72: csect .subll[PR]
73: subfc r3,r4,r3
74: subfe r5,r5,r5
75: neg r5,r5
76: lwz r6,overflow{TC}(RTOC)
77: stw r5,0x0000(r6)
78: blr
79:
80: csect subllx[DS]
81: dc.l .subllx[PR]
82: dc.l TOC[tc0]
83: dc.l 0
84:
85: csect .subllx[PR]
86: subfc r3,r4,r3
87: subfe r5,r5,r5
88: lwz r6,overflow{TC}(RTOC)
89: lwz r7,0x0000(r6)
90: subfc r3,r7,r3
91: subfe r8,r8,r8
92: addc r5,r8,r5
93: neg r5,r5
94: stw r5,0x0000(r6)
95: blr
96:
97: csect mulll[DS]
98: dc.l .mulll[PR]
99: dc.l TOC[tc0]
100: dc.l 0
101:
102: csect .mulll[PR]
103:
104: ; version PowerPC, plus lente
105: ; mulhwu r5,r3,r4
106: ; lwz r6,hiremainder{TC}(RTOC)
107: ; stw r5,0x0000(r6)
108: ; mullw r3,r3,r4
109: ; blr
110: ; version POWER
111: lwz r6,hiremainder{TC}(RTOC)
112: dialect POWER
113: mul r5,r3,r4
114: dialect POWERPC
115: cmpwi r3,0
116: bge @1
117: add r5,r5,r4
118: @1 cmpwi r4,0
119: bge @2
120: add r5,r5,r3
121: @2 stw r5,0x0000(r6)
122: mfspr r3,mq
123: blr
124:
125: csect addmul[DS]
126: dc.l .addmul[PR]
127: dc.l TOC[tc0]
128: dc.l 0
129:
130: csect .addmul[PR]
131: ; version PowerPC, plus lente
132: ; mulhwu r5,r3,r4
133: ; mullw r3,r3,r4
134: ; lwz r6,hiremainder{TC}(RTOC)
135: ; lwz r7,0x0000(r6)
136: ; addc r3,r7,r3
137: ; addze r5,r5
138: ; stw r5,0x0000(r6)
139: ; blr
140: ; version POWER
141: lwz r6,hiremainder{TC}(RTOC)
142: dialect POWER
143: mul r5,r3,r4
144: dialect POWERPC
145: cmpwi r3,0
146: bge @1
147: add r5,r5,r4
148: @1 cmpwi r4,0
149: bge @2
150: add r5,r5,r3
151: @2 lwz r7,0x0000(r6)
152: mfspr r3,mq
153: addc r3,r7,r3
154: addze r5,r5
155: stw r5,0x0000(r6)
156: blr
157:
158: csect divll[DS]
159: dc.l .divll[PR]
160: dc.l TOC[tc0]
161: dc.l 0
162:
163: csect .divll[PR]
164:
165: ; version POWER
166: ; chargement de a puis a1 dans r5, b puis b1 dans r3 et c puis c1 dans r4
167: lwz r6,hiremainder{TC}(RTOC)
168: lwz r5,0x0000(r6)
169:
170: ; etape 1, f est code dans cr5, eb dans r7 et ec dans cr6
171: ; si f = 1, on garde une copie de c dans r10
172: cmpwi 5,r4,0
173: bge 5,@1
174: andi. r7,r4,1
175: mcrf 6,0
176: mr r10,r4
177: srwi r4,r4,1
178: andi. r7,r3,1
179: srwi r3,r3,1
180: rlwimi r3,r5,31,0,0
181: srwi r5,r5,1
182:
183: ; modif
184: cmplw r5,r4
185: bne @1
186: slwi r3,r3,1
187: add r3,r3,r7
188: addc r4,r3,r10
189: subfe. r5,r5,r5
190: li r3,-1
191: beq @5
192: subi r3,r3,1
193: add r4,r10,r4
194: b @5
195:
196: ; etape 2 r3 recoit q et mq recoit r
197: @1 add r8,r5,r5
198: addi r8,r8,1
199: cmplw r4,r8
200: bgt @2
201: bne @3
202: cmpwi r3,0
203: bge @2
204: @3 slwi r9,r4,31
205: srwi r8,r4,1
206: subfc r3,r9,r3
207: subfe r5,r8,r5
208: mtspr mq,r3
209: dialect POWER
210: div r3,r5,r4
211: dialect POWERPC
212: mfspr r4,mq
213: oris r3,r3,0x8000
214: b @4
215: @2 mtspr mq,r3
216: dialect POWER
217: div r3,r5,r4
218: dialect POWERPC
219: mfspr r4,mq
220:
221: ; etape 3 r4 recoit r
222: @4 bge 5,@5
223: slwi r4,r4,1
224: add r4,r4,r7
225: beq 6,@5
226:
227: ; etape 4 modifiee
228: subfc r4,r3,r4
229: subfe. r5,r5,r5
230: beq @5
231: subi r3,r3,1
232: addc r4,r4,r10
233: subfe. r5,r5,r5
234: beq @5
235: subi r3,r3,1
236: addc r4,r4,r10
237:
238: ; retour
239: @5 stw r4,0x0000(r6)
240: blr
241:
242: csect bfffo[DS]
243: dc.l .bfffo[PR]
244: dc.l TOC[tc0]
245: dc.l 0
246:
247: csect .bfffo[PR]
248: cntlzw r3,r3
249: blr
250:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>