Intel® ISA Extensions
Use hardware-based isolation and memory encryption to provide more code protection in your solutions.
Intel Customer Support will be observing the Martin Luther King holiday on Monday, Jan. 17, and will return on Tues. Jan. 18.
For the latest information on Intel’s response to the Log4j/Log4Shell vulnerability, please see Intel-SA-00646

BEXTR intrinsic incompatible with GCC


The __builtin_ia32_bextr_u64() intrinsic for the BMI instruction BEXTR in ICC is incompatible with the GCC.  The GCC version expects two arguments, but ICC takes three. 

#include <x86intrin.h>
#include <stdint.h>
// icc wants 3 args for __builtin_ia32_bextr_u64() but gcc wants 2
uint64_t bextr_intrinsic(uint64_t src, uint64_t pattern) {
    return __builtin_ia32_bextr_u64(src, pattern);

nate@haswell:~/intel$ gcc-4.8 -std=gnu99 -march=native -O3 -c bextr_intrinsic_test.c -o test.o
nate@haswell:~/intel$ objdump -d test.o

test.o:     file format elf64-x86-64

Disassembly of section .text:

0000000000000000 <bextr_intrinsic_compatatility>:
   0:    c4 e2 c8 f7 c7           bextr  %rsi,%rdi,%rax
   5:    c3                       retq
nate@haswell:~/intel$ icc -std=gnu99 -march=native -O3 -c bextr_intrinsic_test.c -o test.o
bextr_intrinsic_test.c(11): error #165: too few arguments in function call
      return __builtin_ia32_bextr_u64(src, pattern);

compilation aborted for bextr_intrinsic_test.c (code 2)
nate@haswell:~/intel$ icc -v
icc version 14.0.3 (gcc version 4.8.0 compatibility)

The issue seems to be that Intel and AMD have specified slightly different intrinsics with either one or two underscores.   Other compilers have moved to treating these two differently in this case:

 I prefer the two argument form since that matches the assembly command and my goal in using the intrinsic is to use this command as directly as possible.   Is there a two argument form of the intrinsic available in ICC?


0 Kudos
1 Reply

Hi Nathan,

This is resolved in the version 15.0 of the Intel compiler which is available as part of Intel® Parallel Studio XE (Cluser, Professional, or Composer editions). You should be able to download this from if you have an up to date registration, otherwise you can get an evaluation copy from