[libav-devel] [PATCH 5/5] x86: h264: Ensure that the cmov instruction is not issued on i586 processors.

Diego Biurrun diego at biurrun.de
Fri May 11 16:58:52 CEST 2012


From: Michael Kostylev <michael.kostylev at gmail.com>

---
 libavcodec/x86/h264_idct.asm      |    2 +-
 libavcodec/x86/h264_intrapred.asm |   12 ++++++------
 libavutil/x86/x86util.asm         |   22 ++++++++++++++++++++++
 3 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/libavcodec/x86/h264_idct.asm b/libavcodec/x86/h264_idct.asm
index cc83806..d3d644c 100644
--- a/libavcodec/x86/h264_idct.asm
+++ b/libavcodec/x86/h264_idct.asm
@@ -994,7 +994,7 @@ cglobal h264_luma_dc_dequant_idct_%1, 3,4,%2
     add        t3d, 128 << 16
     mov        t1d, 7
     cmp        t0d, t1d
-    cmovg      t0d, t1d
+    CMOVG      t0d, t1d
     inc        t1d
     shr        t3d, t0b
     sub        t1d, t0d
diff --git a/libavcodec/x86/h264_intrapred.asm b/libavcodec/x86/h264_intrapred.asm
index a09eb03..49ea804 100644
--- a/libavcodec/x86/h264_intrapred.asm
+++ b/libavcodec/x86/h264_intrapred.asm
@@ -433,12 +433,12 @@ cglobal pred16x16_plane_%3_%1, 2, 9, %2
 %elifidn %3, svq3
     test         r5, r5
     lea          r6, [r5+3]
-    cmovs        r5, r6
+    CMOVS        r5, r6
     sar          r5, 2            ; V/4
     lea          r5, [r5*5]       ; 5*(V/4)
     test         r5, r5
     lea          r6, [r5+15]
-    cmovs        r5, r6
+    CMOVS        r5, r6
     sar          r5, 4            ; (5*(V/4))/16
 %endif
 
@@ -459,12 +459,12 @@ cglobal pred16x16_plane_%3_%1, 2, 9, %2
 %else ; svq3
     test        r1d, r1d
     lea         r4d, [r1d+3]
-    cmovs       r1d, r4d
+    CMOVS       r1d, r4d
     sar         r1d, 2           ; H/4
     lea         r1d, [r1d*5]     ; 5*(H/4)
     test        r1d, r1d
     lea         r4d, [r1d+15]
-    cmovs       r1d, r4d
+    CMOVS       r1d, r4d
     sar         r1d, 4           ; (5*(H/4))/16
 %endif
     movd         m0, r1d
@@ -1248,7 +1248,7 @@ cglobal pred8x8l_horizontal_%1, 4,4
     movq        mm0, [r0+r3*1-8]
     test         r1, r1
     lea          r1, [r0+r3]
-    cmovnz       r1, r0
+    CMOVNZ       r1, r0
     punpckhbw   mm0, [r1+r3*0-8]
     movq        mm1, [r2+r3*1-8]
     punpckhbw   mm1, [r0+r3*2-8]
@@ -2149,7 +2149,7 @@ cglobal pred8x8l_horizontal_up_%1, 4,4
     movq        mm0, [r0+r3*1-8]
     test         r1, r1
     lea          r1, [r0+r3]
-    cmovnz       r1, r0
+    CMOVNZ       r1, r0
     punpckhbw   mm0, [r1+r3*0-8]
     movq        mm1, [r2+r3*1-8]
     punpckhbw   mm1, [r0+r3*2-8]
diff --git a/libavutil/x86/x86util.asm b/libavutil/x86/x86util.asm
index 508f24e..59bdacc 100644
--- a/libavutil/x86/x86util.asm
+++ b/libavutil/x86/x86util.asm
@@ -593,3 +593,25 @@
     shufps       %1, %1, 0
 %endif
 %endmacro
+
+%macro CMOV 3
+%if HAVE_CMOV
+  cmov%+1 %2, %3
+%else
+  j%-1 %%label
+  mov %2, %3
+  %%label:
+%endif
+%endmacro
+
+%macro CMOVG 2
+  CMOV g, %1, %2
+%endmacro
+
+%macro CMOVS 2
+  CMOV s, %1, %2
+%endmacro
+
+%macro CMOVNZ 2
+  CMOV nz, %1, %2
+%endmacro
-- 
1.7.2.5



More information about the libav-devel mailing list