[libav-devel] [GASPP PATCH 5/6] Convert local labels in tbz instructions for armasm

Martin Storsjo martin at martin.st
Mon Oct 16 21:38:18 CEST 2017


Also convert the register from wX into xX, since armasm fails to
assemble it when referring to the register as wX.
---
 gas-preprocessor.pl | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl
index b650c39..d9eaf1d 100755
--- a/gas-preprocessor.pl
+++ b/gas-preprocessor.pl
@@ -891,16 +891,23 @@ sub handle_serialized_line {
                      ($arch eq "aarch64" and !is_aarch64_register($target))) {
                 $call_targets{$target}++;
             }
-        } elsif ($line =~ /(?:^|\n)\s*(\w+\s*:\s*)?(cbn?z|adr)\s+(\w+)\s*,\s*(\w+)/) {
+        } elsif ($line =~ /(?:^|\n)\s*(\w+\s*:\s*)?(cbn?z|adr|tbz)\s+(\w+)\s*,(\s*#\d+\s*,)?\s*(\w+)/) {
             my $instr = $2;
             my $reg = $3;
-            my $target = $4;
+            my $bit = $4;
+            my $target = $5;
             if ($target =~ /^(\d+)([bf])$/) {
                 # The target is a local label
                 $line = handle_local_label($line, $1, $2);
             } else {
                 $call_targets{$target}++;
             }
+            # Convert tbz with a wX register into an xX register.
+            if ($instr eq "tbz" and $reg =~ /w\d+/) {
+                my $xreg = $reg;
+                $xreg =~ s/w/x/;
+                $line =~ s/\b$reg\b/$xreg/;
+            }
         } elsif ($line =~ /^\s*.h?word.*\b\d+[bf]\b/) {
             while ($line =~ /\b(\d+)([bf])\b/g) {
                 $line = handle_local_label($line, $1, $2);
-- 
2.7.4



More information about the libav-devel mailing list