[GASPP,2/2] Convert {v0.8b-v3.8b} into {v0.8b, v1.8b, v2.8b, v3.8b} for armasm64

Message ID 1520515574-32567-2-git-send-email-martin@martin.st
State New
Headers show
Series
  • [GASPP,1/2] Convert .extern into IMPORT for armasm
Related show

Commit Message

Martin Storsjö March 8, 2018, 1:26 p.m.
---
 gas-preprocessor.pl | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

Janne Grunau March 14, 2018, 10:15 p.m. | #1
On 2018-03-08 15:26:14 +0200, Martin Storsjö wrote:
> ---
>  gas-preprocessor.pl | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl
> index 9a7f6d8..5158cc7 100755
> --- a/gas-preprocessor.pl
> +++ b/gas-preprocessor.pl
> @@ -1051,6 +1051,24 @@ sub handle_serialized_line {
>                      $line =~ s/#$scale/#$inverted_scale/;
>                  }
>              }
> +
> +            # Convert "ld1 {v0.4h-v3.4h}" into "ld1 {v0.4h,v1.4h,v2.4h,v3.4h}"
> +            if ($line =~ /(?:ld|st)\d\s+({\s*v(\d+)\.(\d[bhsdBHSD])\s*-\s*v(\d+)\.(\d[bhsdBHSD])\s*})/) {
> +                my $regspec = $1;
> +                my $reg1 = $2;
> +                my $layout1 = $3;
> +                my $reg2 = $4;
> +                my $layout2 = $5;
> +                if ($layout1 eq $layout2) {
> +                    my $new_regspec = "{";
> +                    foreach my $i ($reg1 .. $reg2) {
> +                        $new_regspec .= "," if ($i > $reg1);
> +                        $new_regspec .= "v$i.$layout1";
> +                    }
> +                    $new_regspec .= "}";
> +                    $line =~ s/$regspec/$new_regspec/;
> +                }
> +            }
>          }
>          # armasm is unable to parse &0x - add spacing
>          $line =~ s/&0x/& 0x/g;

ok

Janne

Patch

diff --git a/gas-preprocessor.pl b/gas-preprocessor.pl
index 9a7f6d8..5158cc7 100755
--- a/gas-preprocessor.pl
+++ b/gas-preprocessor.pl
@@ -1051,6 +1051,24 @@  sub handle_serialized_line {
                     $line =~ s/#$scale/#$inverted_scale/;
                 }
             }
+
+            # Convert "ld1 {v0.4h-v3.4h}" into "ld1 {v0.4h,v1.4h,v2.4h,v3.4h}"
+            if ($line =~ /(?:ld|st)\d\s+({\s*v(\d+)\.(\d[bhsdBHSD])\s*-\s*v(\d+)\.(\d[bhsdBHSD])\s*})/) {
+                my $regspec = $1;
+                my $reg1 = $2;
+                my $layout1 = $3;
+                my $reg2 = $4;
+                my $layout2 = $5;
+                if ($layout1 eq $layout2) {
+                    my $new_regspec = "{";
+                    foreach my $i ($reg1 .. $reg2) {
+                        $new_regspec .= "," if ($i > $reg1);
+                        $new_regspec .= "v$i.$layout1";
+                    }
+                    $new_regspec .= "}";
+                    $line =~ s/$regspec/$new_regspec/;
+                }
+            }
         }
         # armasm is unable to parse &0x - add spacing
         $line =~ s/&0x/& 0x/g;