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