1

For CPUs that come with BMI2 instructions, one can use parallel bit deposit (pdep) and parallel bit extract (pext) with GCC using the builtin functions :

  • unsigned int _pdep_u32 (unsigned int, unsigned int)
  • unsigned int _pext_u32 (unsigned int, unsigned int)
  • unsigned long long _pdep_u64 (unsigned long long, unsigned long long)
  • unsigned long long _pext_u64 (unsigned long long, unsigned long long)

What are their equivalent on the Intel compiler ? And on clang ?

plasmacel
  • 8,183
  • 7
  • 53
  • 101
Vincent
  • 57,703
  • 61
  • 205
  • 388
  • You have an answer. You should accept it. https://stackoverflow.com/a/27371072/506073 – ahcox Apr 15 '19 at 18:00
  • Those *are* the Intel intrinsics, as documented by Intel. https://software.intel.com/sites/landingpage/IntrinsicsGuide/. Most compilers implement most of what Intel documents, including GCC and clang. – Peter Cordes Apr 04 '20 at 16:04

1 Answers1

3

Both, Intel and Clang provide the very same intrinsics.

ahcox
  • 9,349
  • 5
  • 33
  • 38
danielschemmel
  • 10,885
  • 1
  • 36
  • 58