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

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