1 .ident "sparcv8plus.s, Version 1.4"
2 .ident "SPARC v9 ISA artwork by Andy Polyakov <appro@fy.chalmers.se>"
5 * ====================================================================
6 * Written by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL
9 * Rights for redistribution and usage in source and binary forms are
10 * granted according to the OpenSSL license. Warranty of any kind is
12 * ====================================================================
16 * This is my modest contributon to OpenSSL project (see
17 * http://www.openssl.org/ for more information about it) and is
18 * a drop-in UltraSPARC ISA replacement for crypto/bn/bn_asm.c
19 * module. For updates see http://fy.chalmers.se/~appro/hpe/.
21 * Questions-n-answers.
24 * A. With SC4.x/SC5.x:
26 * cc -xarch=v8plus -c bn_asm.sparc.v8plus.S -o bn_asm.o
30 * gcc -mcpu=ultrasparc -c bn_asm.sparc.v8plus.S -o bn_asm.o
32 * or if above fails (it does if you have gas installed):
34 * gcc -E bn_asm.sparc.v8plus.S | as -xarch=v8plus /dev/fd/0 -o bn_asm.o
36 * Quick-n-dirty way to fuse the module into the library.
37 * Provided that the library is already configured and built
38 * (in 0.9.2 case with no-asm option):
41 * # cp /some/place/bn_asm.sparc.v8plus.S .
42 * # cc -xarch=v8plus -c bn_asm.sparc.v8plus.S -o bn_asm.o
47 * Quick-n-dirty way to get rid of it:
55 * Q. V8plus achitecture? What kind of beast is that?
56 * A. Well, it's rather a programming model than an architecture...
57 * It's actually v9-compliant, i.e. *any* UltraSPARC, CPU under
58 * special conditions, namely when kernel doesn't preserve upper
59 * 32 bits of otherwise 64-bit registers during a context switch.
61 * Q. Why just UltraSPARC? What about SuperSPARC?
62 * A. Original release did target UltraSPARC only. Now SuperSPARC
63 * version is provided along. Both version share bn_*comba[48]
64 * implementations (see comment later in code for explanation).
65 * But what's so special about this UltraSPARC implementation?
66 * Why didn't I let compiler do the job? Trouble is that most of
67 * available compilers (well, SC5.0 is the only exception) don't
68 * attempt to take advantage of UltraSPARC's 64-bitness under
69 * 32-bit kernels even though it's perfectly possible (see next
72 * Q. 64-bit registers under 32-bit kernels? Didn't you just say it
74 * A. You can't adress *all* registers as 64-bit wide:-( The catch is
75 * that you actually may rely upon %o0-%o5 and %g1-%g4 being fully
76 * preserved if you're in a leaf function, i.e. such never calling
77 * any other functions. All functions in this module are leaf and
78 * 10 registers is a handful. And as a matter of fact none-"comba"
79 * routines don't require even that much and I could even afford to
80 * not allocate own stack frame for 'em:-)
82 * Q. What about 64-bit kernels?
83 * A. What about 'em? Just kidding:-) Pure 64-bit version is currently
84 * under evaluation and development...
86 * Q. What about shared libraries?
87 * A. What about 'em? Kidding again:-) Code does *not* contain any
88 * code position dependencies and it's safe to include it into
89 * shared library as is.
91 * Q. How much faster does it go?
92 * A. Do you have a good benchmark? In either case below is what I
93 * experience with crypto/bn/expspeed.c test program:
95 * v8plus module on U10/300MHz against bn_asm.c compiled with:
97 * cc-5.0 -xarch=v8plus -xO5 -xdepend +7-12%
98 * cc-4.2 -xarch=v8plus -xO5 -xdepend +25-35%
99 * egcs-1.1.2 -mcpu=ultrasparc -O3 +35-45%
101 * v8 module on SS10/60MHz against bn_asm.c compiled with:
103 * cc-5.0 -xarch=v8 -xO5 -xdepend +7-10%
104 * cc-4.2 -xarch=v8 -xO5 -xdepend +10%
105 * egcs-1.1.2 -mv8 -O3 +35-45%
107 * As you can see it's damn hard to beat the new Sun C compiler
108 * and it's in first place GNU C users who will appreciate this
109 * assembler implementation:-)
115 * 1.0 - initial release;
116 * 1.1 - new loop unrolling model(*);
117 * - some more fine tuning;
118 * 1.2 - made gas friendly;
119 * - updates to documentation concerning v9;
120 * - new performance comparison matrix;
121 * 1.3 - fixed problem with /usr/ccs/lib/cpp;
122 * 1.4 - native V9 bn_*_comba[48] implementation (15% more efficient)
123 * resulting in slight overall performance kick;
125 * - support for GNU as added;
127 * (*) Originally unrolled loop looked like this:
129 * op(p+0); if (--n==0) break;
130 * op(p+1); if (--n==0) break;
131 * op(p+2); if (--n==0) break;
132 * op(p+3); if (--n==0) break;
135 * I unroll according to following:
137 * op(p+0); op(p+1); op(p+2); op(p+3);
141 * op(p+0); if (--n==0) return;
142 * op(p+2); if (--n==0) return;
148 * GNU assembler can't stand stuw:-(
152 .section ".text",#alloc,#execinstr
153 .file "bn_asm.sparc.v8plus.S"
157 .global bn_mul_add_words
159 * BN_ULONG bn_mul_add_words(rp,ap,num,w)
165 sra %o2,%g0,%o2 ! signx %o2
166 brgz,a %o2,.L_bn_mul_add_words_proceed
174 .L_bn_mul_add_words_proceed:
175 srl %o3,%g0,%o3 ! clruw %o3
177 bz,pn %icc,.L_bn_mul_add_words_tail
180 .L_bn_mul_add_words_loop: ! wow! 32 aligned!
216 bnz,a,pt %icc,.L_bn_mul_add_words_loop
219 brnz,a,pn %o2,.L_bn_mul_add_words_tail
221 .L_bn_mul_add_words_return:
225 .L_bn_mul_add_words_tail:
232 brz,pt %o2,.L_bn_mul_add_words_return
242 brz,pt %o2,.L_bn_mul_add_words_return
254 .type bn_mul_add_words,#function
255 .size bn_mul_add_words,(.-bn_mul_add_words)
261 * BN_ULONG bn_mul_words(rp,ap,num,w)
267 sra %o2,%g0,%o2 ! signx %o2
268 brgz,a %o2,.L_bn_mul_words_proceeed
276 .L_bn_mul_words_proceeed:
277 srl %o3,%g0,%o3 ! clruw %o3
279 bz,pn %icc,.L_bn_mul_words_tail
282 .L_bn_mul_words_loop: ! wow! 32 aligned!
310 bnz,a,pt %icc,.L_bn_mul_words_loop
315 brnz,a,pn %o2,.L_bn_mul_words_tail
317 .L_bn_mul_words_return:
321 .L_bn_mul_words_tail:
326 brz,pt %o2,.L_bn_mul_words_return
334 brz,pt %o2,.L_bn_mul_words_return
344 .type bn_mul_words,#function
345 .size bn_mul_words,(.-bn_mul_words)
350 * void bn_sqr_words(r,a,n)
355 sra %o2,%g0,%o2 ! signx %o2
356 brgz,a %o2,.L_bn_sqr_words_proceeed
364 .L_bn_sqr_words_proceeed:
367 bz,pn %icc,.L_bn_sqr_words_tail
370 .L_bn_sqr_words_loop: ! wow! 32 aligned!
398 bnz,a,pt %icc,.L_bn_sqr_words_loop
402 brnz,a,pn %o2,.L_bn_sqr_words_tail
404 .L_bn_sqr_words_return:
408 .L_bn_sqr_words_tail:
413 brz,pt %o2,.L_bn_sqr_words_return
421 brz,pt %o2,.L_bn_sqr_words_return
432 .type bn_sqr_words,#function
433 .size bn_sqr_words,(.-bn_sqr_words)
438 * BN_ULONG bn_div_words(h,l,d)
446 srl %o0,%g0,%o0 ! clruw %o0
448 .type bn_div_words,#function
449 .size bn_div_words,(.-bn_div_words)
455 * BN_ULONG bn_add_words(rp,ap,bp,n)
456 * BN_ULONG *rp,*ap,*bp;
460 sra %o3,%g0,%o3 ! signx %o3
461 brgz,a %o3,.L_bn_add_words_proceed
466 .L_bn_add_words_proceed:
468 bz,pn %icc,.L_bn_add_words_tail
469 addcc %g0,0,%g0 ! clear carry flag
471 .L_bn_add_words_loop: ! wow! 32 aligned!
495 brnz,a,pt %g1,.L_bn_add_words_loop
498 brnz,a,pn %o3,.L_bn_add_words_tail
500 .L_bn_add_words_return:
506 .L_bn_add_words_tail:
510 brz,pt %o3,.L_bn_add_words_return
517 brz,pt %o3,.L_bn_add_words_return
528 .type bn_add_words,#function
529 .size bn_add_words,(.-bn_add_words)
533 * BN_ULONG bn_sub_words(rp,ap,bp,n)
534 * BN_ULONG *rp,*ap,*bp;
538 sra %o3,%g0,%o3 ! signx %o3
539 brgz,a %o3,.L_bn_sub_words_proceed
544 .L_bn_sub_words_proceed:
546 bz,pn %icc,.L_bn_sub_words_tail
547 addcc %g0,0,%g0 ! clear carry flag
549 .L_bn_sub_words_loop: ! wow! 32 aligned!
573 brnz,a,pt %g1,.L_bn_sub_words_loop
576 brnz,a,pn %o3,.L_bn_sub_words_tail
578 .L_bn_sub_words_return:
584 .L_bn_sub_words_tail: ! wow! 32 aligned!
588 brz,pt %o3,.L_bn_sub_words_return
595 brz,pt %o3,.L_bn_sub_words_return
606 .type bn_sub_words,#function
607 .size bn_sub_words,(.-bn_sub_words)
610 * Code below depends on the fact that upper parts of the %l0-%l7
611 * and %i0-%i7 are zeroed by kernel after context switch. In
612 * previous versions this comment stated that "the trouble is that
613 * it's not feasible to implement the mumbo-jumbo in less V9
614 * instructions:-(" which apparently isn't true thanks to
615 * 'bcs,a %xcc,.+8; inc %rd' pair. But the performance improvement
616 * results not from the shorter code, but from elimination of
617 * multicycle none-pairable 'rd %y,%rd' instructions.
622 #define FRAME_SIZE -96
625 * Here is register usage map for *all* routines below.
632 #define ap(I) [%i1+4*I]
633 #define bp(I) [%i2+4*I]
634 #define rp(I) [%i0+4*I]
655 .global bn_mul_comba8
657 * void bn_mul_comba8(r,a,b)
661 save %sp,FRAME_SIZE,%sp
667 mulx a_0,b_0,t_1 !mul_add_c(a[0],b[0],c1,c2,c3);
669 stuw t_1,rp(0) !=!r[0]=c1;
672 mulx a_0,b_1,t_1 !mul_add_c(a[0],b[1],c2,c3,c1);
678 mulx a_1,b_0,t_1 !=!mul_add_c(a[1],b[0],c2,c3,c1);
683 stuw t_1,rp(1) !r[1]=c2;
686 mulx a_2,b_0,t_1 !mul_add_c(a[2],b[0],c3,c1,c2);
687 addcc c_12,t_1,c_12 !=
692 mulx a_1,b_1,t_1 !mul_add_c(a[1],b[1],c3,c1,c2);
697 mulx a_0,b_2,t_1 !mul_add_c(a[0],b[2],c3,c1,c2);
702 stuw t_1,rp(2) !r[2]=c3;
705 mulx a_0,b_3,t_1 !mul_add_c(a[0],b[3],c1,c2,c3);
710 mulx a_1,b_2,t_1 !=!mul_add_c(a[1],b[2],c1,c2,c3);
715 mulx a_2,b_1,t_1 !mul_add_c(a[2],b[1],c1,c2,c3);
716 addcc c_12,t_1,c_12 !=
720 mulx a_3,b_0,t_1 !=!mul_add_c(a[3],b[0],c1,c2,c3);!=
725 stuw t_1,rp(3) !r[3]=c1;
728 mulx a_4,b_0,t_1 !mul_add_c(a[4],b[0],c2,c3,c1);
729 addcc c_12,t_1,c_12 !=
733 mulx a_3,b_1,t_1 !=!mul_add_c(a[3],b[1],c2,c3,c1);
737 mulx a_2,b_2,t_1 !=!mul_add_c(a[2],b[2],c2,c3,c1);
742 mulx a_1,b_3,t_1 !mul_add_c(a[1],b[3],c2,c3,c1);
747 mulx a_0,b_4,t_1 !mul_add_c(a[0],b[4],c2,c3,c1);
752 stuw t_1,rp(4) !r[4]=c2;
755 mulx a_0,b_5,t_1 !mul_add_c(a[0],b[5],c3,c1,c2);
760 mulx a_1,b_4,t_1 !mul_add_c(a[1],b[4],c3,c1,c2);
764 mulx a_2,b_3,t_1 !mul_add_c(a[2],b[3],c3,c1,c2);
768 mulx a_3,b_2,t_1 !mul_add_c(a[3],b[2],c3,c1,c2);
773 mulx a_4,b_1,t_1 !mul_add_c(a[4],b[1],c3,c1,c2);
774 addcc c_12,t_1,c_12 !=
778 mulx a_5,b_0,t_1 !=!mul_add_c(a[5],b[0],c3,c1,c2);
783 stuw t_1,rp(5) !r[5]=c3;
786 mulx a_6,b_0,t_1 !mul_add_c(a[6],b[0],c1,c2,c3);
787 addcc c_12,t_1,c_12 !=
791 mulx a_5,b_1,t_1 !=!mul_add_c(a[5],b[1],c1,c2,c3);
795 mulx a_4,b_2,t_1 !=!mul_add_c(a[4],b[2],c1,c2,c3);
799 mulx a_3,b_3,t_1 !=!mul_add_c(a[3],b[3],c1,c2,c3);
803 mulx a_2,b_4,t_1 !=!mul_add_c(a[2],b[4],c1,c2,c3);
808 mulx a_1,b_5,t_1 !mul_add_c(a[1],b[5],c1,c2,c3);
813 mulx a_0,b_6,t_1 !mul_add_c(a[0],b[6],c1,c2,c3);
818 stuw t_1,rp(6) !r[6]=c1;
821 mulx a_0,b_7,t_1 !mul_add_c(a[0],b[7],c2,c3,c1);
826 mulx a_1,b_6,t_1 !mul_add_c(a[1],b[6],c2,c3,c1);
830 mulx a_2,b_5,t_1 !mul_add_c(a[2],b[5],c2,c3,c1);
834 mulx a_3,b_4,t_1 !mul_add_c(a[3],b[4],c2,c3,c1);
838 mulx a_4,b_3,t_1 !mul_add_c(a[4],b[3],c2,c3,c1);
842 mulx a_5,b_2,t_1 !mul_add_c(a[5],b[2],c2,c3,c1);
847 mulx a_6,b_1,t_1 !=!mul_add_c(a[6],b[1],c2,c3,c1);
851 mulx a_7,b_0,t_1 !=!mul_add_c(a[7],b[0],c2,c3,c1);
856 stuw t_1,rp(7) !r[7]=c2;
859 mulx a_7,b_1,t_1 !=!mul_add_c(a[7],b[1],c3,c1,c2);
864 mulx a_6,b_2,t_1 !mul_add_c(a[6],b[2],c3,c1,c2);
868 mulx a_5,b_3,t_1 !mul_add_c(a[5],b[3],c3,c1,c2);
872 mulx a_4,b_4,t_1 !mul_add_c(a[4],b[4],c3,c1,c2);
876 mulx a_3,b_5,t_1 !mul_add_c(a[3],b[5],c3,c1,c2);
880 mulx a_2,b_6,t_1 !mul_add_c(a[2],b[6],c3,c1,c2);
884 mulx a_1,b_7,t_1 !mul_add_c(a[1],b[7],c3,c1,c2);
889 stuw t_1,rp(8) !r[8]=c3;
892 mulx a_2,b_7,t_1 !=!mul_add_c(a[2],b[7],c1,c2,c3);
897 mulx a_3,b_6,t_1 !mul_add_c(a[3],b[6],c1,c2,c3);
901 mulx a_4,b_5,t_1 !mul_add_c(a[4],b[5],c1,c2,c3);
905 mulx a_5,b_4,t_1 !mul_add_c(a[5],b[4],c1,c2,c3);
909 mulx a_6,b_3,t_1 !mul_add_c(a[6],b[3],c1,c2,c3);
913 mulx a_7,b_2,t_1 !mul_add_c(a[7],b[2],c1,c2,c3);
918 stuw t_1,rp(9) !r[9]=c1;
921 mulx a_7,b_3,t_1 !mul_add_c(a[7],b[3],c2,c3,c1);
926 mulx a_6,b_4,t_1 !mul_add_c(a[6],b[4],c2,c3,c1);
930 mulx a_5,b_5,t_1 !mul_add_c(a[5],b[5],c2,c3,c1);
934 mulx a_4,b_6,t_1 !mul_add_c(a[4],b[6],c2,c3,c1);
938 mulx a_3,b_7,t_1 !mul_add_c(a[3],b[7],c2,c3,c1);
943 stuw t_1,rp(10) !r[10]=c2;
946 mulx a_4,b_7,t_1 !mul_add_c(a[4],b[7],c3,c1,c2);
951 mulx a_5,b_6,t_1 !mul_add_c(a[5],b[6],c3,c1,c2);
955 mulx a_6,b_5,t_1 !mul_add_c(a[6],b[5],c3,c1,c2);
959 mulx a_7,b_4,t_1 !mul_add_c(a[7],b[4],c3,c1,c2);
964 stuw t_1,rp(11) !r[11]=c3;
967 mulx a_7,b_5,t_1 !mul_add_c(a[7],b[5],c1,c2,c3);
972 mulx a_6,b_6,t_1 !mul_add_c(a[6],b[6],c1,c2,c3);
976 mulx a_5,b_7,t_1 !mul_add_c(a[5],b[7],c1,c2,c3);
981 stuw t_1,rp(12) !r[12]=c1;
984 mulx a_6,b_7,t_1 !mul_add_c(a[6],b[7],c2,c3,c1);
989 mulx a_7,b_6,t_1 !mul_add_c(a[7],b[6],c2,c3,c1);
994 st t_1,rp(13) !r[13]=c2;
997 mulx a_7,b_7,t_1 !mul_add_c(a[7],b[7],c3,c1,c2);
1000 stuw t_1,rp(14) !r[14]=c3;
1001 stuw c_12,rp(15) !r[15]=c1;
1004 restore %g0,%g0,%o0 !=
1006 .type bn_mul_comba8,#function
1007 .size bn_mul_comba8,(.-bn_mul_comba8)
1011 .global bn_mul_comba4
1013 * void bn_mul_comba4(r,a,b)
1014 * BN_ULONG *r,*a,*b;
1017 save %sp,FRAME_SIZE,%sp
1023 mulx a_0,b_0,t_1 !mul_add_c(a[0],b[0],c1,c2,c3);
1025 stuw t_1,rp(0) !=!r[0]=c1;
1028 mulx a_0,b_1,t_1 !mul_add_c(a[0],b[1],c2,c3,c1);
1034 mulx a_1,b_0,t_1 !=!mul_add_c(a[1],b[0],c2,c3,c1);
1039 stuw t_1,rp(1) !r[1]=c2;
1042 mulx a_2,b_0,t_1 !mul_add_c(a[2],b[0],c3,c1,c2);
1043 addcc c_12,t_1,c_12 !=
1048 mulx a_1,b_1,t_1 !mul_add_c(a[1],b[1],c3,c1,c2);
1053 mulx a_0,b_2,t_1 !mul_add_c(a[0],b[2],c3,c1,c2);
1058 stuw t_1,rp(2) !r[2]=c3;
1061 mulx a_0,b_3,t_1 !mul_add_c(a[0],b[3],c1,c2,c3);
1066 mulx a_1,b_2,t_1 !mul_add_c(a[1],b[2],c1,c2,c3);
1071 mulx a_2,b_1,t_1 !mul_add_c(a[2],b[1],c1,c2,c3);
1072 addcc c_12,t_1,c_12 !=
1075 mulx a_3,b_0,t_1 !mul_add_c(a[3],b[0],c1,c2,c3);!=
1076 addcc c_12,t_1,t_1 !=
1080 stuw t_1,rp(3) !=!r[3]=c1;
1083 mulx a_3,b_1,t_1 !mul_add_c(a[3],b[1],c2,c3,c1);
1088 mulx a_2,b_2,t_1 !mul_add_c(a[2],b[2],c2,c3,c1);
1089 addcc c_12,t_1,c_12 !=
1092 mulx a_1,b_3,t_1 !mul_add_c(a[1],b[3],c2,c3,c1);
1093 addcc c_12,t_1,t_1 !=
1097 stuw t_1,rp(4) !=!r[4]=c2;
1100 mulx a_2,b_3,t_1 !mul_add_c(a[2],b[3],c3,c1,c2);
1105 mulx a_3,b_2,t_1 !mul_add_c(a[3],b[2],c3,c1,c2);
1106 addcc c_12,t_1,t_1 !=
1110 stuw t_1,rp(5) !=!r[5]=c3;
1113 mulx a_3,b_3,t_1 !mul_add_c(a[3],b[3],c1,c2,c3);
1116 stuw t_1,rp(6) !r[6]=c1;
1117 stuw c_12,rp(7) !r[7]=c2;
1122 .type bn_mul_comba4,#function
1123 .size bn_mul_comba4,(.-bn_mul_comba4)
1127 .global bn_sqr_comba8
1129 save %sp,FRAME_SIZE,%sp
1134 mulx a_0,a_0,t_1 !sqr_add_c(a,0,c1,c2,c3);
1136 stuw t_1,rp(0) !r[0]=c1;
1139 mulx a_0,a_1,t_1 !=!sqr_add_c2(a,1,0,c2,c3,c1);
1148 stuw t_1,rp(1) !r[1]=c2;
1151 mulx a_2,a_0,t_1 !sqr_add_c2(a,2,0,c3,c1,c2);
1160 mulx a_1,a_1,t_1 !sqr_add_c(a,1,c3,c1,c2);
1165 stuw t_1,rp(2) !r[2]=c3;
1168 mulx a_0,a_3,t_1 !sqr_add_c2(a,3,0,c1,c2,c3);
1177 mulx a_1,a_2,t_1 !sqr_add_c2(a,2,1,c1,c2,c3);
1185 st t_1,rp(3) !r[3]=c1;
1188 mulx a_4,a_0,t_1 !sqr_add_c2(a,4,0,c2,c3,c1);
1196 mulx a_3,a_1,t_1 !sqr_add_c2(a,3,1,c2,c3,c1);
1204 mulx a_2,a_2,t_1 !sqr_add_c(a,2,c2,c3,c1);
1209 stuw t_1,rp(4) !r[4]=c2;
1212 mulx a_0,a_5,t_1 !sqr_add_c2(a,5,0,c3,c1,c2);
1220 mulx a_1,a_4,t_1 !sqr_add_c2(a,4,1,c3,c1,c2);
1228 mulx a_2,a_3,t_1 !sqr_add_c2(a,3,2,c3,c1,c2);
1236 stuw t_1,rp(5) !r[5]=c3;
1239 mulx a_6,a_0,t_1 !sqr_add_c2(a,6,0,c1,c2,c3);
1247 mulx a_5,a_1,t_1 !sqr_add_c2(a,5,1,c1,c2,c3);
1254 mulx a_4,a_2,t_1 !sqr_add_c2(a,4,2,c1,c2,c3);
1262 mulx a_3,a_3,t_1 !=!sqr_add_c(a,3,c1,c2,c3);
1267 stuw t_1,rp(6) !r[6]=c1;
1270 mulx a_0,a_7,t_1 !sqr_add_c2(a,7,0,c2,c3,c1);
1278 mulx a_1,a_6,t_1 !sqr_add_c2(a,6,1,c2,c3,c1);
1285 mulx a_2,a_5,t_1 !sqr_add_c2(a,5,2,c2,c3,c1);
1292 mulx a_3,a_4,t_1 !sqr_add_c2(a,4,3,c2,c3,c1);
1300 stuw t_1,rp(7) !r[7]=c2;
1303 mulx a_7,a_1,t_1 !sqr_add_c2(a,7,1,c3,c1,c2);
1311 mulx a_6,a_2,t_1 !sqr_add_c2(a,6,2,c3,c1,c2);
1318 mulx a_5,a_3,t_1 !sqr_add_c2(a,5,3,c3,c1,c2);
1325 mulx a_4,a_4,t_1 !sqr_add_c(a,4,c3,c1,c2);
1330 stuw t_1,rp(8) !r[8]=c3;
1333 mulx a_2,a_7,t_1 !sqr_add_c2(a,7,2,c1,c2,c3);
1341 mulx a_3,a_6,t_1 !sqr_add_c2(a,6,3,c1,c2,c3);
1348 mulx a_4,a_5,t_1 !sqr_add_c2(a,5,4,c1,c2,c3);
1356 stuw t_1,rp(9) !r[9]=c1;
1359 mulx a_7,a_3,t_1 !sqr_add_c2(a,7,3,c2,c3,c1);
1367 mulx a_6,a_4,t_1 !sqr_add_c2(a,6,4,c2,c3,c1);
1374 mulx a_5,a_5,t_1 !sqr_add_c(a,5,c2,c3,c1);
1379 stuw t_1,rp(10) !r[10]=c2;
1382 mulx a_4,a_7,t_1 !sqr_add_c2(a,7,4,c3,c1,c2);
1390 mulx a_5,a_6,t_1 !sqr_add_c2(a,6,5,c3,c1,c2);
1398 stuw t_1,rp(11) !r[11]=c3;
1401 mulx a_7,a_5,t_1 !sqr_add_c2(a,7,5,c1,c2,c3);
1409 mulx a_6,a_6,t_1 !sqr_add_c(a,6,c1,c2,c3);
1414 stuw t_1,rp(12) !r[12]=c1;
1417 mulx a_6,a_7,t_1 !sqr_add_c2(a,7,6,c2,c3,c1);
1426 stuw t_1,rp(13) !r[13]=c2;
1429 mulx a_7,a_7,t_1 !sqr_add_c(a,7,c3,c1,c2);
1432 stuw t_1,rp(14) !r[14]=c3;
1433 stuw c_12,rp(15) !r[15]=c1;
1438 .type bn_sqr_comba8,#function
1439 .size bn_sqr_comba8,(.-bn_sqr_comba8)
1443 .global bn_sqr_comba4
1445 * void bn_sqr_comba4(r,a)
1449 save %sp,FRAME_SIZE,%sp
1454 mulx a_0,a_0,t_1 !sqr_add_c(a,0,c1,c2,c3);
1456 stuw t_1,rp(0) !r[0]=c1;
1459 mulx a_0,a_1,t_1 !sqr_add_c2(a,1,0,c2,c3,c1);
1468 stuw t_1,rp(1) !r[1]=c2;
1471 mulx a_2,a_0,t_1 !sqr_add_c2(a,2,0,c3,c1,c2);
1480 mulx a_1,a_1,t_1 !sqr_add_c(a,1,c3,c1,c2);
1485 stuw t_1,rp(2) !r[2]=c3;
1488 mulx a_0,a_3,t_1 !sqr_add_c2(a,3,0,c1,c2,c3);
1496 mulx a_1,a_2,t_1 !sqr_add_c2(a,2,1,c1,c2,c3);
1504 stuw t_1,rp(3) !r[3]=c1;
1507 mulx a_3,a_1,t_1 !sqr_add_c2(a,3,1,c2,c3,c1);
1515 mulx a_2,a_2,t_1 !sqr_add_c(a,2,c2,c3,c1);
1520 stuw t_1,rp(4) !r[4]=c2;
1523 mulx a_2,a_3,t_1 !sqr_add_c2(a,3,2,c3,c1,c2);
1532 stuw t_1,rp(5) !r[5]=c3;
1535 mulx a_3,a_3,t_1 !sqr_add_c(a,3,c1,c2,c3);
1538 stuw t_1,rp(6) !r[6]=c1;
1539 stuw c_12,rp(7) !r[7]=c2;
1544 .type bn_sqr_comba4,#function
1545 .size bn_sqr_comba4,(.-bn_sqr_comba4)