[FFmpeg-devel] [RFC] configure: test inter-procedural constant propagation for armv6 inline asm

Xiaolei Yu dreifachstein at gmail.com
Mon Feb 22 13:10:58 CET 2016


There are two routines in avutil/arm/intmath that fail to compile without IPCP.
This patch tries to detect if such optimizations are present.
I am unable to find a way to test it without using inline asm, so the check flag
is bound to each arch extension.

I also want optflags checks to be performed earlier but am unsure about the side-effect.
This patch just performs ipcp checks after optflags ones.

---
 configure | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/configure b/configure
index a78e228..3b35551 100755
--- a/configure
+++ b/configure
@@ -916,9 +916,25 @@ EOF
 check_insn(){
     log check_insn "$@"
     check_inline_asm ${1}_inline "\"$2\""
+    enabled ${1}_inline && enable ${1}_ipcp
     echo "$2" | check_as && enable ${1}_external || disable ${1}_external
 }
 
+check_inline_asm_ipcp(){
+    log check_inline_asm_ipcp "$@"
+    name="${1}_ipcp"
+    code="$2"
+    param_decl="$3"
+    param_val="$4"
+    shift 4
+    disable ${name}
+    check_cc "$@" $optflags << EOF && enable $name
+static
+void foo($param_decl){ __asm__ volatile($code); }
+void bar() { foo($param_val); }
+EOF
+}
+
 check_yasm(){
     log check_yasm "$@"
     echo "$1" > $TMPS
@@ -1937,6 +1953,7 @@ HAVE_LIST="
     $ARCH_EXT_LIST
     $(add_suffix _external $ARCH_EXT_LIST)
     $(add_suffix _inline   $ARCH_EXT_LIST)
+    $(add_suffix _ipcp     $ARCH_EXT_LIST)
     $ARCH_FEATURES
     $ATOMICS_LIST
     $BUILTIN_LIST
@@ -2145,6 +2162,7 @@ vfpv3_deps="vfp"
 setend_deps="arm"
 
 map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
+map 'eval ${v}_ipcp_deps=${v}_inline'  $ARCH_EXT_LIST_ARM
 
 mipsfpu_deps="mips"
 mipsdsp_deps="mips"
@@ -5889,6 +5907,10 @@ check_optflags $optflags
 check_optflags -fno-math-errno
 check_optflags -fno-signed-zeros
 
+enabled armv6 && check_inline_asm_ipcp armv6 \
+    '"ssat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p)' 'int x, int a, int p' '1, 1, 1' \
+    $optflags
+
 enabled ftrapv && check_cflags -ftrapv
 
 check_cc -mno-red-zone <<EOF && noredzone_flags="-mno-red-zone"
-- 
2.7.0


More information about the ffmpeg-devel mailing list