- attempt to see if this win64 asm is more reliable for streflop

This commit is contained in:
SoftCoder 2014-02-06 17:03:15 -08:00
parent d2f321a2df
commit 2ed1c2ae2b
2 changed files with 15 additions and 10 deletions

View File

@ -137,14 +137,14 @@ enum FPU_RoundMode {
#if _WIN64
/* No fldcw intrinsics on Windows x64, punt to external asm */
extern "C" { void streflop_winx64_fldcw(unsigned int mode); }
extern "C" { unsigned int streflop_winx64_fstcw(); }
extern "C" { void streflop_winx64_fldcw(short mode); }
extern "C" { short streflop_winx64_fstcw(); }
extern "C" { void streflop_winx64_fclex(void); }
extern "C" { void streflop_winx64_stmxcsr(unsigned int mode); }
extern "C" { void streflop_winx64_ldmxcsr(unsigned int mode); }
extern "C" { void streflop_winx64_stmxcsr(int mode); }
extern "C" { void streflop_winx64_ldmxcsr(int mode); }
#define STREFLOP_FSTCW(cw) do { int tmp = 0; tmp = streflop_winx64_fstcw(); (cw) = tmp; } while (0)
#define STREFLOP_FLDCW(cw) do { int tmp = (cw); streflop_winx64_fldcw(tmp); } while (0)
#define STREFLOP_FSTCW(cw) do { short tmp = 0; tmp = streflop_winx64_fstcw(); (cw) = tmp; } while (0)
#define STREFLOP_FLDCW(cw) do { short tmp = (cw); streflop_winx64_fldcw(tmp); } while (0)
#define STREFLOP_STMXCSR(cw) do { int tmp = 0; streflop_winx64_stmxcsr(tmp); (cw) = tmp; } while (0)
#define STREFLOP_LDMXCSR(cw) do { int tmp = (cw); streflop_winx64_ldmxcsr(tmp); } while (0)

View File

@ -8,7 +8,6 @@
; be found in the AUTHORS file in the root of the source tree.
;
_text SEGMENT
; %ifidn __OUTPUT_FORMAT__,x64
; %ifdef _WIN64
@ -23,9 +22,15 @@ streflop_winx64_fclex ENDP
streflop_winx64_fldcw PROC FRAME
fclex
mov qword ptr [rsp + 8], rcx
.ENDPROLOG
fldcw [rsp + 8]
; mov qword ptr [rsp + 8], rcx
; .ENDPROLOG
; fldcw [rsp + 8]
; ret
sub rsp, 8
mov [rsp], rcx ; win x64 specific
.ENDPROLOG
fldcw [rsp]
add rsp, 8
ret
streflop_winx64_fldcw ENDP