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 brgz,a %o2,.L_bn_mul_add_words_proceed
170 .L_bn_mul_add_words_proceed:
171 srl %o3,%g0,%o3 ! clruw %o3
173 bz,pn %icc,.L_bn_mul_add_words_tail
176 .L_bn_mul_add_words_loop: ! wow! 32 aligned!
212 bnz,a,pt %icc,.L_bn_mul_add_words_loop
215 brnz,a,pn %o2,.L_bn_mul_add_words_tail
217 .L_bn_mul_add_words_return:
221 .L_bn_mul_add_words_tail:
228 brz,pt %o2,.L_bn_mul_add_words_return
238 brz,pt %o2,.L_bn_mul_add_words_return
250 .type bn_mul_add_words,#function
251 .size bn_mul_add_words,(.-bn_mul_add_words)
257 * BN_ULONG bn_mul_words(rp,ap,num,w)
263 brgz,a %o2,.L_bn_mul_words_proceeed
268 .L_bn_mul_words_proceeed:
269 srl %o3,%g0,%o3 ! clruw %o3
271 bz,pn %icc,.L_bn_mul_words_tail
274 .L_bn_mul_words_loop: ! wow! 32 aligned!
302 bnz,a,pt %icc,.L_bn_mul_words_loop
307 brnz,a,pn %o2,.L_bn_mul_words_tail
309 .L_bn_mul_words_return:
313 .L_bn_mul_words_tail:
318 brz,pt %o2,.L_bn_mul_words_return
326 brz,pt %o2,.L_bn_mul_words_return
336 .type bn_mul_words,#function
337 .size bn_mul_words,(.-bn_mul_words)
342 * void bn_sqr_words(r,a,n)
347 brgz,a %o2,.L_bn_sqr_words_proceeed
352 .L_bn_sqr_words_proceeed:
355 bz,pn %icc,.L_bn_sqr_words_tail
358 .L_bn_sqr_words_loop: ! wow! 32 aligned!
386 bnz,a,pt %icc,.L_bn_sqr_words_loop
390 brnz,a,pn %o2,.L_bn_sqr_words_tail
392 .L_bn_sqr_words_return:
396 .L_bn_sqr_words_tail:
401 brz,pt %o2,.L_bn_sqr_words_return
409 brz,pt %o2,.L_bn_sqr_words_return
420 .type bn_sqr_words,#function
421 .size bn_sqr_words,(.-bn_sqr_words)
426 * BN_ULONG bn_div_words(h,l,d)
434 srl %o0,%g0,%o0 ! clruw %o0
436 .type bn_div_words,#function
437 .size bn_div_words,(.-bn_div_words)
443 * BN_ULONG bn_add_words(rp,ap,bp,n)
444 * BN_ULONG *rp,*ap,*bp;
448 brgz,a %o3,.L_bn_add_words_proceed
453 .L_bn_add_words_proceed:
455 bz,pn %icc,.L_bn_add_words_tail
456 addcc %g0,0,%g0 ! clear carry flag
459 .L_bn_add_words_loop: ! wow! 32 aligned!
483 brnz,a,pt %g1,.L_bn_add_words_loop
486 brnz,a,pn %o3,.L_bn_add_words_tail
488 .L_bn_add_words_return:
494 .L_bn_add_words_tail:
498 brz,pt %o3,.L_bn_add_words_return
505 brz,pt %o3,.L_bn_add_words_return
516 .type bn_add_words,#function
517 .size bn_add_words,(.-bn_add_words)
521 * BN_ULONG bn_sub_words(rp,ap,bp,n)
522 * BN_ULONG *rp,*ap,*bp;
526 brgz,a %o3,.L_bn_sub_words_proceed
531 .L_bn_sub_words_proceed:
533 bz,pn %icc,.L_bn_sub_words_tail
534 addcc %g0,0,%g0 ! clear carry flag
537 .L_bn_sub_words_loop: ! wow! 32 aligned!
561 brnz,a,pt %g1,.L_bn_sub_words_loop
564 brnz,a,pn %o3,.L_bn_sub_words_tail
566 .L_bn_sub_words_return:
572 .L_bn_sub_words_tail: ! wow! 32 aligned!
576 brz,pt %o3,.L_bn_sub_words_return
583 brz,pt %o3,.L_bn_sub_words_return
594 .type bn_sub_words,#function
595 .size bn_sub_words,(.-bn_sub_words)
598 * Code below depends on the fact that upper parts of the %l0-%l7
599 * and %i0-%i7 are zeroed by kernel after context switch. In
600 * previous versions this comment stated that "the trouble is that
601 * it's not feasible to implement the mumbo-jumbo in less V9
602 * instructions:-(" which apparently isn't true thanks to
603 * 'bcs,a %xcc,.+8; inc %rd' pair. But the performance improvement
604 * results not from the shorter code, but from elimination of
605 * multicycle none-pairable 'rd %y,%rd' instructions.
610 #define FRAME_SIZE -96
613 * Here is register usage map for *all* routines below.
620 #define ap(I) [%i1+4*I]
621 #define bp(I) [%i2+4*I]
622 #define rp(I) [%i0+4*I]
643 .global bn_mul_comba8
645 * void bn_mul_comba8(r,a,b)
649 save %sp,FRAME_SIZE,%sp
655 mulx a_0,b_0,t_1 !mul_add_c(a[0],b[0],c1,c2,c3);
657 stuw t_1,rp(0) !=!r[0]=c1;
660 mulx a_0,b_1,t_1 !mul_add_c(a[0],b[1],c2,c3,c1);
666 mulx a_1,b_0,t_1 !=!mul_add_c(a[1],b[0],c2,c3,c1);
671 stuw t_1,rp(1) !r[1]=c2;
674 mulx a_2,b_0,t_1 !mul_add_c(a[2],b[0],c3,c1,c2);
675 addcc c_12,t_1,c_12 !=
680 mulx a_1,b_1,t_1 !mul_add_c(a[1],b[1],c3,c1,c2);
685 mulx a_0,b_2,t_1 !mul_add_c(a[0],b[2],c3,c1,c2);
690 stuw t_1,rp(2) !r[2]=c3;
693 mulx a_0,b_3,t_1 !mul_add_c(a[0],b[3],c1,c2,c3);
698 mulx a_1,b_2,t_1 !=!mul_add_c(a[1],b[2],c1,c2,c3);
703 mulx a_2,b_1,t_1 !mul_add_c(a[2],b[1],c1,c2,c3);
704 addcc c_12,t_1,c_12 !=
708 mulx a_3,b_0,t_1 !=!mul_add_c(a[3],b[0],c1,c2,c3);!=
713 stuw t_1,rp(3) !r[3]=c1;
716 mulx a_4,b_0,t_1 !mul_add_c(a[4],b[0],c2,c3,c1);
717 addcc c_12,t_1,c_12 !=
721 mulx a_3,b_1,t_1 !=!mul_add_c(a[3],b[1],c2,c3,c1);
725 mulx a_2,b_2,t_1 !=!mul_add_c(a[2],b[2],c2,c3,c1);
730 mulx a_1,b_3,t_1 !mul_add_c(a[1],b[3],c2,c3,c1);
735 mulx a_0,b_4,t_1 !mul_add_c(a[0],b[4],c2,c3,c1);
740 stuw t_1,rp(4) !r[4]=c2;
743 mulx a_0,b_5,t_1 !mul_add_c(a[0],b[5],c3,c1,c2);
748 mulx a_1,b_4,t_1 !mul_add_c(a[1],b[4],c3,c1,c2);
752 mulx a_2,b_3,t_1 !mul_add_c(a[2],b[3],c3,c1,c2);
756 mulx a_3,b_2,t_1 !mul_add_c(a[3],b[2],c3,c1,c2);
761 mulx a_4,b_1,t_1 !mul_add_c(a[4],b[1],c3,c1,c2);
762 addcc c_12,t_1,c_12 !=
766 mulx a_5,b_0,t_1 !=!mul_add_c(a[5],b[0],c3,c1,c2);
771 stuw t_1,rp(5) !r[5]=c3;
774 mulx a_6,b_0,t_1 !mul_add_c(a[6],b[0],c1,c2,c3);
775 addcc c_12,t_1,c_12 !=
779 mulx a_5,b_1,t_1 !=!mul_add_c(a[5],b[1],c1,c2,c3);
783 mulx a_4,b_2,t_1 !=!mul_add_c(a[4],b[2],c1,c2,c3);
787 mulx a_3,b_3,t_1 !=!mul_add_c(a[3],b[3],c1,c2,c3);
791 mulx a_2,b_4,t_1 !=!mul_add_c(a[2],b[4],c1,c2,c3);
796 mulx a_1,b_5,t_1 !mul_add_c(a[1],b[5],c1,c2,c3);
801 mulx a_0,b_6,t_1 !mul_add_c(a[0],b[6],c1,c2,c3);
806 stuw t_1,rp(6) !r[6]=c1;
809 mulx a_0,b_7,t_1 !mul_add_c(a[0],b[7],c2,c3,c1);
814 mulx a_1,b_6,t_1 !mul_add_c(a[1],b[6],c2,c3,c1);
818 mulx a_2,b_5,t_1 !mul_add_c(a[2],b[5],c2,c3,c1);
822 mulx a_3,b_4,t_1 !mul_add_c(a[3],b[4],c2,c3,c1);
826 mulx a_4,b_3,t_1 !mul_add_c(a[4],b[3],c2,c3,c1);
830 mulx a_5,b_2,t_1 !mul_add_c(a[5],b[2],c2,c3,c1);
835 mulx a_6,b_1,t_1 !=!mul_add_c(a[6],b[1],c2,c3,c1);
839 mulx a_7,b_0,t_1 !=!mul_add_c(a[7],b[0],c2,c3,c1);
844 stuw t_1,rp(7) !r[7]=c2;
847 mulx a_7,b_1,t_1 !=!mul_add_c(a[7],b[1],c3,c1,c2);
852 mulx a_6,b_2,t_1 !mul_add_c(a[6],b[2],c3,c1,c2);
856 mulx a_5,b_3,t_1 !mul_add_c(a[5],b[3],c3,c1,c2);
860 mulx a_4,b_4,t_1 !mul_add_c(a[4],b[4],c3,c1,c2);
864 mulx a_3,b_5,t_1 !mul_add_c(a[3],b[5],c3,c1,c2);
868 mulx a_2,b_6,t_1 !mul_add_c(a[2],b[6],c3,c1,c2);
872 mulx a_1,b_7,t_1 !mul_add_c(a[1],b[7],c3,c1,c2);
877 stuw t_1,rp(8) !r[8]=c3;
880 mulx a_2,b_7,t_1 !=!mul_add_c(a[2],b[7],c1,c2,c3);
885 mulx a_3,b_6,t_1 !mul_add_c(a[3],b[6],c1,c2,c3);
889 mulx a_4,b_5,t_1 !mul_add_c(a[4],b[5],c1,c2,c3);
893 mulx a_5,b_4,t_1 !mul_add_c(a[5],b[4],c1,c2,c3);
897 mulx a_6,b_3,t_1 !mul_add_c(a[6],b[3],c1,c2,c3);
901 mulx a_7,b_2,t_1 !mul_add_c(a[7],b[2],c1,c2,c3);
906 stuw t_1,rp(9) !r[9]=c1;
909 mulx a_7,b_3,t_1 !mul_add_c(a[7],b[3],c2,c3,c1);
914 mulx a_6,b_4,t_1 !mul_add_c(a[6],b[4],c2,c3,c1);
918 mulx a_5,b_5,t_1 !mul_add_c(a[5],b[5],c2,c3,c1);
922 mulx a_4,b_6,t_1 !mul_add_c(a[4],b[6],c2,c3,c1);
926 mulx a_3,b_7,t_1 !mul_add_c(a[3],b[7],c2,c3,c1);
931 stuw t_1,rp(10) !r[10]=c2;
934 mulx a_4,b_7,t_1 !mul_add_c(a[4],b[7],c3,c1,c2);
939 mulx a_5,b_6,t_1 !mul_add_c(a[5],b[6],c3,c1,c2);
943 mulx a_6,b_5,t_1 !mul_add_c(a[6],b[5],c3,c1,c2);
947 mulx a_7,b_4,t_1 !mul_add_c(a[7],b[4],c3,c1,c2);
952 stuw t_1,rp(11) !r[11]=c3;
955 mulx a_7,b_5,t_1 !mul_add_c(a[7],b[5],c1,c2,c3);
960 mulx a_6,b_6,t_1 !mul_add_c(a[6],b[6],c1,c2,c3);
964 mulx a_5,b_7,t_1 !mul_add_c(a[5],b[7],c1,c2,c3);
969 stuw t_1,rp(12) !r[12]=c1;
972 mulx a_6,b_7,t_1 !mul_add_c(a[6],b[7],c2,c3,c1);
977 mulx a_7,b_6,t_1 !mul_add_c(a[7],b[6],c2,c3,c1);
982 st t_1,rp(13) !r[13]=c2;
985 mulx a_7,b_7,t_1 !mul_add_c(a[7],b[7],c3,c1,c2);
988 stuw t_1,rp(14) !r[14]=c3;
989 stuw c_12,rp(15) !r[15]=c1;
992 restore %g0,%g0,%o0 !=
994 .type bn_mul_comba8,#function
995 .size bn_mul_comba8,(.-bn_mul_comba8)
999 .global bn_mul_comba4
1001 * void bn_mul_comba4(r,a,b)
1002 * BN_ULONG *r,*a,*b;
1005 save %sp,FRAME_SIZE,%sp
1011 mulx a_0,b_0,t_1 !mul_add_c(a[0],b[0],c1,c2,c3);
1013 stuw t_1,rp(0) !=!r[0]=c1;
1016 mulx a_0,b_1,t_1 !mul_add_c(a[0],b[1],c2,c3,c1);
1022 mulx a_1,b_0,t_1 !=!mul_add_c(a[1],b[0],c2,c3,c1);
1027 stuw t_1,rp(1) !r[1]=c2;
1030 mulx a_2,b_0,t_1 !mul_add_c(a[2],b[0],c3,c1,c2);
1031 addcc c_12,t_1,c_12 !=
1036 mulx a_1,b_1,t_1 !mul_add_c(a[1],b[1],c3,c1,c2);
1041 mulx a_0,b_2,t_1 !mul_add_c(a[0],b[2],c3,c1,c2);
1046 stuw t_1,rp(2) !r[2]=c3;
1049 mulx a_0,b_3,t_1 !mul_add_c(a[0],b[3],c1,c2,c3);
1054 mulx a_1,b_2,t_1 !mul_add_c(a[1],b[2],c1,c2,c3);
1059 mulx a_2,b_1,t_1 !mul_add_c(a[2],b[1],c1,c2,c3);
1060 addcc c_12,t_1,c_12 !=
1063 mulx a_3,b_0,t_1 !mul_add_c(a[3],b[0],c1,c2,c3);!=
1064 addcc c_12,t_1,t_1 !=
1068 stuw t_1,rp(3) !=!r[3]=c1;
1071 mulx a_3,b_1,t_1 !mul_add_c(a[3],b[1],c2,c3,c1);
1076 mulx a_2,b_2,t_1 !mul_add_c(a[2],b[2],c2,c3,c1);
1077 addcc c_12,t_1,c_12 !=
1080 mulx a_1,b_3,t_1 !mul_add_c(a[1],b[3],c2,c3,c1);
1081 addcc c_12,t_1,t_1 !=
1085 stuw t_1,rp(4) !=!r[4]=c2;
1088 mulx a_2,b_3,t_1 !mul_add_c(a[2],b[3],c3,c1,c2);
1093 mulx a_3,b_2,t_1 !mul_add_c(a[3],b[2],c3,c1,c2);
1094 addcc c_12,t_1,t_1 !=
1098 stuw t_1,rp(5) !=!r[5]=c3;
1101 mulx a_3,b_3,t_1 !mul_add_c(a[3],b[3],c1,c2,c3);
1104 stuw t_1,rp(6) !r[6]=c1;
1105 stuw c_12,rp(7) !r[7]=c2;
1110 .type bn_mul_comba4,#function
1111 .size bn_mul_comba4,(.-bn_mul_comba4)
1115 .global bn_sqr_comba8
1117 save %sp,FRAME_SIZE,%sp
1122 mulx a_0,a_0,t_1 !sqr_add_c(a,0,c1,c2,c3);
1124 stuw t_1,rp(0) !r[0]=c1;
1127 mulx a_0,a_1,t_1 !=!sqr_add_c2(a,1,0,c2,c3,c1);
1136 stuw t_1,rp(1) !r[1]=c2;
1139 mulx a_2,a_0,t_1 !sqr_add_c2(a,2,0,c3,c1,c2);
1148 mulx a_1,a_1,t_1 !sqr_add_c(a,1,c3,c1,c2);
1153 stuw t_1,rp(2) !r[2]=c3;
1156 mulx a_0,a_3,t_1 !sqr_add_c2(a,3,0,c1,c2,c3);
1165 mulx a_1,a_2,t_1 !sqr_add_c2(a,2,1,c1,c2,c3);
1173 st t_1,rp(3) !r[3]=c1;
1176 mulx a_4,a_0,t_1 !sqr_add_c2(a,4,0,c2,c3,c1);
1184 mulx a_3,a_1,t_1 !sqr_add_c2(a,3,1,c2,c3,c1);
1192 mulx a_2,a_2,t_1 !sqr_add_c(a,2,c2,c3,c1);
1197 stuw t_1,rp(4) !r[4]=c2;
1200 mulx a_0,a_5,t_1 !sqr_add_c2(a,5,0,c3,c1,c2);
1208 mulx a_1,a_4,t_1 !sqr_add_c2(a,4,1,c3,c1,c2);
1216 mulx a_2,a_3,t_1 !sqr_add_c2(a,3,2,c3,c1,c2);
1224 stuw t_1,rp(5) !r[5]=c3;
1227 mulx a_6,a_0,t_1 !sqr_add_c2(a,6,0,c1,c2,c3);
1235 mulx a_5,a_1,t_1 !sqr_add_c2(a,5,1,c1,c2,c3);
1242 mulx a_4,a_2,t_1 !sqr_add_c2(a,4,2,c1,c2,c3);
1250 mulx a_3,a_3,t_1 !=!sqr_add_c(a,3,c1,c2,c3);
1255 stuw t_1,rp(6) !r[6]=c1;
1258 mulx a_0,a_7,t_1 !sqr_add_c2(a,7,0,c2,c3,c1);
1266 mulx a_1,a_6,t_1 !sqr_add_c2(a,6,1,c2,c3,c1);
1273 mulx a_2,a_5,t_1 !sqr_add_c2(a,5,2,c2,c3,c1);
1280 mulx a_3,a_4,t_1 !sqr_add_c2(a,4,3,c2,c3,c1);
1288 stuw t_1,rp(7) !r[7]=c2;
1291 mulx a_7,a_1,t_1 !sqr_add_c2(a,7,1,c3,c1,c2);
1299 mulx a_6,a_2,t_1 !sqr_add_c2(a,6,2,c3,c1,c2);
1306 mulx a_5,a_3,t_1 !sqr_add_c2(a,5,3,c3,c1,c2);
1313 mulx a_4,a_4,t_1 !sqr_add_c(a,4,c3,c1,c2);
1318 stuw t_1,rp(8) !r[8]=c3;
1321 mulx a_2,a_7,t_1 !sqr_add_c2(a,7,2,c1,c2,c3);
1329 mulx a_3,a_6,t_1 !sqr_add_c2(a,6,3,c1,c2,c3);
1336 mulx a_4,a_5,t_1 !sqr_add_c2(a,5,4,c1,c2,c3);
1344 stuw t_1,rp(9) !r[9]=c1;
1347 mulx a_7,a_3,t_1 !sqr_add_c2(a,7,3,c2,c3,c1);
1355 mulx a_6,a_4,t_1 !sqr_add_c2(a,6,4,c2,c3,c1);
1362 mulx a_5,a_5,t_1 !sqr_add_c(a,5,c2,c3,c1);
1367 stuw t_1,rp(10) !r[10]=c2;
1370 mulx a_4,a_7,t_1 !sqr_add_c2(a,7,4,c3,c1,c2);
1378 mulx a_5,a_6,t_1 !sqr_add_c2(a,6,5,c3,c1,c2);
1386 stuw t_1,rp(11) !r[11]=c3;
1389 mulx a_7,a_5,t_1 !sqr_add_c2(a,7,5,c1,c2,c3);
1397 mulx a_6,a_6,t_1 !sqr_add_c(a,6,c1,c2,c3);
1402 stuw t_1,rp(12) !r[12]=c1;
1405 mulx a_6,a_7,t_1 !sqr_add_c2(a,7,6,c2,c3,c1);
1414 stuw t_1,rp(13) !r[13]=c2;
1417 mulx a_7,a_7,t_1 !sqr_add_c(a,7,c3,c1,c2);
1420 stuw t_1,rp(14) !r[14]=c3;
1421 stuw c_12,rp(15) !r[15]=c1;
1426 .type bn_sqr_comba8,#function
1427 .size bn_sqr_comba8,(.-bn_sqr_comba8)
1431 .global bn_sqr_comba4
1433 * void bn_sqr_comba4(r,a)
1437 save %sp,FRAME_SIZE,%sp
1442 mulx a_0,a_0,t_1 !sqr_add_c(a,0,c1,c2,c3);
1444 stuw t_1,rp(0) !r[0]=c1;
1447 mulx a_0,a_1,t_1 !sqr_add_c2(a,1,0,c2,c3,c1);
1456 stuw t_1,rp(1) !r[1]=c2;
1459 mulx a_2,a_0,t_1 !sqr_add_c2(a,2,0,c3,c1,c2);
1468 mulx a_1,a_1,t_1 !sqr_add_c(a,1,c3,c1,c2);
1473 stuw t_1,rp(2) !r[2]=c3;
1476 mulx a_0,a_3,t_1 !sqr_add_c2(a,3,0,c1,c2,c3);
1484 mulx a_1,a_2,t_1 !sqr_add_c2(a,2,1,c1,c2,c3);
1492 stuw t_1,rp(3) !r[3]=c1;
1495 mulx a_3,a_1,t_1 !sqr_add_c2(a,3,1,c2,c3,c1);
1503 mulx a_2,a_2,t_1 !sqr_add_c(a,2,c2,c3,c1);
1508 stuw t_1,rp(4) !r[4]=c2;
1511 mulx a_2,a_3,t_1 !sqr_add_c2(a,3,2,c3,c1,c2);
1520 stuw t_1,rp(5) !r[5]=c3;
1523 mulx a_3,a_3,t_1 !sqr_add_c(a,3,c1,c2,c3);
1526 stuw t_1,rp(6) !r[6]=c1;
1527 stuw c_12,rp(7) !r[7]=c2;
1532 .type bn_sqr_comba4,#function
1533 .size bn_sqr_comba4,(.-bn_sqr_comba4)