lib: clear scratch register macros should not clear xmm6-xmm15 on Windows
clear all zmms uses same optimization as clear scratch zmms
%endmacro
;
-; This macro clears all scratch GP registers
+; This macro clears scratch GP registers
; for Windows or Linux
;
%macro clear_scratch_gps_asm 0
%endmacro
;
-; This macro clears all scratch XMM registers on SSE
+; This macro clears scratch XMM registers on SSE
;
%macro clear_scratch_xmms_sse_asm 0
%ifdef LINUX
%endmacro
;
-; This macro clears all scratch XMM registers on AVX
+; This macro clears scratch XMM registers on AVX
;
%macro clear_scratch_xmms_avx_asm 0
%ifdef LINUX
vpxor xmm %+ i, xmm %+ i
%assign i (i+1)
%endrep
-; On Windows, XMM0-XMM5 registers are scratch registers
%else
+; On Windows, XMM0-XMM5 registers are scratch registers
%assign i 0
%rep 6
vpxor xmm %+ i, xmm %+ i
%endmacro
;
-; This macro clears all scratch YMM registers
+; This macro clears scratch YMM registers
;
; It should be called before restoring the XMM registers
; for Windows (XMM6-XMM15)
;
%macro clear_scratch_ymms_asm 0
+%ifdef LINUX
; On Linux, all YMM registers are scratch registers
vzeroall
+%else
+; On Windows, XMM0-XMM5 registers are scratch registers
+%assign i 0
+%rep 6
+ vpxor xmm %+ i, xmm %+ i
+%assign i (i+1)
+%endrep
+%endif ; LINUX
%endmacro
;
-; This macro clears all scratch ZMM registers
+; This macro clears scratch ZMM registers
;
; It should be called before restoring the XMM registers
; for Windows (XMM6-XMM15). YMM registers are used
; also the upper 256 bits
;
%macro clear_scratch_zmms_asm 0
+%ifdef LINUX
; On Linux, all ZMM registers are scratch registers
vpxorq xmm0, xmm0, xmm0
vpxorq xmm1, xmm1, xmm1
vmovdqa64 xmm %+ i, xmm %+ j
%assign i (i+1)
%endrep
+%else
+; On Windows, XMM0-XMM5 registers are scratch registers
+ vpxorq xmm0, xmm0, xmm0
+ vpxorq xmm1, xmm1, xmm1
+ vpxorq xmm2, xmm2, xmm2
+ vmovdqa64 xmm3, xmm0
+ vmovdqa64 xmm4, xmm1
+ vmovdqa64 xmm5, xmm2
+%assign i 16
+%rep 16
+%assign j (i % 3)
+ vmovdqa64 xmm %+ i, xmm %+ j
+%assign i (i+1)
+%endrep
+%endif ; LINUX
%endmacro
;
; also the upper 256 bits
;
%macro clear_all_zmms_asm 0
- vzeroall
-%assign i 16
-%rep 16
- vpxorq xmm %+ i, xmm %+ i
+ vpxorq xmm0, xmm0, xmm0
+ vpxorq xmm1, xmm1, xmm1
+ vpxorq xmm2, xmm2, xmm2
+%assign i 3
+%rep (16 + 13)
+%assign j (i % 3)
+ vmovdqa64 xmm %+ i, xmm %+ j
%assign i (i+1)
%endrep
%endmacro
