File tree Expand file tree Collapse file tree 2 files changed +17
-9
lines changed Expand file tree Collapse file tree 2 files changed +17
-9
lines changed Original file line number Diff line number Diff line change 1
1
# Spring supplied CMake build file
2
+ # Patched to avoid using SSE compiler flags on platforms that don't support SSE.
3
+
4
+ include (CheckCXXCompilerFlag)
2
5
3
6
add_definitions (-DSTREFLOP_SSE)
4
7
@@ -75,7 +78,12 @@ SET(libm_flt32_source
75
78
SET (cxxflags "-DLIBM_COMPILING_FLT32 -Wno-unused-parameter -I\" ${CMAKE_CURRENT_SOURCE_DIR} /libm/headers\" " )
76
79
77
80
if (CLANG OR GCC)
78
- SET (cxxflags "${cxxflags} -fno-strict-aliasing -msse -msse2" )
81
+ SET (cxxflags "${cxxflags} -fno-strict-aliasing" )
82
+
83
+ check_cxx_compiler_flag("-msse;-msse2" SSE2_SUPPORTED)
84
+ if (SSE2_SUPPORTED)
85
+ SET (cxxflags "${cxxflags} -msse -msse2" )
86
+ endif ()
79
87
80
88
if (BUILD_FOR_WEB)
81
89
SET (cxxflags "${cxxflags} -msimd128" )
Original file line number Diff line number Diff line change @@ -131,22 +131,22 @@ enum FPU_RoundMode {
131
131
*/
132
132
133
133
// plan for portability
134
- #if defined(_MSC_VER)
134
+ #if defined(__i386__) || defined(__x86_64__)
135
+ #define STREFLOP_FSTCW (cw ) do { asm volatile (" fstcw %0" : " =m" (cw) : ); } while (0 )
136
+ #define STREFLOP_FLDCW (cw ) do { asm volatile (" fclex \n fldcw %0" : : " m" (cw)); } while (0 )
137
+ #define STREFLOP_STMXCSR (cw ) do { asm volatile (" stmxcsr %0" : " =m" (cw) : ); } while (0 )
138
+ #define STREFLOP_LDMXCSR (cw ) do { asm volatile (" ldmxcsr %0" : : " m" (cw) ); } while (0 )
139
+ #elif defined(_M_IX86) || defined(_M_AMD64)
135
140
#define STREFLOP_FSTCW (cw ) do { short tmp; __asm { fstcw tmp }; (cw) = tmp; } while (0 )
136
141
#define STREFLOP_FLDCW (cw ) do { short tmp = (cw); __asm { fclex }; __asm { fldcw tmp }; } while (0 )
137
142
#define STREFLOP_STMXCSR (cw ) do { int tmp; __asm { stmxcsr tmp }; (cw) = tmp; } while (0 )
138
143
#define STREFLOP_LDMXCSR (cw ) do { int tmp = (cw); __asm { ldmxcsr tmp }; } while (0 )
139
- #elif PLATFORM_WEB || PLATFORM_ARM64
144
+ #else
140
145
#define STREFLOP_FSTCW (cw ) (cw=0 );
141
146
#define STREFLOP_FLDCW (cw ) ((void )cw);
142
147
#define STREFLOP_STMXCSR (cw ) (cw=0 );
143
148
#define STREFLOP_LDMXCSR (cw ) ((void )cw);
144
- #else
145
- #define STREFLOP_FSTCW (cw ) do { asm volatile (" fstcw %0" : " =m" (cw) : ); } while (0 )
146
- #define STREFLOP_FLDCW (cw ) do { asm volatile (" fclex \n fldcw %0" : : " m" (cw)); } while (0 )
147
- #define STREFLOP_STMXCSR (cw ) do { asm volatile (" stmxcsr %0" : " =m" (cw) : ); } while (0 )
148
- #define STREFLOP_LDMXCSR (cw ) do { asm volatile (" ldmxcsr %0" : : " m" (cw) ); } while (0 )
149
- #endif // defined(_MSC_VER)
149
+ #endif
150
150
151
151
// Subset of all C99 functions
152
152
You can’t perform that action at this time.
0 commit comments