[x264-devel] x86inc: Enable AVX emulation in additional cases

Anton Mitrofanov git at videolan.org
Tue Apr 12 20:36:17 CEST 2016


x264 | branch: master | Anton Mitrofanov <BugMaster at narod.ru> | Thu Apr  7 13:09:03 2016 +0300| [be677efc6313ade5eddf722fdf097cce56df1344] | committer: Henrik Gramner

x86inc: Enable AVX emulation in additional cases

Allows emulation to work when dst is equal to src2 as long as the
instruction is commutative, e.g. `addps m0, m1, m0`.

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

 common/x86/x86inc.asm |   21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/common/x86/x86inc.asm b/common/x86/x86inc.asm
index 2313404..ff150f1 100644
--- a/common/x86/x86inc.asm
+++ b/common/x86/x86inc.asm
@@ -1124,14 +1124,12 @@ INIT_XMM
     %if __emulate_avx
         %xdefine __src1 %7
         %xdefine __src2 %8
-        %ifnidn %6, %7
-            %if %0 >= 9
-                CHECK_AVX_INSTR_EMU {%1 %6, %7, %8, %9}, %6, %8, %9
-            %else
-                CHECK_AVX_INSTR_EMU {%1 %6, %7, %8}, %6, %8
-            %endif
-            %if %5 && %4 == 0
-                %ifnnum sizeof%8
+        %if %5 && %4 == 0
+            %ifnidn %6, %7
+                %ifidn %6, %8
+                    %xdefine __src1 %8
+                    %xdefine __src2 %7
+                %elifnnum sizeof%8
                     ; 3-operand AVX instructions with a memory arg can only have it in src2,
                     ; whereas SSE emulation prefers to have it in src1 (i.e. the mov).
                     ; So, if the instruction is commutative with a memory arg, swap them.
@@ -1139,6 +1137,13 @@ INIT_XMM
                     %xdefine __src2 %7
                 %endif
             %endif
+        %endif
+        %ifnidn %6, __src1
+            %if %0 >= 9
+                CHECK_AVX_INSTR_EMU {%1 %6, %7, %8, %9}, %6, __src2, %9
+            %else
+                CHECK_AVX_INSTR_EMU {%1 %6, %7, %8}, %6, __src2
+            %endif
             %if __sizeofreg == 8
                 MOVQ %6, __src1
             %elif %3



More information about the x264-devel mailing list