<?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 Re: Moving an XMM register to a less than 128 bit memory locati in Intel® Moderncode for Parallel Architectures</title>
    <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Moving-an-XMM-register-to-a-less-than-128-bit-memory-location/m-p/948748#M5145</link>
    <description>Thanks
&lt;DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Tue, 31 Jan 2006 06:39:13 GMT</pubDate>
    <dc:creator>soth</dc:creator>
    <dc:date>2006-01-31T06:39:13Z</dc:date>
    <item>
      <title>Moving an XMM register to a less than 128 bit memory location</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Moving-an-XMM-register-to-a-less-than-128-bit-memory-location/m-p/948746#M5143</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;&lt;SPAN class="msg_source_code"&gt;&lt;SPAN class="text_smallest"&gt;Code:&lt;/SPAN&gt;&lt;PRE&gt;class Vec3_SSE
{

	
public:

	union
	{
		 ALIGN16( float V[3] );
		struct
		{
		 float x,y,z;
		};
	};

	Vec3_SSE()
	{
		x=0.0f;
		y=0.0f;
		z=0.0f;		
	}

	Vec3_SSE(float _x,float _y,float _z)
	{
		x=_x;
		y=_y;
		z=_z;
	};

	
	inline float Normalize(void);//normalizes vector 3d
	};

/////////////////////////////////////////////////////////////////////////////////
float Vec3_SSE::Normalize(void)
{
	float d;
	

	__asm
	{
		mov	edi, this
		movaps	xmm0, [edi]
		movaps	xmm1, xmm0
		mulps	xmm1, xmm1
		haddps	xmm1, xmm1
		haddps	xmm1, xmm1
		sqrtps  xmm1, xmm1
		movss	d, xmm1
		rcpps	xmm1, xmm1
		mulps	xmm0, xmm1

		movaps	[edi], xmm0		//can this lead to memory overrun?

		
	}
	
	return d;
}&lt;/PRE&gt;&lt;/SPAN&gt;
&lt;DIV&gt;&lt;BR /&gt;&lt;BR /&gt;The question is :&lt;/DIV&gt;
&lt;DIV&gt;Can Iget memory corruption by movinga 128 bit register contents to a 96 bit memory location?&lt;/DIV&gt;
&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;At a first glance everything works fine.&lt;/DIV&gt;</description>
      <pubDate>Tue, 31 Jan 2006 04:39:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Moving-an-XMM-register-to-a-less-than-128-bit-memory-location/m-p/948746#M5143</guid>
      <dc:creator>soth</dc:creator>
      <dc:date>2006-01-31T04:39:42Z</dc:date>
    </item>
    <item>
      <title>Re: Moving an XMM register to a less than 128 bit memory locati</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Moving-an-XMM-register-to-a-less-than-128-bit-memory-location/m-p/948747#M5144</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;FONT face="Times New Roman" size="2"&gt;Dear Soth,&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT face="Times New Roman" size="2"&gt;What you are doing is not safe, even if it works most of the time. You should really use a structure with four float members.&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT face="Times New Roman" size="2"&gt;Aart Bik&lt;BR /&gt;&lt;/FONT&gt;&lt;A href="http://www.aartbik.com/" target="_blank"&gt;&lt;FONT face="Times New Roman" size="2"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;A href="http://www.aartbik.com/" target="_blank"&gt;http://www.aartbik.com/&lt;/A&gt;&lt;/P&gt;
&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 31 Jan 2006 05:33:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Moving-an-XMM-register-to-a-less-than-128-bit-memory-location/m-p/948747#M5144</guid>
      <dc:creator>Intel_C_Intel</dc:creator>
      <dc:date>2006-01-31T05:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: Moving an XMM register to a less than 128 bit memory locati</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Moving-an-XMM-register-to-a-less-than-128-bit-memory-location/m-p/948748#M5145</link>
      <description>Thanks
&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 31 Jan 2006 06:39:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Moving-an-XMM-register-to-a-less-than-128-bit-memory-location/m-p/948748#M5145</guid>
      <dc:creator>soth</dc:creator>
      <dc:date>2006-01-31T06:39:13Z</dc:date>
    </item>
  </channel>
</rss>

