BEXTR intrinsic incompatible with GCC

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: 

http://llvm.org/bugs/show_bug.cgi?id=19431
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60847

 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?

 

publicaciones de 2 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

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 http://registrationcenter.intel.com if you have an up to date registration, otherwise you can get an evaluation copy from https://software.intel.com/en-us/intel-parallel-studio-xe/try-buy.

Brandon Hewitt
Technical Consulting Engineer

For 1:1 technical support: http://premier.intel.com

Software Product Support info: http://www.intel.com/software/support

Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya