summaryrefslogtreecommitdiff
path: root/build/make/rtcd.pl
diff options
context:
space:
mode:
Diffstat (limited to 'build/make/rtcd.pl')
-rwxr-xr-xbuild/make/rtcd.pl35
1 files changed, 29 insertions, 6 deletions
diff --git a/build/make/rtcd.pl b/build/make/rtcd.pl
index 748320041..acb9f6e46 100755
--- a/build/make/rtcd.pl
+++ b/build/make/rtcd.pl
@@ -315,14 +315,26 @@ EOF
sub mips() {
determine_indirection("c", @ALL_ARCHS);
+
+ # Assign the helper variable for each enabled extension
+ foreach my $opt (@ALL_ARCHS) {
+ my $opt_uc = uc $opt;
+ eval "\$have_${opt}=\"flags & HAS_${opt_uc}\"";
+ }
+
common_top;
print <<EOF;
#include "vpx_config.h"
#ifdef RTCD_C
+#include "vpx_ports/mips.h"
static void setup_rtcd_internal(void)
{
+ int flags = mips_cpu_caps();
+
+ (void)flags;
+
EOF
set_function_pointers("c", @ALL_ARCHS);
@@ -410,24 +422,35 @@ if ($opts{arch} eq 'x86') {
&require(@REQUIRES);
x86;
} elsif ($opts{arch} eq 'mips32' || $opts{arch} eq 'mips64') {
+ my $have_dspr2 = 0;
+ my $have_msa = 0;
+ my $have_mmi = 0;
@ALL_ARCHS = filter("$opts{arch}");
open CONFIG_FILE, $opts{config} or
die "Error opening config file '$opts{config}': $!\n";
while (<CONFIG_FILE>) {
if (/HAVE_DSPR2=yes/) {
- @ALL_ARCHS = filter("$opts{arch}", qw/dspr2/);
- last;
+ $have_dspr2 = 1;
}
if (/HAVE_MSA=yes/) {
- @ALL_ARCHS = filter("$opts{arch}", qw/msa/);
- last;
+ $have_msa = 1;
}
if (/HAVE_MMI=yes/) {
- @ALL_ARCHS = filter("$opts{arch}", qw/mmi/);
- last;
+ $have_mmi = 1;
}
}
close CONFIG_FILE;
+ if ($have_dspr2 == 1) {
+ @ALL_ARCHS = filter("$opts{arch}", qw/dspr2/);
+ } elsif ($have_msa == 1 && $have_mmi == 1) {
+ @ALL_ARCHS = filter("$opts{arch}", qw/mmi msa/);
+ } elsif ($have_msa == 1) {
+ @ALL_ARCHS = filter("$opts{arch}", qw/msa/);
+ } elsif ($have_mmi == 1) {
+ @ALL_ARCHS = filter("$opts{arch}", qw/mmi/);
+ } else {
+ unoptimized;
+ }
mips;
} elsif ($opts{arch} =~ /armv7\w?/) {
@ALL_ARCHS = filter(qw/neon_asm neon/);