Module: gas-preprocessor
Branch: master
Commit: 4593d78456303e92314ede3eb6bc9a5dd973c431

Author:    Martin Storsjo <[email protected]>
Committer: Martin Storsjo <[email protected]>
Date:      Mon Oct 16 16:58:46 2017 +0300

Conditionally work around an armasm64 bug in the scale operand to fcvtzs/scvtf

The operand shouldn't be stored as is, but stored as 64-scale, in
the opcode, but armasm64 currently misses to do this.

This bug will be fixed in a future release, and a fix for the bug
will break the workaround. Therefore, only do the workaround as
long as a environment variable is set.

---

 gas-preprocessor.pl | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl
index 7644682..fd49e81 100755
--- a/gas-preprocessor.pl
+++ b/gas-preprocessor.pl
@@ -1037,6 +1037,18 @@ sub handle_serialized_line {
                 $line =~ s/$instr$suffix/${instr}u$suffix/;
               }
             }
+
+            if ($ENV{GASPP_ARMASM64_INVERT_SCALE}) {
+                # Instructions like fcvtzs and scvtf store the scale value
+                # inverted in the opcode (stored as 64 - scale), but armasm64
+                # in early versions stores it as-is. Thus convert from
+                # "fcvtzs w0, s0, #8" into "fcvtzs w0, s0, #56".
+                if ($line =~ 
/(?:fcvtzs|scvtf)\s+(\w+)\s*,\s*(\w+)\s*,\s*#(\d+)/) {
+                    my $scale = $3;
+                    my $inverted_scale = 64 - $3;
+                    $line =~ s/#$scale/#$inverted_scale/;
+                }
+            }
         }
         # armasm is unable to parse &0x - add spacing
         $line =~ s/&0x/& 0x/g;

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

Reply via email to