2
# I have this in perl so I can use more usefull register names and then convert
3
# them into alpha registers.
6
push(@INC,"perlasm","../../perlasm");
9
&asm_init($ARGV[0],$0);
11
print &bn_sub_words("bn_sub_words");
21
$a0="r1"; $b0="r5"; $r0="r9"; $tmp="r13";
22
$a1="r2"; $b1="r6"; $r1="r10"; $t1="r14";
23
$a2="r3"; $b2="r7"; $r2="r11";
24
$a3="r4"; $b3="r8"; $r3="r12"; $t3="r15";
31
&function_begin($name,"");
34
&sub($count,4,$count);
36
&blt($count,&label("finish"));
38
&ld($a0,&QWPw(0,$ap));
39
&ld($b0,&QWPw(0,$bp));
41
##########################################################
44
&ld($a1,&QWPw(1,$ap));
45
&cmpult($a0,$b0,$tmp); # will we borrow?
46
&ld($b1,&QWPw(1,$bp));
47
&sub($a0,$b0,$a0); # do the subtract
48
&ld($a2,&QWPw(2,$ap));
49
&cmpult($a0,$cc,$b0); # will we borrow?
50
&ld($b2,&QWPw(2,$bp));
51
&sub($a0,$cc,$a0); # will we borrow?
52
&ld($a3,&QWPw(3,$ap));
53
&add($b0,$tmp,$cc); # add the borrows
55
&cmpult($a1,$b1,$t1); # will we borrow?
56
&sub($a1,$b1,$a1); # do the subtract
57
&ld($b3,&QWPw(3,$bp));
58
&cmpult($a1,$cc,$b1); # will we borrow?
59
&sub($a1,$cc,$a1); # will we borrow?
60
&add($b1,$t1,$cc); # add the borrows
62
&cmpult($a2,$b2,$tmp); # will we borrow?
63
&sub($a2,$b2,$a2); # do the subtract
64
&st($a0,&QWPw(0,$rp)); # save
65
&cmpult($a2,$cc,$b2); # will we borrow?
66
&sub($a2,$cc,$a2); # will we borrow?
67
&add($b2,$tmp,$cc); # add the borrows
69
&cmpult($a3,$b3,$t3); # will we borrow?
70
&sub($a3,$b3,$a3); # do the subtract
71
&st($a1,&QWPw(1,$rp)); # save
72
&cmpult($a3,$cc,$b3); # will we borrow?
73
&sub($a3,$cc,$a3); # will we borrow?
74
&add($b3,$t3,$cc); # add the borrows
76
&st($a2,&QWPw(2,$rp)); # save
77
&sub($count,4,$count); # count-=4
78
&st($a3,&QWPw(3,$rp)); # save
79
&add($ap,4*$QWS,$ap); # count+=4
80
&add($bp,4*$QWS,$bp); # count+=4
81
&add($rp,4*$QWS,$rp); # count+=4
83
&blt($count,&label("finish"));
84
&ld($a0,&QWPw(0,$ap));
85
&ld($b0,&QWPw(0,$bp));
87
##################################################
88
# Do the last 0..3 words
90
&set_label("last_loop");
92
&ld($a0,&QWPw(0,$ap)); # get a
93
&ld($b0,&QWPw(0,$bp)); # get b
94
&cmpult($a0,$b0,$tmp); # will we borrow?
95
&sub($a0,$b0,$a0); # do the subtract
96
&cmpult($a0,$cc,$b0); # will we borrow?
97
&sub($a0,$cc,$a0); # will we borrow?
98
&st($a0,&QWPw(0,$rp)); # save
99
&add($b0,$tmp,$cc); # add the borrows
104
&sub($count,1,$count);
105
&bgt($count,&label("last_loop"));
106
&function_end_A($name);
108
######################################################
109
&set_label("finish");
110
&add($count,4,$count);
111
&bgt($count,&label("last_loop"));
114
&function_end($name);