diff mbox series

[FFmpeg-devel,1/5,inline,assembly] prepares for contiguous assembly statements merging

Message ID 20200422174918.7290-1-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>

---
 libavcodec/x86/inline_asm.h | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/x86/inline_asm.h b/libavcodec/x86/inline_asm.h
index 0198746719..6ead73ac33 100644
--- a/libavcodec/x86/inline_asm.h
+++ b/libavcodec/x86/inline_asm.h
@@ -23,13 +23,15 @@ 
 
 #include "constants.h"
 
-#define MOVQ_WONE(regd) \
-    __asm__ volatile ( \
-    "pcmpeqd %%" #regd ", %%" #regd " \n\t" \
-    "psrlw $15, %%" #regd ::)
+#define MOVQ_WONE_TPL(regd) \
+  "pcmpeqd %%"#regd", %%"#regd"  \n\t" \
+  "psrlw $15, %%" #regd"  \n\t"
+#define MOVQ_WONE(regd) __asm__ volatile (MOVQ_WONE_TPL(regd) ::)
 
 #define JUMPALIGN()     __asm__ volatile (".p2align 3"::)
-#define MOVQ_ZERO(regd) __asm__ volatile ("pxor %%"#regd", %%"#regd ::)
+
+#define MOVQ_ZERO_TPL(regd) "pxor %%"#regd", %%"#regd"  \n\t"
+#define MOVQ_ZERO(regd) __asm__ volatile (MOVQ_ZERO_TPL(regd) ::)
 
 #define MOVQ_BFE(regd)                                  \
     __asm__ volatile (                                  \
@@ -37,17 +39,20 @@ 
         "paddb   %%"#regd", %%"#regd"   \n\t" ::)
 
 #ifndef PIC
-#define MOVQ_WTWO(regd) __asm__ volatile ("movq %0, %%"#regd" \n\t" :: "m"(ff_pw_2))
+#define MOVQ_WTWO_TPL(regd) "movq %[ff_pw_2], %%"#regd" \n\t"
+#define MOVQ_WTWO_IN [ff_pw_2] "m" (ff_pw_2)
+#define COMMA_MOVQ_WTWO_IN , MOVQ_WTWO_IN
 #else
 // for shared library it's better to use this way for accessing constants
 // pcmpeqd -> -1
-#define MOVQ_WTWO(regd)                                 \
-    __asm__ volatile (                                  \
-        "pcmpeqd %%"#regd", %%"#regd"   \n\t"           \
-        "psrlw         $15, %%"#regd"   \n\t"           \
-        "psllw          $1, %%"#regd"   \n\t"::)
-
+#define MOVQ_WTWO_TPL(regd)		    \
+  "pcmpeqd %%"#regd", %%"#regd"   \n\t"	    \
+  "psrlw         $15, %%"#regd"   \n\t"    \
+  "psllw          $1, %%"#regd"   \n\t"
+#define MOVQ_WTWO_IN
+#define COMMA_MOVQ_WTWO_IN
 #endif
+#define MOVQ_WTWO(regd) __asm__ volatile (MOVQ_WTWO_TPL(regd) :: MOVQ_WTWO_IN)
 
 // using regr as temporary and for the output result
 // first argument is unmodified and second is trashed