Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
10 Views

SIMD Programming

I have a simd vector 4 class defined as:
[bash]		class svec4
		{
		public:
			//ALIGN(16)
			__declspec(align(16)) union{
				__m128 v;
				float f[4];
			};

			svec4()
			{
				v = _mm_setzero_ps();
			}
                 }
[/bash]
problem is the address of the variable v is not always aligned at 16 bytes and a memory exception error pops up. How can I make sure that the address assigned to a variable of type svec4 is always aligned at 16 bytes.
0 Kudos
3 Replies
Highlighted
10 Views

Which version of the Intel compiler are you using and which operating system?

I have tried it with icpc 12.0.0 on a Linux system, and it seems to work fine.
0 Kudos
Highlighted
Employee
10 Views

I would say no to intrinsic. It is beter to write suitable code so that compiler can generate SSE code. The code will be maintainable and portable.
0 Kudos
Highlighted
10 Views

Try adding the __declspec(align(16))to the class declararion as well.

Jim Dempsey
0 Kudos