- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
I have tried it with icpc 12.0.0 on a Linux system, and it seems to work fine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try adding the __declspec(align(16))to the class declararion as well.
Jim Dempsey
Jim Dempsey
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page