summaryrefslogtreecommitdiff
path: root/build/make/rtcd.pl
diff options
context:
space:
mode:
authorJin Bo <jinbo@loongson.cn>2021-07-06 17:18:48 +0800
committeryuanhecai <yuanhecai@loongson.cn>2022-01-28 16:05:51 +0800
commit479758aeb15c82c8faf6d7a905999c7512284c64 (patch)
tree4a4de00d15e4eee635acf7cb3ce14bd48e02128b /build/make/rtcd.pl
parentf7941622f22215f332e82362e8318ae304e471cf (diff)
downloadlibvpx-479758aeb15c82c8faf6d7a905999c7512284c64.tar
libvpx-479758aeb15c82c8faf6d7a905999c7512284c64.tar.gz
libvpx-479758aeb15c82c8faf6d7a905999c7512284c64.tar.bz2
libvpx-479758aeb15c82c8faf6d7a905999c7512284c64.zip
libvpx[loongarch]: Add loongarch support.
LSX and LASX are enabled by default if compiler supports them. Bug: webm:1754 Change-Id: Ic36b113bc4313c50e9d2bbab91199b3aa46d00dc
Diffstat (limited to 'build/make/rtcd.pl')
-rwxr-xr-xbuild/make/rtcd.pl47
1 files changed, 47 insertions, 0 deletions
diff --git a/build/make/rtcd.pl b/build/make/rtcd.pl
index acb9f6e46..8ed776add 100755
--- a/build/make/rtcd.pl
+++ b/build/make/rtcd.pl
@@ -387,6 +387,37 @@ EOF
common_bottom;
}
+sub loongarch() {
+ 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/loongarch.h"
+static void setup_rtcd_internal(void)
+{
+ int flags = loongarch_cpu_caps();
+
+ (void)flags;
+EOF
+
+ set_function_pointers("c", @ALL_ARCHS);
+
+ print <<EOF;
+}
+#endif
+EOF
+ common_bottom;
+}
+
sub unoptimized() {
determine_indirection "c";
common_top;
@@ -462,6 +493,22 @@ if ($opts{arch} eq 'x86') {
} elsif ($opts{arch} =~ /^ppc/ ) {
@ALL_ARCHS = filter(qw/vsx/);
ppc;
+} elsif ($opts{arch} =~ /loongarch/ ) {
+ @ALL_ARCHS = filter("$opts{arch}");
+ open CONFIG_FILE, $opts{config} or
+ die "Error opening config file '$opts{config}': $!\n";
+ while (<CONFIG_FILE>) {
+ if (/HAVE_LSX=yes/) {
+ @ALL_ARCHS = filter("$opts{arch}", qw/lsx/);
+ last;
+ }
+ if (/HAVE_LASX=yes/) {
+ @ALL_ARCHS = filter("$opts{arch}", qw/lasx/);
+ last;
+ }
+ }
+ close CONFIG_FILE;
+ loongarch;
} else {
unoptimized;
}