1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-02 00:29:41 +02:00

Adds an SSE2 version of lrint family

For some reason, MSVC builtin version have extremely low performance
This commit is contained in:
Dmitry Vedenko 2021-06-29 13:49:55 +03:00 committed by Paul Licameli
parent a5d74f564d
commit bfb79feed3

View File

@ -106,17 +106,40 @@
return intgr ;
}
#elif (defined (WIN32) || defined (_WIN32)) && defined(_M_3X64)
#elif (defined (WIN32) || defined (_WIN32)) && defined(_M_X64)
#include <math.h>
#include <immintrin.h>
#include <emmintrin.h>
__inline long int
lrintf (float flt)
#ifdef _MSC_VER
#pragma function(lrint, lrintf)
#endif
__inline
long int lrint(double flt)
{
return _mm_cvt_ss2si(_mm_set_ss(flt));
return _mm_cvtsd_si32(_mm_set_sd(flt));
}
__inline
long int lrintf (float flt)
{
return _mm_cvtss_si32(_mm_set_ss(flt));
}
__inline
long long int llrint(double flt)
{
return _mm_cvtsd_si64(_mm_set_sd(flt));
}
__inline
long long int llrintf(float flt)
{
return _mm_cvtss_si64(_mm_set_ss(flt));
}
#elif (HAVE_LRINT && HAVE_LRINTF)
/* These defines enable functionality introduced with the 1999 ISO C
@ -146,6 +169,6 @@
#include <math.h>
#define lrint(dbl) ((int)rint(dbl))
#define lrintf(flt) ((int)rint(flt))
#define lrintf(flt) ((int)rint(flt))
#endif