[FFmpeg-devel] [PATCH 2/5] [inline assembly] merges contiguous assembly statements
frederic.recoules at univ-grenoble-alpes.fr
frederic.recoules at univ-grenoble-alpes.fr
Wed Apr 22 20:49:15 EEST 2020
From: Frédéric Recoules <frederic.recoules at orange.fr>
---
libavcodec/x86/hpeldsp_init.c | 8 ++++++++
libavcodec/x86/rnd_template.c | 14 +++++++-------
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/libavcodec/x86/hpeldsp_init.c b/libavcodec/x86/hpeldsp_init.c
index d89928cec6..c99513035b 100644
--- a/libavcodec/x86/hpeldsp_init.c
+++ b/libavcodec/x86/hpeldsp_init.c
@@ -95,6 +95,8 @@ void ff_avg_approx_pixels8_xy2_3dnow(uint8_t *block, const uint8_t *pixels,
/* MMX no rounding */
#define DEF(x, y) x ## _no_rnd_ ## y ## _mmx
#define SET_RND MOVQ_WONE
+#define SET_RND_TPL MOVQ_WONE_TPL
+#define COMMA_SET_RND_IN
#define PAVGBP(a, b, c, d, e, f) PAVGBP_MMX_NO_RND(a, b, c, d, e, f)
#define PAVGB(a, b, c, e) PAVGB_MMX_NO_RND(a, b, c, e)
#define STATIC static
@@ -104,6 +106,8 @@ void ff_avg_approx_pixels8_xy2_3dnow(uint8_t *block, const uint8_t *pixels,
#undef DEF
#undef SET_RND
+#undef SET_RND_TPL
+#undef COMMA_SET_RND_IN
#undef PAVGBP
#undef PAVGB
#undef STATIC
@@ -121,6 +125,8 @@ CALL_2X_PIXELS(put_no_rnd_pixels16_xy2_mmx, put_no_rnd_pixels8_xy2_mmx, 8)
#define DEF(x, y) x ## _ ## y ## _mmx
#define SET_RND MOVQ_WTWO
+#define SET_RND_TPL MOVQ_WTWO_TPL
+#define COMMA_SET_RND_IN COMMA_MOVQ_WTWO_IN
#define PAVGBP(a, b, c, d, e, f) PAVGBP_MMX(a, b, c, d, e, f)
#define PAVGB(a, b, c, e) PAVGB_MMX(a, b, c, e)
@@ -134,6 +140,8 @@ CALL_2X_PIXELS(put_no_rnd_pixels16_xy2_mmx, put_no_rnd_pixels8_xy2_mmx, 8)
#undef DEF
#undef SET_RND
+#undef SET_RND_TPL
+#undef COMMA_SET_RND_IN
#undef PAVGBP
#undef PAVGB
diff --git a/libavcodec/x86/rnd_template.c b/libavcodec/x86/rnd_template.c
index 09946bd23f..a98fbc10ab 100644
--- a/libavcodec/x86/rnd_template.c
+++ b/libavcodec/x86/rnd_template.c
@@ -33,9 +33,9 @@
av_unused STATIC void DEF(put, pixels8_xy2)(uint8_t *block, const uint8_t *pixels,
ptrdiff_t line_size, int h)
{
- MOVQ_ZERO(mm7);
- SET_RND(mm6); // =2 for rnd and =1 for no_rnd version
__asm__ volatile(
+ MOVQ_ZERO_TPL(mm7)
+ SET_RND_TPL(mm6) // =2 for rnd and =1 for no_rnd version
"movq (%1), %%mm0 \n\t"
"movq 1(%1), %%mm4 \n\t"
"movq %%mm0, %%mm1 \n\t"
@@ -93,7 +93,7 @@ av_unused STATIC void DEF(put, pixels8_xy2)(uint8_t *block, const uint8_t *pixel
"subl $2, %0 \n\t"
"jnz 1b \n\t"
:"+g"(h), "+S"(pixels)
- :"D"(block), "r"((x86_reg)line_size)
+ :"D"(block), "r"((x86_reg)line_size) COMMA_SET_RND_IN
:FF_REG_a, "memory");
}
@@ -102,10 +102,10 @@ av_unused STATIC void DEF(put, pixels8_xy2)(uint8_t *block, const uint8_t *pixel
av_unused STATIC void DEF(avg, pixels8_xy2)(uint8_t *block, const uint8_t *pixels,
ptrdiff_t line_size, int h)
{
- MOVQ_ZERO(mm7);
- SET_RND(mm6); // =2 for rnd and =1 for no_rnd version
__asm__ volatile(
- "movq (%1), %%mm0 \n\t"
+ MOVQ_ZERO_TPL(mm7)
+ SET_RND_TPL(mm6) // =2 for rnd and =1 for no_rnd version
+ "movq (%1), %%mm0 \n\t"
"movq 1(%1), %%mm4 \n\t"
"movq %%mm0, %%mm1 \n\t"
"movq %%mm4, %%mm5 \n\t"
@@ -170,6 +170,6 @@ av_unused STATIC void DEF(avg, pixels8_xy2)(uint8_t *block, const uint8_t *pixel
"subl $2, %0 \n\t"
"jnz 1b \n\t"
:"+g"(h), "+S"(pixels)
- :"D"(block), "r"((x86_reg)line_size)
+ :"D"(block), "r"((x86_reg)line_size) COMMA_SET_RND_IN
:FF_REG_a, "memory");
}
--
2.17.1
More information about the ffmpeg-devel
mailing list