Unify CPUID_FTZ and CPUID_DAZ

Get rid of the 2 CPUID flags and combine them with SSE in one
implementation.
SSE flags can now be set on all x86 and x86_64 platforms -
independent of -ffast-math.
Helper defines borrowed from STREFLOP.
This commit is contained in:
dhewg 2011-12-21 21:37:40 +01:00 committed by Daniel Gibson
parent 57b8d55db0
commit 975cda1637
3 changed files with 6 additions and 10 deletions

View file

@ -612,6 +612,7 @@ set(src_sys_dedicated sys/linux/dedicated.cpp)
if (APPLE)
set(src_sys_base
sys/cpu.cpp
sys/threads.cpp
sys/sys_local.cpp
sys/posix/posix_net.cpp
@ -633,6 +634,7 @@ if (APPLE)
)
elseif (WIN32)
set(src_sys_base
sys/cpu.cpp
sys/threads.cpp
sys/sys_local.cpp
sys/win32/win_cpu.cpp
@ -653,6 +655,7 @@ elseif (WIN32)
)
else()
set(src_sys_base
sys/cpu.cpp
sys/threads.cpp
sys/sys_local.cpp
sys/posix/posix_net.cpp

View file

@ -112,14 +112,9 @@ void idSIMD::InitProcessor( const char *module, bool forceGeneric ) {
idLib::common->Printf( "%s using %s for SIMD processing\n", module, SIMDProcessor->GetName() );
}
if ( cpuid & CPUID_FTZ ) {
if ( cpuid & CPUID_SSE ) {
idLib::sys->FPU_SetFTZ( true );
idLib::common->Printf( "enabled Flush-To-Zero mode\n" );
}
if ( cpuid & CPUID_DAZ ) {
idLib::sys->FPU_SetDAZ( true );
idLib::common->Printf( "enabled Denormals-Are-Zero mode\n" );
}
}

View file

@ -39,8 +39,6 @@ typedef enum {
CPUID_SSE2 = 0x00080, // Streaming SIMD Extensions 2
CPUID_SSE3 = 0x00100, // Streaming SIMD Extentions 3 aka Prescott's New Instructions
CPUID_ALTIVEC = 0x00200, // AltiVec
CPUID_FTZ = 0x04000, // Flush-To-Zero mode (denormal results are flushed to zero)
CPUID_DAZ = 0x08000 // Denormals-Are-Zero mode (denormal source operands are set to zero)
} cpuid_t;
typedef enum {
@ -169,10 +167,10 @@ void Sys_FPU_SetPrecision( int precision );
// sets the FPU rounding mode
void Sys_FPU_SetRounding( int rounding );
// sets Flush-To-Zero mode (only available when CPUID_FTZ is set)
// sets Flush-To-Zero mode
void Sys_FPU_SetFTZ( bool enable );
// sets Denormals-Are-Zero mode (only available when CPUID_DAZ is set)
// sets Denormals-Are-Zero mode
void Sys_FPU_SetDAZ( bool enable );
// returns amount of system ram