diff mbox series

[FFmpeg-devel,3/5,inline,assembly] prepares for mmx clobbers akin to xmm

Message ID 20200422174918.7290-3-frederic.recoules@univ-grenoble-alpes.fr
State New
Headers show
Series [FFmpeg-devel,1/5,inline,assembly] prepares for contiguous assembly statements merging
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

FRÉDÉRIC RECOULES April 22, 2020, 5:49 p.m. UTC
From: Frédéric Recoules <frederic.recoules@orange.fr>

---
 configure           |  4 ++++
 libavutil/x86/asm.h | 20 ++++++++++++++++++++
 2 files changed, 24 insertions(+)

Comments

Michael Niedermayer April 22, 2020, 9:18 p.m. UTC | #1
On Wed, Apr 22, 2020 at 07:49:16PM +0200, frederic.recoules@univ-grenoble-alpes.fr wrote:
> From: Frédéric Recoules <frederic.recoules@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
                            ^^^^
typo

[...]
diff mbox series

Patch

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