Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
ba3cc127
Commit
ba3cc127
authored
Feb 01, 2021
by
Piotr Caban
Committed by
Alexandre Julliard
Feb 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Improve sqrt accuracy and performance on i386.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e53c4bd5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
math.c
dlls/msvcrt/math.c
+36
-0
No files found.
dlls/msvcrt/math.c
View file @
ba3cc127
...
...
@@ -1202,6 +1202,37 @@ __ASM_GLOBAL_FUNC( sse2_sqrt,
"ret"
)
#endif
#ifdef __i386__
#define SET_X87_CW \
"subl $4, %esp\n\t" \
__ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") \
"fnstcw (%esp)\n\t" \
"movw (%esp), %ax\n\t" \
"testw $0xc00, %ax\n\t" \
"jz 1f\n\t" \
"andw $0xf3ff, %ax\n\t" \
"movw %ax, 2(%esp)\n\t" \
"fldcw 2(%esp)\n\t" \
"1:\n\t"
#define RESET_X87_CW \
"movw (%esp), %ax\n\t" \
"testw $0xc00, %ax\n\t" \
"jz 1f\n\t" \
"fldcw (%esp)\n\t" \
"1:\n\t" \
"addl $4, %esp\n\t" \
__ASM_CFI(".cfi_adjust_cfa_offset -4\n\t")
double
CDECL
x87_sqrt
(
double
);
__ASM_GLOBAL_FUNC
(
x87_sqrt
,
"fldl 4(%esp)
\n\t
"
SET_X87_CW
"fsqrt
\n\t
"
RESET_X87_CW
"ret"
)
#endif
/*********************************************************************
* sqrt (MSVCRT.@)
*
...
...
@@ -1214,6 +1245,11 @@ double CDECL sqrt( double x )
return
x
;
return
sse2_sqrt
(
x
);
#elif defined( __i386__ )
if
(
!
sqrt_validate
(
&
x
))
return
x
;
return
x87_sqrt
(
x
);
#else
static
const
double
tiny
=
1.0e-300
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment