- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
note that __attribute__((aligned(16))) only works for allocation on the stack. When you allocate a type defined with that attribute on the heap (i.e. new/malloc) then the alignment restriction of the attribute does not apply. Instead you should rather use _mm_malloc with the correct alignment parameter.
It is possible to overload the new and delete operators of the class to achieve the desired effect automatically:
void *operator new(size_t size) { return _mm_malloc(size, alignment); }
void *operator new[](size_t size) { return _mm_malloc(size, alignment); }
void operator delete(void *ptr, size_t) { _mm_free(ptr); }
void operator delete[](void *ptr, size_t) { _mm_free(ptr); }
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
could you please re-check your post?your question is somehow missing (or not displayed properly).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
can you share what typo have you find?
what compiler are you using and which platform? 64 or 32 bit?
what compiler options?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
note that __attribute__((aligned(16))) only works for allocation on the stack. When you allocate a type defined with that attribute on the heap (i.e. new/malloc) then the alignment restriction of the attribute does not apply. Instead you should rather use _mm_malloc with the correct alignment parameter.
It is possible to overload the new and delete operators of the class to achieve the desired effect automatically:
void *operator new(size_t size) { return _mm_malloc(size, alignment); }
void *operator new[](size_t size) { return _mm_malloc(size, alignment); }
void operator delete(void *ptr, size_t) { _mm_free(ptr); }
void operator delete[](void *ptr, size_t) { _mm_free(ptr); }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
_aligned_malloc / _aligned_free
to allocate aligned memory.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
quick solution : use
_mm_loadu_si128 / _mm_storeu_si128
to replase
_mm_load_si128 and _mm_store_si128
it should be pass.
(the __attribute__((aligned(16))) could be remove also.)

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page