C:_mm_log2_ps()的x86 Intel本征用法->错误:类型'int'不兼容? [英] C: x86 Intel Intrinsics usage of _mm_log2_ps() -> error: incompatible type 'int'?

查看:172
本文介绍了C:_mm_log2_ps()的x86 Intel本征用法->错误:类型'int'不兼容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将log2应用于__m128变量.像这样:

I'm trying to apply the log2 onto a __m128 variable. Like this:

#include <immintrin.h>
int main (void) {
    __m128 two_v = {2.0, 2.0, 2.0, 2.0};
    __m128 log2_v = _mm_log2_ps(two_v); // log_2 := log(2)

    return 0;
}

尝试编译此错误会返回此错误:

Trying to compile this returns this error:

error: initializing '__m128' with an expression of
      incompatible type 'int'
                __m128 log2_v = _mm_log2_ps(two_v); // log_2 := log(2)
                       ^        ~~~~~~~~~~~~~~~~~~

我该如何解决?

推荐答案

您研究的immintrin.h与用于编译的immintrin.h是不同的. 可能是,您正在研究特定于Intel的标头(例如/opt/intel/include/immintrin.h),而您的编译器使用默认的immintrin.h

The immintrin.h you look into and immintrin.h used for compilation are different. Likely, you're looking into Intel-specific header (somewhere like /opt/intel/include/immintrin.h), while your compiler uses default immintrin.h

正如正确地说的那样,extern __m128 _mm_log2_ps(__m128 v1) Intel编译器.对于非商业开发,它可免费用于Linux.

As it was correctly said, extern __m128 _mm_log2_ps(__m128 v1) is SVML routine, so the very first solution I see is to use Intel Compiler. For non-commercial development its free for Linux.

尽管您可以在使用其他编译器的编译过程中将自定义immintrin.h文件的include路径指定为第一个参数,但是我认为您会遇到太多错误-仅因为此标头是特定于Intel的.

Although you can specify the include path to your custom immintrin.h file as a very first argument during compilation using different compiler, but I think you'll get just way too many errors - just because this header is Intel-specific.

这篇关于C:_mm_log2_ps()的x86 Intel本征用法->错误:类型'int'不兼容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆