<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic constants in SIMD inline assembly in Intel® ISA Extensions</title>
    <link>https://community.intel.com/t5/Intel-ISA-Extensions/constants-in-SIMD-inline-assembly/m-p/797665#M565</link>
    <description>how do i add a constant toeach elementin an array?see snipet codes&lt;BR /&gt;&lt;BR /&gt;&lt;P&gt;#include "stdafx.h"&lt;/P&gt;&lt;P&gt;#include &lt;IOSTREAM&gt;&lt;/IOSTREAM&gt;&lt;/P&gt;&lt;P&gt;#include &lt;IOMANIP&gt;&lt;/IOMANIP&gt;&lt;/P&gt;&lt;P&gt;#include "xmmintrin.h"&lt;/P&gt;&lt;P&gt;using namespace std;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int _tmain(int argc, _TCHAR* argv[])&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;int x[4][4]={1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4}; //source or input&lt;/P&gt;&lt;P&gt;int y[4][4];//destination or output&lt;/P&gt;&lt;P&gt;int b[4] ={5,5,5,5};// constants to be added&lt;/P&gt;&lt;P&gt;int f0,f1,f2,f3;&lt;/P&gt;&lt;P&gt;__asm&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;mov eax,x&lt;/P&gt;&lt;P&gt;mov ecx,b&lt;/P&gt;&lt;P&gt;mov edi,y&lt;/P&gt;&lt;P&gt;//stage one&lt;/P&gt;&lt;P&gt;movq mm0,[eax]&lt;/P&gt;&lt;P&gt;movq mm7,[ecx]&lt;/P&gt;&lt;P&gt;paddw mm0,mm7&lt;/P&gt;&lt;P&gt;movq [f0],mm0&lt;/P&gt;&lt;P&gt;movq mm1,[eax+8]&lt;/P&gt;&lt;P&gt;paddw mm1,mm7&lt;/P&gt;&lt;P&gt;movq [f1],mm1&lt;/P&gt;&lt;P&gt;movq mm2,[eax+16]&lt;/P&gt;&lt;P&gt;paddw mm2,mm7&lt;/P&gt;&lt;P&gt;movq [f2],mm2&lt;/P&gt;&lt;P&gt;movq mm3,[eax+24]&lt;/P&gt;&lt;P&gt;paddw mm3,mm7&lt;/P&gt;&lt;P&gt;movq [f3],mm3&lt;/P&gt;&lt;P&gt;//stage two&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;movq mm0,[f0]&lt;/P&gt;&lt;P&gt;psraw mm0,6&lt;/P&gt;&lt;P&gt;movq [edi],mm0&lt;/P&gt;&lt;P&gt;movq mm1,[f1]&lt;/P&gt;&lt;P&gt;psraw mm1,6&lt;/P&gt;&lt;P&gt;movq [edi+8],mm1&lt;/P&gt;&lt;P&gt;movq mm2,[f2]&lt;/P&gt;&lt;P&gt;psraw mm2,6&lt;/P&gt;&lt;P&gt;movq [edi+16],mm2&lt;/P&gt;&lt;P&gt;movq mm3,[f3]&lt;/P&gt;&lt;P&gt;psraw mm3,6&lt;/P&gt;&lt;P&gt;movq [edi+24],mm3&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;for (int i = 0; i &amp;lt; 4; i++)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;for (int j = 0; j &amp;lt; 4; j++)&lt;/P&gt;&lt;P&gt;cout &amp;lt;&amp;lt; y&lt;I&gt;&lt;J&gt; &amp;lt;&amp;lt; " ";&lt;/J&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;cout &amp;lt;&amp;lt; endl;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;return 0;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
    <pubDate>Sun, 20 Feb 2011 11:05:27 GMT</pubDate>
    <dc:creator>Smart_Lubobya</dc:creator>
    <dc:date>2011-02-20T11:05:27Z</dc:date>
    <item>
      <title>constants in SIMD inline assembly</title>
      <link>https://community.intel.com/t5/Intel-ISA-Extensions/constants-in-SIMD-inline-assembly/m-p/797665#M565</link>
      <description>how do i add a constant toeach elementin an array?see snipet codes&lt;BR /&gt;&lt;BR /&gt;&lt;P&gt;#include "stdafx.h"&lt;/P&gt;&lt;P&gt;#include &lt;IOSTREAM&gt;&lt;/IOSTREAM&gt;&lt;/P&gt;&lt;P&gt;#include &lt;IOMANIP&gt;&lt;/IOMANIP&gt;&lt;/P&gt;&lt;P&gt;#include "xmmintrin.h"&lt;/P&gt;&lt;P&gt;using namespace std;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;int _tmain(int argc, _TCHAR* argv[])&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;int x[4][4]={1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4}; //source or input&lt;/P&gt;&lt;P&gt;int y[4][4];//destination or output&lt;/P&gt;&lt;P&gt;int b[4] ={5,5,5,5};// constants to be added&lt;/P&gt;&lt;P&gt;int f0,f1,f2,f3;&lt;/P&gt;&lt;P&gt;__asm&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;mov eax,x&lt;/P&gt;&lt;P&gt;mov ecx,b&lt;/P&gt;&lt;P&gt;mov edi,y&lt;/P&gt;&lt;P&gt;//stage one&lt;/P&gt;&lt;P&gt;movq mm0,[eax]&lt;/P&gt;&lt;P&gt;movq mm7,[ecx]&lt;/P&gt;&lt;P&gt;paddw mm0,mm7&lt;/P&gt;&lt;P&gt;movq [f0],mm0&lt;/P&gt;&lt;P&gt;movq mm1,[eax+8]&lt;/P&gt;&lt;P&gt;paddw mm1,mm7&lt;/P&gt;&lt;P&gt;movq [f1],mm1&lt;/P&gt;&lt;P&gt;movq mm2,[eax+16]&lt;/P&gt;&lt;P&gt;paddw mm2,mm7&lt;/P&gt;&lt;P&gt;movq [f2],mm2&lt;/P&gt;&lt;P&gt;movq mm3,[eax+24]&lt;/P&gt;&lt;P&gt;paddw mm3,mm7&lt;/P&gt;&lt;P&gt;movq [f3],mm3&lt;/P&gt;&lt;P&gt;//stage two&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;movq mm0,[f0]&lt;/P&gt;&lt;P&gt;psraw mm0,6&lt;/P&gt;&lt;P&gt;movq [edi],mm0&lt;/P&gt;&lt;P&gt;movq mm1,[f1]&lt;/P&gt;&lt;P&gt;psraw mm1,6&lt;/P&gt;&lt;P&gt;movq [edi+8],mm1&lt;/P&gt;&lt;P&gt;movq mm2,[f2]&lt;/P&gt;&lt;P&gt;psraw mm2,6&lt;/P&gt;&lt;P&gt;movq [edi+16],mm2&lt;/P&gt;&lt;P&gt;movq mm3,[f3]&lt;/P&gt;&lt;P&gt;psraw mm3,6&lt;/P&gt;&lt;P&gt;movq [edi+24],mm3&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;for (int i = 0; i &amp;lt; 4; i++)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;for (int j = 0; j &amp;lt; 4; j++)&lt;/P&gt;&lt;P&gt;cout &amp;lt;&amp;lt; y&lt;I&gt;&lt;J&gt; &amp;lt;&amp;lt; " ";&lt;/J&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;cout &amp;lt;&amp;lt; endl;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;return 0;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
      <pubDate>Sun, 20 Feb 2011 11:05:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-ISA-Extensions/constants-in-SIMD-inline-assembly/m-p/797665#M565</guid>
      <dc:creator>Smart_Lubobya</dc:creator>
      <dc:date>2011-02-20T11:05:27Z</dc:date>
    </item>
    <item>
      <title>constants in SIMD inline assembly</title>
      <link>https://community.intel.com/t5/Intel-ISA-Extensions/constants-in-SIMD-inline-assembly/m-p/797666#M566</link>
      <description>Hello, I suggest you to use SSE2 with 128-bit XMM registers instead of ancient 64-bit MMX (mm0-mm7),try using intrinsics instead of assembly (e.g. you will need _mm_add_epi32() in your case) to minimize efforts or use compiler, like Intel C/C++ Compiler,which can easily auto-vectorize such constructs.I'm not sure I understand what the snippet shown is trying to achieve ... but please note that type 'int' is 32-bit, i.e. requires 4-byteof mem,and PADDD instruction to add.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;-Max</description>
      <pubDate>Tue, 08 Mar 2011 08:18:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-ISA-Extensions/constants-in-SIMD-inline-assembly/m-p/797666#M566</guid>
      <dc:creator>Max_L</dc:creator>
      <dc:date>2011-03-08T08:18:49Z</dc:date>
    </item>
  </channel>
</rss>

