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 38 kB

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