diff options
Diffstat (limited to 'src/lib/libcrypto/rc4/asm/rc4-s390x.pl')
-rw-r--r-- | src/lib/libcrypto/rc4/asm/rc4-s390x.pl | 47 |
1 files changed, 38 insertions, 9 deletions
diff --git a/src/lib/libcrypto/rc4/asm/rc4-s390x.pl b/src/lib/libcrypto/rc4/asm/rc4-s390x.pl index 96681fa05e..7528ece13c 100644 --- a/src/lib/libcrypto/rc4/asm/rc4-s390x.pl +++ b/src/lib/libcrypto/rc4/asm/rc4-s390x.pl | |||
@@ -13,6 +13,29 @@ | |||
13 | # "cluster" Address Generation Interlocks, so that one pipeline stall | 13 | # "cluster" Address Generation Interlocks, so that one pipeline stall |
14 | # resolves several dependencies. | 14 | # resolves several dependencies. |
15 | 15 | ||
16 | # November 2010. | ||
17 | # | ||
18 | # Adapt for -m31 build. If kernel supports what's called "highgprs" | ||
19 | # feature on Linux [see /proc/cpuinfo], it's possible to use 64-bit | ||
20 | # instructions and achieve "64-bit" performance even in 31-bit legacy | ||
21 | # application context. The feature is not specific to any particular | ||
22 | # processor, as long as it's "z-CPU". Latter implies that the code | ||
23 | # remains z/Architecture specific. On z990 it was measured to perform | ||
24 | # 50% better than code generated by gcc 4.3. | ||
25 | |||
26 | $flavour = shift; | ||
27 | |||
28 | if ($flavour =~ /3[12]/) { | ||
29 | $SIZE_T=4; | ||
30 | $g=""; | ||
31 | } else { | ||
32 | $SIZE_T=8; | ||
33 | $g="g"; | ||
34 | } | ||
35 | |||
36 | while (($output=shift) && ($output!~/^\w[\w\-]*\.\w+$/)) {} | ||
37 | open STDOUT,">$output"; | ||
38 | |||
16 | $rp="%r14"; | 39 | $rp="%r14"; |
17 | $sp="%r15"; | 40 | $sp="%r15"; |
18 | $code=<<___; | 41 | $code=<<___; |
@@ -39,7 +62,12 @@ $code.=<<___; | |||
39 | .type RC4,\@function | 62 | .type RC4,\@function |
40 | .align 64 | 63 | .align 64 |
41 | RC4: | 64 | RC4: |
42 | stmg %r6,%r11,48($sp) | 65 | stm${g} %r6,%r11,6*$SIZE_T($sp) |
66 | ___ | ||
67 | $code.=<<___ if ($flavour =~ /3[12]/); | ||
68 | llgfr $len,$len | ||
69 | ___ | ||
70 | $code.=<<___; | ||
43 | llgc $XX[0],0($key) | 71 | llgc $XX[0],0($key) |
44 | llgc $YY,1($key) | 72 | llgc $YY,1($key) |
45 | la $XX[0],1($XX[0]) | 73 | la $XX[0],1($XX[0]) |
@@ -90,7 +118,7 @@ $code.=<<___; | |||
90 | xgr $acc,$TX[1] | 118 | xgr $acc,$TX[1] |
91 | stg $acc,0($out) | 119 | stg $acc,0($out) |
92 | la $out,8($out) | 120 | la $out,8($out) |
93 | brct $cnt,.Loop8 | 121 | brctg $cnt,.Loop8 |
94 | 122 | ||
95 | .Lshort: | 123 | .Lshort: |
96 | lghi $acc,7 | 124 | lghi $acc,7 |
@@ -122,7 +150,7 @@ $code.=<<___; | |||
122 | ahi $XX[0],-1 | 150 | ahi $XX[0],-1 |
123 | stc $XX[0],0($key) | 151 | stc $XX[0],0($key) |
124 | stc $YY,1($key) | 152 | stc $YY,1($key) |
125 | lmg %r6,%r11,48($sp) | 153 | lm${g} %r6,%r11,6*$SIZE_T($sp) |
126 | br $rp | 154 | br $rp |
127 | .size RC4,.-RC4 | 155 | .size RC4,.-RC4 |
128 | .string "RC4 for s390x, CRYPTOGAMS by <appro\@openssl.org>" | 156 | .string "RC4 for s390x, CRYPTOGAMS by <appro\@openssl.org>" |
@@ -143,11 +171,11 @@ $ikey="%r7"; | |||
143 | $iinp="%r8"; | 171 | $iinp="%r8"; |
144 | 172 | ||
145 | $code.=<<___; | 173 | $code.=<<___; |
146 | .globl RC4_set_key | 174 | .globl private_RC4_set_key |
147 | .type RC4_set_key,\@function | 175 | .type private_RC4_set_key,\@function |
148 | .align 64 | 176 | .align 64 |
149 | RC4_set_key: | 177 | private_RC4_set_key: |
150 | stmg %r6,%r8,48($sp) | 178 | stm${g} %r6,%r8,6*$SIZE_T($sp) |
151 | lhi $cnt,256 | 179 | lhi $cnt,256 |
152 | la $idx,0(%r0) | 180 | la $idx,0(%r0) |
153 | sth $idx,0($key) | 181 | sth $idx,0($key) |
@@ -180,9 +208,9 @@ RC4_set_key: | |||
180 | la $iinp,0(%r0) | 208 | la $iinp,0(%r0) |
181 | j .L2ndloop | 209 | j .L2ndloop |
182 | .Ldone: | 210 | .Ldone: |
183 | lmg %r6,%r8,48($sp) | 211 | lm${g} %r6,%r8,6*$SIZE_T($sp) |
184 | br $rp | 212 | br $rp |
185 | .size RC4_set_key,.-RC4_set_key | 213 | .size private_RC4_set_key,.-private_RC4_set_key |
186 | 214 | ||
187 | ___ | 215 | ___ |
188 | } | 216 | } |
@@ -203,3 +231,4 @@ RC4_options: | |||
203 | ___ | 231 | ___ |
204 | 232 | ||
205 | print $code; | 233 | print $code; |
234 | close STDOUT; # force flush | ||