Remove old versions of OpenSSL.
[dragonfly.git] / crypto / openssl-0.9 / crypto / bn / asm / x86 / sqr.pl
blob1f90993cf68993e11cf05edfc6562ab6a092279b
1 #!/usr/local/bin/perl
2 # x86 assember
4 sub bn_sqr_words
6 local($name)=@_;
8 &function_begin($name,"");
10 &comment("");
11 $r="esi";
12 $a="edi";
13 $num="ebx";
15 &mov($r,&wparam(0)); #
16 &mov($a,&wparam(1)); #
17 &mov($num,&wparam(2)); #
19 &and($num,0xfffffff8); # num / 8
20 &jz(&label("sw_finish"));
22 &set_label("sw_loop",0);
23 for ($i=0; $i<32; $i+=4)
25 &comment("Round $i");
26 &mov("eax",&DWP($i,$a,"",0)); # *a
27 # XXX
28 &mul("eax"); # *a * *a
29 &mov(&DWP($i*2,$r,"",0),"eax"); #
30 &mov(&DWP($i*2+4,$r,"",0),"edx");#
33 &comment("");
34 &add($a,32);
35 &add($r,64);
36 &sub($num,8);
37 &jnz(&label("sw_loop"));
39 &set_label("sw_finish",0);
40 &mov($num,&wparam(2)); # get num
41 &and($num,7);
42 &jz(&label("sw_end"));
44 for ($i=0; $i<7; $i++)
46 &comment("Tail Round $i");
47 &mov("eax",&DWP($i*4,$a,"",0)); # *a
48 # XXX
49 &mul("eax"); # *a * *a
50 &mov(&DWP($i*8,$r,"",0),"eax"); #
51 &dec($num) if ($i != 7-1);
52 &mov(&DWP($i*8+4,$r,"",0),"edx");
53 &jz(&label("sw_end")) if ($i != 7-1);
55 &set_label("sw_end",0);
57 &function_end($name);