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

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