Improve approximate xfloat

- Disable denormals for SPU threads
- Add clamping helpers
This commit is contained in:
Markus Stockhausen 2019-10-26 22:51:38 +02:00 committed by Nekotekina
parent 3b46c9cb6a
commit a36f0497ce
2 changed files with 59 additions and 35 deletions

View file

@ -282,6 +282,21 @@ void cpu_thread::operator()()
thread_ctrl::set_native_priority(-1);
}
if (id_type() == 2)
{
// force input/output denormals to zero for SPU threads (FTZ/DAZ)
_mm_setcsr( _mm_getcsr() | 0x8040 );
volatile u32 a = 0x1fc00000;
__m128 b = _mm_castsi128_ps(_mm_set1_epi32(const_cast<u32 &>(a)));
int c = _mm_cvtsi128_si32(_mm_castps_si128(_mm_mul_ps(b,b)));
if (c != 0)
{
LOG_FATAL(GENERAL,"could not disable denormals");
}
}
if (id_type() == 1 && false)
{
g_fxo->get<cpu_profiler>()->registered.push(id);