complementary x86_64-xlate.pl update.
authorAndy Polyakov <appro@openssl.org>
Tue, 12 Jul 2005 22:11:22 +0000 (22:11 +0000)
committerAndy Polyakov <appro@openssl.org>
Tue, 12 Jul 2005 22:11:22 +0000 (22:11 +0000)
crypto/perlasm/x86_64-xlate.pl

index ef1a4ce..166dcec 100755 (executable)
@@ -133,6 +133,10 @@ my $current_function;
        my $self = shift;
 
        if (!$masm) {
+           # Solaris /usr/ccs/bin/as can't handle multiplications
+           # in $self->{value}
+           $self->{value} =~ s/(?<![0-9a-f])(0[x0-9a-f]+)/oct($1)/egi;
+           $self->{value} =~ s/([0-9]+\s*[\*\/\%]\s*[0-9]+)/eval($1)/eg;
            sprintf "\$%s",$self->{value};
        } else {
            $self->{value} =~ s/0x([0-9a-f]+)/0$1h/ig;
@@ -163,14 +167,14 @@ my $current_function;
        my $self = shift;
        my $sz = shift;
 
+       # silently convert all EAs to 64-bit, required for elder GNU
+       # assembler and results in more compact code
+       $self->{index} =~ s/^[er](.?[0-9xp])[d]?$/r\1/;
+       $self->{base}  =~ s/^[er](.?[0-9xp])[d]?$/r\1/;
        if (!$masm) {
-           # elder GNU assembler insists on 64-bit EAs:-(
-           # on pros side, this results in more compact code:-)
-           $self->{index} =~ s/^[er](.?[0-9xp])[d]?$/r\1/;
-           $self->{base}  =~ s/^[er](.?[0-9xp])[d]?$/r\1/;
            # Solaris /usr/ccs/bin/as can't handle multiplications
            # in $self->{label}
-           $self->{label} =~ s/(?<![0-9a-f])(0[x0-9a-f]+)/oct($1)/eg;
+           $self->{label} =~ s/(?<![0-9a-f])(0[x0-9a-f]+)/oct($1)/egi;
            $self->{label} =~ s/([0-9]+\s*[\*\/\%]\s*[0-9]+)/eval($1)/eg;
 
            if (defined($self->{index})) {