The built-in arm assembler in clang doesn't support .dn/.qn
aliases, even Apple's normal standalone binutils-derived as
supports them.
---
 gas-preprocessor.pl |   30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl
index 54694c5..d0555c8 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)
@@ -482,6 +485,33 @@ foreach my $line (@pass1_lines) {
             $line .= ".unreq " . uc($1) . "\n";
         }
     }
+    if ($line =~ /\.unreq\s+(.*)/) {
+        if (defined $neon_alias_reg{$1}) {
+            delete $neon_alias_reg{$1};
+            delete $neon_alias_type{$1};
+            next;
+        }
+    }
+
+    if ($line =~ /(\w+)\s+\.(dn|qn)\s+(\w+)\.(\w+)/) {
+        $neon_alias_reg{$1}  = $3;
+        $neon_alias_type{$1} = $4;
+        next;
+    }
+    if ($line =~ /^\s+v\w+/ and scalar keys %neon_alias_reg > 0) {
+        # 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;
-- 
1.7.9.4

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

Reply via email to