[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.

BugMaster BugMaster at narod.ru
Fri Mar 27 20:42:55 CET 2015


On Tue, 24 Mar 2015 14:31:05 +0530, Kaustubh Raste wrote:
> ---
>  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}"

AS="${AS-${CC}}"

>          ;;
>      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"

How broad is support of MSA among MIPS cpus to make default? Same for
the -mfp64. It may be ok if we really would have optimizations that
need (same as we target ARMv7 by default) but not without real
optimizations.

https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html says that
-flax-vector-conversions should not be used for new code.

> +
> +    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
> +

Detection of supported CPU features by checking compiler support looks
wrong. A specially if we take cross compiling into account.

>  [ $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 */

This define is nowhere set or used so this chunk is meaningless at
least without real code to use it.

> +
>  /* Analyse flags */
>  #define X264_ANALYSE_I4x4       0x0001  /* Analyse i4x4 */
>  #define X264_ANALYSE_I8x8       0x0002  /* Analyse i8x8 (requires 8x8 transform) */



More information about the x264-devel mailing list