BMI2 intrinsics in gcc

Discussion of chess software programming and technical issues.

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
AlvaroBegue
Posts: 920
Joined: Tue Mar 09, 2010 2:46 pm
Location: New York
Full name: Álvaro Begué (RuyDos)

BMI2 intrinsics in gcc

Post by AlvaroBegue » Sun May 14, 2017 12:36 am

Hi,

I am trying to use the BMI2 instructions with gcc built-ins. According to the documentation I can find, there should be a function _pdep_u64 if I am compiling with -mbmi2, but whatever I try, the compiler complains that it doesn't know that function.

I have gcc version 5.3.0.

Any ideas?

Thanks!
Álvaro.

jwes
Posts: 778
Joined: Sat Jul 01, 2006 5:11 am

Re: BMI2 intrinsics in gcc

Post by jwes » Sun May 14, 2017 12:55 am

AlvaroBegue wrote:Hi,

I am trying to use the BMI2 instructions with gcc built-ins. According to the documentation I can find, there should be a function _pdep_u64 if I am compiling with -mbmi2, but whatever I try, the compiler complains that it doesn't know that function.

I have gcc version 5.3.0.

Any ideas?

Thanks!
Álvaro.
I am no gcc expert, but I can use _pdep_u64 . I compile on gcc 5.3 with
g++ -O3 -m64 -D _WIN32_WINNT=0x0600 -march=native -Wno-write-strings -Wno-narrowing

Did you #include <immintrin.h> ?

AlvaroBegue
Posts: 920
Joined: Tue Mar 09, 2010 2:46 pm
Location: New York
Full name: Álvaro Begué (RuyDos)

Re: BMI2 intrinsics in gcc

Post by AlvaroBegue » Sun May 14, 2017 1:08 am

jwes wrote: Did you #include <immintrin.h> ?
That was it. Thanks!

But why is that header file not mentioned in the documentation?

These would have been good places to put it:
https://gcc.gnu.org/onlinedocs/gcc-4.9. ... tions.html
https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html

ZirconiumX
Posts: 1327
Joined: Sun Jul 17, 2011 9:14 am

Re: BMI2 intrinsics in gcc

Post by ZirconiumX » Sun May 14, 2017 7:50 am

Because that header is an Intel-provided system header that would probably be in the glibc documentation. The intrinsics GCC uses on x86 are described here.
Some believe in the almighty dollar.

I believe in the almighty printf statement.

Post Reply