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

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