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

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:

    SAVE_MM_PERMUTATION
    INIT_XMM <cpuflags>
    LOAD_MM_PERMUTATION
parent 8badb910
......@@ -1077,19 +1077,32 @@ INIT_XMM
%endif
%assign %%i 0
%rep num_mmregs
CAT_XDEFINE %%f, %%i, m %+ %%i
%xdefine %%tmp m %+ %%i
CAT_XDEFINE %%f, %%i, regnumof %+ %%tmp
%assign %%i %%i+1
%endrep
%endmacro
%macro LOAD_MM_PERMUTATION 1 ; name to load from
%ifdef %1_m0
%macro LOAD_MM_PERMUTATION 0-1 ; name to load from
%if %0
%xdefine %%f %1_m
%else
%xdefine %%f current_function %+ _m
%endif
%xdefine %%tmp %%f %+ 0
%ifnum %%tmp
RESET_MM_PERMUTATION
%assign %%i 0
%rep num_mmregs
CAT_XDEFINE m, %%i, %1_m %+ %%i
CAT_XDEFINE nn, m %+ %%i, %%i
%xdefine %%tmp %%f %+ %%i
CAT_XDEFINE %%m, %%i, m %+ %%tmp
%assign %%i %%i+1
%endrep
%rep num_mmregs
%assign %%i %%i-1
CAT_XDEFINE m, %%i, %%m %+ %%i
CAT_XDEFINE nn, m %+ %%i, %%i
%endrep
%endif
%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