On 2014-01-02 13:18:04 +0200, Martin Storsjö wrote:
> 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+)/) {
if ($line =~ /(\w+)\s+\.(dn|qn)\s+(\w+)(?:\.(\w+))?/) {
type is optional and we should either handle the also optional index or
fail if it's there
> + $neon_alias_reg{$1} = $3;
> + $neon_alias_type{$1} = $4;
> + next;
> + }
> + if ($line =~ /^\s+v\w+/ and scalar keys %neon_alias_reg > 0) {
I would expect 'scalar keys %neon_alias_reg > 0' only to be rarely true
(it's currently only used in one file in libav for one architecture)
and faster to evaluate than the string match so it should be checked
first. Checking it last doesn't make sense since the foreach for an
empty array should be as fast.
> + # 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;
Janne
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel