Skip to content

Commit

Permalink
Fix issues related to MXCSR register
Browse files Browse the repository at this point in the history
  • Loading branch information
M-HT committed Sep 5, 2023
1 parent 4d55fc2 commit e7e6f2f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions simde/x86/sse.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,14 @@ enum {
SIMDE_MM_ROUND_TOWARD_ZERO = 0x6000
#endif
};
#if defined(_MM_ROUND_MASK)
# define SIMDE_MM_ROUND_MASK _MM_ROUND_MASK
#else
# define SIMDE_MM_ROUND_MASK (0x6000)
#endif
#if defined(SIMDE_X86_SSE_ENABLE_NATIVE_ALIASES)
#define _MM_ROUND_MASK SIMDE_MM_ROUND_MASK
#endif

#if defined(_MM_FROUND_TO_NEAREST_INT)
# define SIMDE_MM_FROUND_TO_NEAREST_INT _MM_FROUND_TO_NEAREST_INT
Expand Down Expand Up @@ -531,7 +539,7 @@ SIMDE_MM_GET_FLUSH_ZERO_MODE (void) {
#endif
}
#if defined(SIMDE_X86_SSE_ENABLE_NATIVE_ALIASES)
#define _MM_SET_FLUSH_ZERO_MODE(a) SIMDE_MM_SET_FLUSH_ZERO_MODE(a)
#define _MM_GET_FLUSH_ZERO_MODE(a) SIMDE_MM_GET_FLUSH_ZERO_MODE(a)
#endif

SIMDE_FUNCTION_ATTRIBUTES
Expand Down Expand Up @@ -566,7 +574,7 @@ simde_mm_setcsr (uint32_t a) {
#if defined(SIMDE_X86_SSE_NATIVE)
_mm_setcsr(a);
#else
SIMDE_MM_SET_ROUNDING_MODE(HEDLEY_STATIC_CAST(unsigned int, a));
SIMDE_MM_SET_ROUNDING_MODE(HEDLEY_STATIC_CAST(unsigned int, a & SIMDE_MM_ROUND_MASK));
#endif
}
#if defined(SIMDE_X86_SSE_ENABLE_NATIVE_ALIASES)
Expand Down

0 comments on commit e7e6f2f

Please sign in to comment.