Intel® ISA Extensions
Use hardware-based isolation and memory encryption to provide more code protection in your solutions.

Pointer Arithmetic using Intel AVX2

Nicolai_B_
Beginner
564 Views

Hi,

is there an opportunity to operate on pointers in 256 bit AVX2 registers (e.g. incrementing, border check, masking operations) and load from pointer, stored in a vector register?

Thank you in advance!

Nicolai

0 Kudos
1 Solution
jimdempseyatthecove
Honored Contributor III
564 Views

Yes. Download the Intel(R) Intrinsics Guid and the appropriate ISA guide. (you will have to search for the link)

AVX2 (and earlier) support integer 32 and 64 formats. You may have a minor issue in that the compare instructions are signed. But you can program around this.

Jim Dempsey

View solution in original post

0 Kudos
2 Replies
jimdempseyatthecove
Honored Contributor III
565 Views

Yes. Download the Intel(R) Intrinsics Guid and the appropriate ISA guide. (you will have to search for the link)

AVX2 (and earlier) support integer 32 and 64 formats. You may have a minor issue in that the compare instructions are signed. But you can program around this.

Jim Dempsey

0 Kudos
andysem
New Contributor III
564 Views

You can operate on 32 and 64-bit integers in vector registers, and you can also use gather instructions which use vector registers as offsets relative to a pointer in a general purpose register. But you cannot use vector registers as pointers in instructions, and as such boundary checking extensions (i.e. MPX) do not apply. You have to move pointers between general purpose registers or memory and vector registers if you want to operate on them in vector fashion, and this adds a certain performance overhead. On the other hand, you can perform manual boundary checking on vector registers, so that could be beneficial.

 

0 Kudos
Reply