Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- Software
- Software Development Technologies
- Intel® ISA Extensions
- Understanding Bitwise Intrinsics

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

YAkha

Student Ambassador

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-20-2017
02:43 AM

158 Views

Understanding Bitwise Intrinsics

Hello,

This is a very simple doubt, but I just started out with AVX512 ISA.

_mm512_xor_epi64 This intrinsic needs two _m512i data types, which i am let to believe are packed with 8 int64 values each. And this command will return a _m512i data type containing 8 integers which are the result of the bitwise logical XOR operation between each of the 8 integers.

For instance, if the _m512i **A** data type is packed with (2,1,4,5,2,2,3,1) int64 values, and **B **_m512i is packed with (4,2,1,3,5,2,1,3).

Then running _mm512_xor_epi64(A, B) will** return a pointer to a _m512i data type** which contains (xor(2,4), xor(1,2), xor(4,1), xor(5,3), xor(2, 5), xor(2, 2), xor(3, 1), xor(1,3)). Where xor() is the bitwise XOR of the binary form of 2 and 4, isnt it?

Does extern __m512i __cdecl _mm512_load_epi64(void const* mt); Does this allow me to pack an allocated array of 8 int64 values into a _m512i data type, provided * mt is the pointer to such an array?

**Is there an intrinsic to unpack such values**? Would really appreciate some help in the right direction.

1 Solution

andysem

New Contributor III

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-20-2017
03:40 PM

158 Views

Then running _mm512_xor_epi64(A, B) will

return a pointer to a _m512i data type

No, it will return the vector by value.

which contains (xor(2,4), xor(1,2), xor(4,1), xor(5,3), xor(2, 5), xor(2, 2), xor(3, 1), xor(1,3)). Where xor() is the bitwise XOR of the binary form of 2 and 4, isnt it?

That's right.

Does extern __m512i __cdecl _mm512_load_epi64(void const* mt); Does this allow me to pack an allocated array of 8 int64 values into a _m512i data type, provided * mt is the pointer to such an array?

The _mm512_load_epi64 intrinsic loads a vector from aligned memory. "Packing" is not the right term because there are a number of pack/unpack intrinsics which operate differently.

Is there an intrinsic to unpack such values?

Assuming you want to extract elements of a vector, there are a number of extract intrinsics (https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=extract). Depending on the circumstances, there might be other ways, like storing the vector to memory first or shuffling the elements (https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=shuffle) and then extracting the lowest element (https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=cvt&expand=1810&techs=SSE,SSE2).

Link Copied

1 Reply

andysem

New Contributor III

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-20-2017
03:40 PM

159 Views

Then running _mm512_xor_epi64(A, B) will

return a pointer to a _m512i data type

No, it will return the vector by value.

which contains (xor(2,4), xor(1,2), xor(4,1), xor(5,3), xor(2, 5), xor(2, 2), xor(3, 1), xor(1,3)). Where xor() is the bitwise XOR of the binary form of 2 and 4, isnt it?

That's right.

Does extern __m512i __cdecl _mm512_load_epi64(void const* mt); Does this allow me to pack an allocated array of 8 int64 values into a _m512i data type, provided * mt is the pointer to such an array?

The _mm512_load_epi64 intrinsic loads a vector from aligned memory. "Packing" is not the right term because there are a number of pack/unpack intrinsics which operate differently.

Is there an intrinsic to unpack such values?

Assuming you want to extract elements of a vector, there are a number of extract intrinsics (https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=extract). Depending on the circumstances, there might be other ways, like storing the vector to memory first or shuffling the elements (https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=shuffle) and then extracting the lowest element (https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=cvt&expand=1810&techs=SSE,SSE2).

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

For more complete information about compiler optimizations, see our Optimization Notice.