问题描述
在Linux上,Feenableexcept和fedisableexcept可用于控制浮点异常时SIGFPE中断的生成.如何在Mac OS X Intel上执行此操作?
On Linux, feenableexcept and fedisableexcept can be used to control the generation of SIGFPE interrupts on floating point exceptions. How can I do this on Mac OS X Intel?
用于启用浮点中断的嵌入式程序集在 http://中提供developer.apple.com/documentation/Performance/Conceptual/Mac_OSX_Numerics/Mac_OSX_Numerics.pdf ,第7-15页,但仅适用于PowerPC组装.
Inline assembly for enabling floating point interrupts is provided in http://developer.apple.com/documentation/Performance/Conceptual/Mac_OSX_Numerics/Mac_OSX_Numerics.pdf, pp. 7-15, but only for PowerPC assembly.
推荐答案
可以使用xmmintrin.h
中的_MM_SET_EXCEPTION_MASK
启用sse的异常.例如,要启用无效的(nan)异常,请
Exceptions for sse can be enabled using _MM_SET_EXCEPTION_MASK
from xmmintrin.h
. For example, to enable invalid (nan) exceptions, do
#include <xmmintrin.h>
...
_MM_SET_EXCEPTION_MASK(_MM_GET_EXCEPTION_MASK() & ~_MM_MASK_INVALID);
这篇关于在Mac OS X Intel上启用浮点中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!