[x264-devel] [PATCH 14/14] configure: Support targeting ARM with MSVC tools
Martin Storsjö
martin at martin.st
Fri Mar 24 10:33:46 CET 2017
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.
---
configure | 19 ++++++++++++++-----
tools/checkasm.c | 2 +-
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/configure b/configure
index 33df6dc..ff11cca 100755
--- a/configure
+++ b/configure
@@ -376,7 +376,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
@@ -761,14 +761,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)
@@ -885,9 +889,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 db3a50d..9e3514d 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;
--
2.7.4
More information about the x264-devel
mailing list