4141#include <asm/hwcap.h>
4242#include <sys/auxv.h>
4343#endif
44+ #ifdef OS_DARWIN
45+ #include <sys/sysctl.h>
46+ int32_t value ;
47+ size_t length = sizeof (value );
48+ #endif
4449
4550extern gotoblas_t gotoblas_ARMV8 ;
51+ #ifdef DYNAMIC_LIST
52+ #ifdef DYN_CORTEXA53
53+ extern gotoblas_t gotoblas_CORTEXA53 ;
54+ #else
55+ #define gotoblas_CORTEXA53 gotoblas_ARMV8
56+ #endif
57+ #ifdef DYN_CORTEXA57
58+ extern gotoblas_t gotoblas_CORTEXA57 ;
59+ #else
60+ #define gotoblas_CORTEXA57 gotoblas_ARMV8
61+ #endif
62+ #ifdef DYN_CORTEXA72
63+ extern gotoblas_t gotoblas_CORTEXA72 ;
64+ #else
65+ #define gotoblas_CORTEXA72 gotoblas_ARMV8
66+ #endif
67+ #ifdef DYN_CORTEXA73
68+ extern gotoblas_t gotoblas_CORTEXA73 ;
69+ #else
70+ #define gotoblas_CORTEXA73 gotoblas_ARMV8
71+ #endif
72+ #ifdef DYN_FALKOR
73+ extern gotoblas_t gotoblas_FALKOR ;
74+ #else
75+ #define gotoblas_FALKOR gotoblas_ARMV8
76+ #endif
77+ #ifdef DYN_TSV110
78+ extern gotoblas_t gotoblas_TSV110 ;
79+ #else
80+ #define gotoblas_TSV110 gotoblas_ARMV8
81+ #endif
82+ #ifdef DYN_THUNDERX
83+ extern gotoblas_t gotoblas_THUNDERX ;
84+ #else
85+ #define gotoblas_THUNDERX gotoblas_ARMV8
86+ #endif
87+ #ifdef DYN_THUNDERX2T99
88+ extern gotoblas_t gotoblas_THUNDERX2T99 ;
89+ #else
90+ #define gotoblas_THUNDERX2T99 gotoblas_ARMV8
91+ #endif
92+ #ifdef DYN_THUNDERX3T110
93+ extern gotoblas_t gotoblas_THUNDERX3T110 ;
94+ #else
95+ #define gotoblas_THUNDERX3T110 gotoblas_ARMV8
96+ #endif
97+ #ifdef DYN_EMAG8180
98+ extern gotoblas_t gotoblas_EMAG8180 ;
99+ #else
100+ #define gotoblas_EMAG8180 gotoblas_ARMV8
101+ #endif
102+ #ifdef DYN_NEOVERSEN1
103+ extern gotoblas_t gotoblas_NEOVERSEN1 ;
104+ #else
105+ #define gotoblas_NEOVERSEN1 gotoblas_ARMV8
106+ #endif
107+ #ifdef DYN_VORTEX
108+ extern gotoblas_t gotoblas_VORTEX ;
109+ #else
110+ #define gotoblas_VORTEX gotoblas_ARMV8
111+ #endif
112+ #else
46113extern gotoblas_t gotoblas_CORTEXA53 ;
47114extern gotoblas_t gotoblas_CORTEXA57 ;
48115extern gotoblas_t gotoblas_CORTEXA72 ;
@@ -54,10 +121,12 @@ extern gotoblas_t gotoblas_TSV110;
54121extern gotoblas_t gotoblas_EMAG8180 ;
55122extern gotoblas_t gotoblas_NEOVERSEN1 ;
56123extern gotoblas_t gotoblas_THUNDERX3T110 ;
124+ extern gotoblas_t gotoblas_VORTEX ;
125+ #endif
57126
58127extern void openblas_warning (int verbose , const char * msg );
59128
60- #define NUM_CORETYPES 12
129+ #define NUM_CORETYPES 13
61130
62131/*
63132 * In case asm/hwcap.h is outdated on the build system, make sure
@@ -68,7 +137,7 @@ extern void openblas_warning(int verbose, const char * msg);
68137#endif
69138
70139#define get_cpu_ftr (id , var ) ({ \
71- __asm__ __volatile__ ("mrs %0, "#id : "=r" (var)); \
140+ __asm__ ("mrs %0, "#id : "=r" (var)); \
72141 })
73142
74143static char * corename [] = {
@@ -84,6 +153,7 @@ static char *corename[] = {
84153 "emag8180" ,
85154 "neoversen1" ,
86155 "thunderx3t110" ,
156+ "vortex" ,
87157 "unknown"
88158};
89159
@@ -100,6 +170,7 @@ char *gotoblas_corename(void) {
100170 if (gotoblas == & gotoblas_EMAG8180 ) return corename [ 9 ];
101171 if (gotoblas == & gotoblas_NEOVERSEN1 ) return corename [10 ];
102172 if (gotoblas == & gotoblas_THUNDERX3T110 ) return corename [11 ];
173+ if (gotoblas == & gotoblas_VORTEX ) return corename [12 ];
103174 return corename [NUM_CORETYPES ];
104175}
105176
@@ -131,6 +202,7 @@ static gotoblas_t *force_coretype(char *coretype) {
131202 case 9 : return (& gotoblas_EMAG8180 );
132203 case 10 : return (& gotoblas_NEOVERSEN1 );
133204 case 11 : return (& gotoblas_THUNDERX3T110 );
205+ case 12 : return (& gotoblas_VORTEX );
134206 }
135207 snprintf (message , 128 , "Core not found: %s\n" , coretype );
136208 openblas_warning (1 , message );
@@ -142,6 +214,10 @@ static gotoblas_t *get_coretype(void) {
142214 char coremsg [128 ];
143215
144216#if (!defined OS_LINUX && !defined OS_ANDROID )
217+ #ifdef DARWIN
218+ sysctlbyname ("hw.cpufamily" ,& value ,& length ,NULL ,0 );
219+ if (value == 131287967 ) return CPU_VORTEX ;
220+ #endif
145221 return NULL ;
146222#else
147223
0 commit comments