Quantcast
Channel: Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1616

__assume_aligned(x) in a for loop

$
0
0
#   define MY_ALIGNED_MEMORY_ALIGN  sizeof(__m256)  /* _mm_malloc align [bytes] */
#   define MY_ASSUME_ALIGNED(x)     __assume_aligned((x),MY_ALIGNED_MEMORY_ALIGN)

for(auto& i1:packets) {
        MY_ASSUME_ALIGNED(i1.left);
        MY_ASSUME_ALIGNED(i1.right);
    }

"packets" is std::vector<> of structure with "left" and "right" float pointers, suitable for vectorization.

Isn't this give an overhead for this "for" loop when I just only want to give compiler a hint that pointers are aligned?


Viewing all articles
Browse latest Browse all 1616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>