[x265] [PATCH] blockfill_s_16x16 sse2 asm code optimization

chen chenm003 at 163.com
Mon Feb 2 12:51:26 CET 2015


this version is good.
of course, you may use %rep to reduce text lines, don't need modify, just for future

At 2015-02-02 19:48:10,praveen at multicorewareinc.com wrote:
># HG changeset patch
># User Praveen Tiwari
># Date 1422877414 -19800
># Branch stable
># Node ID 8d03acd70332ccf642fc7222bf6f9e7f005983ba
># Parent  8e1f8ca9d4112d8ad9801bf79518482306ff55ce
>blockfill_s_16x16 sse2 asm code optimization
>
>eliminated branch instructions and optimized LEA instruction
>
>diff -r 8e1f8ca9d411 -r 8d03acd70332 source/common/x86/blockcopy8.asm
>--- a/source/common/x86/blockcopy8.asm Mon Feb 02 17:03:40 2015 +0530
>+++ b/source/common/x86/blockcopy8.asm Mon Feb 02 17:13:34 2015 +0530
>@@ -1771,57 +1771,58 @@
> RET
> 
> ;-----------------------------------------------------------------------------
>-; void blockfill_s_%1x%2(int16_t* dst, intptr_t dstride, int16_t val)
>+; void blockfill_s_16x16(int16_t* dst, intptr_t dstride, int16_t val)
> ;-----------------------------------------------------------------------------
>-%macro BLOCKFILL_S_W16_H8 2
> INIT_XMM sse2
>-cglobal blockfill_s_%1x%2, 3, 5, 1, dst, dstStride, val
>-
>-mov        r3d,           %2/8
>+cglobal blockfill_s_16x16, 3, 4, 1, dst, dstStride, val
> 
> add        r1,            r1
>+lea        r3,            [3 * r1]
> 
> movd       m0,            r2d
>-pshuflw    m0,            m0,       0
>-pshufd     m0,            m0,       0
>-
>-.loop:
>-     movu       [r0],               m0
>-     movu       [r0 + 16],          m0
>-
>-     movu       [r0 + r1],          m0
>-     movu       [r0 + r1 + 16],     m0
>-
>-     movu       [r0 + 2 * r1],      m0
>-     movu       [r0 + 2 * r1 + 16], m0
>-
>-     lea        r4,                 [r0 + 2 * r1]
>-     movu       [r4 + r1],          m0
>-     movu       [r4 + r1 + 16],     m0
>-
>-     movu       [r0 + 4 * r1],      m0
>-     movu       [r0 + 4 * r1 + 16], m0
>-
>-     lea        r4,                 [r0 + 4 * r1]
>-     movu       [r4 + r1],          m0
>-     movu       [r4 + r1 + 16],     m0
>-
>-     movu       [r4 + 2 * r1],      m0
>-     movu       [r4 + 2 * r1 + 16], m0
>-
>-     lea        r4,                 [r4 + 2 * r1]
>-     movu       [r4 + r1],          m0
>-     movu       [r4 + r1 + 16],     m0
>-
>-     lea        r0,                 [r0 + 8 * r1]
>-
>-     dec        r3d
>-     jnz        .loop
>-
>+pshuflw    m0,            m0,         0
>+pshufd     m0,            m0,         0
>+
>+movu       [r0],           m0
>+movu       [r0 + 16],      m0
>+movu       [r0 + r1],      m0
>+movu       [r0 + r1 + 16], m0
>+movu       [r0 + 2 * r1],  m0
>+movu       [r0 + 2 * r1 + 16], m0
>+
>+movu       [r0 + r3],          m0
>+movu       [r0 + r3 + 16],     m0
>+lea        r0,                 [r0 + 4 * r1]
>+movu       [r0],               m0
>+movu       [r0 + 16],          m0
>+
>+movu       [r0 + r1],          m0
>+movu       [r0 + r1 + 16],     m0
>+movu       [r0 + 2 * r1],      m0
>+movu       [r0 + 2 * r1 + 16], m0
>+movu       [r0 + r3],          m0
>+movu       [r0 + r3 + 16],     m0
>+lea        r0,                 [r0 + 4 * r1]
>+movu       [r0],               m0
>+movu       [r0 + 16],          m0
>+
>+movu       [r0 + r1],          m0
>+movu       [r0 + r1 + 16],     m0
>+movu       [r0 + 2 * r1],      m0
>+movu       [r0 + 2 * r1 + 16], m0
>+movu       [r0 + r3],          m0
>+movu       [r0 + r3 + 16],     m0
>+lea        r0,                 [r0 + 4 * r1]
>+movu       [r0],               m0
>+movu       [r0 + 16],          m0
>+
>+movu       [r0 + r1],          m0
>+movu       [r0 + r1 + 16],     m0
>+movu       [r0 + 2 * r1],      m0
>+movu       [r0 + 2 * r1 + 16], m0
>+movu       [r0 + r3],          m0
>+movu       [r0 + r3 + 16],     m0
> RET
>-%endmacro
>-
>-BLOCKFILL_S_W16_H8 16, 16
> 
> INIT_YMM avx2
> cglobal blockfill_s_16x16, 3, 4, 1
>_______________________________________________
>x265-devel mailing list
>x265-devel at videolan.org
>https://mailman.videolan.org/listinfo/x265-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20150202/48556662/attachment-0001.html>


More information about the x265-devel mailing list