[x264-devel] x86inc: Remove argument from WIN64_RESTORE_XMM

Anton Mitrofanov git at videolan.org
Mon May 22 00:01:08 CEST 2017


x264 | branch: master | Anton Mitrofanov <BugMaster at narod.ru> | Sat May 20 21:17:59 2017 +0300| [3538df12688fc4408f585c4e65ee92d5a4737b2c] | committer: Henrik Gramner

x86inc: Remove argument from WIN64_RESTORE_XMM

The use of rsp was pretty much hardcoded there and probably didn't work
otherwise with stack_size > 0.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=3538df12688fc4408f585c4e65ee92d5a4737b2c
---

 common/x86/pixel-a.asm |  2 +-
 common/x86/x86inc.asm  | 19 ++++++++++---------
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/common/x86/pixel-a.asm b/common/x86/pixel-a.asm
index 0dfe61d6..42e0dd08 100644
--- a/common/x86/pixel-a.asm
+++ b/common/x86/pixel-a.asm
@@ -4867,7 +4867,7 @@ ASD8
     add     r6, 4*%1
     sub    r0d, 4*%1
     jg .loop
-    WIN64_RESTORE_XMM rsp
+    WIN64_RESTORE_XMM
 %if mmsize==32
     vzeroupper
 %endif
diff --git a/common/x86/x86inc.asm b/common/x86/x86inc.asm
index 65fb7933..ff8b5002 100644
--- a/common/x86/x86inc.asm
+++ b/common/x86/x86inc.asm
@@ -463,41 +463,42 @@ DECLARE_REG 14, R13, 120
     WIN64_PUSH_XMM
 %endmacro
 
-%macro WIN64_RESTORE_XMM_INTERNAL 1
+%macro WIN64_RESTORE_XMM_INTERNAL 0
     %assign %%pad_size 0
     %if xmm_regs_used > 8
         %assign %%i xmm_regs_used
         %rep xmm_regs_used-8
             %assign %%i %%i-1
-            movaps xmm %+ %%i, [%1 + (%%i-8)*16 + stack_size + 32]
+            movaps xmm %+ %%i, [rsp + (%%i-8)*16 + stack_size + 32]
         %endrep
     %endif
     %if stack_size_padded > 0
         %if stack_size > 0 && required_stack_alignment > STACK_ALIGNMENT
             mov rsp, rstkm
         %else
-            add %1, stack_size_padded
+            add rsp, stack_size_padded
             %assign %%pad_size stack_size_padded
         %endif
     %endif
     %if xmm_regs_used > 7
-        movaps xmm7, [%1 + stack_offset - %%pad_size + 24]
+        movaps xmm7, [rsp + stack_offset - %%pad_size + 24]
     %endif
     %if xmm_regs_used > 6
-        movaps xmm6, [%1 + stack_offset - %%pad_size +  8]
+        movaps xmm6, [rsp + stack_offset - %%pad_size +  8]
     %endif
 %endmacro
 
-%macro WIN64_RESTORE_XMM 1
-    WIN64_RESTORE_XMM_INTERNAL %1
+%macro WIN64_RESTORE_XMM 0
+    WIN64_RESTORE_XMM_INTERNAL
     %assign stack_offset (stack_offset-stack_size_padded)
+    %assign stack_size_padded 0
     %assign xmm_regs_used 0
 %endmacro
 
 %define has_epilogue regs_used > 7 || xmm_regs_used > 6 || mmsize == 32 || stack_size > 0
 
 %macro RET 0
-    WIN64_RESTORE_XMM_INTERNAL rsp
+    WIN64_RESTORE_XMM_INTERNAL
     POP_IF_USED 14, 13, 12, 11, 10, 9, 8, 7
     %if mmsize == 32
         vzeroupper
@@ -613,7 +614,7 @@ DECLARE_ARG 7, 8, 9, 10, 11, 12, 13, 14
 %if WIN64 == 0
     %macro WIN64_SPILL_XMM 1
     %endmacro
-    %macro WIN64_RESTORE_XMM 1
+    %macro WIN64_RESTORE_XMM 0
     %endmacro
     %macro WIN64_PUSH_XMM 0
     %endmacro



More information about the x264-devel mailing list