Bug 57624 - BZHI instrinsic is missing
Summary: BZHI instrinsic is missing
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.8.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-15 14:33 UTC by Steinar H. Gunderson
Modified: 2013-06-27 11:23 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steinar H. Gunderson 2013-06-15 14:33:23 UTC
Hi,

The GCC documentation (http://gcc.gnu.org/onlinedocs/gcc/X86-Built_002din-Functions.html) claims there should be such an intrinsic, added in gcc 4.7:

     unsigned long long _bzhi_u64 (unsigned long long, unsigned long long)

Yet, with gcc 4.8.1 (Debian 4.8.1-2), nothing of the sort exists:

sesse@gruessi:~$ gcc-4.8 -Wall -O2 -mbmi2 -c bzhi-test.c
bzhi-test.c: In function ‘func’:
bzhi-test.c:5:2: warning: implicit declaration of function ‘_bzhi_u64’ [-Wimplicit-function-declaration]
  return _bzhi_u64(x, y);
  ^

A function call is generated instead, which was obviously not what I intended. :-)

I thought this was maybe just a documentation error, but __builtin_ia32_bzhi_u64 also does not exist.
Comment 1 Jakub Jelinek 2013-06-15 16:04:22 UTC
If you forget to include
#include <x86intrin.h>
then don't be surprised.
Comment 2 Steinar H. Gunderson 2013-06-27 11:23:37 UTC
Shouldn't really the documentation say so, then? The entire GCC manual seems to make no note of this header at all, as far as I can see.