- Add inlined assembly for MSVC to _clearfp, _control87, _fpreset, _logb and _statusfp, move fpreset into arch-specific directory and remove x86 #ifdefs from the code.

- Disable warning C4733 for __wine_push_frame and __wine_pop_frame

svn path=/trunk/; revision=42458
This commit is contained in:
Stefan Ginsberg 2009-08-07 09:36:53 +00:00
parent 2abccb66e9
commit 7b78af8b30
7 changed files with 34 additions and 21 deletions

View file

@ -81,7 +81,6 @@
<file>copysign.c</file>
<file>fpclass.c</file>
<file>fpecode.c</file>
<file>fpreset.c</file>
<file>isnan.c</file>
<file>nafter.c</file>
<file>scalb.c</file>
@ -89,6 +88,7 @@
<directory name="i386">
<file>clearfp.c</file>
<file>cntrlfp.c</file>
<file>fpreset.c</file>
<file>logb.c</file>
<file>statfp.c</file>
</directory>
@ -97,6 +97,7 @@
<directory name="i386">
<file>clearfp.c</file>
<file>cntrlfp.c</file>
<file>fpreset.c</file>
<file>logb.c</file>
<file>statfp.c</file>
</directory>

View file

@ -18,10 +18,10 @@ unsigned int _statusfp( void );
unsigned int CDECL _clearfp(void)
{
unsigned int retVal = _statusfp();
#if defined(__GNUC__) && defined(__i386__)
#if defined(__GNUC__)
__asm__ __volatile__( "fnclex" );
#else
FIXME(":Not Implemented\n");
__asm fnclex;
#endif
return retVal;
}

View file

@ -29,12 +29,7 @@
unsigned int CDECL _controlfp(unsigned int newval, unsigned int mask)
{
#ifdef __i386__
return _control87( newval, mask & ~_EM_DENORMAL );
#else
FIXME(":Not Implemented!\n");
return 0;
#endif
}
/*********************************************************************
@ -42,14 +37,17 @@ unsigned int CDECL _controlfp(unsigned int newval, unsigned int mask)
*/
unsigned int CDECL _control87(unsigned int newval, unsigned int mask)
{
#if defined(__GNUC__) && defined(__i386__)
unsigned int fpword = 0;
unsigned int flags = 0;
TRACE("(%08x, %08x): Called\n", newval, mask);
/* Get fp control word */
#if defined(__GNUC__)
__asm__ __volatile__( "fstcw %0" : "=m" (fpword) : );
#else
__asm fstcw [fpword];
#endif
TRACE("Control word before : %08x\n", fpword);
@ -98,11 +96,11 @@ unsigned int CDECL _control87(unsigned int newval, unsigned int mask)
TRACE("Control word after : %08x\n", fpword);
/* Put fp control word */
#if defined(__GNUC__)
__asm__ __volatile__( "fldcw %0" : : "m" (fpword) );
#else
__asm fldcw [fpword];
#endif
return flags;
#else
FIXME(":Not Implemented!\n");
return 0;
#endif
}

View file

@ -15,9 +15,9 @@
*/
void CDECL _fpreset(void)
{
#if defined(__GNUC__) && defined(__i386__)
#if defined(__GNUC__)
__asm__ __volatile__( "fninit" );
#else
FIXME(":Not Implemented!\n");
__asm fninit;
#endif
}

View file

@ -29,6 +29,10 @@ double _logb (double __x)
("fxtract\n\t"
: "=t" (__junk), "=u" (__val) : "0" (__x));
#else
__asm fld [__x];
__asm fxtract;
__asm fstp st(0);
__asm fstp [__val];
#endif /*__GNUC__*/
return __val;
}

View file

@ -24,19 +24,18 @@
*/
unsigned int CDECL _statusfp(void)
{
unsigned int retVal = 0;
#if defined(__GNUC__) && defined(__i386__)
unsigned int retVal = 0;
unsigned int fpword;
#if defined(__GNUC__)
__asm__ __volatile__( "fstsw %0" : "=m" (fpword) : );
#else
__asm fstsw [fpword];
#endif
if (fpword & 0x1) retVal |= _SW_INVALID;
if (fpword & 0x2) retVal |= _SW_DENORMAL;
if (fpword & 0x4) retVal |= _SW_ZERODIVIDE;
if (fpword & 0x8) retVal |= _SW_OVERFLOW;
if (fpword & 0x10) retVal |= _SW_UNDERFLOW;
if (fpword & 0x20) retVal |= _SW_INEXACT;
#else
FIXME(":Not implemented!\n");
#endif
return retVal;
}

View file

@ -53,6 +53,12 @@
#define EH_NESTED_CALL 0x10
#ifndef _M_ARM
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4733)
#endif
static inline EXCEPTION_REGISTRATION_RECORD *__wine_push_frame( EXCEPTION_REGISTRATION_RECORD *frame )
{
frame->Next = (struct _EXCEPTION_REGISTRATION_RECORD *)__readfsdword(0);
@ -65,6 +71,11 @@ static inline EXCEPTION_REGISTRATION_RECORD *__wine_pop_frame( EXCEPTION_REGISTR
__writefsdword(0, (unsigned long)frame->Next);
return frame->Next;
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif
#define __TRY _SEH2_TRY