[x264-devel] configure: Support targeting ARM with MSVC tools

Martin Storsjö git at videolan.org
Mon May 22 00:02:10 CEST 2017


x264 | branch: master | Martin Storsjö <martin at martin.st> | Fri Mar 24 11:33:46 2017 +0200| [a52d41c4d135c79373a86c3a82dcc2ec3f88b025] | committer: Henrik Gramner

configure: Support targeting ARM with MSVC tools

Set up the right gas-preprocessor as assembler frontend in these cases,
using armasm as actual assembler.

Don't try to add the -mcpu -mfpu options in this case.

Check whether the compiler actually supports inline assembly.

Check for the ARMv7 features in a different way for the MSVC compiler.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=a52d41c4d135c79373a86c3a82dcc2ec3f88b025
---

 configure        | 19 ++++++++++++++-----
 tools/checkasm.c |  2 +-
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index b1962f0e..d9de8abe 100755
--- a/configure
+++ b/configure
@@ -377,7 +377,7 @@ 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 \
-             MSA MMAP WINRT VSX"
+             MSA MMAP WINRT VSX ARM_INLINE_ASM"
 
 # parse options
 
@@ -762,14 +762,18 @@ case $host_cpu in
         ;;
     arm*)
         ARCH="ARM"
-        AS="${AS-${CC}}"
         if [ "$SYS" = MACOSX ] ; then
+            AS="${AS-${CC}}"
             ASFLAGS="$ASFLAGS -DPREFIX -DPIC"  # apple's ld doesn't support movw/movt relocations at all
             # build for armv7 by default
             if ! echo $CFLAGS | grep -Eq '\-arch' ; then
                 CFLAGS="$CFLAGS -arch armv7"
                 LDFLAGS="$LDFLAGS -arch armv7"
             fi
+        elif [ "$SYS" = WINDOWS ] ; then
+            AS="${AS-${SRCPATH}/tools/gas-preprocessor.pl -arch arm -as-type armasm -force-thumb -- armasm -nologo -ignore 4509}"
+        else
+            AS="${AS-${CC}}"
         fi
         ;;
     aarch64)
@@ -886,9 +890,14 @@ fi
 
 if [ $asm = auto -a $ARCH = ARM ] ; then
     # set flags so neon is built by default
-    echo $CFLAGS | grep -Eq '(-mcpu|-march|-mfpu)' || CFLAGS="$CFLAGS -mcpu=cortex-a8 -mfpu=neon"
-
-    if  cc_check '' '' '__asm__("rev ip, ip");' ; then      define HAVE_ARMV6
+    [ $compiler == CL ] || echo $CFLAGS | grep -Eq '(-mcpu|-march|-mfpu)' || CFLAGS="$CFLAGS -mcpu=cortex-a8 -mfpu=neon"
+
+    cc_check '' '' '__asm__("add r0, r1, r2");' && define HAVE_ARM_INLINE_ASM
+    if [ $compiler = CL ] && cpp_check '' '' 'defined(_M_ARM) && _M_ARM >= 7' ; then
+        define HAVE_ARMV6
+        define HAVE_ARMV6T2
+        define HAVE_NEON
+    elif cc_check '' '' '__asm__("rev ip, ip");' ; then     define HAVE_ARMV6
         cc_check '' '' '__asm__("movt r0, #0");'         && define HAVE_ARMV6T2
         cc_check '' '' '__asm__("vadd.i16 q0, q0, q0");' && define HAVE_NEON
         ASFLAGS="$ASFLAGS -c"
diff --git a/tools/checkasm.c b/tools/checkasm.c
index c201193c..4657bbac 100644
--- a/tools/checkasm.c
+++ b/tools/checkasm.c
@@ -100,7 +100,7 @@ static inline uint32_t read_time(void)
                   : "=a"(a) :: "edx", "memory" );
 #elif ARCH_PPC
     asm volatile( "mftb %0" : "=r"(a) :: "memory" );
-#elif ARCH_ARM     // ARMv7 only
+#elif HAVE_ARM_INLINE_ASM    // ARMv7 only
     asm volatile( "mrc p15, 0, %0, c9, c13, 0" : "=r"(a) :: "memory" );
 #elif ARCH_AARCH64
     uint64_t b = 0;



More information about the x264-devel mailing list