Community
cancel
Showing results for 
Search instead for 
Did you mean: 
maeshiro_mi
Beginner
137 Views

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!

0 Kudos
5 Replies
Om_S_Intel
Employee
137 Views

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.

 

maeshiro_mi
Beginner
137 Views

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!

Bernard
Black Belt
137 Views

@maeshiro_mi

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

maeshiro_mi
Beginner
137 Views

Thanks iliyapolak.

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

Bernard
Black Belt
137 Views

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:)

Reply