[XviD-devel] [PATCH]: remove redundant asm in calc_cbp_sse2

Mat Hostetter mat at curl.com
Sun Apr 18 03:56:09 CEST 2004


The LOOP_SSE2 macro ends with "test ecx, ecx", but each caller
of the macro does the same test again.  So if you disassemble
calc_cbp_sse2, you'll see a bunch of instances of this:

  50:   85 c9                   test   %ecx,%ecx
  52:   85 c9                   test   %ecx,%ecx
  54:   74 05                   je     5b <calc_cbp_sse2.blk2>

This trivial patch just deletes the redundant instructions.


--- src/bitstream/x86_asm/cbp_sse2.asm~	2004-04-04 16:35:53.000000000 -0400
+++ src/bitstream/x86_asm/cbp_sse2.asm	2004-04-17 21:38:20.000000000 -0400
@@ -93,37 +93,31 @@
   pxor xmm6, xmm6          ; zero
 
   LOOP_SSE2 0
-  test ecx, ecx
   jz .blk2
   or eax, (1<<5)
 
 .blk2
   LOOP_SSE2 1
-  test ecx, ecx
   jz .blk3
   or eax, (1<<4)
 
 .blk3
   LOOP_SSE2 2
-  test ecx, ecx
   jz .blk4
   or eax, (1<<3)
 
 .blk4
   LOOP_SSE2 3
-  test ecx, ecx
   jz .blk5
   or eax, (1<<2)
 
 .blk5
   LOOP_SSE2 4
-  test ecx, ecx
   jz .blk6
   or eax, (1<<1)
 
 .blk6
   LOOP_SSE2 5
-  test ecx, ecx
   jz .finished
   or eax, (1<<0)
 


More information about the XviD-devel mailing list