]> git.sesse.net Git - x264/commitdiff
mips: Initial MSA support
authorKaustubh Raste <kaustubh.raste@imgtec.com>
Fri, 17 Apr 2015 12:08:58 +0000 (17:38 +0530)
committerHenrik Gramner <henrik@gramner.com>
Sat, 25 Jul 2015 20:52:54 +0000 (22:52 +0200)
MSA is the MIPS SIMD Architecture.

Add X264_CPU_MSA define.
Update configure to detect MIPS platform and set flags.
CPU-specific gcc options are expected through --extra-cflags.

Sample command line for mips32r5:
    ./configure --host=mipsel-linux-gnu --cross-prefix=<TOOLCHAIN>/mips-mti-linux-gnu-
    --extra-cflags="-EL -mips32r5 -msched-weight -mload-store-pairs"

Signed-off-by: Kaustubh Raste <kaustubh.raste@imgtec.com>
common/cpu.c
configure
x264.h

index e0d1377ba7ccc28e77ca7ef13e509b1064e7d6fe..e311bab1e552e331bf8f7020d4d05b58aa8a7e31 100644 (file)
@@ -92,6 +92,8 @@ const x264_cpu_name_t x264_cpu_names[] =
 #elif ARCH_AARCH64
     {"ARMv8",           X264_CPU_ARMV8},
     {"NEON",            X264_CPU_NEON},
+#elif ARCH_MIPS
+    {"MSA",             X264_CPU_MSA},
 #endif
     {"", 0},
 };
@@ -419,6 +421,17 @@ uint32_t x264_cpu_detect( void )
     return X264_CPU_ARMV8 | X264_CPU_NEON;
 }
 
+#elif ARCH_MIPS
+
+uint32_t x264_cpu_detect( void )
+{
+    uint32_t flags = 0;
+#if HAVE_MSA
+    flags |= X264_CPU_MSA;
+#endif
+    return flags;
+}
+
 #else
 
 uint32_t x264_cpu_detect( void )
index 2c6cfe868eb28fb9e0ad8f930434766bc44d6fa2..d82c44906d3ed48d52d5c0363340b6e2b10b6f81 100755 (executable)
--- a/configure
+++ b/configure
@@ -358,7 +358,8 @@ NL="
 
 # list of all preprocessor HAVE values we can define
 CONFIG_HAVE="MALLOC_H ALTIVEC ALTIVEC_H MMX ARMV6 ARMV6T2 NEON BEOSTHREAD POSIXTHREAD WIN32THREAD THREAD LOG2F SWSCALE \
-             LAVF FFMS GPAC AVS GPL VECTOREXT INTERLACED CPU_COUNT OPENCL THP LSMASH X86_INLINE_ASM AS_FUNC INTEL_DISPATCHER"
+             LAVF FFMS GPAC AVS GPL VECTOREXT INTERLACED CPU_COUNT OPENCL THP LSMASH X86_INLINE_ASM AS_FUNC INTEL_DISPATCHER \
+             MSA"
 
 # parse options
 
@@ -727,8 +728,10 @@ case $host_cpu in
     sparc)
         ARCH="SPARC"
         ;;
-    mips|mipsel|mips64|mips64el)
+    mips*)
         ARCH="MIPS"
+        AS="${AS-${CC}}"
+        AS_EXT=".c"
         ;;
     arm*)
         ARCH="ARM"
@@ -854,6 +857,20 @@ if [ $asm = auto -a \( $ARCH = ARM -o $ARCH = AARCH64 \) ] ; then
     as_check ".func test${NL}.endfunc" && define HAVE_AS_FUNC 1
 fi
 
+if [ $asm = auto -a $ARCH = MIPS ] ; then
+    if ! echo $CFLAGS | grep -Eq '(-march|-mmsa|-mno-msa)' ; then
+        cc_check '' '-mmsa -mfp64 -mhard-float' && CFLAGS="-mmsa -mfp64 -mhard-float $CFLAGS"
+    fi
+
+    if cc_check '' '' '__asm__("addvi.b $w0, $w1, 1");' ; then
+        define HAVE_MSA
+    else
+        echo "You specified a pre-MSA CPU in your CFLAGS."
+        echo "If you really want to run on such a CPU, configure with --disable-asm."
+        exit 1
+    fi
+fi
+
 [ $asm = no ] && AS=""
 [ "x$AS" = x ] && asm="no" || asm="yes"
 
diff --git a/x264.h b/x264.h
index 6202f725ff45e470db53322c8e3ae427471fa7fc..ff9d897db09a51cd52013f79203cb5f849c04d43 100644 (file)
--- a/x264.h
+++ b/x264.h
@@ -41,7 +41,7 @@
 
 #include "x264_config.h"
 
-#define X264_BUILD 147
+#define X264_BUILD 148
 
 /* Application developers planning to link against a shared library version of
  * libx264 from a Microsoft Visual Studio or similar development environment
@@ -158,6 +158,9 @@ typedef struct
 #define X264_CPU_FAST_NEON_MRC   0x0000004  /* Transfer from NEON to ARM register is fast (Cortex-A9) */
 #define X264_CPU_ARMV8           0x0000008
 
+/* MIPS */
+#define X264_CPU_MSA             0x0000001  /* MIPS MSA */
+
 /* Analyse flags */
 #define X264_ANALYSE_I4x4       0x0001  /* Analyse i4x4 */
 #define X264_ANALYSE_I8x8       0x0002  /* Analyse i8x8 (requires 8x8 transform) */