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

14 years ago
10 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187
  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 "CORTEXA57"
  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. #ifdef FORCE_VULCAN
  832. #define FORCE
  833. #define ARCHITECTURE "ARM64"
  834. #define SUBARCHITECTURE "VULCAN"
  835. #define SUBDIRNAME "arm64"
  836. #define ARCHCONFIG "-DVULCAN " \
  837. "-DL1_CODE_SIZE=32768 -DL1_CODE_LINESIZE=64 -DL1_CODE_ASSOCIATIVE=8 " \
  838. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 -DL1_DATA_ASSOCIATIVE=8 " \
  839. "-DL2_SIZE=262144 -DL2_LINESIZE=64 -DL2_ASSOCIATIVE=8 " \
  840. "-DL3_SIZE=33554432 -DL3_LINESIZE=64 -DL3_ASSOCIATIVE=32 " \
  841. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  842. "-DHAVE_VFPV4 -DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON"
  843. #define LIBNAME "vulcan"
  844. #define CORENAME "VULCAN"
  845. #else
  846. #endif
  847. #ifdef FORCE_THUNDERX
  848. #define FORCE
  849. #define ARCHITECTURE "ARM64"
  850. #define SUBARCHITECTURE "THUNDERX"
  851. #define SUBDIRNAME "arm64"
  852. #define ARCHCONFIG "-DTHUNDERX " \
  853. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=128 " \
  854. "-DL2_SIZE=16777216 -DL2_LINESIZE=128 -DL2_ASSOCIATIVE=16 " \
  855. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 "
  856. #define LIBNAME "thunderx"
  857. #define CORENAME "THUNDERX"
  858. #else
  859. #endif
  860. #ifdef FORCE_THUNDERX2T99
  861. #define FORCE
  862. #define ARCHITECTURE "ARM64"
  863. #define SUBARCHITECTURE "THUNDERX2T99"
  864. #define SUBDIRNAME "arm64"
  865. #define ARCHCONFIG "-DTHUNDERX2T99 " \
  866. "-DL1_CODE_SIZE=32768 -DL1_CODE_LINESIZE=64 -DL1_CODE_ASSOCIATIVE=8 " \
  867. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 -DL1_DATA_ASSOCIATIVE=8 " \
  868. "-DL2_SIZE=262144 -DL2_LINESIZE=64 -DL2_ASSOCIATIVE=8 " \
  869. "-DL3_SIZE=33554432 -DL3_LINESIZE=64 -DL3_ASSOCIATIVE=32 " \
  870. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  871. "-DHAVE_VFPV4 -DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON"
  872. #define LIBNAME "thunderx2t99"
  873. #define CORENAME "THUNDERX2T99"
  874. #else
  875. #endif
  876. #ifndef FORCE
  877. #if defined(__powerpc__) || defined(__powerpc) || defined(powerpc) || \
  878. defined(__PPC__) || defined(PPC) || defined(_POWER) || defined(__POWERPC__)
  879. #ifndef POWER
  880. #define POWER
  881. #endif
  882. #define OPENBLAS_SUPPORTED
  883. #endif
  884. #if defined(__zarch__) || defined(__s390x__)
  885. #define ZARCH
  886. #include "cpuid_zarch.c"
  887. #define OPENBLAS_SUPPORTED
  888. #endif
  889. #ifdef INTEL_AMD
  890. #include "cpuid_x86.c"
  891. #define OPENBLAS_SUPPORTED
  892. #endif
  893. #ifdef __ia64__
  894. #include "cpuid_ia64.c"
  895. #define OPENBLAS_SUPPORTED
  896. #endif
  897. #ifdef __alpha
  898. #include "cpuid_alpha.c"
  899. #define OPENBLAS_SUPPORTED
  900. #endif
  901. #ifdef POWER
  902. #include "cpuid_power.c"
  903. #define OPENBLAS_SUPPORTED
  904. #endif
  905. #ifdef sparc
  906. #include "cpuid_sparc.c"
  907. #define OPENBLAS_SUPPORTED
  908. #endif
  909. #ifdef __mips__
  910. #ifdef __mips64
  911. #include "cpuid_mips64.c"
  912. #else
  913. #include "cpuid_mips.c"
  914. #endif
  915. #define OPENBLAS_SUPPORTED
  916. #endif
  917. #ifdef __arm__
  918. #include "cpuid_arm.c"
  919. #define OPENBLAS_SUPPORTED
  920. #endif
  921. #ifdef __aarch64__
  922. #include "cpuid_arm64.c"
  923. #define OPENBLAS_SUPPORTED
  924. #endif
  925. #ifndef OPENBLAS_SUPPORTED
  926. #error "This arch/CPU is not supported by OpenBLAS."
  927. #endif
  928. #else
  929. #endif
  930. static int get_num_cores(void) {
  931. #ifdef OS_WINDOWS
  932. SYSTEM_INFO sysinfo;
  933. #elif defined(__FreeBSD__) || defined(__APPLE__)
  934. int m[2], count;
  935. size_t len;
  936. #endif
  937. #if defined(linux) || defined(__sun__)
  938. //returns the number of processors which are currently online
  939. return sysconf(_SC_NPROCESSORS_CONF);
  940. #elif defined(OS_WINDOWS)
  941. GetSystemInfo(&sysinfo);
  942. return sysinfo.dwNumberOfProcessors;
  943. #elif defined(__FreeBSD__) || defined(__APPLE__)
  944. m[0] = CTL_HW;
  945. m[1] = HW_NCPU;
  946. len = sizeof(int);
  947. sysctl(m, 2, &count, &len, NULL, 0);
  948. return count;
  949. #else
  950. return 2;
  951. #endif
  952. }
  953. int main(int argc, char *argv[]){
  954. #ifdef FORCE
  955. char buffer[8192], *p, *q;
  956. int length;
  957. #endif
  958. if (argc == 1) return 0;
  959. switch (argv[1][0]) {
  960. case '0' : /* for Makefile */
  961. #ifdef FORCE
  962. printf("CORE=%s\n", CORENAME);
  963. #else
  964. #if defined(INTEL_AMD) || defined(POWER) || defined(__mips__) || defined(__arm__) || defined(__aarch64__) || defined(ZARCH)
  965. printf("CORE=%s\n", get_corename());
  966. #endif
  967. #endif
  968. #ifdef FORCE
  969. printf("LIBCORE=%s\n", LIBNAME);
  970. #else
  971. printf("LIBCORE=");
  972. get_libname();
  973. printf("\n");
  974. #endif
  975. printf("NUM_CORES=%d\n", get_num_cores());
  976. #if defined(__arm__) && !defined(FORCE)
  977. get_features();
  978. #endif
  979. #ifdef INTEL_AMD
  980. #ifndef FORCE
  981. get_sse();
  982. #else
  983. sprintf(buffer, "%s", ARCHCONFIG);
  984. p = &buffer[0];
  985. while (*p) {
  986. if ((*p == '-') && (*(p + 1) == 'D')) {
  987. p += 2;
  988. while ((*p != ' ') && (*p != '\0')) {
  989. if (*p == '=') {
  990. printf("=");
  991. p ++;
  992. while ((*p != ' ') && (*p != '\0')) {
  993. printf("%c", *p);
  994. p ++;
  995. }
  996. } else {
  997. printf("%c", *p);
  998. p ++;
  999. if ((*p == ' ') || (*p =='\0')) printf("=1");
  1000. }
  1001. }
  1002. printf("\n");
  1003. } else p ++;
  1004. }
  1005. #endif
  1006. #endif
  1007. #ifdef MAKE_NB_JOBS
  1008. #if MAKE_NB_JOBS > 0
  1009. printf("MAKE += -j %d\n", MAKE_NB_JOBS);
  1010. #else
  1011. // Let make use parent -j argument or -j1 if there
  1012. // is no make parent
  1013. #endif
  1014. #elif NO_PARALLEL_MAKE==1
  1015. printf("MAKE += -j 1\n");
  1016. #else
  1017. #ifndef OS_WINDOWS
  1018. printf("MAKE += -j %d\n", get_num_cores());
  1019. #endif
  1020. #endif
  1021. break;
  1022. case '1' : /* For config.h */
  1023. #ifdef FORCE
  1024. sprintf(buffer, "%s -DCORE_%s\n", ARCHCONFIG, CORENAME);
  1025. p = &buffer[0];
  1026. while (*p) {
  1027. if ((*p == '-') && (*(p + 1) == 'D')) {
  1028. p += 2;
  1029. printf("#define ");
  1030. while ((*p != ' ') && (*p != '\0')) {
  1031. if (*p == '=') {
  1032. printf(" ");
  1033. p ++;
  1034. while ((*p != ' ') && (*p != '\0')) {
  1035. printf("%c", *p);
  1036. p ++;
  1037. }
  1038. } else {
  1039. if (*p != '\n')
  1040. printf("%c", *p);
  1041. p ++;
  1042. }
  1043. }
  1044. printf("\n");
  1045. } else p ++;
  1046. }
  1047. #else
  1048. get_cpuconfig();
  1049. #endif
  1050. #ifdef FORCE
  1051. printf("#define CHAR_CORENAME \"%s\"\n", CORENAME);
  1052. #else
  1053. #if defined(INTEL_AMD) || defined(POWER) || defined(__mips__) || defined(__arm__) || defined(__aarch64__) || defined(ZARCH)
  1054. printf("#define CHAR_CORENAME \"%s\"\n", get_corename());
  1055. #endif
  1056. #endif
  1057. break;
  1058. case '2' : /* SMP */
  1059. if (get_num_cores() > 1) printf("SMP=1\n");
  1060. break;
  1061. }
  1062. fflush(stdout);
  1063. return 0;
  1064. }