AVX intrinsics with uin8_t and uint32_t

AVX intrinsics with uin8_t and uint32_t

Hi, all. I'm new with intrinsics and your help would be very appreciated.

I want to vectorize some std::vectors processing and my question is, how can I add(or subtract)  std::vector<uint8_t> and std::vector<uint32_t>?

Thanks in advance!

6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

The data types need to be of the same type. Also data access must be done using single stride for vectorization. These condition will not be met in your case.

 

Thanks om-sachan.

The Auto-Vectorizer is able to vectorize this for loop, right?

std::vector<uint8_t> vec1;
vec1.resize(8192);
std::vector<uint32_t> vec2;
vec2.resize(8192);

for (int i = 0; i < 8192; i++) {
  vec2 += vec1;
}

So I thought I could code it with intrinsics to start learning.

Thanks again om-sachan!

@maeshiro_mi

Run your code and inspect disassembly you should see vmovaps(d) and vaddps(d) instructions or their integer counterparts.

Thanks iliyapolak.

I found very interesting checking assembly and converting it to intrinsics.

Quote:

maeshiro_mi wrote:

Thanks iliyapolak.

I found very interesting checking assembly and converting it to intrinsics.

I must admit that I am doing the same:)

Leave a Comment

Please sign in to add a comment. Not a member? Join today