mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-09 08:39:41 +00:00
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>
This commit is contained in:
parent
ec217218c2
commit
f629705b02
@ -99,9 +99,6 @@
|
|||||||
%endif
|
%endif
|
||||||
%endmacro
|
%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:
|
; Macros to eliminate most code duplication between x86_32 and x86_64:
|
||||||
; Currently this works only for leaf functions which load all their arguments
|
; 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
|
; 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 cpuflag(x) ((cpuflags & (cpuflags_ %+ x)) == (cpuflags_ %+ x))
|
||||||
%define notcpuflag(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.
|
; 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.
|
; You shouldn't need to invoke this macro directly, it's a subroutine for INIT_MMX &co.
|
||||||
%macro INIT_CPUFLAGS 0-2
|
%macro INIT_CPUFLAGS 0-*
|
||||||
CPUNOP amdnop
|
%xdefine SUFFIX
|
||||||
|
%undef cpuname
|
||||||
|
%assign cpuflags 0
|
||||||
|
|
||||||
%if %0 >= 1
|
%if %0 >= 1
|
||||||
%xdefine cpuname %1
|
%rep %0
|
||||||
%assign cpuflags cpuflags_%1
|
%ifdef cpuname
|
||||||
%if %0 >= 2
|
%xdefine cpuname cpuname %+ _%1
|
||||||
%xdefine cpuname %1_%2
|
%else
|
||||||
%assign cpuflags cpuflags | cpuflags_%2
|
%xdefine cpuname %1
|
||||||
%endif
|
%endif
|
||||||
|
%assign cpuflags cpuflags | cpuflags_%1
|
||||||
|
%rotate 1
|
||||||
|
%endrep
|
||||||
%xdefine SUFFIX _ %+ cpuname
|
%xdefine SUFFIX _ %+ cpuname
|
||||||
|
|
||||||
%if cpuflag(avx)
|
%if cpuflag(avx)
|
||||||
%assign avx_enabled 1
|
%assign avx_enabled 1
|
||||||
%endif
|
%endif
|
||||||
@ -782,16 +786,15 @@ SECTION .note.GNU-stack noalloc noexec nowrite progbits
|
|||||||
%endif
|
%endif
|
||||||
%if cpuflag(aligned)
|
%if cpuflag(aligned)
|
||||||
%define movu mova
|
%define movu mova
|
||||||
%elifidn %1, sse3
|
%elif cpuflag(sse3) && notcpuflag(ssse3)
|
||||||
%define movu lddqu
|
%define movu lddqu
|
||||||
%endif
|
%endif
|
||||||
%if notcpuflag(sse2)
|
%endif
|
||||||
CPUNOP basicnop
|
|
||||||
%endif
|
%if cpuflag(sse2)
|
||||||
|
CPUNOP amdnop
|
||||||
%else
|
%else
|
||||||
%xdefine SUFFIX
|
CPUNOP basicnop
|
||||||
%undef cpuname
|
|
||||||
%undef cpuflags
|
|
||||||
%endif
|
%endif
|
||||||
%endmacro
|
%endmacro
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user