Function crashes when using _mm_load_pd(使用 _mm_load_pd 时函数崩溃)
问题描述
我有以下功能:
当我在 Linux 上调用它时,一切都很好,但是当我在 Windows 操作系统上调用它时,我的程序崩溃并显示程序不再工作".我做错了什么,如何确定我的错误?
When I am calling it on Linux, everything is fine, but when I am calling it on a windows OS, my program crashes with "program is not working anymore". What am I doing wrong, and how can I determine my error?
推荐答案
不保证您的数据按照 SSE 加载的要求进行 16 字节对齐.要么使用 _mm_loadu_pd
:
Your data is not guaranteed to be 16 byte aligned as required by SSE loads. Either use _mm_loadu_pd
:
或确保您的数据在可能的情况下正确对齐,例如对于静态或本地:
or make sure that your data is correctly aligned where possible, e.g. for static or locals:
或不使用 C++11,使用特定于编译器的语言扩展:
or without C++11, using compiler-specific language extensions:
您可以使用 #ifdef
来 #define
一个适用于目标编译器的 ALIGN(x)
宏.
You could use #ifdef
to #define
an ALIGN(x)
macro that works on the target compiler.
这篇关于使用 _mm_load_pd 时函数崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!