diff options
Diffstat (limited to 'src/lib/libcrypto/perlasm/x86asm.pl')
| -rw-r--r-- | src/lib/libcrypto/perlasm/x86asm.pl | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/src/lib/libcrypto/perlasm/x86asm.pl b/src/lib/libcrypto/perlasm/x86asm.pl index 4756a28e59..bf783cff26 100644 --- a/src/lib/libcrypto/perlasm/x86asm.pl +++ b/src/lib/libcrypto/perlasm/x86asm.pl | |||
| @@ -87,6 +87,57 @@ sub ::movq | |||
| 87 | { &::generic("movq",@_); } | 87 | { &::generic("movq",@_); } |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | # SSE>2 instructions | ||
| 91 | my %regrm = ( "eax"=>0, "ecx"=>1, "edx"=>2, "ebx"=>3, | ||
| 92 | "esp"=>4, "ebp"=>5, "esi"=>6, "edi"=>7 ); | ||
| 93 | sub ::pextrd | ||
| 94 | { my($dst,$src,$imm)=@_; | ||
| 95 | if ("$dst:$src" =~ /(e[a-dsd][ixp]):xmm([0-7])/) | ||
| 96 | { &::data_byte(0x66,0x0f,0x3a,0x16,0xc0|($2<<3)|$regrm{$1},$imm); } | ||
| 97 | else | ||
| 98 | { &::generic("pextrd",@_); } | ||
| 99 | } | ||
| 100 | |||
| 101 | sub ::pinsrd | ||
| 102 | { my($dst,$src,$imm)=@_; | ||
| 103 | if ("$dst:$src" =~ /xmm([0-7]):(e[a-dsd][ixp])/) | ||
| 104 | { &::data_byte(0x66,0x0f,0x3a,0x22,0xc0|($1<<3)|$regrm{$2},$imm); } | ||
| 105 | else | ||
| 106 | { &::generic("pinsrd",@_); } | ||
| 107 | } | ||
| 108 | |||
| 109 | sub ::pshufb | ||
| 110 | { my($dst,$src)=@_; | ||
| 111 | if ("$dst:$src" =~ /xmm([0-7]):xmm([0-7])/) | ||
| 112 | { &data_byte(0x66,0x0f,0x38,0x00,0xc0|($1<<3)|$2); } | ||
| 113 | else | ||
| 114 | { &::generic("pshufb",@_); } | ||
| 115 | } | ||
| 116 | |||
| 117 | sub ::palignr | ||
| 118 | { my($dst,$src,$imm)=@_; | ||
| 119 | if ("$dst:$src" =~ /xmm([0-7]):xmm([0-7])/) | ||
| 120 | { &::data_byte(0x66,0x0f,0x3a,0x0f,0xc0|($1<<3)|$2,$imm); } | ||
| 121 | else | ||
| 122 | { &::generic("palignr",@_); } | ||
| 123 | } | ||
| 124 | |||
| 125 | sub ::pclmulqdq | ||
| 126 | { my($dst,$src,$imm)=@_; | ||
| 127 | if ("$dst:$src" =~ /xmm([0-7]):xmm([0-7])/) | ||
| 128 | { &::data_byte(0x66,0x0f,0x3a,0x44,0xc0|($1<<3)|$2,$imm); } | ||
| 129 | else | ||
| 130 | { &::generic("pclmulqdq",@_); } | ||
| 131 | } | ||
| 132 | |||
| 133 | sub ::rdrand | ||
| 134 | { my ($dst)=@_; | ||
| 135 | if ($dst =~ /(e[a-dsd][ixp])/) | ||
| 136 | { &::data_byte(0x0f,0xc7,0xf0|$regrm{$dst}); } | ||
| 137 | else | ||
| 138 | { &::generic("rdrand",@_); } | ||
| 139 | } | ||
| 140 | |||
| 90 | # label management | 141 | # label management |
| 91 | $lbdecor="L"; # local label decoration, set by package | 142 | $lbdecor="L"; # local label decoration, set by package |
| 92 | $label="000"; | 143 | $label="000"; |
| @@ -174,7 +225,7 @@ sub ::asm_init | |||
| 174 | $filename=$fn; | 225 | $filename=$fn; |
| 175 | $i386=$cpu; | 226 | $i386=$cpu; |
| 176 | 227 | ||
| 177 | $elf=$cpp=$coff=$aout=$macosx=$win32=$netware=$mwerks=$openbsd=0; | 228 | $elf=$cpp=$coff=$aout=$macosx=$win32=$netware=$mwerks=$openbsd=$android=0; |
| 178 | if (($type eq "elf")) | 229 | if (($type eq "elf")) |
| 179 | { $elf=1; require "x86gas.pl"; } | 230 | { $elf=1; require "x86gas.pl"; } |
| 180 | elsif (($type eq "a\.out")) | 231 | elsif (($type eq "a\.out")) |
| @@ -195,6 +246,8 @@ sub ::asm_init | |||
| 195 | { $openbsd=$elf=1; require "x86gas.pl"; } | 246 | { $openbsd=$elf=1; require "x86gas.pl"; } |
| 196 | elsif (($type eq "openbsd-a.out")) | 247 | elsif (($type eq "openbsd-a.out")) |
| 197 | { $openbsd=1; require "x86gas.pl"; } | 248 | { $openbsd=1; require "x86gas.pl"; } |
| 249 | elsif (($type eq "android")) | ||
| 250 | { $elf=1; $android=1; require "x86gas.pl"; } | ||
| 198 | else | 251 | else |
| 199 | { print STDERR <<"EOF"; | 252 | { print STDERR <<"EOF"; |
| 200 | Pick one target type from | 253 | Pick one target type from |
