summaryrefslogtreecommitdiff
path: root/libavutil/x86
diff options
context:
space:
mode:
authorHenrik Gramner <henrik@gramner.com>2014-09-05 00:13:38 +0200
committerDiego Biurrun <diego@biurrun.de>2014-09-09 02:00:25 -0700
commitf629705b0239c80fddc1b0b15ed4bb9042c77d23 (patch)
tree1bf5fce76960051767b7ae6c2dc272ec150927eb /libavutil/x86
parentec217218c27d53c5b323323e6ef862bcdbcabe5f (diff)
x86inc: Make INIT_CPUFLAGS support an arbitrary number of cpuflags
Previously there was a limit of two cpuflags. Signed-off-by: Diego Biurrun <diego@biurrun.de>
Diffstat (limited to 'libavutil/x86')
-rw-r--r--libavutil/x86/x86inc.asm41
1 files changed, 22 insertions, 19 deletions
diff --git a/libavutil/x86/x86inc.asm b/libavutil/x86/x86inc.asm
index cfc5d99210..e3ed3813e0 100644
--- a/libavutil/x86/x86inc.asm
+++ b/libavutil/x86/x86inc.asm
@@ -99,9 +99,6 @@
%endif
%endmacro
-; Always use long nops (reduces 0x90 spam in disassembly on x86_32)
-CPUNOP amdnop
-
; Macros to eliminate most code duplication between x86_32 and x86_64:
; Currently this works only for leaf functions which load all their arguments
; into registers at the start, and make no other use of the stack. Luckily that
@@ -759,19 +756,26 @@ SECTION .note.GNU-stack noalloc noexec nowrite progbits
%define cpuflag(x) ((cpuflags & (cpuflags_ %+ x)) == (cpuflags_ %+ x))
%define notcpuflag(x) ((cpuflags & (cpuflags_ %+ x)) != (cpuflags_ %+ x))
-; Takes up to 2 cpuflags from the above list.
+; Takes an arbitrary number of cpuflags from the above list.
; All subsequent functions (up to the next INIT_CPUFLAGS) is built for the specified cpu.
; You shouldn't need to invoke this macro directly, it's a subroutine for INIT_MMX &co.
-%macro INIT_CPUFLAGS 0-2
- CPUNOP amdnop
+%macro INIT_CPUFLAGS 0-*
+ %xdefine SUFFIX
+ %undef cpuname
+ %assign cpuflags 0
+
%if %0 >= 1
- %xdefine cpuname %1
- %assign cpuflags cpuflags_%1
- %if %0 >= 2
- %xdefine cpuname %1_%2
- %assign cpuflags cpuflags | cpuflags_%2
- %endif
+ %rep %0
+ %ifdef cpuname
+ %xdefine cpuname cpuname %+ _%1
+ %else
+ %xdefine cpuname %1
+ %endif
+ %assign cpuflags cpuflags | cpuflags_%1
+ %rotate 1
+ %endrep
%xdefine SUFFIX _ %+ cpuname
+
%if cpuflag(avx)
%assign avx_enabled 1
%endif
@@ -782,16 +786,15 @@ SECTION .note.GNU-stack noalloc noexec nowrite progbits
%endif
%if cpuflag(aligned)
%define movu mova
- %elifidn %1, sse3
+ %elif cpuflag(sse3) && notcpuflag(ssse3)
%define movu lddqu
%endif
- %if notcpuflag(sse2)
- CPUNOP basicnop
- %endif
+ %endif
+
+ %if cpuflag(sse2)
+ CPUNOP amdnop
%else
- %xdefine SUFFIX
- %undef cpuname
- %undef cpuflags
+ CPUNOP basicnop
%endif
%endmacro