<div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial"><div><br> </div>At 2014-10-17 13:03:42,"Praveen Tiwari" <praveen@multicorewareinc.com> wrote:<br> <blockquote id="isReplyContent" style="margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-style: 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: Fri, Oct 17, 2014 at 3:11 AM<br>Subject: Re: [x265] [PATCH] weight_pp avx2 asm code, improved from 8608.65 cycles to 5138.09 cycles over sse version of asm code<br>To: Development for x265 <<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a>><br><br><br><div><div style="color: rgb(0, 0, 0); line-height: 1.7; font-family: arial; font-size: 14px;"> </div><pre style="color: rgb(0, 0, 0); line-height: 1.7; font-family: arial; font-size: 14px;"><br>At 2014-10-16 17:20:13,<a href="mailto:praveen@multicorewareinc.com" target="_blank">praveen@multicorewareinc.com</a> wrote:
># HG changeset patch
># User Praveen Tiwari
># Date 1413451199 -19800
># Node ID 858be8d7d7176ab6c6d01cf92d00c8478fe99b34
># Parent  79702581ec824a2a375aebe228d69c3930aeea96
>weight_pp avx2 asm code, improved from 8608.65 cycles to 5138.09 cycles over sse version of asm code
>
>diff -r 79702581ec82 -r 858be8d7d717 source/common/x86/pixel-util8.asm
>--- a/source/common/x86/pixel-util8.asm        Wed Oct 15 17:49:35 2014 -0500
>+++ b/source/common/x86/pixel-util8.asm        Thu Oct 16 14:49:59 2014 +0530
>@@ -1375,6 +1375,60 @@

>     RET

>+INIT_YMM avx2
>+cglobal weight_pp, 6, 7, 6
>+
>+    mov          r6d, r6m
>+    shl          r6d, 6           ; m0 = [w0<<6] 
>+    movd         xm0, r6d
>+
>+    movd         xm1, r7m         ; m1 = [round]
>+    punpcklwd    xm0, xm1
>+    pshufd       xm0, xm0, 0 
>+    vinserti128  m0, m0, xm0, 1   ; assuming both (w0<<6) and round are using maximum of 16 bits each, m0 = [w0<<6 round]
</pre><pre style="color: rgb(0, 0, 0); line-height: 1.7; font-family: arial; font-size: 14px;">>>vpbroadcastd is better</pre><pre><font color="#000000" face="arial"><span style="line-height: 1.7; font-size: 14px;">Yeah, exactly I tried to replace  (pshufd xm0, xm0, 0) + (vinserti128  m0, m0, xm0, 1) with vpbroadcastd m0, xm0 (as per document syntax, </span></font><font color="#000066" style="color: rgb(0, 0, 0); line-height: 1.7; font-family: arial; font-size: 14px;">__m256i</font><span style="color: rgb(0, 0, 0); line-height: 1.7; font-family: arial; font-size: 14px;">  </span><font color="#000000" style="color: rgb(0, 0, 0); line-height: 1.7; font-family: arial; font-size: 14px;">_mm256_broadcastd_epi32</font><font color="#666666" style="color: rgb(0, 0, 0); line-height: 1.7; font-family: arial; font-size: 14px;"> 
            (</font><font color="#000066" style="color: rgb(0, 0, 0); line-height: 1.7; font-family: arial; font-size: 14px;">__m128i</font><span style="color: rgb(0, 0, 0); line-height: 1.7; font-family: arial; font-size: 14px;"> a</span><font color="#666666" style="color: rgb(0, 0, 0); line-height: 1.7; font-family: arial; font-size: 14px;">)</font><span style="color: rgb(0, 0, 0); line-height: 1.7; font-family: arial; font-size: 14px;">) but it throwing build </span><font color="#000000" face="arial"><span style="line-height: 23.79px; font-size: 14px;">error: invalid combination of opcode and operands.</span></font></pre><pre><font color="#000000" face="arial"><span style="line-height: 23.79px; font-size: 14px;">In Intel document, you can see "<span style="color: rgb(0, 0, 0); font-family: NeoSansIntel; font-size: 9pt; font-style: normal; font-variant: normal;">VPBROADCASTD <span style="color: rgb(0, 0, 0); font-family: NeoSansIntel,Italic; font-size: 9pt; font-style: normal; font-variant: normal;"><em>ymm1, xmm2/m32",</em><span style="line-height: 23.79px; font-size: 14px;"><font face="Arial"> It means you just write as "vpbroadcastd m0, xm0" or "vpbroadcastd m0, [r0]"</font></span></span></span></span></font></pre><pre><font color="#000000"><span style="line-height: 23.79px; font-size: 14px;"></span></font> </pre><span style="color: rgb(0, 0, 0); line-height: 1.7; font-family: arial; font-size: 14px;"><pre style="color: rgb(0, 0, 0); line-height: 1.7; font-family: arial; font-size: 14px;"> </pre><pre> </pre></span></div></div></div>
</blockquote></div>