Added MSVC defines to cpuid.h and getarch.c.
authorHank Anderson <hank.p.anderson@gmail.com>
Fri, 2 Jan 2015 03:01:28 +0000 (21:01 -0600)
committerHank Anderson <hank.p.anderson@gmail.com>
Fri, 2 Jan 2015 03:01:28 +0000 (21:01 -0600)
cpuid.h
getarch.c

diff --git a/cpuid.h b/cpuid.h
index ab6a3fb..406b7fa 100644 (file)
--- a/cpuid.h
+++ b/cpuid.h
 #ifndef CPUID_H
 #define CPUID_H
 
+#if defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64)
+#define INTEL_AMD
+#endif
+
 #define VENDOR_INTEL      1
 #define VENDOR_UMC        2
 #define VENDOR_AMD        3
@@ -59,7 +63,7 @@
 #define FAMILY_PM     7
 #define FAMILY_IA64   8
 
-#if defined(__i386__) || defined(__x86_64__)
+#ifdef INTEL_AMD
 #define GET_EXFAMILY  1
 #define GET_EXMODEL   2
 #define GET_TYPE      3
index f6a5ecb..8a6b4dc 100644 (file)
--- a/getarch.c
+++ b/getarch.c
@@ -69,10 +69,14 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 /* or implied, of The University of Texas at Austin.                 */
 /*********************************************************************/
 
-#if defined(__WIN32__) || defined(__WIN64__) || defined(__CYGWIN32__) || defined(__CYGWIN64__)
+#if defined(__WIN32__) || defined(__WIN64__) || defined(__CYGWIN32__) || defined(__CYGWIN64__) || defined(_WIN32) || defined(_WIN64)
 #define OS_WINDOWS
 #endif
 
+#if defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64)
+#define INTEL_AMD
+#endif
+
 #include <stdio.h>
 #include <string.h>
 #ifdef OS_WINDOWS
@@ -783,7 +787,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #define OPENBLAS_SUPPORTED
 #endif
 
-#if defined(__i386__) || (__x86_64__)
+#ifdef INTEL_AMD
 #include "cpuid_x86.c"
 #define OPENBLAS_SUPPORTED
 #endif
@@ -878,7 +882,7 @@ int main(int argc, char *argv[]){
 #ifdef FORCE
     printf("CORE=%s\n", CORENAME);
 #else
-#if defined(__i386__) || defined(__x86_64__) || defined(POWER) || defined(__mips__) || defined(__arm__) || defined(__aarch64__)
+#if defined(INTEL_AMD) || defined(POWER) || defined(__mips__) || defined(__arm__) || defined(__aarch64__)
     printf("CORE=%s\n", get_corename());
 #endif
 #endif
@@ -898,7 +902,7 @@ int main(int argc, char *argv[]){
 #endif
 
 
-#if defined(__i386__) || defined(__x86_64__)
+#ifdef INTEL_AMD
 #ifndef FORCE
     get_sse();
 #else
@@ -978,7 +982,7 @@ int main(int argc, char *argv[]){
 #ifdef FORCE
     printf("#define CHAR_CORENAME \"%s\"\n", CORENAME);
 #else
-#if defined(__i386__) || defined(__x86_64__) || defined(POWER) || defined(__mips__) || defined(__arm__) || defined(__aarch64__)
+#if defined(INTEL_AMD) || defined(POWER) || defined(__mips__) || defined(__arm__) || defined(__aarch64__)
     printf("#define CHAR_CORENAME \"%s\"\n", get_corename());
 #endif
 #endif