BMI2 intrinsics in gcc

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

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

BMI2 intrinsics in gcc

Post by AlvaroBegue »

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 7:11 am

Re: BMI2 intrinsics in gcc

Post by jwes »

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: 931
Joined: Tue Mar 09, 2010 3:46 pm
Location: New York
Full name: Álvaro Begué (RuyDos)

Re: BMI2 intrinsics in gcc

Post by AlvaroBegue »

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: 1334
Joined: Sun Jul 17, 2011 11:14 am

Re: BMI2 intrinsics in gcc

Post by ZirconiumX »

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.