[x265] [PATCH 17 of 20] x86inc: Enable AVX emulation in additional cases

vignesh at multicorewareinc.com vignesh at multicorewareinc.com
Mon Jun 12 07:37:59 CEST 2017


# HG changeset patch
# User Vignesh Vijayakumar
# Date 1496815420 -19800
#      Wed Jun 07 11:33:40 2017 +0530
# Node ID c9cc85dda7c070800ad4f86a9c9ba82300b275da
# Parent  d64adca2176b860242da335e3c8d19f77eb0559b
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`

diff -r d64adca2176b -r c9cc85dda7c0 source/common/x86/x86inc.asm
--- a/source/common/x86/x86inc.asm	Wed Jun 07 11:07:48 2017 +0530
+++ b/source/common/x86/x86inc.asm	Wed Jun 07 11:33:40 2017 +0530
@@ -1085,14 +1085,12 @@
     %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
-                %ifnid %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.
@@ -1100,6 +1098,13 @@
                     %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 x265-devel mailing list