You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

getarch.c 32 kB

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