[x265] [PATCH] blockcopy_pp_4x16 asm code optimization: eliminated branch instructions

praveen at multicorewareinc.com praveen at multicorewareinc.com
Thu Feb 5 11:51:21 CET 2015


# HG changeset patch
# User Praveen Tiwari
# Date 1423133470 -19800
# Node ID 7105ee079176c18464982fdc15ed0e0e05f5d015
# Parent  18edf28d3879454f940fced1e8f5b6cb81fe041f
blockcopy_pp_4x16 asm code optimization: eliminated branch instructions

diff -r 18edf28d3879 -r 7105ee079176 source/common/x86/blockcopy8.asm
--- a/source/common/x86/blockcopy8.asm	Thu Feb 05 16:05:46 2015 +0530
+++ b/source/common/x86/blockcopy8.asm	Thu Feb 05 16:21:10 2015 +0530
@@ -183,6 +183,40 @@
     RET
 
 ;-----------------------------------------------------------------------------
+; void blockcopy_pp_4x16(pixel* dst, intptr_t dstStride, const pixel* src, intptr_t srcStride)
+;-----------------------------------------------------------------------------
+INIT_XMM sse2
+cglobal blockcopy_pp_4x16, 4, 6, 4
+
+    lea     r4,    [3 * r1]
+    lea     r5,    [3 * r3]
+
+    movd     m0,     [r2]
+    movd     m1,     [r2 + r3]
+    movd     m2,     [r2 + 2 * r3]
+    movd     m3,     [r2 + r5]
+
+    movd     [r0],          m0
+    movd     [r0 + r1],     m1
+    movd     [r0 + 2 * r1], m2
+    movd     [r0 + r4],     m3
+
+%rep 3
+    lea      r2,     [r2 + 4 * r3]
+    movd     m0,     [r2]
+    movd     m1,     [r2 + r3]
+    movd     m2,     [r2 + 2 * r3]
+    movd     m3,     [r2 + r5]
+
+    lea      r0,            [r0 + 4 * r1]
+    movd     [r0],          m0
+    movd     [r0 + r1],     m1
+    movd     [r0 + 2 * r1], m2
+    movd     [r0 + r4],     m3
+%endrep
+    RET
+
+;-----------------------------------------------------------------------------
 ; void blockcopy_pp_%1x%2(pixel* dst, intptr_t dstStride, const pixel* src, intptr_t srcStride)
 ;-----------------------------------------------------------------------------
 %macro BLOCKCOPY_PP_W4_H8 2
@@ -223,7 +257,6 @@
     RET
 %endmacro
 
-BLOCKCOPY_PP_W4_H8 4, 16
 BLOCKCOPY_PP_W4_H8 4, 32
 
 ;-----------------------------------------------------------------------------


More information about the x265-devel mailing list