The built-in arm assembler in clang doesn't support .dn/.qn
aliases, even Apple's normal standalone binutils-derived as
supports them.
---
Updated to handle the .unreq before adding the case-insensitive unreq
aliases (which shouldn't make much of a difference, but this way there's
less chance of the two cases interfering).

Also updated to handle [n] indexes, and to not require any type suffix,
and reordered the checks, as suggested by Janne.
---
 gas-preprocessor.pl |   30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl
index 54694c5..8720a1c 100755
--- a/gas-preprocessor.pl
+++ b/gas-preprocessor.pl
@@ -408,6 +408,9 @@ my %call_targets;
 my @irp_args;
 my $irp_param;
 
+my %neon_alias_reg;
+my %neon_alias_type;
+
 # pass 2: parse .rept and .if variants
 foreach my $line (@pass1_lines) {
     # handle .previous (only with regard to .section not .subsection)
@@ -474,6 +477,13 @@ foreach my $line (@pass1_lines) {
         }
     }
 
+    if ($line =~ /\.unreq\s+(.*)/) {
+        if (defined $neon_alias_reg{$1}) {
+            delete $neon_alias_reg{$1};
+            delete $neon_alias_type{$1};
+            next;
+        }
+    }
     # old gas versions store upper and lower case names on .req,
     # but they remove only one on .unreq
     if ($fix_unreq) {
@@ -483,6 +493,26 @@ foreach my $line (@pass1_lines) {
         }
     }
 
+    if ($line =~ /(\w+)\s+\.(dn|qn)\s+(\w+)(?:\.(\w+))?(\[\d+\])?/) {
+        $neon_alias_reg{$1} = "$3$5";
+        $neon_alias_type{$1} = $4;
+        next;
+    }
+    if (scalar keys %neon_alias_reg > 0 && $line =~ /^\s+v\w+/) {
+        # This line seems to possibly have a neon instruction
+        foreach (keys %neon_alias_reg) {
+            my $alias = $_;
+            # Require the register alias to match as an invididual word, not 
as a substring
+            # of a larger word-token.
+            if ($line =~ /\b$alias\b/) {
+                $line =~ s/\b$alias\b/$neon_alias_reg{$alias}/g;
+                # Add the type suffix. If multiple aliases match on the same 
line,
+                # only do this replacement the first time (a vfoo.bar string 
won't match v\w+).
+                $line =~ s/^(\s+)(v\w+)(\s+)/$1$2.$neon_alias_type{$alias}$3/;
+            }
+        }
+    }
+
     if ($line =~ /\.rept\s+(.*)/) {
         $num_repts = $1;
         @rept_lines = ("\n");
-- 
1.7.9.4

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to