From: Zhiguo Zhou Date: Wed, 14 May 2025 12:35:43 +0000 (+0800) Subject: Pick up {vex} in x86_64 assembler translator X-Git-Tag: openssl-3.5.1~98 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1db578fb99a524ef014bd27af034210db1a077b0;p=thirdparty%2Fopenssl.git Pick up {vex} in x86_64 assembler translator Reviewed-by: Saša Nedvědický Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/27632) (cherry picked from commit 4189992f5bd8e38d640ec0cbe602d7dfc8c78a7e) --- diff --git a/crypto/perlasm/x86_64-xlate.pl b/crypto/perlasm/x86_64-xlate.pl index 2cd9a219c23..d677963c617 100755 --- a/crypto/perlasm/x86_64-xlate.pl +++ b/crypto/perlasm/x86_64-xlate.pl @@ -218,6 +218,25 @@ my @segment_stack = (); my $current_function; my %globals; +{ package vex_prefix; # pick up vex prefixes, example: {vex} vpmadd52luq m256, %ymm, %ymm + sub re { + my ($class, $line) = @_; + my $self = {}; + my $ret; + + if ($$line =~ /(^\{vex\})/) { + bless $self,$class; + $self->{value} = $1; + $ret = $self; + $$line = substr($$line,@+[0]); $$line =~ s/^\s+//; + } + $ret; + } + sub out { + my $self = shift; + $self->{value}; + } +} { package opcode; # pick up opcodes sub re { my ($class, $line) = @_; @@ -1396,7 +1415,11 @@ while(defined(my $line=<>)) { if (my $directive=directive->re(\$line)) { printf "%s",$directive->out(); - } elsif (my $opcode=opcode->re(\$line)) { + } else { + if (my $vex_prefix=vex_prefix->re(\$line)) { + printf "%s",$vex_prefix->out(); + } + if (my $opcode=opcode->re(\$line)) { my $asm = eval("\$".$opcode->mnemonic()); if ((ref($asm) eq 'CODE') && scalar(my @bytes=&$asm($line))) { @@ -1446,6 +1469,7 @@ while(defined(my $line=<>)) { } else { printf "\t%s",$opcode->out(); } + } } print $line,"\n";