You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

getarch.c 37 kB

14 years ago
10 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206
  1. /*****************************************************************************
  2. Copyright (c) 2011-2014, The OpenBLAS Project
  3. All rights reserved.
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions are
  6. met:
  7. 1. Redistributions of source code must retain the above copyright
  8. notice, this list of conditions and the following disclaimer.
  9. 2. Redistributions in binary form must reproduce the above copyright
  10. notice, this list of conditions and the following disclaimer in
  11. the documentation and/or other materials provided with the
  12. distribution.
  13. 3. Neither the name of the OpenBLAS project nor the names of
  14. its contributors may be used to endorse or promote products
  15. derived from this software without specific prior written
  16. permission.
  17. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  18. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  19. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  20. ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  21. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  22. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  23. SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  24. CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  25. OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
  26. USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. **********************************************************************************/
  28. /*********************************************************************/
  29. /* Copyright 2009, 2010 The University of Texas at Austin. */
  30. /* All rights reserved. */
  31. /* */
  32. /* Redistribution and use in source and binary forms, with or */
  33. /* without modification, are permitted provided that the following */
  34. /* conditions are met: */
  35. /* */
  36. /* 1. Redistributions of source code must retain the above */
  37. /* copyright notice, this list of conditions and the following */
  38. /* disclaimer. */
  39. /* */
  40. /* 2. Redistributions in binary form must reproduce the above */
  41. /* copyright notice, this list of conditions and the following */
  42. /* disclaimer in the documentation and/or other materials */
  43. /* provided with the distribution. */
  44. /* */
  45. /* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
  46. /* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
  47. /* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
  48. /* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
  49. /* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
  50. /* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
  51. /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
  52. /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
  53. /* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
  54. /* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
  55. /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
  56. /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
  57. /* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
  58. /* POSSIBILITY OF SUCH DAMAGE. */
  59. /* */
  60. /* The views and conclusions contained in the software and */
  61. /* documentation are those of the authors and should not be */
  62. /* interpreted as representing official policies, either expressed */
  63. /* or implied, of The University of Texas at Austin. */
  64. /*********************************************************************/
  65. #if defined(__WIN32__) || defined(__WIN64__) || defined(__CYGWIN32__) || defined(__CYGWIN64__) || defined(_WIN32) || defined(_WIN64)
  66. #define OS_WINDOWS
  67. #endif
  68. #if defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64)
  69. #define INTEL_AMD
  70. #endif
  71. #include <stdio.h>
  72. #include <string.h>
  73. #ifdef OS_WINDOWS
  74. #include <windows.h>
  75. #endif
  76. #if defined(__FreeBSD__) || defined(__APPLE__)
  77. #include <sys/types.h>
  78. #include <sys/sysctl.h>
  79. #endif
  80. #if defined(linux) || defined(__sun__)
  81. #include <sys/sysinfo.h>
  82. #include <unistd.h>
  83. #endif
  84. /* #define FORCE_P2 */
  85. /* #define FORCE_KATMAI */
  86. /* #define FORCE_COPPERMINE */
  87. /* #define FORCE_NORTHWOOD */
  88. /* #define FORCE_PRESCOTT */
  89. /* #define FORCE_BANIAS */
  90. /* #define FORCE_YONAH */
  91. /* #define FORCE_CORE2 */
  92. /* #define FORCE_PENRYN */
  93. /* #define FORCE_DUNNINGTON */
  94. /* #define FORCE_NEHALEM */
  95. /* #define FORCE_SANDYBRIDGE */
  96. /* #define FORCE_ATOM */
  97. /* #define FORCE_ATHLON */
  98. /* #define FORCE_OPTERON */
  99. /* #define FORCE_OPTERON_SSE3 */
  100. /* #define FORCE_BARCELONA */
  101. /* #define FORCE_SHANGHAI */
  102. /* #define FORCE_ISTANBUL */
  103. /* #define FORCE_BOBCAT */
  104. /* #define FORCE_BULLDOZER */
  105. /* #define FORCE_PILEDRIVER */
  106. /* #define FORCE_SSE_GENERIC */
  107. /* #define FORCE_VIAC3 */
  108. /* #define FORCE_NANO */
  109. /* #define FORCE_POWER3 */
  110. /* #define FORCE_POWER4 */
  111. /* #define FORCE_POWER5 */
  112. /* #define FORCE_POWER6 */
  113. /* #define FORCE_POWER7 */
  114. /* #define FORCE_POWER8 */
  115. /* #define FORCE_PPCG4 */
  116. /* #define FORCE_PPC970 */
  117. /* #define FORCE_PPC970MP */
  118. /* #define FORCE_PPC440 */
  119. /* #define FORCE_PPC440FP2 */
  120. /* #define FORCE_CELL */
  121. /* #define FORCE_SICORTEX */
  122. /* #define FORCE_LOONGSON3A */
  123. /* #define FORCE_LOONGSON3B */
  124. /* #define FORCE_I6400 */
  125. /* #define FORCE_P6600 */
  126. /* #define FORCE_P5600 */
  127. /* #define FORCE_ITANIUM2 */
  128. /* #define FORCE_SPARC */
  129. /* #define FORCE_SPARCV7 */
  130. /* #define FORCE_GENERIC */
  131. #ifdef FORCE_P2
  132. #define FORCE
  133. #define FORCE_INTEL
  134. #define ARCHITECTURE "X86"
  135. #define SUBARCHITECTURE "PENTIUM2"
  136. #define ARCHCONFIG "-DPENTIUM2 " \
  137. "-DL1_DATA_SIZE=16384 -DL1_DATA_LINESIZE=32 " \
  138. "-DL2_SIZE=512488 -DL2_LINESIZE=32 " \
  139. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  140. "-DHAVE_CMOV -DHAVE_MMX"
  141. #define LIBNAME "p2"
  142. #define CORENAME "P5"
  143. #endif
  144. #ifdef FORCE_KATMAI
  145. #define FORCE
  146. #define FORCE_INTEL
  147. #define ARCHITECTURE "X86"
  148. #define SUBARCHITECTURE "PENTIUM3"
  149. #define ARCHCONFIG "-DPENTIUM3 " \
  150. "-DL1_DATA_SIZE=16384 -DL1_DATA_LINESIZE=32 " \
  151. "-DL2_SIZE=524288 -DL2_LINESIZE=32 " \
  152. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  153. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE "
  154. #define LIBNAME "katmai"
  155. #define CORENAME "KATMAI"
  156. #endif
  157. #ifdef FORCE_COPPERMINE
  158. #define FORCE
  159. #define FORCE_INTEL
  160. #define ARCHITECTURE "X86"
  161. #define SUBARCHITECTURE "PENTIUM3"
  162. #define ARCHCONFIG "-DPENTIUM3 " \
  163. "-DL1_DATA_SIZE=16384 -DL1_DATA_LINESIZE=32 " \
  164. "-DL2_SIZE=262144 -DL2_LINESIZE=32 " \
  165. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  166. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE "
  167. #define LIBNAME "coppermine"
  168. #define CORENAME "COPPERMINE"
  169. #endif
  170. #ifdef FORCE_NORTHWOOD
  171. #define FORCE
  172. #define FORCE_INTEL
  173. #define ARCHITECTURE "X86"
  174. #define SUBARCHITECTURE "PENTIUM4"
  175. #define ARCHCONFIG "-DPENTIUM4 " \
  176. "-DL1_DATA_SIZE=8192 -DL1_DATA_LINESIZE=64 " \
  177. "-DL2_SIZE=524288 -DL2_LINESIZE=64 " \
  178. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 " \
  179. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 "
  180. #define LIBNAME "northwood"
  181. #define CORENAME "NORTHWOOD"
  182. #endif
  183. #ifdef FORCE_PRESCOTT
  184. #define FORCE
  185. #define FORCE_INTEL
  186. #define ARCHITECTURE "X86"
  187. #define SUBARCHITECTURE "PENTIUM4"
  188. #define ARCHCONFIG "-DPENTIUM4 " \
  189. "-DL1_DATA_SIZE=16384 -DL1_DATA_LINESIZE=64 " \
  190. "-DL2_SIZE=1048576 -DL2_LINESIZE=64 " \
  191. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 " \
  192. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3"
  193. #define LIBNAME "prescott"
  194. #define CORENAME "PRESCOTT"
  195. #endif
  196. #ifdef FORCE_BANIAS
  197. #define FORCE
  198. #define FORCE_INTEL
  199. #define ARCHITECTURE "X86"
  200. #define SUBARCHITECTURE "BANIAS"
  201. #define ARCHCONFIG "-DPENTIUMM " \
  202. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 " \
  203. "-DL2_SIZE=1048576 -DL2_LINESIZE=64 " \
  204. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  205. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 "
  206. #define LIBNAME "banias"
  207. #define CORENAME "BANIAS"
  208. #endif
  209. #ifdef FORCE_YONAH
  210. #define FORCE
  211. #define FORCE_INTEL
  212. #define ARCHITECTURE "X86"
  213. #define SUBARCHITECTURE "YONAH"
  214. #define ARCHCONFIG "-DPENTIUMM " \
  215. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 " \
  216. "-DL2_SIZE=1048576 -DL2_LINESIZE=64 " \
  217. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  218. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 "
  219. #define LIBNAME "yonah"
  220. #define CORENAME "YONAH"
  221. #endif
  222. #ifdef FORCE_CORE2
  223. #define FORCE
  224. #define FORCE_INTEL
  225. #define ARCHITECTURE "X86"
  226. #define SUBARCHITECTURE "CONRORE"
  227. #define ARCHCONFIG "-DCORE2 " \
  228. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 " \
  229. "-DL2_SIZE=1048576 -DL2_LINESIZE=64 " \
  230. "-DDTB_DEFAULT_ENTRIES=256 -DDTB_SIZE=4096 " \
  231. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_SSSE3"
  232. #define LIBNAME "core2"
  233. #define CORENAME "CORE2"
  234. #endif
  235. #ifdef FORCE_PENRYN
  236. #define FORCE
  237. #define FORCE_INTEL
  238. #define ARCHITECTURE "X86"
  239. #define SUBARCHITECTURE "PENRYN"
  240. #define ARCHCONFIG "-DPENRYN " \
  241. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 " \
  242. "-DL2_SIZE=1048576 -DL2_LINESIZE=64 " \
  243. "-DDTB_DEFAULT_ENTRIES=256 -DDTB_SIZE=4096 " \
  244. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_SSSE3 -DHAVE_SSE4_1"
  245. #define LIBNAME "penryn"
  246. #define CORENAME "PENRYN"
  247. #endif
  248. #ifdef FORCE_DUNNINGTON
  249. #define FORCE
  250. #define FORCE_INTEL
  251. #define ARCHITECTURE "X86"
  252. #define SUBARCHITECTURE "DUNNINGTON"
  253. #define ARCHCONFIG "-DDUNNINGTON " \
  254. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 " \
  255. "-DL2_SIZE=1048576 -DL2_LINESIZE=64 " \
  256. "-DL3_SIZE=16777216 -DL3_LINESIZE=64 " \
  257. "-DDTB_DEFAULT_ENTRIES=256 -DDTB_SIZE=4096 " \
  258. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_SSSE3 -DHAVE_SSE4_1"
  259. #define LIBNAME "dunnington"
  260. #define CORENAME "DUNNINGTON"
  261. #endif
  262. #ifdef FORCE_NEHALEM
  263. #define FORCE
  264. #define FORCE_INTEL
  265. #define ARCHITECTURE "X86"
  266. #define SUBARCHITECTURE "NEHALEM"
  267. #define ARCHCONFIG "-DNEHALEM " \
  268. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 " \
  269. "-DL2_SIZE=262144 -DL2_LINESIZE=64 " \
  270. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  271. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_SSSE3 -DHAVE_SSE4_1 -DHAVE_SSE4_2"
  272. #define LIBNAME "nehalem"
  273. #define CORENAME "NEHALEM"
  274. #endif
  275. #ifdef FORCE_SANDYBRIDGE
  276. #define FORCE
  277. #define FORCE_INTEL
  278. #define ARCHITECTURE "X86"
  279. #define SUBARCHITECTURE "SANDYBRIDGE"
  280. #define ARCHCONFIG "-DSANDYBRIDGE " \
  281. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 " \
  282. "-DL2_SIZE=262144 -DL2_LINESIZE=64 " \
  283. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  284. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_SSSE3 -DHAVE_SSE4_1 -DHAVE_SSE4_2 -DHAVE_AVX"
  285. #define LIBNAME "sandybridge"
  286. #define CORENAME "SANDYBRIDGE"
  287. #endif
  288. #ifdef FORCE_HASWELL
  289. #define FORCE
  290. #define FORCE_INTEL
  291. #define ARCHITECTURE "X86"
  292. #define SUBARCHITECTURE "HASWELL"
  293. #define ARCHCONFIG "-DHASWELL " \
  294. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 " \
  295. "-DL2_SIZE=262144 -DL2_LINESIZE=64 " \
  296. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  297. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_SSSE3 -DHAVE_SSE4_1 -DHAVE_SSE4_2 -DHAVE_AVX " \
  298. "-DFMA3"
  299. #define LIBNAME "haswell"
  300. #define CORENAME "HASWELL"
  301. #endif
  302. #ifdef FORCE_ATOM
  303. #define FORCE
  304. #define FORCE_INTEL
  305. #define ARCHITECTURE "X86"
  306. #define SUBARCHITECTURE "ATOM"
  307. #define ARCHCONFIG "-DATOM " \
  308. "-DL1_DATA_SIZE=24576 -DL1_DATA_LINESIZE=64 " \
  309. "-DL2_SIZE=524288 -DL2_LINESIZE=64 " \
  310. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 " \
  311. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_SSSE3"
  312. #define LIBNAME "atom"
  313. #define CORENAME "ATOM"
  314. #endif
  315. #ifdef FORCE_ATHLON
  316. #define FORCE
  317. #define FORCE_INTEL
  318. #define ARCHITECTURE "X86"
  319. #define SUBARCHITECTURE "ATHLON"
  320. #define ARCHCONFIG "-DATHLON " \
  321. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=64 " \
  322. "-DL2_SIZE=1048576 -DL2_LINESIZE=64 " \
  323. "-DDTB_DEFAULT_ENTRIES=32 -DDTB_SIZE=4096 -DHAVE_3DNOW " \
  324. "-DHAVE_3DNOWEX -DHAVE_MMX -DHAVE_SSE "
  325. #define LIBNAME "athlon"
  326. #define CORENAME "ATHLON"
  327. #endif
  328. #ifdef FORCE_OPTERON
  329. #define FORCE
  330. #define FORCE_INTEL
  331. #define ARCHITECTURE "X86"
  332. #define SUBARCHITECTURE "OPTERON"
  333. #define ARCHCONFIG "-DOPTERON " \
  334. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=64 " \
  335. "-DL2_SIZE=1048576 -DL2_LINESIZE=64 " \
  336. "-DDTB_DEFAULT_ENTRIES=32 -DDTB_SIZE=4096 -DHAVE_3DNOW " \
  337. "-DHAVE_3DNOWEX -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 "
  338. #define LIBNAME "opteron"
  339. #define CORENAME "OPTERON"
  340. #endif
  341. #ifdef FORCE_OPTERON_SSE3
  342. #define FORCE
  343. #define FORCE_INTEL
  344. #define ARCHITECTURE "X86"
  345. #define SUBARCHITECTURE "OPTERON"
  346. #define ARCHCONFIG "-DOPTERON " \
  347. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=64 " \
  348. "-DL2_SIZE=1048576 -DL2_LINESIZE=64 " \
  349. "-DDTB_DEFAULT_ENTRIES=32 -DDTB_SIZE=4096 -DHAVE_3DNOW " \
  350. "-DHAVE_3DNOWEX -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3"
  351. #define LIBNAME "opteron"
  352. #define CORENAME "OPTERON"
  353. #endif
  354. #if defined(FORCE_BARCELONA) || defined(FORCE_SHANGHAI) || defined(FORCE_ISTANBUL)
  355. #define FORCE
  356. #define FORCE_INTEL
  357. #define ARCHITECTURE "X86"
  358. #define SUBARCHITECTURE "BARCELONA"
  359. #define ARCHCONFIG "-DBARCELONA " \
  360. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=64 " \
  361. "-DL2_SIZE=524288 -DL2_LINESIZE=64 -DL3_SIZE=2097152 " \
  362. "-DDTB_DEFAULT_ENTRIES=48 -DDTB_SIZE=4096 " \
  363. "-DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 " \
  364. "-DHAVE_SSE4A -DHAVE_MISALIGNSSE -DHAVE_128BITFPU -DHAVE_FASTMOVU"
  365. #define LIBNAME "barcelona"
  366. #define CORENAME "BARCELONA"
  367. #endif
  368. #if defined(FORCE_BOBCAT)
  369. #define FORCE
  370. #define FORCE_INTEL
  371. #define ARCHITECTURE "X86"
  372. #define SUBARCHITECTURE "BOBCAT"
  373. #define ARCHCONFIG "-DBOBCAT " \
  374. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 " \
  375. "-DL2_SIZE=524288 -DL2_LINESIZE=64 " \
  376. "-DDTB_DEFAULT_ENTRIES=40 -DDTB_SIZE=4096 " \
  377. "-DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_SSSE3 " \
  378. "-DHAVE_SSE4A -DHAVE_MISALIGNSSE -DHAVE_CFLUSH -DHAVE_CMOV"
  379. #define LIBNAME "bobcat"
  380. #define CORENAME "BOBCAT"
  381. #endif
  382. #if defined (FORCE_BULLDOZER)
  383. #define FORCE
  384. #define FORCE_INTEL
  385. #define ARCHITECTURE "X86"
  386. #define SUBARCHITECTURE "BULLDOZER"
  387. #define ARCHCONFIG "-DBULLDOZER " \
  388. "-DL1_DATA_SIZE=49152 -DL1_DATA_LINESIZE=64 " \
  389. "-DL2_SIZE=1024000 -DL2_LINESIZE=64 -DL3_SIZE=16777216 " \
  390. "-DDTB_DEFAULT_ENTRIES=32 -DDTB_SIZE=4096 " \
  391. "-DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 " \
  392. "-DHAVE_SSE4A -DHAVE_MISALIGNSSE -DHAVE_128BITFPU -DHAVE_FASTMOVU " \
  393. "-DHAVE_AVX -DHAVE_FMA4"
  394. #define LIBNAME "bulldozer"
  395. #define CORENAME "BULLDOZER"
  396. #endif
  397. #if defined (FORCE_PILEDRIVER)
  398. #define FORCE
  399. #define FORCE_INTEL
  400. #define ARCHITECTURE "X86"
  401. #define SUBARCHITECTURE "PILEDRIVER"
  402. #define ARCHCONFIG "-DPILEDRIVER " \
  403. "-DL1_DATA_SIZE=16384 -DL1_DATA_LINESIZE=64 " \
  404. "-DL2_SIZE=2097152 -DL2_LINESIZE=64 -DL3_SIZE=12582912 " \
  405. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  406. "-DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_SSE4_1 -DHAVE_SSE4_2 " \
  407. "-DHAVE_SSE4A -DHAVE_MISALIGNSSE -DHAVE_128BITFPU -DHAVE_FASTMOVU -DHAVE_CFLUSH " \
  408. "-DHAVE_AVX -DHAVE_FMA4 -DHAVE_FMA3"
  409. #define LIBNAME "piledriver"
  410. #define CORENAME "PILEDRIVER"
  411. #endif
  412. #if defined (FORCE_STEAMROLLER)
  413. #define FORCE
  414. #define FORCE_INTEL
  415. #define ARCHITECTURE "X86"
  416. #define SUBARCHITECTURE "STEAMROLLER"
  417. #define ARCHCONFIG "-DSTEAMROLLER " \
  418. "-DL1_DATA_SIZE=16384 -DL1_DATA_LINESIZE=64 " \
  419. "-DL2_SIZE=2097152 -DL2_LINESIZE=64 -DL3_SIZE=12582912 " \
  420. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  421. "-DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_SSE4_1 -DHAVE_SSE4_2 " \
  422. "-DHAVE_SSE4A -DHAVE_MISALIGNSSE -DHAVE_128BITFPU -DHAVE_FASTMOVU -DHAVE_CFLUSH " \
  423. "-DHAVE_AVX -DHAVE_FMA4 -DHAVE_FMA3"
  424. #define LIBNAME "steamroller"
  425. #define CORENAME "STEAMROLLER"
  426. #endif
  427. #if defined (FORCE_EXCAVATOR)
  428. #define FORCE
  429. #define FORCE_INTEL
  430. #define ARCHITECTURE "X86"
  431. #define SUBARCHITECTURE "EXCAVATOR"
  432. #define ARCHCONFIG "-DEXCAVATOR " \
  433. "-DL1_DATA_SIZE=16384 -DL1_DATA_LINESIZE=64 " \
  434. "-DL2_SIZE=2097152 -DL2_LINESIZE=64 -DL3_SIZE=12582912 " \
  435. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  436. "-DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_SSE4_1 -DHAVE_SSE4_2 " \
  437. "-DHAVE_SSE4A -DHAVE_MISALIGNSSE -DHAVE_128BITFPU -DHAVE_FASTMOVU -DHAVE_CFLUSH " \
  438. "-DHAVE_AVX -DHAVE_FMA4 -DHAVE_FMA3"
  439. #define LIBNAME "excavator"
  440. #define CORENAME "EXCAVATOR"
  441. #endif
  442. #if defined (FORCE_ZEN)
  443. #define FORCE
  444. #define FORCE_INTEL
  445. #define ARCHITECTURE "X86"
  446. #define SUBARCHITECTURE "ZEN"
  447. #define ARCHCONFIG "-DZEN " \
  448. "-DL1_CODE_SIZE=32768 -DL1_CODE_LINESIZE=64 -DL1_CODE_ASSOCIATIVE=8 " \
  449. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 -DL2_CODE_ASSOCIATIVE=8 " \
  450. "-DL2_SIZE=524288 -DL2_LINESIZE=64 -DL2_ASSOCIATIVE=8 " \
  451. "-DL3_SIZE=16777216 -DL3_LINESIZE=64 -DL3_ASSOCIATIVE=8 " \
  452. "-DITB_DEFAULT_ENTRIES=64 -DITB_SIZE=4096 " \
  453. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  454. "-DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_SSE4_1 -DHAVE_SSE4_2 " \
  455. "-DHAVE_SSE4A -DHAVE_MISALIGNSSE -DHAVE_128BITFPU -DHAVE_FASTMOVU -DHAVE_CFLUSH " \
  456. "-DHAVE_AVX -DHAVE_FMA3 -DFMA3"
  457. #define LIBNAME "zen"
  458. #define CORENAME "ZEN"
  459. #endif
  460. #ifdef FORCE_SSE_GENERIC
  461. #define FORCE
  462. #define FORCE_INTEL
  463. #define ARCHITECTURE "X86"
  464. #define SUBARCHITECTURE "GENERIC"
  465. #define ARCHCONFIG "-DGENERIC " \
  466. "-DL1_DATA_SIZE=16384 -DL1_DATA_LINESIZE=64 " \
  467. "-DL2_SIZE=524288 -DL2_LINESIZE=64 " \
  468. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 " \
  469. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2"
  470. #define LIBNAME "generic"
  471. #define CORENAME "GENERIC"
  472. #endif
  473. #ifdef FORCE_VIAC3
  474. #define FORCE
  475. #define FORCE_INTEL
  476. #define ARCHITECTURE "X86"
  477. #define SUBARCHITECTURE "VIAC3"
  478. #define ARCHCONFIG "-DVIAC3 " \
  479. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \
  480. "-DL2_SIZE=65536 -DL2_LINESIZE=32 " \
  481. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 " \
  482. "-DHAVE_MMX -DHAVE_SSE "
  483. #define LIBNAME "viac3"
  484. #define CORENAME "VIAC3"
  485. #endif
  486. #ifdef FORCE_NANO
  487. #define FORCE
  488. #define FORCE_INTEL
  489. #define ARCHITECTURE "X86"
  490. #define SUBARCHITECTURE "NANO"
  491. #define ARCHCONFIG "-DNANO " \
  492. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=64 " \
  493. "-DL2_SIZE=1048576 -DL2_LINESIZE=64 " \
  494. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 " \
  495. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_SSSE3"
  496. #define LIBNAME "nano"
  497. #define CORENAME "NANO"
  498. #endif
  499. #ifdef FORCE_POWER3
  500. #define FORCE
  501. #define ARCHITECTURE "POWER"
  502. #define SUBARCHITECTURE "POWER3"
  503. #define SUBDIRNAME "power"
  504. #define ARCHCONFIG "-DPOWER3 " \
  505. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=128 " \
  506. "-DL2_SIZE=2097152 -DL2_LINESIZE=128 " \
  507. "-DDTB_DEFAULT_ENTRIES=256 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  508. #define LIBNAME "power3"
  509. #define CORENAME "POWER3"
  510. #endif
  511. #ifdef FORCE_POWER4
  512. #define FORCE
  513. #define ARCHITECTURE "POWER"
  514. #define SUBARCHITECTURE "POWER4"
  515. #define SUBDIRNAME "power"
  516. #define ARCHCONFIG "-DPOWER4 " \
  517. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=128 " \
  518. "-DL2_SIZE=1509949 -DL2_LINESIZE=128 " \
  519. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=6 "
  520. #define LIBNAME "power4"
  521. #define CORENAME "POWER4"
  522. #endif
  523. #ifdef FORCE_POWER5
  524. #define FORCE
  525. #define ARCHITECTURE "POWER"
  526. #define SUBARCHITECTURE "POWER5"
  527. #define SUBDIRNAME "power"
  528. #define ARCHCONFIG "-DPOWER5 " \
  529. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=128 " \
  530. "-DL2_SIZE=1509949 -DL2_LINESIZE=128 " \
  531. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=6 "
  532. #define LIBNAME "power5"
  533. #define CORENAME "POWER5"
  534. #endif
  535. #if defined(FORCE_POWER6) || defined(FORCE_POWER7)
  536. #define FORCE
  537. #define ARCHITECTURE "POWER"
  538. #define SUBARCHITECTURE "POWER6"
  539. #define SUBDIRNAME "power"
  540. #define ARCHCONFIG "-DPOWER6 " \
  541. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=128 " \
  542. "-DL2_SIZE=4194304 -DL2_LINESIZE=128 " \
  543. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  544. #define LIBNAME "power6"
  545. #define CORENAME "POWER6"
  546. #endif
  547. #if defined(FORCE_POWER8)
  548. #define FORCE
  549. #define ARCHITECTURE "POWER"
  550. #define SUBARCHITECTURE "POWER8"
  551. #define SUBDIRNAME "power"
  552. #define ARCHCONFIG "-DPOWER8 " \
  553. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=128 " \
  554. "-DL2_SIZE=4194304 -DL2_LINESIZE=128 " \
  555. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  556. #define LIBNAME "power8"
  557. #define CORENAME "POWER8"
  558. #endif
  559. #ifdef FORCE_PPCG4
  560. #define FORCE
  561. #define ARCHITECTURE "POWER"
  562. #define SUBARCHITECTURE "PPCG4"
  563. #define SUBDIRNAME "power"
  564. #define ARCHCONFIG "-DPPCG4 " \
  565. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=32 " \
  566. "-DL2_SIZE=262144 -DL2_LINESIZE=32 " \
  567. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  568. #define LIBNAME "ppcg4"
  569. #define CORENAME "PPCG4"
  570. #endif
  571. #ifdef FORCE_PPC970
  572. #define FORCE
  573. #define ARCHITECTURE "POWER"
  574. #define SUBARCHITECTURE "PPC970"
  575. #define SUBDIRNAME "power"
  576. #define ARCHCONFIG "-DPPC970 " \
  577. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=128 " \
  578. "-DL2_SIZE=512488 -DL2_LINESIZE=128 " \
  579. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  580. #define LIBNAME "ppc970"
  581. #define CORENAME "PPC970"
  582. #endif
  583. #ifdef FORCE_PPC970MP
  584. #define FORCE
  585. #define ARCHITECTURE "POWER"
  586. #define SUBARCHITECTURE "PPC970"
  587. #define SUBDIRNAME "power"
  588. #define ARCHCONFIG "-DPPC970 " \
  589. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=128 " \
  590. "-DL2_SIZE=1024976 -DL2_LINESIZE=128 " \
  591. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  592. #define LIBNAME "ppc970mp"
  593. #define CORENAME "PPC970"
  594. #endif
  595. #ifdef FORCE_PPC440
  596. #define FORCE
  597. #define ARCHITECTURE "POWER"
  598. #define SUBARCHITECTURE "PPC440"
  599. #define SUBDIRNAME "power"
  600. #define ARCHCONFIG "-DPPC440 " \
  601. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=32 " \
  602. "-DL2_SIZE=16384 -DL2_LINESIZE=128 " \
  603. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=16 "
  604. #define LIBNAME "ppc440"
  605. #define CORENAME "PPC440"
  606. #endif
  607. #ifdef FORCE_PPC440FP2
  608. #define FORCE
  609. #define ARCHITECTURE "POWER"
  610. #define SUBARCHITECTURE "PPC440FP2"
  611. #define SUBDIRNAME "power"
  612. #define ARCHCONFIG "-DPPC440FP2 " \
  613. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=32 " \
  614. "-DL2_SIZE=16384 -DL2_LINESIZE=128 " \
  615. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=16 "
  616. #define LIBNAME "ppc440FP2"
  617. #define CORENAME "PPC440FP2"
  618. #endif
  619. #ifdef FORCE_CELL
  620. #define FORCE
  621. #define ARCHITECTURE "POWER"
  622. #define SUBARCHITECTURE "CELL"
  623. #define SUBDIRNAME "power"
  624. #define ARCHCONFIG "-DCELL " \
  625. "-DL1_DATA_SIZE=262144 -DL1_DATA_LINESIZE=128 " \
  626. "-DL2_SIZE=512488 -DL2_LINESIZE=128 " \
  627. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  628. #define LIBNAME "cell"
  629. #define CORENAME "CELL"
  630. #endif
  631. #ifdef FORCE_SICORTEX
  632. #define FORCE
  633. #define ARCHITECTURE "MIPS"
  634. #define SUBARCHITECTURE "SICORTEX"
  635. #define SUBDIRNAME "mips"
  636. #define ARCHCONFIG "-DSICORTEX " \
  637. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=32 " \
  638. "-DL2_SIZE=512488 -DL2_LINESIZE=32 " \
  639. "-DDTB_DEFAULT_ENTRIES=32 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  640. #define LIBNAME "mips"
  641. #define CORENAME "sicortex"
  642. #endif
  643. #ifdef FORCE_LOONGSON3A
  644. #define FORCE
  645. #define ARCHITECTURE "MIPS"
  646. #define SUBARCHITECTURE "LOONGSON3A"
  647. #define SUBDIRNAME "mips64"
  648. #define ARCHCONFIG "-DLOONGSON3A " \
  649. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \
  650. "-DL2_SIZE=512488 -DL2_LINESIZE=32 " \
  651. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 "
  652. #define LIBNAME "loongson3a"
  653. #define CORENAME "LOONGSON3A"
  654. #else
  655. #endif
  656. #ifdef FORCE_LOONGSON3B
  657. #define FORCE
  658. #define ARCHITECTURE "MIPS"
  659. #define SUBARCHITECTURE "LOONGSON3B"
  660. #define SUBDIRNAME "mips64"
  661. #define ARCHCONFIG "-DLOONGSON3B " \
  662. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \
  663. "-DL2_SIZE=512488 -DL2_LINESIZE=32 " \
  664. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 "
  665. #define LIBNAME "loongson3b"
  666. #define CORENAME "LOONGSON3B"
  667. #else
  668. #endif
  669. #ifdef FORCE_I6400
  670. #define FORCE
  671. #define ARCHITECTURE "MIPS"
  672. #define SUBARCHITECTURE "I6400"
  673. #define SUBDIRNAME "mips64"
  674. #define ARCHCONFIG "-DI6400 " \
  675. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \
  676. "-DL2_SIZE=1048576 -DL2_LINESIZE=32 " \
  677. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  678. #define LIBNAME "i6400"
  679. #define CORENAME "I6400"
  680. #else
  681. #endif
  682. #ifdef FORCE_P6600
  683. #define FORCE
  684. #define ARCHITECTURE "MIPS"
  685. #define SUBARCHITECTURE "P6600"
  686. #define SUBDIRNAME "mips64"
  687. #define ARCHCONFIG "-DP6600 " \
  688. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \
  689. "-DL2_SIZE=1048576 -DL2_LINESIZE=32 " \
  690. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  691. #define LIBNAME "p6600"
  692. #define CORENAME "P6600"
  693. #else
  694. #endif
  695. #ifdef FORCE_P5600
  696. #define FORCE
  697. #define ARCHITECTURE "MIPS"
  698. #define SUBARCHITECTURE "P5600"
  699. #define SUBDIRNAME "mips"
  700. #define ARCHCONFIG "-DP5600 " \
  701. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \
  702. "-DL2_SIZE=1048576 -DL2_LINESIZE=32 " \
  703. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  704. #define LIBNAME "p5600"
  705. #define CORENAME "P5600"
  706. #else
  707. #endif
  708. #ifdef FORCE_ITANIUM2
  709. #define FORCE
  710. #define ARCHITECTURE "IA64"
  711. #define SUBARCHITECTURE "ITANIUM2"
  712. #define SUBDIRNAME "ia64"
  713. #define ARCHCONFIG "-DITANIUM2 " \
  714. "-DL1_DATA_SIZE=262144 -DL1_DATA_LINESIZE=128 " \
  715. "-DL2_SIZE=1572864 -DL2_LINESIZE=128 -DDTB_SIZE=16384 -DDTB_DEFAULT_ENTRIES=128 "
  716. #define LIBNAME "itanium2"
  717. #define CORENAME "itanium2"
  718. #endif
  719. #ifdef FORCE_SPARC
  720. #define FORCE
  721. #define ARCHITECTURE "SPARC"
  722. #define SUBARCHITECTURE "SPARC"
  723. #define SUBDIRNAME "sparc"
  724. #define ARCHCONFIG "-DSPARC -DV9 " \
  725. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=64 " \
  726. "-DL2_SIZE=1572864 -DL2_LINESIZE=64 -DDTB_SIZE=8192 -DDTB_DEFAULT_ENTRIES=64 "
  727. #define LIBNAME "sparc"
  728. #define CORENAME "sparc"
  729. #endif
  730. #ifdef FORCE_SPARCV7
  731. #define FORCE
  732. #define ARCHITECTURE "SPARC"
  733. #define SUBARCHITECTURE "SPARC"
  734. #define SUBDIRNAME "sparc"
  735. #define ARCHCONFIG "-DSPARC -DV7 " \
  736. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=64 " \
  737. "-DL2_SIZE=1572864 -DL2_LINESIZE=64 -DDTB_SIZE=8192 -DDTB_DEFAULT_ENTRIES=64 "
  738. #define LIBNAME "sparcv7"
  739. #define CORENAME "sparcv7"
  740. #endif
  741. #ifdef FORCE_GENERIC
  742. #define FORCE
  743. #define ARCHITECTURE "GENERIC"
  744. #define SUBARCHITECTURE "GENERIC"
  745. #define SUBDIRNAME "generic"
  746. #define ARCHCONFIG "-DGENERIC " \
  747. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=128 " \
  748. "-DL2_SIZE=512488 -DL2_LINESIZE=128 " \
  749. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  750. #define LIBNAME "generic"
  751. #define CORENAME "generic"
  752. #endif
  753. #ifdef FORCE_ARMV7
  754. #define FORCE
  755. #define ARCHITECTURE "ARM"
  756. #define SUBARCHITECTURE "ARMV7"
  757. #define SUBDIRNAME "arm"
  758. #define ARCHCONFIG "-DARMV7 " \
  759. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \
  760. "-DL2_SIZE=512488 -DL2_LINESIZE=32 " \
  761. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 " \
  762. "-DHAVE_VFPV3 -DHAVE_VFP"
  763. #define LIBNAME "armv7"
  764. #define CORENAME "ARMV7"
  765. #else
  766. #endif
  767. #ifdef FORCE_CORTEXA9
  768. #define FORCE
  769. #define ARCHITECTURE "ARM"
  770. #define SUBARCHITECTURE "CORTEXA9"
  771. #define SUBDIRNAME "arm"
  772. #define ARCHCONFIG "-DCORTEXA9 -DARMV7 " \
  773. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=32 " \
  774. "-DL2_SIZE=1048576 -DL2_LINESIZE=32 " \
  775. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 " \
  776. "-DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON"
  777. #define LIBNAME "cortexa9"
  778. #define CORENAME "CORTEXA9"
  779. #else
  780. #endif
  781. #ifdef FORCE_CORTEXA15
  782. #define FORCE
  783. #define ARCHITECTURE "ARM"
  784. #define SUBARCHITECTURE "CORTEXA15"
  785. #define SUBDIRNAME "arm"
  786. #define ARCHCONFIG "-DCORTEXA15 -DARMV7 " \
  787. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=32 " \
  788. "-DL2_SIZE=1048576 -DL2_LINESIZE=32 " \
  789. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 " \
  790. "-DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON"
  791. #define LIBNAME "cortexa15"
  792. #define CORENAME "CORTEXA15"
  793. #else
  794. #endif
  795. #ifdef FORCE_ARMV6
  796. #define FORCE
  797. #define ARCHITECTURE "ARM"
  798. #define SUBARCHITECTURE "ARMV6"
  799. #define SUBDIRNAME "arm"
  800. #define ARCHCONFIG "-DARMV6 " \
  801. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \
  802. "-DL2_SIZE=512488 -DL2_LINESIZE=32 " \
  803. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 " \
  804. "-DHAVE_VFP"
  805. #define LIBNAME "armv6"
  806. #define CORENAME "ARMV6"
  807. #else
  808. #endif
  809. #ifdef FORCE_ARMV5
  810. #define FORCE
  811. #define ARCHITECTURE "ARM"
  812. #define SUBARCHITECTURE "ARMV5"
  813. #define SUBDIRNAME "arm"
  814. #define ARCHCONFIG "-DARMV5 " \
  815. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \
  816. "-DL2_SIZE=512488 -DL2_LINESIZE=32 " \
  817. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 "
  818. #define LIBNAME "armv5"
  819. #define CORENAME "ARMV5"
  820. #else
  821. #endif
  822. #ifdef FORCE_ARMV8
  823. #define FORCE
  824. #define ARCHITECTURE "ARM64"
  825. #define SUBARCHITECTURE "ARMV8"
  826. #define SUBDIRNAME "arm64"
  827. #define ARCHCONFIG "-DARMV8 " \
  828. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 " \
  829. "-DL2_SIZE=262144 -DL2_LINESIZE=64 " \
  830. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=32 "
  831. #define LIBNAME "armv8"
  832. #define CORENAME "ARMV8"
  833. #endif
  834. #ifdef FORCE_CORTEXA57
  835. #define FORCE
  836. #define ARCHITECTURE "ARM64"
  837. #define SUBARCHITECTURE "CORTEXA57"
  838. #define SUBDIRNAME "arm64"
  839. #define ARCHCONFIG "-DCORTEXA57 " \
  840. "-DL1_CODE_SIZE=49152 -DL1_CODE_LINESIZE=64 -DL1_CODE_ASSOCIATIVE=3 " \
  841. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 -DL1_DATA_ASSOCIATIVE=2 " \
  842. "-DL2_SIZE=2097152 -DL2_LINESIZE=64 -DL2_ASSOCIATIVE=16 " \
  843. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  844. "-DHAVE_VFPV4 -DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON"
  845. #define LIBNAME "cortexa57"
  846. #define CORENAME "CORTEXA57"
  847. #else
  848. #endif
  849. #ifdef FORCE_VULCAN
  850. #define FORCE
  851. #define ARCHITECTURE "ARM64"
  852. #define SUBARCHITECTURE "VULCAN"
  853. #define SUBDIRNAME "arm64"
  854. #define ARCHCONFIG "-DVULCAN " \
  855. "-DL1_CODE_SIZE=32768 -DL1_CODE_LINESIZE=64 -DL1_CODE_ASSOCIATIVE=8 " \
  856. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 -DL1_DATA_ASSOCIATIVE=8 " \
  857. "-DL2_SIZE=262144 -DL2_LINESIZE=64 -DL2_ASSOCIATIVE=8 " \
  858. "-DL3_SIZE=33554432 -DL3_LINESIZE=64 -DL3_ASSOCIATIVE=32 " \
  859. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  860. "-DHAVE_VFPV4 -DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON"
  861. #define LIBNAME "vulcan"
  862. #define CORENAME "VULCAN"
  863. #else
  864. #endif
  865. #ifdef FORCE_THUNDERX
  866. #define FORCE
  867. #define ARCHITECTURE "ARM64"
  868. #define SUBARCHITECTURE "THUNDERX"
  869. #define SUBDIRNAME "arm64"
  870. #define ARCHCONFIG "-DTHUNDERX " \
  871. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=128 " \
  872. "-DL2_SIZE=16777216 -DL2_LINESIZE=128 -DL2_ASSOCIATIVE=16 " \
  873. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 "
  874. #define LIBNAME "thunderx"
  875. #define CORENAME "THUNDERX"
  876. #else
  877. #endif
  878. #ifdef FORCE_THUNDERX2T99
  879. #define FORCE
  880. #define ARCHITECTURE "ARM64"
  881. #define SUBARCHITECTURE "THUNDERX2T99"
  882. #define SUBDIRNAME "arm64"
  883. #define ARCHCONFIG "-DTHUNDERX2T99 " \
  884. "-DL1_CODE_SIZE=32768 -DL1_CODE_LINESIZE=64 -DL1_CODE_ASSOCIATIVE=8 " \
  885. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 -DL1_DATA_ASSOCIATIVE=8 " \
  886. "-DL2_SIZE=262144 -DL2_LINESIZE=64 -DL2_ASSOCIATIVE=8 " \
  887. "-DL3_SIZE=33554432 -DL3_LINESIZE=64 -DL3_ASSOCIATIVE=32 " \
  888. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  889. "-DHAVE_VFPV4 -DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON"
  890. #define LIBNAME "thunderx2t99"
  891. #define CORENAME "THUNDERX2T99"
  892. #else
  893. #endif
  894. #ifndef FORCE
  895. #if defined(__powerpc__) || defined(__powerpc) || defined(powerpc) || \
  896. defined(__PPC__) || defined(PPC) || defined(_POWER) || defined(__POWERPC__)
  897. #ifndef POWER
  898. #define POWER
  899. #endif
  900. #define OPENBLAS_SUPPORTED
  901. #endif
  902. #if defined(__zarch__) || defined(__s390x__)
  903. #define ZARCH
  904. #include "cpuid_zarch.c"
  905. #define OPENBLAS_SUPPORTED
  906. #endif
  907. #ifdef INTEL_AMD
  908. #include "cpuid_x86.c"
  909. #define OPENBLAS_SUPPORTED
  910. #endif
  911. #ifdef __ia64__
  912. #include "cpuid_ia64.c"
  913. #define OPENBLAS_SUPPORTED
  914. #endif
  915. #ifdef __alpha
  916. #include "cpuid_alpha.c"
  917. #define OPENBLAS_SUPPORTED
  918. #endif
  919. #ifdef POWER
  920. #include "cpuid_power.c"
  921. #define OPENBLAS_SUPPORTED
  922. #endif
  923. #ifdef sparc
  924. #include "cpuid_sparc.c"
  925. #define OPENBLAS_SUPPORTED
  926. #endif
  927. #ifdef __mips__
  928. #ifdef __mips64
  929. #include "cpuid_mips64.c"
  930. #else
  931. #include "cpuid_mips.c"
  932. #endif
  933. #define OPENBLAS_SUPPORTED
  934. #endif
  935. #ifdef __arm__
  936. #include "cpuid_arm.c"
  937. #define OPENBLAS_SUPPORTED
  938. #endif
  939. #ifdef __aarch64__
  940. #include "cpuid_arm64.c"
  941. #define OPENBLAS_SUPPORTED
  942. #endif
  943. #ifndef OPENBLAS_SUPPORTED
  944. #error "This arch/CPU is not supported by OpenBLAS."
  945. #endif
  946. #else
  947. #endif
  948. static int get_num_cores(void) {
  949. #ifdef OS_WINDOWS
  950. SYSTEM_INFO sysinfo;
  951. #elif defined(__FreeBSD__) || defined(__APPLE__)
  952. int m[2], count;
  953. size_t len;
  954. #endif
  955. #if defined(linux) || defined(__sun__)
  956. //returns the number of processors which are currently online
  957. return sysconf(_SC_NPROCESSORS_CONF);
  958. #elif defined(OS_WINDOWS)
  959. GetSystemInfo(&sysinfo);
  960. return sysinfo.dwNumberOfProcessors;
  961. #elif defined(__FreeBSD__) || defined(__APPLE__)
  962. m[0] = CTL_HW;
  963. m[1] = HW_NCPU;
  964. len = sizeof(int);
  965. sysctl(m, 2, &count, &len, NULL, 0);
  966. return count;
  967. #else
  968. return 2;
  969. #endif
  970. }
  971. int main(int argc, char *argv[]){
  972. #ifdef FORCE
  973. char buffer[8192], *p, *q;
  974. int length;
  975. #endif
  976. if (argc == 1) return 0;
  977. switch (argv[1][0]) {
  978. case '0' : /* for Makefile */
  979. #ifdef FORCE
  980. printf("CORE=%s\n", CORENAME);
  981. #else
  982. #if defined(INTEL_AMD) || defined(POWER) || defined(__mips__) || defined(__arm__) || defined(__aarch64__) || defined(ZARCH)
  983. printf("CORE=%s\n", get_corename());
  984. #endif
  985. #endif
  986. #ifdef FORCE
  987. printf("LIBCORE=%s\n", LIBNAME);
  988. #else
  989. printf("LIBCORE=");
  990. get_libname();
  991. printf("\n");
  992. #endif
  993. printf("NUM_CORES=%d\n", get_num_cores());
  994. #if defined(__arm__) && !defined(FORCE)
  995. get_features();
  996. #endif
  997. #ifdef INTEL_AMD
  998. #ifndef FORCE
  999. get_sse();
  1000. #else
  1001. sprintf(buffer, "%s", ARCHCONFIG);
  1002. p = &buffer[0];
  1003. while (*p) {
  1004. if ((*p == '-') && (*(p + 1) == 'D')) {
  1005. p += 2;
  1006. while ((*p != ' ') && (*p != '\0')) {
  1007. if (*p == '=') {
  1008. printf("=");
  1009. p ++;
  1010. while ((*p != ' ') && (*p != '\0')) {
  1011. printf("%c", *p);
  1012. p ++;
  1013. }
  1014. } else {
  1015. printf("%c", *p);
  1016. p ++;
  1017. if ((*p == ' ') || (*p =='\0')) printf("=1");
  1018. }
  1019. }
  1020. printf("\n");
  1021. } else p ++;
  1022. }
  1023. #endif
  1024. #endif
  1025. #ifdef MAKE_NB_JOBS
  1026. #if MAKE_NB_JOBS > 0
  1027. printf("MAKE += -j %d\n", MAKE_NB_JOBS);
  1028. #else
  1029. // Let make use parent -j argument or -j1 if there
  1030. // is no make parent
  1031. #endif
  1032. #elif NO_PARALLEL_MAKE==1
  1033. printf("MAKE += -j 1\n");
  1034. #else
  1035. #ifndef OS_WINDOWS
  1036. printf("MAKE += -j %d\n", get_num_cores());
  1037. #endif
  1038. #endif
  1039. break;
  1040. case '1' : /* For config.h */
  1041. #ifdef FORCE
  1042. sprintf(buffer, "%s -DCORE_%s\n", ARCHCONFIG, CORENAME);
  1043. p = &buffer[0];
  1044. while (*p) {
  1045. if ((*p == '-') && (*(p + 1) == 'D')) {
  1046. p += 2;
  1047. printf("#define ");
  1048. while ((*p != ' ') && (*p != '\0')) {
  1049. if (*p == '=') {
  1050. printf(" ");
  1051. p ++;
  1052. while ((*p != ' ') && (*p != '\0')) {
  1053. printf("%c", *p);
  1054. p ++;
  1055. }
  1056. } else {
  1057. if (*p != '\n')
  1058. printf("%c", *p);
  1059. p ++;
  1060. }
  1061. }
  1062. printf("\n");
  1063. } else p ++;
  1064. }
  1065. #else
  1066. get_cpuconfig();
  1067. #endif
  1068. #ifdef FORCE
  1069. printf("#define CHAR_CORENAME \"%s\"\n", CORENAME);
  1070. #else
  1071. #if defined(INTEL_AMD) || defined(POWER) || defined(__mips__) || defined(__arm__) || defined(__aarch64__) || defined(ZARCH)
  1072. printf("#define CHAR_CORENAME \"%s\"\n", get_corename());
  1073. #endif
  1074. #endif
  1075. break;
  1076. case '2' : /* SMP */
  1077. if (get_num_cores() > 1) printf("SMP=1\n");
  1078. break;
  1079. }
  1080. fflush(stdout);
  1081. return 0;
  1082. }