Use __control87_2 when available

This commit is contained in:
Chris Robinson
2012-09-16 01:44:45 -07:00
parent 657ee85136
commit a1daec66e2
3 changed files with 11 additions and 0 deletions
+7
View File
@@ -185,6 +185,10 @@ void SetMixerFPUMode(FPUCtl *ctl)
if((CPUCapFlags&CPU_CAP_SSE))
newState |= 0x8000; /* flush-to-zero */
_FPU_SETCW(newState);
#elif defined(HAVE___CONTROL87_2)
int mode;
__control87_2(0, 0, &ctl->state, NULL);
__control87_2(_RC_CHOP|_DN_FLUSH|_PC_24, _MCW_RC|_MCW_DN|_MCW_PC, &mode, NULL);
#elif defined(HAVE__CONTROLFP)
ctl->state = _controlfp(0, 0);
(void)_controlfp(_RC_CHOP|_DN_FLUSH|_PC_24, _MCW_RC|_MCW_DN|_MCW_PC);
@@ -201,6 +205,9 @@ void RestoreFPUMode(const FPUCtl *ctl)
#if defined(_FPU_GETCW) && defined(_FPU_SETCW) && (defined(__i386__) || defined(__x86_64__))
fpu_control_t fpuState = ctl->state;
_FPU_SETCW(fpuState);
#elif defined(HAVE___CONTROL87_2)
int mode;
__control87_2(ctl->state, _MCW_RC|_MCW_DN|_MCW_PC, &mode, NULL);
#elif defined(HAVE__CONTROLFP)
_controlfp(ctl->state, _MCW_RC|_MCW_DN|_MCW_PC);
#elif defined(HAVE_FESETROUND)
+1
View File
@@ -277,6 +277,7 @@ IF(HAVE_FENV_H)
ENDIF()
IF(HAVE_FLOAT_H)
CHECK_SYMBOL_EXISTS(_controlfp float.h HAVE__CONTROLFP)
CHECK_SYMBOL_EXISTS(__control87_2 float.h HAVE___CONTROL87_2)
ENDIF()
CHECK_FUNCTION_EXISTS(strtof HAVE_STRTOF)
+3
View File
@@ -157,6 +157,9 @@
/* Define if we have _controlfp() */
#cmakedefine HAVE__CONTROLFP
/* Define if we have __control87_2() */
#cmakedefine HAVE___CONTROL87_2
/* Define if we have pthread_setschedparam() */
#cmakedefine HAVE_PTHREAD_SETSCHEDPARAM