C++ 调用 always_inline '__m128i _mm_cvtepu8_epi32(__m128i)'时内联失败:目标特定选项不匹配 _mm_cvtepu8_epi32 (__m128i __X)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35772562/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 14:33:08  来源:igfitidea点击:

inlining failed in call to always_inline '__m128i _mm_cvtepu8_epi32(__m128i)': target specific option mismatch _mm_cvtepu8_epi32 (__m128i __X)

c++compilationsse

提问by ttsesm

I am trying to compile this projectfrom github which is implemented in C++ with SIMD intrinsic (SSE4.1). The project in github is given as a Visual Studio solution, but I am trying to port it in Qtcreator with cmake. While I am trying to compile it I get the following error:

我正在尝试从 github编译这个项目,它是用 C++ 实现的,带有 SIMD 内在(SSE4.1)。github 中的项目是作为 Visual Studio 解决方案提供的,但我正在尝试使用 cmake 将其移植到 Qtcreator 中。当我尝试编译它时,我收到以下错误:

/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/include/smmintrin.h:520:1: error: inlining failed in call to always_inline '__m128i _mm_cvtepu8_epi32(__m128i)': target specific option mismatch
 _mm_cvtepu8_epi32 (__m128i __X)

which I am sure it has to do with the SSE optimization part, but since I am not that familiar with this subject I do not really know what it means and how I can solve it and in the net that I searched I couldn't really get something useful. The code that gives the following problem is the following:

我确定这与 SSE 优化部分有关,但是由于我对这个主题不太熟悉,因此我真的不知道它的含义以及如何解决它,并且在我搜索的网络中我真的无法解决得到一些有用的东西。出现以下问题的代码如下:

static void cvt8u32f(const Mat& src, Mat& dest, const float amp)
{
    const int imsize = src.size().area()/8;
    const int nn = src.size().area()- imsize*8 ;
    uchar* s = (uchar*)src.ptr(0);
    float* d = dest.ptr<float>(0);
    const __m128 mamp = _mm_set_ps1(amp);
    const __m128i zero = _mm_setzero_si128();
    for(int i=imsize;i--;)
    {
        __m128i s1 = _mm_loadl_epi64((__m128i*)s);

        _mm_store_ps(d,_mm_mul_ps(mamp,_mm_cvtepi32_ps(_mm_cvtepu8_epi32(s1))));
        _mm_store_ps(d+4,_mm_mul_ps(mamp,_mm_cvtepi32_ps(_mm_cvtepu8_epi32(_mm_srli_si128(s1,4)))));
        s+=8;
        d+=8;
    }
    for(int i=0;i<nn;i++)
    {
        *d = (float)*s * amp;
        s++,d++;
    }

}

can someone explain me what is the issue and what I am missing. Thanks in advance.

有人可以向我解释是什么问题以及我缺少什么。提前致谢。

回答by Olga

add in file.pro: QMAKE_CXXFLAGS +=-msse3

在 file.pro 中添加:QMAKE_CXXFLAGS +=-msse3