1 // System dependent IEEE floating-point coprocessor initialization.
16 #include "cl_float_config.h"
18 #if (defined(linux) || defined(__linux)) && (defined(FAST_FLOAT) || defined(FAST_DOUBLE))
20 // Division by 0.0 should return NaN and not raise an SIGFPE.
21 // For this, we either have to link with -lieee or copy some
22 // part from libc-linux/sysdeps/linux/{i386,m68k}/ieee.c:
24 #include <fpu_control.h>
26 #if 0 // Unfortunately this gives an error if also linked with -lieee
27 #if defined(HAVE_FPU_CONTROL_T)
28 fpu_control_t __fpu_control = _FPU_IEEE;
30 unsigned short __fpu_control = _FPU_IEEE;
33 AT_INITIALIZATION(ieee)
35 #if defined(_FPU_IEEE)
36 #if defined(HAVE_FPU_CONTROL_T)
37 extern fpu_control_t __fpu_control;
38 __fpu_control = _FPU_IEEE;
39 #elif defined(HAVE_SETFPUCW)
40 __setfpucw(_FPU_IEEE);
42 extern unsigned short __fpu_control;
43 __fpu_control = _FPU_IEEE;
46 // Nothing to do (as on some architectures):
47 // probably this means that _FPU_DEFAULT is just as good as _FPU_IEEE.
56 // This dummy links in this module whenever some module needs IEEE floats.
61 CL_PROVIDE_END(cl_ieee)