1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
|
.SPACE $PRIVATE$
.SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31
.SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82
.SPACE $TEXT$
.SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=44
.SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY
.IMPORT $global$,DATA
.IMPORT $$dyncall,MILLICODE
; gcc_compiled.:
.SPACE $TEXT$
.SUBSPA $CODE$
.align 4
.EXPORT bn_mul_add_words,ENTRY,PRIV_LEV=3,ARGW0=GR,ARGW1=GR,ARGW2=GR,ARGW3=GR,RTNVAL=GR
bn_mul_add_words
.PROC
.CALLINFO FRAME=64,CALLS,SAVE_RP,ENTRY_GR=4
.ENTRY
stw %r2,-20(0,%r30)
stwm %r4,64(0,%r30)
copy %r24,%r31
stw %r3,-60(0,%r30)
ldi 0,%r20
ldo 12(%r26),%r2
stw %r23,-16(0,%r30)
copy %r25,%r3
ldo 12(%r3),%r1
fldws -16(0,%r30),%fr8L
L$0010
copy %r20,%r25
ldi 0,%r24
fldws 0(0,%r3),%fr9L
ldw 0(0,%r26),%r19
xmpyu %fr8L,%fr9L,%fr9
fstds %fr9,-16(0,%r30)
copy %r19,%r23
ldw -16(0,%r30),%r28
ldw -12(0,%r30),%r29
ldi 0,%r22
add %r23,%r29,%r29
addc %r22,%r28,%r28
add %r25,%r29,%r29
addc %r24,%r28,%r28
copy %r28,%r21
ldi 0,%r20
copy %r21,%r20
addib,= -1,%r31,L$0011
stw %r29,0(0,%r26)
copy %r20,%r25
ldi 0,%r24
fldws -8(0,%r1),%fr9L
ldw -8(0,%r2),%r19
xmpyu %fr8L,%fr9L,%fr9
fstds %fr9,-16(0,%r30)
copy %r19,%r23
ldw -16(0,%r30),%r28
ldw -12(0,%r30),%r29
ldi 0,%r22
add %r23,%r29,%r29
addc %r22,%r28,%r28
add %r25,%r29,%r29
addc %r24,%r28,%r28
copy %r28,%r21
ldi 0,%r20
copy %r21,%r20
addib,= -1,%r31,L$0011
stw %r29,-8(0,%r2)
copy %r20,%r25
ldi 0,%r24
fldws -4(0,%r1),%fr9L
ldw -4(0,%r2),%r19
xmpyu %fr8L,%fr9L,%fr9
fstds %fr9,-16(0,%r30)
copy %r19,%r23
ldw -16(0,%r30),%r28
ldw -12(0,%r30),%r29
ldi 0,%r22
add %r23,%r29,%r29
addc %r22,%r28,%r28
add %r25,%r29,%r29
addc %r24,%r28,%r28
copy %r28,%r21
ldi 0,%r20
copy %r21,%r20
addib,= -1,%r31,L$0011
stw %r29,-4(0,%r2)
copy %r20,%r25
ldi 0,%r24
fldws 0(0,%r1),%fr9L
ldw 0(0,%r2),%r19
xmpyu %fr8L,%fr9L,%fr9
fstds %fr9,-16(0,%r30)
copy %r19,%r23
ldw -16(0,%r30),%r28
ldw -12(0,%r30),%r29
ldi 0,%r22
add %r23,%r29,%r29
addc %r22,%r28,%r28
add %r25,%r29,%r29
addc %r24,%r28,%r28
copy %r28,%r21
ldi 0,%r20
copy %r21,%r20
addib,= -1,%r31,L$0011
stw %r29,0(0,%r2)
ldo 16(%r1),%r1
ldo 16(%r3),%r3
ldo 16(%r2),%r2
bl L$0010,0
ldo 16(%r26),%r26
L$0011
copy %r20,%r28
ldw -84(0,%r30),%r2
ldw -60(0,%r30),%r3
bv 0(%r2)
ldwm -64(0,%r30),%r4
.EXIT
.PROCEND
.align 4
.EXPORT bn_mul_words,ENTRY,PRIV_LEV=3,ARGW0=GR,ARGW1=GR,ARGW2=GR,ARGW3=GR,RTNVAL=GR
bn_mul_words
.PROC
.CALLINFO FRAME=64,CALLS,SAVE_RP,ENTRY_GR=3
.ENTRY
stw %r2,-20(0,%r30)
copy %r25,%r2
stwm %r4,64(0,%r30)
copy %r24,%r19
ldi 0,%r28
stw %r23,-16(0,%r30)
ldo 12(%r26),%r31
ldo 12(%r2),%r29
fldws -16(0,%r30),%fr8L
L$0026
fldws 0(0,%r2),%fr9L
xmpyu %fr8L,%fr9L,%fr9
fstds %fr9,-16(0,%r30)
copy %r28,%r21
ldi 0,%r20
ldw -16(0,%r30),%r24
ldw -12(0,%r30),%r25
add %r21,%r25,%r25
addc %r20,%r24,%r24
copy %r24,%r23
ldi 0,%r22
copy %r23,%r28
addib,= -1,%r19,L$0027
stw %r25,0(0,%r26)
fldws -8(0,%r29),%fr9L
xmpyu %fr8L,%fr9L,%fr9
fstds %fr9,-16(0,%r30)
copy %r28,%r21
ldi 0,%r20
ldw -16(0,%r30),%r24
ldw -12(0,%r30),%r25
add %r21,%r25,%r25
addc %r20,%r24,%r24
copy %r24,%r23
ldi 0,%r22
copy %r23,%r28
addib,= -1,%r19,L$0027
stw %r25,-8(0,%r31)
fldws -4(0,%r29),%fr9L
xmpyu %fr8L,%fr9L,%fr9
fstds %fr9,-16(0,%r30)
copy %r28,%r21
ldi 0,%r20
ldw -16(0,%r30),%r24
ldw -12(0,%r30),%r25
add %r21,%r25,%r25
addc %r20,%r24,%r24
copy %r24,%r23
ldi 0,%r22
copy %r23,%r28
addib,= -1,%r19,L$0027
stw %r25,-4(0,%r31)
fldws 0(0,%r29),%fr9L
xmpyu %fr8L,%fr9L,%fr9
fstds %fr9,-16(0,%r30)
copy %r28,%r21
ldi 0,%r20
ldw -16(0,%r30),%r24
ldw -12(0,%r30),%r25
add %r21,%r25,%r25
addc %r20,%r24,%r24
copy %r24,%r23
ldi 0,%r22
copy %r23,%r28
addib,= -1,%r19,L$0027
stw %r25,0(0,%r31)
ldo 16(%r29),%r29
ldo 16(%r2),%r2
ldo 16(%r31),%r31
bl L$0026,0
ldo 16(%r26),%r26
L$0027
ldw -84(0,%r30),%r2
bv 0(%r2)
ldwm -64(0,%r30),%r4
.EXIT
.PROCEND
.align 4
.EXPORT bn_sqr_words,ENTRY,PRIV_LEV=3,ARGW0=GR,ARGW1=GR,ARGW2=GR
bn_sqr_words
.PROC
.CALLINFO FRAME=0,NO_CALLS
.ENTRY
ldo 28(%r26),%r19
ldo 12(%r25),%r28
L$0042
fldws 0(0,%r25),%fr8L
fldws 0(0,%r25),%fr8R
xmpyu %fr8L,%fr8R,%fr8
fstds %fr8,-16(0,%r30)
ldw -16(0,%r30),%r22
ldw -12(0,%r30),%r23
stw %r23,0(0,%r26)
copy %r22,%r21
ldi 0,%r20
addib,= -1,%r24,L$0049
stw %r21,-24(0,%r19)
fldws -8(0,%r28),%fr8L
fldws -8(0,%r28),%fr8R
xmpyu %fr8L,%fr8R,%fr8
fstds %fr8,-16(0,%r30)
ldw -16(0,%r30),%r22
ldw -12(0,%r30),%r23
stw %r23,-20(0,%r19)
copy %r22,%r21
ldi 0,%r20
addib,= -1,%r24,L$0049
stw %r21,-16(0,%r19)
fldws -4(0,%r28),%fr8L
fldws -4(0,%r28),%fr8R
xmpyu %fr8L,%fr8R,%fr8
fstds %fr8,-16(0,%r30)
ldw -16(0,%r30),%r22
ldw -12(0,%r30),%r23
stw %r23,-12(0,%r19)
copy %r22,%r21
ldi 0,%r20
addib,= -1,%r24,L$0049
stw %r21,-8(0,%r19)
fldws 0(0,%r28),%fr8L
fldws 0(0,%r28),%fr8R
xmpyu %fr8L,%fr8R,%fr8
fstds %fr8,-16(0,%r30)
ldw -16(0,%r30),%r22
ldw -12(0,%r30),%r23
stw %r23,-4(0,%r19)
copy %r22,%r21
ldi 0,%r20
addib,= -1,%r24,L$0049
stw %r21,0(0,%r19)
ldo 16(%r28),%r28
ldo 16(%r25),%r25
ldo 32(%r19),%r19
bl L$0042,0
ldo 32(%r26),%r26
L$0049
bv,n 0(%r2)
.EXIT
.PROCEND
.IMPORT BN_num_bits_word,CODE
.IMPORT fprintf,CODE
.IMPORT __iob,DATA
.SPACE $TEXT$
.SUBSPA $LIT$
.align 4
L$C0000
.STRING "Division would overflow (%d)\x0a\x00"
.IMPORT abort,CODE
.SPACE $TEXT$
.SUBSPA $CODE$
.align 4
.EXPORT bn_div64,ENTRY,PRIV_LEV=3,ARGW0=GR,ARGW1=GR,ARGW2=GR,RTNVAL=GR
bn_div64
.PROC
.CALLINFO FRAME=128,CALLS,SAVE_RP,ENTRY_GR=8
.ENTRY
stw %r2,-20(0,%r30)
stwm %r8,128(0,%r30)
stw %r7,-124(0,%r30)
stw %r4,-112(0,%r30)
stw %r3,-108(0,%r30)
copy %r26,%r3
copy %r25,%r4
stw %r6,-120(0,%r30)
ldi 0,%r7
stw %r5,-116(0,%r30)
movb,<> %r24,%r5,L$0051
ldi 2,%r6
bl L$0068,0
ldi -1,%r28
L$0051
.CALL ARGW0=GR
bl BN_num_bits_word,%r2
copy %r5,%r26
copy %r28,%r24
ldi 32,%r19
comb,= %r19,%r24,L$0052
subi 31,%r24,%r19
mtsar %r19
zvdepi 1,32,%r19
comb,>>= %r19,%r3,L$0052
addil LR'__iob-$global$+32,%r27
ldo RR'__iob-$global$+32(%r1),%r26
ldil LR'L$C0000,%r25
.CALL ARGW0=GR,ARGW1=GR,ARGW2=GR
bl fprintf,%r2
ldo RR'L$C0000(%r25),%r25
.CALL
bl abort,%r2
nop
L$0052
comb,>> %r5,%r3,L$0053
subi 32,%r24,%r24
sub %r3,%r5,%r3
L$0053
comib,= 0,%r24,L$0054
subi 31,%r24,%r19
mtsar %r19
zvdep %r5,32,%r5
zvdep %r3,32,%r21
subi 32,%r24,%r20
mtsar %r20
vshd 0,%r4,%r20
or %r21,%r20,%r3
mtsar %r19
zvdep %r4,32,%r4
L$0054
extru %r5,15,16,%r23
extru %r5,31,16,%r28
L$0055
extru %r3,15,16,%r19
comb,<> %r23,%r19,L$0058
copy %r3,%r26
bl L$0059,0
zdepi -1,31,16,%r29
L$0058
.IMPORT $$divU,MILLICODE
bl $$divU,%r31
copy %r23,%r25
L$0059
stw %r29,-16(0,%r30)
fldws -16(0,%r30),%fr10L
stw %r28,-16(0,%r30)
fldws -16(0,%r30),%fr10R
stw %r23,-16(0,%r30)
xmpyu %fr10L,%fr10R,%fr8
fldws -16(0,%r30),%fr10R
fstws %fr8R,-16(0,%r30)
xmpyu %fr10L,%fr10R,%fr9
ldw -16(0,%r30),%r8
fstws %fr9R,-16(0,%r30)
copy %r8,%r22
ldw -16(0,%r30),%r8
extru %r4,15,16,%r24
copy %r8,%r21
L$0060
sub %r3,%r21,%r20
copy %r20,%r19
depi 0,31,16,%r19
comib,<> 0,%r19,L$0061
zdep %r20,15,16,%r19
addl %r19,%r24,%r19
comb,>>= %r19,%r22,L$0061
sub %r22,%r28,%r22
sub %r21,%r23,%r21
bl L$0060,0
ldo -1(%r29),%r29
L$0061
stw %r29,-16(0,%r30)
fldws -16(0,%r30),%fr10L
stw %r28,-16(0,%r30)
fldws -16(0,%r30),%fr10R
xmpyu %fr10L,%fr10R,%fr8
fstws %fr8R,-16(0,%r30)
ldw -16(0,%r30),%r8
stw %r23,-16(0,%r30)
fldws -16(0,%r30),%fr10R
copy %r8,%r19
xmpyu %fr10L,%fr10R,%fr8
fstws %fr8R,-16(0,%r30)
extru %r19,15,16,%r20
ldw -16(0,%r30),%r8
zdep %r19,15,16,%r19
addl %r8,%r20,%r20
comclr,<<= %r19,%r4,0
addi 1,%r20,%r20
comb,<<= %r20,%r3,L$0066
sub %r4,%r19,%r4
addl %r3,%r5,%r3
ldo -1(%r29),%r29
L$0066
addib,= -1,%r6,L$0056
sub %r3,%r20,%r3
zdep %r29,15,16,%r7
shd %r3,%r4,16,%r3
bl L$0055,0
zdep %r4,15,16,%r4
L$0056
or %r7,%r29,%r28
L$0068
ldw -148(0,%r30),%r2
ldw -124(0,%r30),%r7
ldw -120(0,%r30),%r6
ldw -116(0,%r30),%r5
ldw -112(0,%r30),%r4
ldw -108(0,%r30),%r3
bv 0(%r2)
ldwm -128(0,%r30),%r8
.EXIT
.PROCEND
|