[FFmpeg-devel] [PATCH 3/5] [inline assembly] prepares for mmx clobbers akin to xmm
frederic.recoules at univ-grenoble-alpes.fr
frederic.recoules at univ-grenoble-alpes.fr
Wed Apr 22 20:49:16 EEST 2020
From: Frédéric Recoules <frederic.recoules at orange.fr>
---
configure | 4 ++++
libavutil/x86/asm.h | 20 ++++++++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/configure b/configure
index 6533b43250..ddfea5ccfa 100755
--- a/configure
+++ b/configure
@@ -2275,6 +2275,7 @@ TOOLCHAIN_FEATURES="
symver_gnu_asm
vfp_args
xform_asm
+ mmx_clobbers
xmm_clobbers
"
@@ -5917,6 +5918,9 @@ EOF
check_inline_asm ebx_available '""::"b"(0)' &&
check_inline_asm ebx_available '"":::"%ebx"'
+ # check whether mmx clobbers are supported
+ check_inline_asm mmx_clobbers '"":::"%mm0"'
+
# check whether xmm clobbers are supported
check_inline_asm xmm_clobbers '"":::"%xmm0"'
diff --git a/libavutil/x86/asm.h b/libavutil/x86/asm.h
index 9bff42d628..bb3c13f5c1 100644
--- a/libavutil/x86/asm.h
+++ b/libavutil/x86/asm.h
@@ -79,6 +79,26 @@ typedef int x86_reg;
# define BROKEN_RELOCATIONS 1
#endif
+/*
+ * If gcc is not set to support mmx (-mmmx) it will not accept mmx registers
+ * in the clobber list for inline asm. MMX_CLOBBERS takes a list of mmx
+ * registers to be marked as clobbered and evaluates to nothing if they are
+ * not supported, or to the list itself if they are supported. Since a clobber
+ * list may not be empty, XMM_CLOBBERS_ONLY should be used if the mmx
+ * registers are the only in the clobber list.
+ * For example a list with "eax" and "mm0" as clobbers should become:
+ * : MMX_CLOBBERS("mm0",) "eax"
+ * and a list with only "mm0" should become:
+ * MMX_CLOBBERS_ONLY("mm0")
+ */
+#if HAVE_MMX_CLOBBERS
+# define MMX_CLOBBERS(...) __VA_ARGS__
+# define MMX_CLOBBERS_ONLY(...) : __VA_ARGS__
+#else
+# define MMX_CLOBBERS(...)
+# define MMX_CLOBBERS_ONLY(...)
+#endif
+
/*
* If gcc is not set to support sse (-msse) it will not accept xmm registers
* in the clobber list for inline asm. XMM_CLOBBERS takes a list of xmm
--
2.17.1
More information about the ffmpeg-devel
mailing list