mirror of
https://github.com/reactos/reactos.git
synced 2024-09-30 22:47:28 +00:00
[KERNEL32_APITEST] Fix compilation & global wut?? with SSE exception test
This commit is contained in:
parent
4959ccc8df
commit
0995b35bac
|
@ -102,33 +102,28 @@ static LONG WINAPI ExceptionFilterSSEException(LPEXCEPTION_POINTERS exp)
|
||||||
return EXCEPTION_CONTINUE_EXECUTION;
|
return EXCEPTION_CONTINUE_EXECUTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __clang__
|
#if defined(__clang__) || defined(__GNUC__)
|
||||||
__attribute__((__target__("sse")))
|
__attribute__((__target__("sse")))
|
||||||
#endif
|
#endif
|
||||||
static
|
static
|
||||||
VOID TestSSEExceptions(VOID)
|
VOID TestSSEExceptions(VOID)
|
||||||
{
|
{
|
||||||
LPTOP_LEVEL_EXCEPTION_FILTER p;
|
LPTOP_LEVEL_EXCEPTION_FILTER p;
|
||||||
BOOL supportsSSE = FALSE;
|
|
||||||
unsigned int csr;
|
unsigned int csr;
|
||||||
|
|
||||||
/* Test SSE support for the CPU */
|
/* Test SSE support for the CPU */
|
||||||
p = SetUnhandledExceptionFilter(ExceptionFilterSSESupport);
|
p = SetUnhandledExceptionFilter(ExceptionFilterSSESupport);
|
||||||
ok(p == NULL, "Previous filter should be NULL\n");
|
ok(p == NULL, "Previous filter should be NULL\n");
|
||||||
#ifdef _MSC_VER
|
|
||||||
#if defined(_M_AMD64)
|
#if !defined(_M_AMD64)
|
||||||
{
|
{
|
||||||
__m128 xmm = { { 0 } };
|
BOOL supportsSSE = FALSE;
|
||||||
xmm = _mm_xor_ps(xmm, xmm);
|
#ifdef _MSC_VER
|
||||||
if (!ExceptionCaught) supportsSSE = TRUE;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
xorps xmm0, xmm0
|
xorps xmm0, xmm0
|
||||||
mov supportsSSE, 0x1
|
mov supportsSSE, 0x1
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
__asm__(
|
__asm__(
|
||||||
"xorps %%xmm0, %%xmm0\n"
|
"xorps %%xmm0, %%xmm0\n"
|
||||||
|
@ -136,12 +131,16 @@ VOID TestSSEExceptions(VOID)
|
||||||
: "=r"(supportsSSE)
|
: "=r"(supportsSSE)
|
||||||
);
|
);
|
||||||
#endif /* _MSC_VER */
|
#endif /* _MSC_VER */
|
||||||
|
|
||||||
if(!supportsSSE)
|
if(!supportsSSE)
|
||||||
{
|
{
|
||||||
skip("CPU doesn't support SSE instructions.\n");
|
skip("CPU doesn't support SSE instructions.\n");
|
||||||
SetUnhandledExceptionFilter(NULL);
|
SetUnhandledExceptionFilter(NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
#endif /* !defined(_M_AMD64) */
|
||||||
|
|
||||||
/* Deliberately throw a divide by 0 exception */
|
/* Deliberately throw a divide by 0 exception */
|
||||||
p = SetUnhandledExceptionFilter(ExceptionFilterSSEException);
|
p = SetUnhandledExceptionFilter(ExceptionFilterSSEException);
|
||||||
ok(p == ExceptionFilterSSESupport, "Unexpected old filter : 0x%p", p);
|
ok(p == ExceptionFilterSSESupport, "Unexpected old filter : 0x%p", p);
|
||||||
|
@ -157,7 +156,6 @@ VOID TestSSEExceptions(VOID)
|
||||||
__m128 xmm1 = { { 1., 1. } }, xmm2 = { { 0 } };
|
__m128 xmm1 = { { 1., 1. } }, xmm2 = { { 0 } };
|
||||||
/* Wait, aren't exceptions masked? Yes, but actually no. */
|
/* Wait, aren't exceptions masked? Yes, but actually no. */
|
||||||
xmm1 = _mm_div_ps(xmm1, xmm2);
|
xmm1 = _mm_div_ps(xmm1, xmm2);
|
||||||
if (!ExceptionCaught) supportsSSE = TRUE;
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
__asm
|
__asm
|
||||||
|
@ -178,20 +176,15 @@ VOID TestSSEExceptions(VOID)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
|
ULONG zeros[4] = {0, 0, 0, 0};
|
||||||
|
ULONG ones[4] = {0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000};
|
||||||
__asm__ (
|
__asm__ (
|
||||||
"xorps %%xmm0, %%xmm0\n"
|
"movups (%0), %%xmm0\n"
|
||||||
"pushl $0x3f800000\n"
|
"movups (%1), %%xmm1\n"
|
||||||
"pushl $0x3f800000\n"
|
|
||||||
"pushl $0x3f800000\n"
|
|
||||||
"pushl $0x3f800000\n"
|
|
||||||
"movups (%%esp), %%xmm1\n"
|
|
||||||
|
|
||||||
/* Divide by 0 */
|
/* Divide by 0 */
|
||||||
"divps %%xmm0, %%xmm1\n"
|
"divps %%xmm0, %%xmm1\n"
|
||||||
|
|
||||||
/* Clean up */
|
: : "r"(&zeros), "r"(&ones) : "xmm0", "xmm1"
|
||||||
"addl $16, %%esp\n"
|
|
||||||
:
|
|
||||||
);
|
);
|
||||||
#endif /* _MSC_VER */
|
#endif /* _MSC_VER */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue