[FFmpeg-devel] [PATCH 1/5] [inline assembly] prepares for contiguous assembly statements merging
frederic.recoules at univ-grenoble-alpes.fr
frederic.recoules at univ-grenoble-alpes.fr
Wed Apr 22 20:49:14 EEST 2020
From: Frédéric Recoules <frederic.recoules at orange.fr>
---
libavcodec/x86/inline_asm.h | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
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
--
2.17.1
More information about the ffmpeg-devel
mailing list