Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Pourya_Shirazian
Beginner
86 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
Andreas_Klaedtke
Beginner
86 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.
Om_S_Intel
Employee
86 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.
jimdempseyatthecove
Black Belt
86 Views

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

Jim Dempsey
Reply