我使用Intel函数_rdrand16_step()
编写了一个代码,在Windows(Visual Studio 2017)上工作正常,但在Linux(g ++)上我无法正常工作。
我在代码中两次调用了该函数:
#include <immintrin.h>
...
unsigned short val = 0;
if (_rdrand16_step(&val))
...
_rdrand16_step(&val);
...
和g ++输出:
/usr/lib/gcc/x86_64-linux-gnu/8/include/immintrin.h: In member function ‘int otp_s7c::crypt(std::__cxx11::string, std::__cxx11::string, long long unsigned int)’:
/usr/lib/gcc/x86_64-linux-gnu/8/include/immintrin.h:129:1: error: inlining failed in call to always_inline ‘int _rdrand16_step(short unsigned int*)’: target specific option mismatch
_rdrand16_step (unsigned short *__P)
^~~~~~~~~~~~~~
otp_s7c.cpp:139:24: note: called from here
if (_rdrand16_step(&val))
~~~~~~~~~~~~~~^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/8/include/immintrin.h:129:1: error: inlining failed in call to always_inline ‘int _rdrand16_step(short unsigned int*)’: target specific option mismatch
_rdrand16_step (unsigned short *__P)
^~~~~~~~~~~~~~
otp_s7c.cpp:148:23: note: called from here
_rdrand16_step(&val);
~~~~~~~~~~~~~~^~~~~~