Add CPUID identification of Intel Ice Lake
[platform/upstream/openblas.git] / cpuid_arm.c
index 211ea27..19aa907 100644 (file)
@@ -34,7 +34,7 @@
 #define CPU_CORTEXA15          4
 
 static char *cpuname[] = {
-  "UNKOWN",
+  "UNKNOWN",
   "ARMV6",
   "ARMV7",
   "CORTEXA9",
@@ -74,7 +74,7 @@ int get_feature(char *search)
        fclose(infile);
 
 
-       if( p == NULL ) return;
+       if( p == NULL ) return 0;
 
        t = strtok(p," ");
        while( t = strtok(NULL," "))
@@ -112,9 +112,12 @@ int detect(void)
          if (strstr(p, "0xc09")) {
            return CPU_CORTEXA9;
          }
-         if (strstr(p, "0xc15")) {
+         if (strstr(p, "0xc0f")) {
            return CPU_CORTEXA15;
          }
+         if (strstr(p, "0xd07")) {
+           return CPU_ARMV7;  //ARMV8 on 32-bit
+         }
 
        }
 
@@ -158,6 +161,27 @@ int detect(void)
 
 
        }
+
+       p = (char *) NULL ;
+       infile = fopen("/proc/cpuinfo", "r");
+
+       while (fgets(buffer, sizeof(buffer), infile))
+       {
+
+               if ((!strncmp("CPU architecture", buffer, 16)))
+               {
+                       p = strchr(buffer, ':') + 2;
+                       break;
+               }
+       }
+       fclose(infile);
+       if(p != NULL) {
+         if (strstr(p, "8")) {
+           return CPU_ARMV7;  //ARMV8 on 32-bit
+         }
+
+       }
+
 #endif
 
        return CPU_UNKNOWN;
@@ -192,6 +216,7 @@ void get_cpuconfig(void)
        {
               case CPU_CORTEXA9:
                        printf("#define CORTEXA9\n");
+                       printf("#define ARMV7\n");
                        printf("#define HAVE_VFP\n");
                        printf("#define HAVE_VFPV3\n");
                        if ( get_feature("neon"))       printf("#define HAVE_NEON\n");
@@ -207,6 +232,7 @@ void get_cpuconfig(void)
 
               case CPU_CORTEXA15:
                        printf("#define CORTEXA15\n");
+                       printf("#define ARMV7\n");
                        printf("#define HAVE_VFP\n");
                        printf("#define HAVE_VFPV3\n");
                        if ( get_feature("neon"))       printf("#define HAVE_NEON\n");