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

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