compiler generic XmmRegister types (mingw doesn't like M128A)

This commit is contained in:
Mr. eXoDia 2014-12-30 02:01:11 +01:00
parent 46398eba7b
commit 6e7778eddb
3 changed files with 24 additions and 20 deletions

View File

@ -10,14 +10,6 @@
#include <windows.h> #include <windows.h>
#include <stdint.h> #include <stdint.h>
#ifdef __GNUC__
typedef struct DECLSPEC_ALIGN(16) _M128A
{
ULONGLONG Low;
LONGLONG High;
} M128A, *PM128A;
#endif //__GNUC__
#pragma pack(push, 1) #pragma pack(push, 1)
// Global.Constant.Structure.Declaration: // Global.Constant.Structure.Declaration:
@ -596,8 +588,14 @@ typedef struct
typedef struct typedef struct
{ {
M128A Low; //XMM/SSE part ULONGLONG Low;
M128A High; //AVX part LONGLONG High;
} XmmRegister_t;
typedef struct
{
XmmRegister_t Low; //XMM/SSE part
XmmRegister_t High; //AVX part
} YmmRegister_t; } YmmRegister_t;
typedef struct typedef struct
@ -657,10 +655,10 @@ typedef struct
x87FPU_t x87fpu; x87FPU_t x87fpu;
DWORD MxCsr; DWORD MxCsr;
#ifdef _WIN64 #ifdef _WIN64
M128A XmmRegisters[16]; XmmRegister_t XmmRegisters[16];
YmmRegister_t YmmRegisters[16]; YmmRegister_t YmmRegisters[16];
#else // x86 #else // x86
M128A XmmRegisters[8]; XmmRegister_t XmmRegisters[8];
YmmRegister_t YmmRegisters[8]; YmmRegister_t YmmRegisters[8];
#endif #endif
} TITAN_ENGINE_CONTEXT_t; } TITAN_ENGINE_CONTEXT_t;

View File

@ -962,8 +962,8 @@ __declspec(dllexport) bool TITCALL SetAVXContext(HANDLE hActiveThread, TITAN_ENG
return false; return false;
DWORD FeatureLength; DWORD FeatureLength;
PM128A Sse = (PM128A)_LocateXStateFeature(Context, XSTATE_LEGACY_SSE, &FeatureLength); XmmRegister_t* Sse = (XmmRegister_t*)_LocateXStateFeature(Context, XSTATE_LEGACY_SSE, &FeatureLength);
PM128A Avx = (PM128A)_LocateXStateFeature(Context, XSTATE_AVX, NULL); XmmRegister_t* Avx = (XmmRegister_t*)_LocateXStateFeature(Context, XSTATE_AVX, NULL);
int NumberOfRegisters = FeatureLength / sizeof(Sse[0]); int NumberOfRegisters = FeatureLength / sizeof(Sse[0]);
if(Sse != NULL) //If the feature is unsupported by the processor it will return NULL if(Sse != NULL) //If the feature is unsupported by the processor it will return NULL
@ -1022,8 +1022,8 @@ __declspec(dllexport) bool TITCALL GetAVXContext(HANDLE hActiveThread, TITAN_ENG
return false; return false;
DWORD FeatureLength; DWORD FeatureLength;
PM128A Sse = (PM128A)_LocateXStateFeature(Context, XSTATE_LEGACY_SSE, &FeatureLength); XmmRegister_t* Sse = (XmmRegister_t*)_LocateXStateFeature(Context, XSTATE_LEGACY_SSE, &FeatureLength);
PM128A Avx = (PM128A)_LocateXStateFeature(Context, XSTATE_AVX, NULL); XmmRegister_t* Avx = (XmmRegister_t*)_LocateXStateFeature(Context, XSTATE_AVX, NULL);
int NumberOfRegisters = FeatureLength / sizeof(Sse[0]); int NumberOfRegisters = FeatureLength / sizeof(Sse[0]);
if(Sse != NULL) //If the feature is unsupported by the processor it will return NULL if(Sse != NULL) //If the feature is unsupported by the processor it will return NULL

View File

@ -95,8 +95,14 @@
typedef struct typedef struct
{ {
M128A Low; //XMM/SSE part ULONGLONG Low;
M128A High; //AVX part LONGLONG High;
} XmmRegister_t;
typedef struct
{
XmmRegister_t Low; //XMM/SSE part
XmmRegister_t High; //AVX part
} YmmRegister_t; } YmmRegister_t;
typedef struct typedef struct
@ -156,10 +162,10 @@ typedef struct
x87FPU_t x87fpu; x87FPU_t x87fpu;
DWORD MxCsr; DWORD MxCsr;
#ifdef _WIN64 #ifdef _WIN64
M128A XmmRegisters[16]; XmmRegister_t XmmRegisters[16];
YmmRegister_t YmmRegisters[16]; YmmRegister_t YmmRegisters[16];
#else // x86 #else // x86
M128A XmmRegisters[8]; XmmRegister_t XmmRegisters[8];
YmmRegister_t YmmRegisters[8]; YmmRegister_t YmmRegisters[8];
#endif #endif
} TITAN_ENGINE_CONTEXT_t; } TITAN_ENGINE_CONTEXT_t;