OSDN Git Service

x86: Move XOP emulation to x86util
authorJames Almer <jamrial@gmail.com>
Mon, 24 Feb 2014 05:34:38 +0000 (02:34 -0300)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 24 Feb 2014 07:30:19 +0000 (08:30 +0100)
We need the emulation to support the cases where the first
argument is the same as the fourth. To achieve this a fifth
argument working as a temporary may be needed.
Emulation that doesn't obey the original instruction semantics
can't be in x86inc.

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/x86/flacdsp.asm
libavutil/x86/x86inc.asm
libavutil/x86/x86util.asm

index 1a83cd8..37ee87b 100644 (file)
@@ -44,21 +44,21 @@ ALIGN 16
     test   jq, jq
     jz .end_order
 .loop_order:
-    pmacsdql m2, m0, m1, m2
+    PMACSDQL m2, m0, m1, m2, m0
     movd   m0, [decodedq+jq*4]
-    pmacsdql m3, m1, m0, m3
+    PMACSDQL m3, m1, m0, m3, m1
     movd   m1, [coeffsq+jq*4]
     inc    jq
     jl .loop_order
 .end_order:
-    pmacsdql m2, m0, m1, m2
+    PMACSDQL m2, m0, m1, m2, m0
     psrlq  m2, m4
     movd   m0, [decodedq]
     paddd  m0, m2
     movd   [decodedq], m0
     sub  lend, 2
     jl .ret
-    pmacsdql m3, m1, m0, m3
+    PMACSDQL m3, m1, m0, m3, m1
     psrlq  m3, m4
     movd   m1, [decodedq+4]
     paddd  m1, m3
index 88cae0c..a7f9f54 100644 (file)
@@ -1407,25 +1407,6 @@ AVX_INSTR pfmul, 1, 0, 1
 %undef i
 %undef j
 
-%macro FMA_INSTR 3
-    %macro %1 4-7 %1, %2, %3
-        %if cpuflag(xop)
-            v%5 %1, %2, %3, %4
-        %elifidn %1, %4
-            %6 %2, %3
-            %7 %1, %2
-        %else
-            %6 %1, %2, %3
-            %7 %1, %4
-        %endif
-    %endmacro
-%endmacro
-
-FMA_INSTR  pmacsdd,  pmulld, paddd
-FMA_INSTR  pmacsww,  pmullw, paddw
-FMA_INSTR pmacsdql,  pmuldq, paddq
-FMA_INSTR pmadcswd, pmaddwd, paddd
-
 ; tzcnt is equivalent to "rep bsf" and is backwards-compatible with bsf.
 ; This lets us use tzcnt without bumping the yasm version requirement yet.
 %define tzcnt rep bsf
index 59e5df2..df58cad 100644 (file)
 %endif
 %endmacro
 
+%macro PMA_EMU 4
+    %macro %1 5-8 %2, %3, %4
+        %if cpuflag(xop)
+            v%6 %1, %2, %3, %4
+        %elifidn %1, %4
+            %7 %5, %2, %3
+            %8 %1, %4, %5
+        %else
+            %7 %1, %2, %3
+            %8 %1, %4
+        %endif
+    %endmacro
+%endmacro
+
+PMA_EMU  PMACSWW,  pmacsww,  pmullw, paddw
+PMA_EMU  PMACSDD,  pmacsdd,  pmulld, paddd ; sse4 emulation
+PMA_EMU PMACSDQL, pmacsdql,  pmuldq, paddq ; sse4 emulation
+PMA_EMU PMADCSWD, pmadcswd, pmaddwd, paddd
+
 ; Wrapper for non-FMA version of fmaddps
 %macro FMULADD_PS 5
     %if cpuflag(fma3) || cpuflag(fma4)