[FFmpeg-cvslog] x86inc: Add REPX macro to repeat instructions/operations
Henrik Gramner
git at videolan.org
Wed Nov 8 14:51:47 EET 2023
ffmpeg | branch: master | Henrik Gramner <henrik at gramner.com> | Fri Sep 29 11:36:23 2023 +0000| [ed8ddf0bd3b188a08ae0b4e21235f7e3e6ce501b] | committer: Anton Khirnov
x86inc: Add REPX macro to repeat instructions/operations
When operating on large blocks of data it's common to repeatedly use
an instruction on multiple registers. Using the REPX macro makes it
easy to quickly write dense code to achieve this without having to
explicitly duplicate the same instruction over and over.
For example,
REPX {paddw x, m4}, m0, m1, m2, m3
REPX {mova [r0+16*x], m5}, 0, 1, 2, 3
will expand to
paddw m0, m4
paddw m1, m4
paddw m2, m4
paddw m3, m4
mova [r0+16*0], m5
mova [r0+16*1], m5
mova [r0+16*2], m5
mova [r0+16*3], m5
Commit taken from x264:
https://code.videolan.org/videolan/x264/-/commit/6d10612ab0007f8f60dd2399182efd696da3ffe4
Signed-off-by: Frank Plowman <post at frankplowman.com>
Signed-off-by: Anton Khirnov <anton at khirnov.net>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ed8ddf0bd3b188a08ae0b4e21235f7e3e6ce501b
---
libavutil/x86/x86inc.asm | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/libavutil/x86/x86inc.asm b/libavutil/x86/x86inc.asm
index 251ee797de..e099ee4b10 100644
--- a/libavutil/x86/x86inc.asm
+++ b/libavutil/x86/x86inc.asm
@@ -232,6 +232,16 @@ DECLARE_REG_TMP_SIZE 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
%define gprsize 4
%endif
+; Repeats an instruction/operation for multiple arguments.
+; Example usage: "REPX {psrlw x, 8}, m0, m1, m2, m3"
+%macro REPX 2-* ; operation, args
+ %xdefine %%f(x) %1
+ %rep %0 - 1
+ %rotate 1
+ %%f(%1)
+ %endrep
+%endmacro
+
%macro PUSH 1
push %1
%ifidn rstk, rsp
More information about the ffmpeg-cvslog
mailing list