summaryrefslogtreecommitdiffstats
path: root/crypto/bn/asm/sparcv9-mont.pl
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2007-06-17 17:10:03 +0000
committerAndy Polyakov <appro@openssl.org>2007-06-17 17:10:03 +0000
commit7d9cf7c0bbc17a2c00339e660c83ebf1a4f9061a (patch)
tree004fe317e4795d576c92746d7e954c2db6a5d3af /crypto/bn/asm/sparcv9-mont.pl
parent55525742f4c2bf416013fc3a75ec642775d97f80 (diff)
Eliminate conditional final subtraction in Montgomery assembler modules.
Diffstat (limited to 'crypto/bn/asm/sparcv9-mont.pl')
-rw-r--r--crypto/bn/asm/sparcv9-mont.pl36
1 files changed, 15 insertions, 21 deletions
diff --git a/crypto/bn/asm/sparcv9-mont.pl b/crypto/bn/asm/sparcv9-mont.pl
index acdf6928ca..d78b43209a 100644
--- a/crypto/bn/asm/sparcv9-mont.pl
+++ b/crypto/bn/asm/sparcv9-mont.pl
@@ -2,8 +2,9 @@
# ====================================================================
# Written by Andy Polyakov <appro@fy.chalmers.se> for the OpenSSL
-# project. Rights for redistribution and usage in source and binary
-# forms are granted according to the OpenSSL license.
+# project. The module is, however, dual licensed under OpenSSL and
+# CRYPTOGAMS licenses depending on where you obtain it. For further
+# details see http://www.openssl.org/~appro/cryptogams/.
# ====================================================================
# December 2005
@@ -254,44 +255,36 @@ $fname:
.Ltail:
add $np,$num,$np
add $rp,$num,$rp
-
- cmp $car2,0 ! clears %icc.c
- bne,pn %icc,.Lsub
+ mov $tp,$ap
sub %g0,$num,%o7 ! k=-num
- cmp $car1,$npj ! compare top-most $tp and $np words
- bcs,pt %icc,.Lcopy ! %icc.c is clean if not taken
- nop
+ srl $npj,30,%o0 ! boundary condition...
+ brz,pn %o0,.Lcopy ! ... is met
+ subcc %g0,%g0,%g0 ! clear %icc.c
.align 16,0x1000000
.Lsub:
ld [$tp+%o7],%o0
ld [$np+%o7],%o1
- subccc %o0,%o1,%o1
+ subccc %o0,%o1,%o1 ! tp[j]-np[j]
st %o1,[$rp+%o7]
add %o7,4,%o7
brnz %o7,.Lsub
nop
- subccc $car2,0,$car2
- bcc %icc,.Lzap
+ subc $car2,0,$car2 ! handle upmost overflow bit
+ and $tp,$car2,$ap
+ andn $rp,$car2,$np
+ or $ap,$np,$ap
sub %g0,$num,%o7
.align 16,0x1000000
.Lcopy:
- ld [$tp+%o7],%o0
+ ld [$ap+%o7],%o0 ! copy or in-place refresh
+ st %g0,[$tp+%o7] ! zap tp
st %o0,[$rp+%o7]
add %o7,4,%o7
brnz %o7,.Lcopy
nop
- ba .Lzap
- sub %g0,$num,%o7
-
-.align 32
-.Lzap:
- st %g0,[$tp+%o7]
- add %o7,4,%o7
- brnz %o7,.Lzap
- nop
mov 1,%i0
ret
restore
@@ -609,6 +602,7 @@ $code.=<<___;
add $tp,8,$tp
.type $fname,#function
.size $fname,(.-$fname)
+.asciz "Montgomery Multipltication for SPARCv9, CRYPTOGAMS by <appro\@openssl.org>"
___
$code =~ s/\`([^\`]*)\`/eval($1)/gem;
print $code;