On Sat, 21 Oct 2017, Martin Storsjo wrote:

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.
---
Suggestions on what to name the environment variable are welcome;
it's hard to guess what to name it as I don't know what version
the fix will appear in.
---
gas-preprocessor.pl | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl
index 7644682..58d36cc 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_FIX_EARLY_ARMASM64}) {
+                # 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;
--
2.7.4

OK'd by Janne on irc, with the name suggestion GASPP_ARMASM64_INVERT_SCALE - will push with that name.

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

Reply via email to