Commit 28e48798 authored by Henrik Gramner's avatar Henrik Gramner
Browse files

x86inc: Improve SAVE/LOAD_MM_PERMUTATION macros

Use register numbers instead of copying the full register names. This makes it
possible to change register widths in the middle of a function and keep the
mmreg permutations intact which can be useful for code that only needs larger
vectors for parts of the function in combination with macros etc.

Also change the LOAD_MM_PERMUTATION macro to use the same default name as the
SAVE macro. This simplifies swapping from ymm to xmm registers or vice versa:

    INIT_XMM <cpuflags>
parent 8badb910
...@@ -1077,19 +1077,32 @@ INIT_XMM ...@@ -1077,19 +1077,32 @@ INIT_XMM
%endif %endif
%assign %%i 0 %assign %%i 0
%rep num_mmregs %rep num_mmregs
CAT_XDEFINE %%f, %%i, m %+ %%i %xdefine %%tmp m %+ %%i
CAT_XDEFINE %%f, %%i, regnumof %+ %%tmp
%assign %%i %%i+1 %assign %%i %%i+1
%endrep %endrep
%endmacro %endmacro
%macro LOAD_MM_PERMUTATION 1 ; name to load from %macro LOAD_MM_PERMUTATION 0-1 ; name to load from
%ifdef %1_m0 %if %0
%xdefine %%f %1_m
%xdefine %%f current_function %+ _m
%xdefine %%tmp %%f %+ 0
%ifnum %%tmp
%assign %%i 0 %assign %%i 0
%rep num_mmregs %rep num_mmregs
CAT_XDEFINE m, %%i, %1_m %+ %%i %xdefine %%tmp %%f %+ %%i
CAT_XDEFINE nn, m %+ %%i, %%i CAT_XDEFINE %%m, %%i, m %+ %%tmp
%assign %%i %%i+1 %assign %%i %%i+1
%endrep %endrep
%rep num_mmregs
%assign %%i %%i-1
CAT_XDEFINE m, %%i, %%m %+ %%i
CAT_XDEFINE nn, m %+ %%i, %%i
%endif %endif
%endmacro %endmacro
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment