mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-16 06:04:07 +00:00
merge #8
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@545 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -38,25 +38,26 @@ switch(ty) {
|
||||
return vec;
|
||||
}
|
||||
|
||||
static MwBool hasMMX(void) {
|
||||
MwU32 _eax = 1;
|
||||
MwU32 _ebx, _edx;
|
||||
#if defined(__WATCOMC__) || defined(__i386__) || defined(__amd64__)
|
||||
static cpuFeatures getCPUFeatures(void) {
|
||||
MwU32 _eax = 1;
|
||||
cpuFeatures _edx;
|
||||
|
||||
#ifdef __WATCOMC__
|
||||
__asm {
|
||||
cpuid
|
||||
mov _eax, eax
|
||||
mov _ebx, ebx
|
||||
mov _edx, edx
|
||||
}
|
||||
#else
|
||||
__asm__ __volatile__(
|
||||
"cpuid" : "=a"(_eax), "=b"(_ebx), "=d"(_edx)
|
||||
"cpuid" : "=a"(_eax), "=d"(_edx)
|
||||
: "a"(1));
|
||||
#endif
|
||||
|
||||
return (_edx & (1 << 23)) == (1 << 23);
|
||||
return _edx;
|
||||
}
|
||||
#endif
|
||||
|
||||
static MwLLMathVTable** mwLLMultiTable;
|
||||
static MwLLMathVTable* multiTableSetupAndGet(int ty);
|
||||
@@ -69,10 +70,20 @@ static MwLLMathVTable* getMultiTable(int ty) {
|
||||
}
|
||||
|
||||
static MwLLMathVTable* multiTableSetupAndGet(int ty) {
|
||||
#if defined(__WATCOMC__) || defined(__i386__) || defined(__amd64__)
|
||||
cpuFeatures features;
|
||||
#endif
|
||||
|
||||
mwLLMultiTable = default_multi_table();
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
if(hasMMX()) {
|
||||
#if defined(__WATCOMC__) || defined(__i386__) || defined(__amd64__)
|
||||
features = getCPUFeatures();
|
||||
printf("Avaliable x86_64 Features:\n");
|
||||
printf("\tMMX: %s\n", features.mmx ? "true" : "false");
|
||||
printf("\tSSE: %s\n", features.sse ? "true" : "false");
|
||||
printf("\tSSE2: %s\n", features.sse2 ? "true" : "false");
|
||||
|
||||
if(features.mmx) {
|
||||
mmx_apply(mwLLMultiTable);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user