diff options
Diffstat (limited to 'src/lib/libcrypto/bn/asm/ppc.pl')
-rw-r--r-- | src/lib/libcrypto/bn/asm/ppc.pl | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/lib/libcrypto/bn/asm/ppc.pl b/src/lib/libcrypto/bn/asm/ppc.pl index 307c7ccb35..08e0053473 100644 --- a/src/lib/libcrypto/bn/asm/ppc.pl +++ b/src/lib/libcrypto/bn/asm/ppc.pl | |||
@@ -116,7 +116,7 @@ if ($opf =~ /32\.s/) { | |||
116 | $UDIV= "divwu"; # unsigned divide | 116 | $UDIV= "divwu"; # unsigned divide |
117 | $UCMPI= "cmplwi"; # unsigned compare with immediate | 117 | $UCMPI= "cmplwi"; # unsigned compare with immediate |
118 | $UCMP= "cmplw"; # unsigned compare | 118 | $UCMP= "cmplw"; # unsigned compare |
119 | $COUNTZ="cntlzw"; # count leading zeros | 119 | $CNTLZ= "cntlzw"; # count leading zeros |
120 | $SHL= "slw"; # shift left | 120 | $SHL= "slw"; # shift left |
121 | $SHR= "srw"; # unsigned shift right | 121 | $SHR= "srw"; # unsigned shift right |
122 | $SHRI= "srwi"; # unsigned shift right by immediate | 122 | $SHRI= "srwi"; # unsigned shift right by immediate |
@@ -124,6 +124,7 @@ if ($opf =~ /32\.s/) { | |||
124 | $CLRU= "clrlwi"; # clear upper bits | 124 | $CLRU= "clrlwi"; # clear upper bits |
125 | $INSR= "insrwi"; # insert right | 125 | $INSR= "insrwi"; # insert right |
126 | $ROTL= "rotlwi"; # rotate left by immediate | 126 | $ROTL= "rotlwi"; # rotate left by immediate |
127 | $TR= "tw"; # conditional trap | ||
127 | } elsif ($opf =~ /64\.s/) { | 128 | } elsif ($opf =~ /64\.s/) { |
128 | $BITS= 64; | 129 | $BITS= 64; |
129 | $BNSZ= $BITS/8; | 130 | $BNSZ= $BITS/8; |
@@ -139,7 +140,7 @@ if ($opf =~ /32\.s/) { | |||
139 | $UDIV= "divdu"; # unsigned divide | 140 | $UDIV= "divdu"; # unsigned divide |
140 | $UCMPI= "cmpldi"; # unsigned compare with immediate | 141 | $UCMPI= "cmpldi"; # unsigned compare with immediate |
141 | $UCMP= "cmpld"; # unsigned compare | 142 | $UCMP= "cmpld"; # unsigned compare |
142 | $COUNTZ="cntlzd"; # count leading zeros | 143 | $CNTLZ= "cntlzd"; # count leading zeros |
143 | $SHL= "sld"; # shift left | 144 | $SHL= "sld"; # shift left |
144 | $SHR= "srd"; # unsigned shift right | 145 | $SHR= "srd"; # unsigned shift right |
145 | $SHRI= "srdi"; # unsigned shift right by immediate | 146 | $SHRI= "srdi"; # unsigned shift right by immediate |
@@ -147,6 +148,7 @@ if ($opf =~ /32\.s/) { | |||
147 | $CLRU= "clrldi"; # clear upper bits | 148 | $CLRU= "clrldi"; # clear upper bits |
148 | $INSR= "insrdi"; # insert right | 149 | $INSR= "insrdi"; # insert right |
149 | $ROTL= "rotldi"; # rotate left by immediate | 150 | $ROTL= "rotldi"; # rotate left by immediate |
151 | $TR= "td"; # conditional trap | ||
150 | } else { die "nonsense $opf"; } | 152 | } else { die "nonsense $opf"; } |
151 | 153 | ||
152 | ( defined shift || open STDOUT,">$opf" ) || die "can't open $opf: $!"; | 154 | ( defined shift || open STDOUT,">$opf" ) || die "can't open $opf: $!"; |
@@ -1710,17 +1712,12 @@ Lppcasm_add_adios: | |||
1710 | bclr BO_ALWAYS,CR0_LT | 1712 | bclr BO_ALWAYS,CR0_LT |
1711 | Lppcasm_div1: | 1713 | Lppcasm_div1: |
1712 | xor r0,r0,r0 #r0=0 | 1714 | xor r0,r0,r0 #r0=0 |
1713 | $COUNTZ r7,r5 #r7 = num leading 0s in d. | 1715 | li r8,$BITS |
1714 | subfic r8,r7,$BITS #r8 = BN_num_bits_word(d) | 1716 | $CNTLZ. r7,r5 #r7 = num leading 0s in d. |
1715 | cmpi 0,0,r8,$BITS # | 1717 | bc BO_IF,CR0_EQ,Lppcasm_div2 #proceed if no leading zeros |
1716 | bc BO_IF,CR0_EQ,Lppcasm_div2 #proceed if (r8==$BITS) | 1718 | subf r8,r7,r8 #r8 = BN_num_bits_word(d) |
1717 | li r9,1 # r9=1 | 1719 | $SHR. r9,r3,r8 #are there any bits above r8'th? |
1718 | $SHL r10,r9,r8 # r9<<=r8 | 1720 | $TR 16,r9,r0 #if there're, signal to dump core... |
1719 | $UCMP 0,r3,r10 # | ||
1720 | bc BO_IF,CR0_GT,Lppcasm_div2 #or if (h > (1<<r8)) | ||
1721 | $UDIV r3,r3,r0 #if not assert(0) divide by 0! | ||
1722 | #that's how we signal overflow | ||
1723 | bclr BO_ALWAYS,CR0_LT #return. NEVER REACHED. | ||
1724 | Lppcasm_div2: | 1721 | Lppcasm_div2: |
1725 | $UCMP 0,r3,r5 #h>=d? | 1722 | $UCMP 0,r3,r5 #h>=d? |
1726 | bc BO_IF,CR0_LT,Lppcasm_div3 #goto Lppcasm_div3 if not | 1723 | bc BO_IF,CR0_LT,Lppcasm_div3 #goto Lppcasm_div3 if not |