Commit ce0757d9 authored by Kaustubh Raste's avatar Kaustubh Raste Committed by Henrik Gramner
Browse files

mips: Initial MSA support



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: default avatarKaustubh Raste <kaustubh.raste@imgtec.com>
parent 9140ee1f
......@@ -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 )
......
......@@ -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"
......
......@@ -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) */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment