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;
147 #if defined(__SUNPRO_C) && defined(__sparcv9)
148 /* They've said -xarch=v9 at command line */
149 .register %g2,#scratch
150 .register %g3,#scratch
151 # define FRAME_SIZE -192
152 #elif defined(__GNUC__) && defined(__arch64__)
153 /* They've said -m64 at command line */
154 .register %g2,#scratch
155 .register %g3,#scratch
156 # define FRAME_SIZE -192
158 # define FRAME_SIZE -96
161 * GNU assembler can't stand stuw:-(
165 .section ".text",#alloc,#execinstr
166 .file "bn_asm.sparc.v8plus.S"
170 .global bn_mul_add_words
172 * BN_ULONG bn_mul_add_words(rp,ap,num,w)
178 sra %o2,%g0,%o2 ! signx %o2
179 brgz,a %o2,.L_bn_mul_add_words_proceed
187 .L_bn_mul_add_words_proceed:
188 srl %o3,%g0,%o3 ! clruw %o3
190 bz,pn %icc,.L_bn_mul_add_words_tail
193 .L_bn_mul_add_words_loop: ! wow! 32 aligned!
229 bnz,a,pt %icc,.L_bn_mul_add_words_loop
232 brnz,a,pn %o2,.L_bn_mul_add_words_tail
234 .L_bn_mul_add_words_return:
238 .L_bn_mul_add_words_tail:
245 brz,pt %o2,.L_bn_mul_add_words_return
255 brz,pt %o2,.L_bn_mul_add_words_return
267 .type bn_mul_add_words,#function
268 .size bn_mul_add_words,(.-bn_mul_add_words)
274 * BN_ULONG bn_mul_words(rp,ap,num,w)
280 sra %o2,%g0,%o2 ! signx %o2
281 brgz,a %o2,.L_bn_mul_words_proceeed
289 .L_bn_mul_words_proceeed:
290 srl %o3,%g0,%o3 ! clruw %o3
292 bz,pn %icc,.L_bn_mul_words_tail
295 .L_bn_mul_words_loop: ! wow! 32 aligned!
323 bnz,a,pt %icc,.L_bn_mul_words_loop
328 brnz,a,pn %o2,.L_bn_mul_words_tail
330 .L_bn_mul_words_return:
334 .L_bn_mul_words_tail:
339 brz,pt %o2,.L_bn_mul_words_return
347 brz,pt %o2,.L_bn_mul_words_return
357 .type bn_mul_words,#function
358 .size bn_mul_words,(.-bn_mul_words)
363 * void bn_sqr_words(r,a,n)
368 sra %o2,%g0,%o2 ! signx %o2
369 brgz,a %o2,.L_bn_sqr_words_proceeed
377 .L_bn_sqr_words_proceeed:
380 bz,pn %icc,.L_bn_sqr_words_tail
383 .L_bn_sqr_words_loop: ! wow! 32 aligned!
411 bnz,a,pt %icc,.L_bn_sqr_words_loop
415 brnz,a,pn %o2,.L_bn_sqr_words_tail
417 .L_bn_sqr_words_return:
421 .L_bn_sqr_words_tail:
426 brz,pt %o2,.L_bn_sqr_words_return
434 brz,pt %o2,.L_bn_sqr_words_return
445 .type bn_sqr_words,#function
446 .size bn_sqr_words,(.-bn_sqr_words)
451 * BN_ULONG bn_div_words(h,l,d)
459 srl %o0,%g0,%o0 ! clruw %o0
461 .type bn_div_words,#function
462 .size bn_div_words,(.-bn_div_words)
468 * BN_ULONG bn_add_words(rp,ap,bp,n)
469 * BN_ULONG *rp,*ap,*bp;
473 sra %o3,%g0,%o3 ! signx %o3
474 brgz,a %o3,.L_bn_add_words_proceed
479 .L_bn_add_words_proceed:
481 bz,pn %icc,.L_bn_add_words_tail
482 addcc %g0,0,%g0 ! clear carry flag
484 .L_bn_add_words_loop: ! wow! 32 aligned!
508 brnz,a,pt %g1,.L_bn_add_words_loop
511 brnz,a,pn %o3,.L_bn_add_words_tail
513 .L_bn_add_words_return:
519 .L_bn_add_words_tail:
523 brz,pt %o3,.L_bn_add_words_return
530 brz,pt %o3,.L_bn_add_words_return
541 .type bn_add_words,#function
542 .size bn_add_words,(.-bn_add_words)
546 * BN_ULONG bn_sub_words(rp,ap,bp,n)
547 * BN_ULONG *rp,*ap,*bp;
551 sra %o3,%g0,%o3 ! signx %o3
552 brgz,a %o3,.L_bn_sub_words_proceed
557 .L_bn_sub_words_proceed:
559 bz,pn %icc,.L_bn_sub_words_tail
560 addcc %g0,0,%g0 ! clear carry flag
562 .L_bn_sub_words_loop: ! wow! 32 aligned!
586 brnz,a,pt %g1,.L_bn_sub_words_loop
589 brnz,a,pn %o3,.L_bn_sub_words_tail
591 .L_bn_sub_words_return:
597 .L_bn_sub_words_tail: ! wow! 32 aligned!
601 brz,pt %o3,.L_bn_sub_words_return
608 brz,pt %o3,.L_bn_sub_words_return
619 .type bn_sub_words,#function
620 .size bn_sub_words,(.-bn_sub_words)
623 * Code below depends on the fact that upper parts of the %l0-%l7
624 * and %i0-%i7 are zeroed by kernel after context switch. In
625 * previous versions this comment stated that "the trouble is that
626 * it's not feasible to implement the mumbo-jumbo in less V9
627 * instructions:-(" which apparently isn't true thanks to
628 * 'bcs,a %xcc,.+8; inc %rd' pair. But the performance improvement
629 * results not from the shorter code, but from elimination of
630 * multicycle none-pairable 'rd %y,%rd' instructions.
636 * Here is register usage map for *all* routines below.
643 #define ap(I) [%i1+4*I]
644 #define bp(I) [%i2+4*I]
645 #define rp(I) [%i0+4*I]
666 .global bn_mul_comba8
668 * void bn_mul_comba8(r,a,b)
672 save %sp,FRAME_SIZE,%sp
678 mulx a_0,b_0,t_1 !mul_add_c(a[0],b[0],c1,c2,c3);
680 stuw t_1,rp(0) !=!r[0]=c1;
683 mulx a_0,b_1,t_1 !mul_add_c(a[0],b[1],c2,c3,c1);
689 mulx a_1,b_0,t_1 !=!mul_add_c(a[1],b[0],c2,c3,c1);
694 stuw t_1,rp(1) !r[1]=c2;
697 mulx a_2,b_0,t_1 !mul_add_c(a[2],b[0],c3,c1,c2);
698 addcc c_12,t_1,c_12 !=
703 mulx a_1,b_1,t_1 !mul_add_c(a[1],b[1],c3,c1,c2);
708 mulx a_0,b_2,t_1 !mul_add_c(a[0],b[2],c3,c1,c2);
713 stuw t_1,rp(2) !r[2]=c3;
716 mulx a_0,b_3,t_1 !mul_add_c(a[0],b[3],c1,c2,c3);
721 mulx a_1,b_2,t_1 !=!mul_add_c(a[1],b[2],c1,c2,c3);
726 mulx a_2,b_1,t_1 !mul_add_c(a[2],b[1],c1,c2,c3);
727 addcc c_12,t_1,c_12 !=
731 mulx a_3,b_0,t_1 !=!mul_add_c(a[3],b[0],c1,c2,c3);!=
736 stuw t_1,rp(3) !r[3]=c1;
739 mulx a_4,b_0,t_1 !mul_add_c(a[4],b[0],c2,c3,c1);
740 addcc c_12,t_1,c_12 !=
744 mulx a_3,b_1,t_1 !=!mul_add_c(a[3],b[1],c2,c3,c1);
748 mulx a_2,b_2,t_1 !=!mul_add_c(a[2],b[2],c2,c3,c1);
753 mulx a_1,b_3,t_1 !mul_add_c(a[1],b[3],c2,c3,c1);
758 mulx a_0,b_4,t_1 !mul_add_c(a[0],b[4],c2,c3,c1);
763 stuw t_1,rp(4) !r[4]=c2;
766 mulx a_0,b_5,t_1 !mul_add_c(a[0],b[5],c3,c1,c2);
771 mulx a_1,b_4,t_1 !mul_add_c(a[1],b[4],c3,c1,c2);
775 mulx a_2,b_3,t_1 !mul_add_c(a[2],b[3],c3,c1,c2);
779 mulx a_3,b_2,t_1 !mul_add_c(a[3],b[2],c3,c1,c2);
784 mulx a_4,b_1,t_1 !mul_add_c(a[4],b[1],c3,c1,c2);
785 addcc c_12,t_1,c_12 !=
789 mulx a_5,b_0,t_1 !=!mul_add_c(a[5],b[0],c3,c1,c2);
794 stuw t_1,rp(5) !r[5]=c3;
797 mulx a_6,b_0,t_1 !mul_add_c(a[6],b[0],c1,c2,c3);
798 addcc c_12,t_1,c_12 !=
802 mulx a_5,b_1,t_1 !=!mul_add_c(a[5],b[1],c1,c2,c3);
806 mulx a_4,b_2,t_1 !=!mul_add_c(a[4],b[2],c1,c2,c3);
810 mulx a_3,b_3,t_1 !=!mul_add_c(a[3],b[3],c1,c2,c3);
814 mulx a_2,b_4,t_1 !=!mul_add_c(a[2],b[4],c1,c2,c3);
819 mulx a_1,b_5,t_1 !mul_add_c(a[1],b[5],c1,c2,c3);
824 mulx a_0,b_6,t_1 !mul_add_c(a[0],b[6],c1,c2,c3);
829 stuw t_1,rp(6) !r[6]=c1;
832 mulx a_0,b_7,t_1 !mul_add_c(a[0],b[7],c2,c3,c1);
837 mulx a_1,b_6,t_1 !mul_add_c(a[1],b[6],c2,c3,c1);
841 mulx a_2,b_5,t_1 !mul_add_c(a[2],b[5],c2,c3,c1);
845 mulx a_3,b_4,t_1 !mul_add_c(a[3],b[4],c2,c3,c1);
849 mulx a_4,b_3,t_1 !mul_add_c(a[4],b[3],c2,c3,c1);
853 mulx a_5,b_2,t_1 !mul_add_c(a[5],b[2],c2,c3,c1);
858 mulx a_6,b_1,t_1 !=!mul_add_c(a[6],b[1],c2,c3,c1);
862 mulx a_7,b_0,t_1 !=!mul_add_c(a[7],b[0],c2,c3,c1);
867 stuw t_1,rp(7) !r[7]=c2;
870 mulx a_7,b_1,t_1 !=!mul_add_c(a[7],b[1],c3,c1,c2);
875 mulx a_6,b_2,t_1 !mul_add_c(a[6],b[2],c3,c1,c2);
879 mulx a_5,b_3,t_1 !mul_add_c(a[5],b[3],c3,c1,c2);
883 mulx a_4,b_4,t_1 !mul_add_c(a[4],b[4],c3,c1,c2);
887 mulx a_3,b_5,t_1 !mul_add_c(a[3],b[5],c3,c1,c2);
891 mulx a_2,b_6,t_1 !mul_add_c(a[2],b[6],c3,c1,c2);
895 mulx a_1,b_7,t_1 !mul_add_c(a[1],b[7],c3,c1,c2);
900 stuw t_1,rp(8) !r[8]=c3;
903 mulx a_2,b_7,t_1 !=!mul_add_c(a[2],b[7],c1,c2,c3);
908 mulx a_3,b_6,t_1 !mul_add_c(a[3],b[6],c1,c2,c3);
912 mulx a_4,b_5,t_1 !mul_add_c(a[4],b[5],c1,c2,c3);
916 mulx a_5,b_4,t_1 !mul_add_c(a[5],b[4],c1,c2,c3);
920 mulx a_6,b_3,t_1 !mul_add_c(a[6],b[3],c1,c2,c3);
924 mulx a_7,b_2,t_1 !mul_add_c(a[7],b[2],c1,c2,c3);
929 stuw t_1,rp(9) !r[9]=c1;
932 mulx a_7,b_3,t_1 !mul_add_c(a[7],b[3],c2,c3,c1);
937 mulx a_6,b_4,t_1 !mul_add_c(a[6],b[4],c2,c3,c1);
941 mulx a_5,b_5,t_1 !mul_add_c(a[5],b[5],c2,c3,c1);
945 mulx a_4,b_6,t_1 !mul_add_c(a[4],b[6],c2,c3,c1);
949 mulx a_3,b_7,t_1 !mul_add_c(a[3],b[7],c2,c3,c1);
954 stuw t_1,rp(10) !r[10]=c2;
957 mulx a_4,b_7,t_1 !mul_add_c(a[4],b[7],c3,c1,c2);
962 mulx a_5,b_6,t_1 !mul_add_c(a[5],b[6],c3,c1,c2);
966 mulx a_6,b_5,t_1 !mul_add_c(a[6],b[5],c3,c1,c2);
970 mulx a_7,b_4,t_1 !mul_add_c(a[7],b[4],c3,c1,c2);
975 stuw t_1,rp(11) !r[11]=c3;
978 mulx a_7,b_5,t_1 !mul_add_c(a[7],b[5],c1,c2,c3);
983 mulx a_6,b_6,t_1 !mul_add_c(a[6],b[6],c1,c2,c3);
987 mulx a_5,b_7,t_1 !mul_add_c(a[5],b[7],c1,c2,c3);
992 stuw t_1,rp(12) !r[12]=c1;
995 mulx a_6,b_7,t_1 !mul_add_c(a[6],b[7],c2,c3,c1);
1000 mulx a_7,b_6,t_1 !mul_add_c(a[7],b[6],c2,c3,c1);
1005 st t_1,rp(13) !r[13]=c2;
1008 mulx a_7,b_7,t_1 !mul_add_c(a[7],b[7],c3,c1,c2);
1011 stuw t_1,rp(14) !r[14]=c3;
1012 stuw c_12,rp(15) !r[15]=c1;
1015 restore %g0,%g0,%o0 !=
1017 .type bn_mul_comba8,#function
1018 .size bn_mul_comba8,(.-bn_mul_comba8)
1022 .global bn_mul_comba4
1024 * void bn_mul_comba4(r,a,b)
1025 * BN_ULONG *r,*a,*b;
1028 save %sp,FRAME_SIZE,%sp
1034 mulx a_0,b_0,t_1 !mul_add_c(a[0],b[0],c1,c2,c3);
1036 stuw t_1,rp(0) !=!r[0]=c1;
1039 mulx a_0,b_1,t_1 !mul_add_c(a[0],b[1],c2,c3,c1);
1045 mulx a_1,b_0,t_1 !=!mul_add_c(a[1],b[0],c2,c3,c1);
1050 stuw t_1,rp(1) !r[1]=c2;
1053 mulx a_2,b_0,t_1 !mul_add_c(a[2],b[0],c3,c1,c2);
1054 addcc c_12,t_1,c_12 !=
1059 mulx a_1,b_1,t_1 !mul_add_c(a[1],b[1],c3,c1,c2);
1064 mulx a_0,b_2,t_1 !mul_add_c(a[0],b[2],c3,c1,c2);
1069 stuw t_1,rp(2) !r[2]=c3;
1072 mulx a_0,b_3,t_1 !mul_add_c(a[0],b[3],c1,c2,c3);
1077 mulx a_1,b_2,t_1 !mul_add_c(a[1],b[2],c1,c2,c3);
1082 mulx a_2,b_1,t_1 !mul_add_c(a[2],b[1],c1,c2,c3);
1083 addcc c_12,t_1,c_12 !=
1086 mulx a_3,b_0,t_1 !mul_add_c(a[3],b[0],c1,c2,c3);!=
1087 addcc c_12,t_1,t_1 !=
1091 stuw t_1,rp(3) !=!r[3]=c1;
1094 mulx a_3,b_1,t_1 !mul_add_c(a[3],b[1],c2,c3,c1);
1099 mulx a_2,b_2,t_1 !mul_add_c(a[2],b[2],c2,c3,c1);
1100 addcc c_12,t_1,c_12 !=
1103 mulx a_1,b_3,t_1 !mul_add_c(a[1],b[3],c2,c3,c1);
1104 addcc c_12,t_1,t_1 !=
1108 stuw t_1,rp(4) !=!r[4]=c2;
1111 mulx a_2,b_3,t_1 !mul_add_c(a[2],b[3],c3,c1,c2);
1116 mulx a_3,b_2,t_1 !mul_add_c(a[3],b[2],c3,c1,c2);
1117 addcc c_12,t_1,t_1 !=
1121 stuw t_1,rp(5) !=!r[5]=c3;
1124 mulx a_3,b_3,t_1 !mul_add_c(a[3],b[3],c1,c2,c3);
1127 stuw t_1,rp(6) !r[6]=c1;
1128 stuw c_12,rp(7) !r[7]=c2;
1133 .type bn_mul_comba4,#function
1134 .size bn_mul_comba4,(.-bn_mul_comba4)
1138 .global bn_sqr_comba8
1140 save %sp,FRAME_SIZE,%sp
1145 mulx a_0,a_0,t_1 !sqr_add_c(a,0,c1,c2,c3);
1147 stuw t_1,rp(0) !r[0]=c1;
1150 mulx a_0,a_1,t_1 !=!sqr_add_c2(a,1,0,c2,c3,c1);
1159 stuw t_1,rp(1) !r[1]=c2;
1162 mulx a_2,a_0,t_1 !sqr_add_c2(a,2,0,c3,c1,c2);
1171 mulx a_1,a_1,t_1 !sqr_add_c(a,1,c3,c1,c2);
1176 stuw t_1,rp(2) !r[2]=c3;
1179 mulx a_0,a_3,t_1 !sqr_add_c2(a,3,0,c1,c2,c3);
1188 mulx a_1,a_2,t_1 !sqr_add_c2(a,2,1,c1,c2,c3);
1196 st t_1,rp(3) !r[3]=c1;
1199 mulx a_4,a_0,t_1 !sqr_add_c2(a,4,0,c2,c3,c1);
1207 mulx a_3,a_1,t_1 !sqr_add_c2(a,3,1,c2,c3,c1);
1215 mulx a_2,a_2,t_1 !sqr_add_c(a,2,c2,c3,c1);
1220 stuw t_1,rp(4) !r[4]=c2;
1223 mulx a_0,a_5,t_1 !sqr_add_c2(a,5,0,c3,c1,c2);
1231 mulx a_1,a_4,t_1 !sqr_add_c2(a,4,1,c3,c1,c2);
1239 mulx a_2,a_3,t_1 !sqr_add_c2(a,3,2,c3,c1,c2);
1247 stuw t_1,rp(5) !r[5]=c3;
1250 mulx a_6,a_0,t_1 !sqr_add_c2(a,6,0,c1,c2,c3);
1258 mulx a_5,a_1,t_1 !sqr_add_c2(a,5,1,c1,c2,c3);
1265 mulx a_4,a_2,t_1 !sqr_add_c2(a,4,2,c1,c2,c3);
1273 mulx a_3,a_3,t_1 !=!sqr_add_c(a,3,c1,c2,c3);
1278 stuw t_1,rp(6) !r[6]=c1;
1281 mulx a_0,a_7,t_1 !sqr_add_c2(a,7,0,c2,c3,c1);
1289 mulx a_1,a_6,t_1 !sqr_add_c2(a,6,1,c2,c3,c1);
1296 mulx a_2,a_5,t_1 !sqr_add_c2(a,5,2,c2,c3,c1);
1303 mulx a_3,a_4,t_1 !sqr_add_c2(a,4,3,c2,c3,c1);
1311 stuw t_1,rp(7) !r[7]=c2;
1314 mulx a_7,a_1,t_1 !sqr_add_c2(a,7,1,c3,c1,c2);
1322 mulx a_6,a_2,t_1 !sqr_add_c2(a,6,2,c3,c1,c2);
1329 mulx a_5,a_3,t_1 !sqr_add_c2(a,5,3,c3,c1,c2);
1336 mulx a_4,a_4,t_1 !sqr_add_c(a,4,c3,c1,c2);
1341 stuw t_1,rp(8) !r[8]=c3;
1344 mulx a_2,a_7,t_1 !sqr_add_c2(a,7,2,c1,c2,c3);
1352 mulx a_3,a_6,t_1 !sqr_add_c2(a,6,3,c1,c2,c3);
1359 mulx a_4,a_5,t_1 !sqr_add_c2(a,5,4,c1,c2,c3);
1367 stuw t_1,rp(9) !r[9]=c1;
1370 mulx a_7,a_3,t_1 !sqr_add_c2(a,7,3,c2,c3,c1);
1378 mulx a_6,a_4,t_1 !sqr_add_c2(a,6,4,c2,c3,c1);
1385 mulx a_5,a_5,t_1 !sqr_add_c(a,5,c2,c3,c1);
1390 stuw t_1,rp(10) !r[10]=c2;
1393 mulx a_4,a_7,t_1 !sqr_add_c2(a,7,4,c3,c1,c2);
1401 mulx a_5,a_6,t_1 !sqr_add_c2(a,6,5,c3,c1,c2);
1409 stuw t_1,rp(11) !r[11]=c3;
1412 mulx a_7,a_5,t_1 !sqr_add_c2(a,7,5,c1,c2,c3);
1420 mulx a_6,a_6,t_1 !sqr_add_c(a,6,c1,c2,c3);
1425 stuw t_1,rp(12) !r[12]=c1;
1428 mulx a_6,a_7,t_1 !sqr_add_c2(a,7,6,c2,c3,c1);
1437 stuw t_1,rp(13) !r[13]=c2;
1440 mulx a_7,a_7,t_1 !sqr_add_c(a,7,c3,c1,c2);
1443 stuw t_1,rp(14) !r[14]=c3;
1444 stuw c_12,rp(15) !r[15]=c1;
1449 .type bn_sqr_comba8,#function
1450 .size bn_sqr_comba8,(.-bn_sqr_comba8)
1454 .global bn_sqr_comba4
1456 * void bn_sqr_comba4(r,a)
1460 save %sp,FRAME_SIZE,%sp
1465 mulx a_0,a_0,t_1 !sqr_add_c(a,0,c1,c2,c3);
1467 stuw t_1,rp(0) !r[0]=c1;
1470 mulx a_0,a_1,t_1 !sqr_add_c2(a,1,0,c2,c3,c1);
1479 stuw t_1,rp(1) !r[1]=c2;
1482 mulx a_2,a_0,t_1 !sqr_add_c2(a,2,0,c3,c1,c2);
1491 mulx a_1,a_1,t_1 !sqr_add_c(a,1,c3,c1,c2);
1496 stuw t_1,rp(2) !r[2]=c3;
1499 mulx a_0,a_3,t_1 !sqr_add_c2(a,3,0,c1,c2,c3);
1507 mulx a_1,a_2,t_1 !sqr_add_c2(a,2,1,c1,c2,c3);
1515 stuw t_1,rp(3) !r[3]=c1;
1518 mulx a_3,a_1,t_1 !sqr_add_c2(a,3,1,c2,c3,c1);
1526 mulx a_2,a_2,t_1 !sqr_add_c(a,2,c2,c3,c1);
1531 stuw t_1,rp(4) !r[4]=c2;
1534 mulx a_2,a_3,t_1 !sqr_add_c2(a,3,2,c3,c1,c2);
1543 stuw t_1,rp(5) !r[5]=c3;
1546 mulx a_3,a_3,t_1 !sqr_add_c(a,3,c1,c2,c3);
1549 stuw t_1,rp(6) !r[6]=c1;
1550 stuw c_12,rp(7) !r[7]=c2;
1555 .type bn_sqr_comba4,#function
1556 .size bn_sqr_comba4,(.-bn_sqr_comba4)