[x264-devel] [PATCH] Updated configure to detect MIPS platform and set flags. Added define for MIPS MSA. MSA is SIMD architecture of MIPS. Flags are added to enable MSA.

Kaustubh Raste kaustubh.raste at imgtec.com
Tue Mar 24 10:01:05 CET 2015


---
 configure | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 x264.h    |  3 +++
 2 files changed, 49 insertions(+)

diff --git a/configure b/configure
index 15b1c91..1999ad6 100755
--- a/configure
+++ b/configure
@@ -735,6 +735,7 @@ case $host_cpu in
         ;;
     mips|mipsel|mips64|mips64el)
         ARCH="MIPS"
+        AS="${AS-${cross_prefix}gcc}"
         ;;
     arm*)
         ARCH="ARM"
@@ -860,6 +861,51 @@ 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
+    # set flags so msa is built by default
+    echo $CFLAGS | grep -Eq '(-mcpu|-march|-arch)' || CFLAGS="$CFLAGS -mfp64 -mmsa -flax-vector-conversions"
+
+    if cc_check '' '' '__asm__("move.v $w5, $w11");' ; then define HAVE_MSA
+        CFLAGS="$CFLAGS -msched-weight -funroll-loops -mload-store-pairs"
+        LDFLAGS="$LDFLAGS -mmsa -mfp64"
+
+        if cc_check '' '' '__asm__("ulw  $6,  4($9)");' ; then
+            case $host_cpu in
+                mips|mipsel)
+                    CFLAGS="$CFLAGS -mips32r5 -mtune=p5600"
+                    ASFLAGS="$ASFLAGS -mips32r5 -mtune=p5600"
+                    LDFLAGS="$LDFLAGS -mips32r5 -mtune=p5600"
+                   ;;
+                mips64|mips64el)
+                    CFLAGS="$CFLAGS -mips64r5 -mabi=64"
+                    ASFLAGS="$ASFLAGS -mips64r5 -mabi=64"
+                    LDFLAGS="$LDFLAGS -mips64r5 -mabi=64"
+                    ;;
+            esac
+        else
+            case $host_cpu in
+                mips|mipsel)
+                    CFLAGS="$CFLAGS -mips32r6"
+                    ASFLAGS="$ASFLAGS -mips32r6"
+                    LDFLAGS="$LDFLAGS -mips32r6"
+                    ;;
+                mips64|mips64el)
+                    CFLAGS="$CFLAGS -mips64r6 -mabi=64 -mtune=i6400"
+                    ASFLAGS="$ASFLAGS -mips64r6 -mabi=64 -mtune=i6400"
+                    LDFLAGS="$LDFLAGS -mips64r6 -mabi=64 -mtune=i6400"
+                    ;;
+            esac
+        fi
+    else
+        CFLAGS="$CFLAGS -mips32r2"
+    fi
+
+    if cc_check '' '' '__asm__("madd.d $f0, $f2, $f4, $f6");' ; then
+        CFLAGS="$CFLAGS -mhard-float"
+        ASFLAGS="$ASFLAGS -mhard-float"
+    fi
+fi
+
 [ $asm = no ] && AS=""
 [ "x$AS" = x ] && asm="no" || asm="yes"
 
diff --git a/x264.h b/x264.h
index 7cc5fcc..8194246 100644
--- a/x264.h
+++ b/x264.h
@@ -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) */
-- 
2.3.2



More information about the x264-devel mailing list