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

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