Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Opus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xiph.Org
Opus
Commits
12c751e0
Verified
Commit
12c751e0
authored
4 years ago
by
Marcus Asteborg
Committed by
Jean-Marc Valin
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Prefer SSE and ASM implementation of float2int before lrintf for MSVC
Signed-off-by:
Jean-Marc Valin
<
jmvalin@jmvalin.ca
>
parent
da404556
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#1955
passed
4 years ago
Stage: build
Stage: external
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
celt/float_cast.h
+32
-26
32 additions, 26 deletions
celt/float_cast.h
with
32 additions
and
26 deletions
celt/float_cast.h
+
32
−
26
View file @
12c751e0
...
...
@@ -67,6 +67,38 @@
#include
<xmmintrin.h>
static
OPUS_INLINE
opus_int32
float2int
(
float
x
)
{
return
_mm_cvt_ss2si
(
_mm_set_ss
(
x
));}
#elif (defined(_MSC_VER) && _MSC_VER >= 1400) && (defined(_M_X64) || (defined(_M_IX86_FP) && _M_IX86_FP >= 1))
#include
<xmmintrin.h>
static
OPUS_INLINE
opus_int32
float2int
(
float
value
)
{
/* _mm_load_ss will generate same code as _mm_set_ss
** in _MSC_VER >= 1914 /02 so keep __mm_load__ss
** for backward compatibility.
*/
return
_mm_cvtss_si32
(
_mm_load_ss
(
&
value
));
}
#elif (defined(_MSC_VER) && _MSC_VER >= 1400) && defined (_M_IX86)
#include
<math.h>
/* Win32 doesn't seem to have these functions.
** Therefore implement OPUS_INLINE versions of these functions here.
*/
static
OPUS_INLINE
opus_int32
float2int
(
float
flt
)
{
int
intgr
;
_asm
{
fld
flt
fistp
intgr
}
;
return
intgr
;
}
#elif defined(HAVE_LRINTF)
/* These defines enable functionality introduced with the 1999 ISO C
...
...
@@ -96,32 +128,6 @@ static OPUS_INLINE opus_int32 float2int(float x) {return _mm_cvt_ss2si(_mm_set_s
#include
<math.h>
#define float2int(x) lrint(x)
#elif (defined(_MSC_VER) && _MSC_VER >= 1400) && (defined(_M_X64) || (defined(_M_IX86_FP) && _M_IX86_FP >= 1))
#include
<xmmintrin.h>
static
__inline
long
int
float2int
(
float
value
)
{
return
_mm_cvtss_si32
(
_mm_load_ss
(
&
value
));
}
#elif (defined(_MSC_VER) && _MSC_VER >= 1400) && defined (_M_IX86)
#include
<math.h>
/* Win32 doesn't seem to have these functions.
** Therefore implement OPUS_INLINE versions of these functions here.
*/
static
__inline
long
int
float2int
(
float
flt
)
{
int
intgr
;
_asm
{
fld
flt
fistp
intgr
}
;
return
intgr
;
}
#else
#if (defined(__GNUC__) && defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment