<div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial"><div> </div>
<div></div>
<div id="divNeteaseMailCard"></div>
<div><br></div>At 2015-02-06 17:23:23,"Praveen Tiwari" <praveen@multicorewareinc.com> wrote:<br>
<blockquote id="isReplyContent" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div dir="ltr"><br>
<div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">chen</b> <span dir="ltr"><<a href="mailto:chenm003@163.com">chenm003@163.com</a>></span><br>Date: Thu, Feb 5, 2015 at 5:55 PM<br>Subject: Re: [x265] [PATCH] blockcopy_pp_12x32: SSE2 asm code optimization<br>To: Development for x265 <<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a>><br><br><br>
<div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial"></div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial"></div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial">>>this code is right</div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial">>>but could you try use general register move (rN, rNd) in x64 mode?</div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial"><br></div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial">I applied your idea of using general register as buffer in x64 for 4x8 (easy to test with) but surprisingly using SIMD registers is faster. here I have the code and performance numbers:</div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial">copy_pp[ 4x8] 2.67x <b>139.98 </b> 374.18 [using <span style="LINE-HEIGHT: 23px">general register move (rN, rNd)</span><span style="LINE-HEIGHT: 1.7">] </span><span style="LINE-HEIGHT: 1.7"> </span></div>
<div><font face="arial" color="#000000"><span style="FONT-SIZE: 14px; LINE-HEIGHT: 23px">copy_pp[ 4x8] 3.34x <b>109.60 </b> 366.35 [SIMD registers as buffer]</span></font><br></div>
<div><font face="arial" color="#000000"><span style="FONT-SIZE: 14px; LINE-HEIGHT: 23px"><br></span></font></div>
<div><font face="arial" color="#000000"><span style="FONT-SIZE: 14px; LINE-HEIGHT: 23px">codes: </span></font><span style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 23px; FONT-FAMILY: arial">[using </span><span style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 23px; FONT-FAMILY: arial">general register move (rN, rNd)</span><span style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial">] </span><span style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial"> </span></div>
<div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial"> ;-----------------------------------------------------------------------------</div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial"><span class="" style="WHITE-SPACE: pre"></span>; void blockcopy_pp_4x8(pixel* dst, intptr_t dstStride, const pixel* src, intptr_t srcStride)</div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial"><span class="" style="WHITE-SPACE: pre"></span>;-----------------------------------------------------------------------------</div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial"><span class="" style="WHITE-SPACE: pre"></span>INIT_XMM sse2</div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial"><span class="" style="WHITE-SPACE: pre"></span>cglobal blockcopy_pp_4x8, 4, 10, 0</div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial"><span class="" style="WHITE-SPACE: pre"></span> </div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial"><span class="" style="WHITE-SPACE: pre"></span> lea r4, [3 * r1]</div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial"><span class="" style="WHITE-SPACE: pre"></span> lea r5, [3 * r3]</div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial"><span class="" style="WHITE-SPACE: pre"></span> </div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial"><span class="" style="WHITE-SPACE: pre"></span> mov r6d, [r2]</div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial"><span class="" style="WHITE-SPACE: pre"></span> mov r7d, [r2 + r3]</div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial"><span class="" style="WHITE-SPACE: pre"></span> mov r8d, [r2 + 2 * r3]</div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial"><span class="" style="WHITE-SPACE: pre"></span> mov r9d, [r2 + r5]</div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial"><span class="" style="WHITE-SPACE: pre"></span> </div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial"><span class="" style="WHITE-SPACE: pre"></span> mov [r0], r6d</div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial"><span class="" style="WHITE-SPACE: pre"></span> mov [r0 + r1], r7d</div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial"><span class="" style="WHITE-SPACE: pre"></span> mov [r0 + 2 * r1], r8d</div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial"><span class="" style="WHITE-SPACE: pre"></span> mov [r0 + r4], r9d</div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial"><span class="" style="WHITE-SPACE: pre"></span>it is slower because you use more register.</div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial">use below sequence:</div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial"> </div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial">mov r6d, [r2]</div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial">mov [r0], r6d</div>
<div style="FONT-SIZE: 14px; COLOR: rgb(0,0,0); LINE-HEIGHT: 1.7; FONT-FAMILY: arial"> </div></div></div></div></div></blockquote></div>