aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/helpers.c33
-rw-r--r--CMakeLists.txt5
-rw-r--r--config.h.in6
3 files changed, 44 insertions, 0 deletions
diff --git a/Alc/helpers.c b/Alc/helpers.c
index 262c2551..6eff516e 100644
--- a/Alc/helpers.c
+++ b/Alc/helpers.c
@@ -54,6 +54,9 @@ DEFINE_DEVPROPKEY(DEVPKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd, 0x80,
#ifdef HAVE_DLFCN_H
#include <dlfcn.h>
#endif
+#ifdef HAVE_INTRIN_H
+#include <intrin.h>
+#endif
#ifdef HAVE_CPUID_H
#include <cpuid.h>
#endif
@@ -109,6 +112,36 @@ void FillCPUCaps(ALuint capfilter)
#endif
}
}
+#elif defined(HAVE___CPUID)
+ union {
+ int regs[4];
+ char str[sizeof(int[4])];
+ } cpuinf[3];
+ unsigned int maxfunc = 0;
+ unsigned int maxextfunc = 0;
+
+ (__cpuid)(cpuinf[0].regs, 0);
+ maxfunc = cpuinf[0].regs[0];
+
+ (__cpuid)(cpuinf[0].regs, 0x80000000);
+ maxextfunc = cpuinf[0].regs[0];
+ TRACE("Detected max CPUID function: 0x%x (ext. 0x%x)\n", maxfunc, maxextfunc);
+
+ TRACE("Vendor ID: \"%.4s%.4s%.4s\"\n", cpuinf[0].str+4, cpuinf[0].str+12, cpuinf[0].str+8);
+ if(maxextfunc >= 0x80000004)
+ {
+ (__cpuid)(cpuinf[0].regs, 0x80000002);
+ (__cpuid)(cpuinf[1].regs, 0x80000003);
+ (__cpuid)(cpuinf[2].regs, 0x80000004);
+ TRACE("Name: \"%.16s%.16s%.16s\"\n", cpuinf[0].str, cpuinf[1].str, cpuinf[2].str);
+ }
+
+ if(maxfunc >= 1)
+ {
+ (__cpuid)(cpuinf[0].regs, 1);
+ if((cpuinf[0].regs[3]&(1<<25)))
+ caps |= CPU_CAP_SSE;
+ }
#endif
#endif
#ifdef HAVE_NEON
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f8ba10e2..04d8f9c0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -191,6 +191,8 @@ IF(WIN32)
MESSAGE(STATUS "Could not find Wine header files" )
ENDIF()
ENDIF()
+
+ CHECK_INCLUDE_FILE(intrin.h HAVE_INTRIN_H)
ELSE()
SET(OLD_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
# Yes GCC, really don't accept visibility modes you don't support
@@ -278,6 +280,9 @@ IF(HAVE_FLOAT_H)
CHECK_SYMBOL_EXISTS(_controlfp float.h HAVE__CONTROLFP)
CHECK_SYMBOL_EXISTS(__control87_2 float.h HAVE___CONTROL87_2)
ENDIF()
+IF(HAVE_INTRIN_H)
+ CHECK_SYMBOL_EXISTS(__cpuid intrin.h HAVE___CPUID)
+ENDIF()
CHECK_FUNCTION_EXISTS(strtof HAVE_STRTOF)
CHECK_FUNCTION_EXISTS(stat HAVE_STAT)
diff --git a/config.h.in b/config.h.in
index 75d7a790..3c2609f5 100644
--- a/config.h.in
+++ b/config.h.in
@@ -100,6 +100,9 @@
/* Define if we have the floorf function */
#cmakedefine HAVE_FLOORF
+/* Define if we have the __cpuid function */
+#cmakedefine HAVE___CPUID
+
/* Define if we have the strtof function */
#cmakedefine HAVE_STRTOF
@@ -145,6 +148,9 @@
/* Define if we have initguid.h */
#cmakedefine HAVE_INITGUID_H
+/* Define if we have intrin.h */
+#cmakedefine HAVE_INTRIN_H
+
/* Define if we have ieeefp.h */
#cmakedefine HAVE_IEEEFP_H