]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Pick up {vex} in x86_64 assembler translator
authorZhiguo Zhou <zhiguo.zhou@intel.com>
Wed, 14 May 2025 12:35:43 +0000 (20:35 +0800)
committerTomas Mraz <tomas@openssl.org>
Mon, 19 May 2025 14:24:42 +0000 (16:24 +0200)
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27632)

crypto/perlasm/x86_64-xlate.pl

index af12a798ca4d99566e8395892eadd86a230f057f..5de98e653937edc57e6d2aef69317f76c5f84103 100755 (executable)
@@ -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";