2015-10-20 87 views
1

我正尝试在Windows(GCC 4.8.1)上使用MinGW 64的_BitScanForward64内部函数(https://software.intel.com/sites/landingpage/IntrinsicsGuide/#expand=381,421,373&cats=Bit%20Manipulation)。_BitScanForward64在Windows上使用MinGW

我想:

#include "immintrin.h" 
#include "x86intrin.h" 
#include "xmmintrin.h" 

,但它仍然没有看到功能(根据英特尔引导它应该是“immintrin.h”)。

如何在Windows上使用MinGW64来使用它?

+0

英特尔编译器可以在Visual Studio中使用。它们支持微软使用的一些内在特性,但不支持GCC。 GCC为此建立了功能。搜索周围,你会发现他们。 https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html –

+0

尝试'_builtin_ffs' –

回答

1

GCC没有为此使用内在。它使用built in function_builtin_ffs。维基百科每个编译器都有一个nice summary

原因英特尔列出了这种内在的,我认为是英特尔C++编译器试图以支持其Microsoft created在Visual Studio在Windows上使用至少在同一内部函数。这不幸意味着某些内部函数没有为每个编译器定义。更糟糕的是,有时他们的定义不同。例如英特尔的定义addcarry-u64不同意微软的定义,但looking at the assembly shows that Intel uses Microsoft's definition and GCC and Clang use Intel's defintion

对于大多数x86 SIMD内在函数,GCC,Intel,Clang和MSVC同意(with a few exceptions coming from MSVC),但对于其他必须习惯的内部函数,它们只在某些编译器中定义或者被定义为不同,或者必须使用内置函数或库函数。

英特尔编译器甚至有它自己的内在因素:_bit_scan_forward