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

14 years ago
10 years ago
Simplifying ARMv8 build parameters ARMv8 builds were a bit mixed up, with ThunderX2 code in ARMv8 mode (which is not right because TX2 is ARMv8.1) as well as requiring a few redundancies in the defines, making it harder to maintain and understand what core has what. A few other minor issues were also fixed. Tests were made on the following cores: A53, A57, A72, Falkor, ThunderX, ThunderX2, and XGene. Tests were: OpenBLAS/test, OpenBLAS/benchmark, BLAS-Tester. A summary: * Removed TX2 code from ARMv8 build, to make sure it is compatible with all ARMv8 cores, not just v8.1. Also, the TX2 code has actually harmed performance on big cores. * Commoned up ARMv8 architectures' defines in params.h, to make sure that all will benefit from ARMv8 settings, in addition to their own. * Adding a few more cores, using ARMv8's include strategy, to benefit from compiler optimisations using mtune. Also updated cache information from the manuals, making sure we set good conservative values by default. Removed Vulcan, as it's an alias to TX2. * Auto-detecting most of those cores, but also updating the forced compilation in getarch.c, to make sure the parameters are the same whether compiled natively or forced arch. Benefits: * ARMv8 build is now guaranteed to work on all ARMv8 cores * Improved performance for ARMv8 builds on some cores (A72, Falkor, ThunderX1 and 2: up to 11%) over current develop * Improved performance for *all* cores comparing to develop branch before TX2's patch (9% ~ 36%) * ThunderX1 builds are 14% faster than ARMv8 on TX1, 9% faster than current develop's branch and 8% faster than deveop before tx2 patches Issues: * Regression from current develop branch for A53 (-12%) and A57 (-3%) with ARMv8 builds, but still faster than before TX2's commit (+15% and +24% respectively). This can be improved with a simplification of TX2's code, to be done in future patches. At least the code is guaranteed to be ARMv8.0 now. Comments: * CortexA57 builds are unchanged on A57 hardware from develop's branch, which makes sense, as it's untouched. * CortexA72 builds improve over A57 on A72 hardware, even if they're using the same includes due to new compiler tunning in the makefile.
6 years ago
Simplifying ARMv8 build parameters ARMv8 builds were a bit mixed up, with ThunderX2 code in ARMv8 mode (which is not right because TX2 is ARMv8.1) as well as requiring a few redundancies in the defines, making it harder to maintain and understand what core has what. A few other minor issues were also fixed. Tests were made on the following cores: A53, A57, A72, Falkor, ThunderX, ThunderX2, and XGene. Tests were: OpenBLAS/test, OpenBLAS/benchmark, BLAS-Tester. A summary: * Removed TX2 code from ARMv8 build, to make sure it is compatible with all ARMv8 cores, not just v8.1. Also, the TX2 code has actually harmed performance on big cores. * Commoned up ARMv8 architectures' defines in params.h, to make sure that all will benefit from ARMv8 settings, in addition to their own. * Adding a few more cores, using ARMv8's include strategy, to benefit from compiler optimisations using mtune. Also updated cache information from the manuals, making sure we set good conservative values by default. Removed Vulcan, as it's an alias to TX2. * Auto-detecting most of those cores, but also updating the forced compilation in getarch.c, to make sure the parameters are the same whether compiled natively or forced arch. Benefits: * ARMv8 build is now guaranteed to work on all ARMv8 cores * Improved performance for ARMv8 builds on some cores (A72, Falkor, ThunderX1 and 2: up to 11%) over current develop * Improved performance for *all* cores comparing to develop branch before TX2's patch (9% ~ 36%) * ThunderX1 builds are 14% faster than ARMv8 on TX1, 9% faster than current develop's branch and 8% faster than deveop before tx2 patches Issues: * Regression from current develop branch for A53 (-12%) and A57 (-3%) with ARMv8 builds, but still faster than before TX2's commit (+15% and +24% respectively). This can be improved with a simplification of TX2's code, to be done in future patches. At least the code is guaranteed to be ARMv8.0 now. Comments: * CortexA57 builds are unchanged on A57 hardware from develop's branch, which makes sense, as it's untouched. * CortexA72 builds improve over A57 on A72 hardware, even if they're using the same includes due to new compiler tunning in the makefile.
6 years ago
Simplifying ARMv8 build parameters ARMv8 builds were a bit mixed up, with ThunderX2 code in ARMv8 mode (which is not right because TX2 is ARMv8.1) as well as requiring a few redundancies in the defines, making it harder to maintain and understand what core has what. A few other minor issues were also fixed. Tests were made on the following cores: A53, A57, A72, Falkor, ThunderX, ThunderX2, and XGene. Tests were: OpenBLAS/test, OpenBLAS/benchmark, BLAS-Tester. A summary: * Removed TX2 code from ARMv8 build, to make sure it is compatible with all ARMv8 cores, not just v8.1. Also, the TX2 code has actually harmed performance on big cores. * Commoned up ARMv8 architectures' defines in params.h, to make sure that all will benefit from ARMv8 settings, in addition to their own. * Adding a few more cores, using ARMv8's include strategy, to benefit from compiler optimisations using mtune. Also updated cache information from the manuals, making sure we set good conservative values by default. Removed Vulcan, as it's an alias to TX2. * Auto-detecting most of those cores, but also updating the forced compilation in getarch.c, to make sure the parameters are the same whether compiled natively or forced arch. Benefits: * ARMv8 build is now guaranteed to work on all ARMv8 cores * Improved performance for ARMv8 builds on some cores (A72, Falkor, ThunderX1 and 2: up to 11%) over current develop * Improved performance for *all* cores comparing to develop branch before TX2's patch (9% ~ 36%) * ThunderX1 builds are 14% faster than ARMv8 on TX1, 9% faster than current develop's branch and 8% faster than deveop before tx2 patches Issues: * Regression from current develop branch for A53 (-12%) and A57 (-3%) with ARMv8 builds, but still faster than before TX2's commit (+15% and +24% respectively). This can be improved with a simplification of TX2's code, to be done in future patches. At least the code is guaranteed to be ARMv8.0 now. Comments: * CortexA57 builds are unchanged on A57 hardware from develop's branch, which makes sense, as it's untouched. * CortexA72 builds improve over A57 on A72 hardware, even if they're using the same includes due to new compiler tunning in the makefile.
6 years ago
Simplifying ARMv8 build parameters ARMv8 builds were a bit mixed up, with ThunderX2 code in ARMv8 mode (which is not right because TX2 is ARMv8.1) as well as requiring a few redundancies in the defines, making it harder to maintain and understand what core has what. A few other minor issues were also fixed. Tests were made on the following cores: A53, A57, A72, Falkor, ThunderX, ThunderX2, and XGene. Tests were: OpenBLAS/test, OpenBLAS/benchmark, BLAS-Tester. A summary: * Removed TX2 code from ARMv8 build, to make sure it is compatible with all ARMv8 cores, not just v8.1. Also, the TX2 code has actually harmed performance on big cores. * Commoned up ARMv8 architectures' defines in params.h, to make sure that all will benefit from ARMv8 settings, in addition to their own. * Adding a few more cores, using ARMv8's include strategy, to benefit from compiler optimisations using mtune. Also updated cache information from the manuals, making sure we set good conservative values by default. Removed Vulcan, as it's an alias to TX2. * Auto-detecting most of those cores, but also updating the forced compilation in getarch.c, to make sure the parameters are the same whether compiled natively or forced arch. Benefits: * ARMv8 build is now guaranteed to work on all ARMv8 cores * Improved performance for ARMv8 builds on some cores (A72, Falkor, ThunderX1 and 2: up to 11%) over current develop * Improved performance for *all* cores comparing to develop branch before TX2's patch (9% ~ 36%) * ThunderX1 builds are 14% faster than ARMv8 on TX1, 9% faster than current develop's branch and 8% faster than deveop before tx2 patches Issues: * Regression from current develop branch for A53 (-12%) and A57 (-3%) with ARMv8 builds, but still faster than before TX2's commit (+15% and +24% respectively). This can be improved with a simplification of TX2's code, to be done in future patches. At least the code is guaranteed to be ARMv8.0 now. Comments: * CortexA57 builds are unchanged on A57 hardware from develop's branch, which makes sense, as it's untouched. * CortexA72 builds improve over A57 on A72 hardware, even if they're using the same includes due to new compiler tunning in the makefile.
6 years ago
Simplifying ARMv8 build parameters ARMv8 builds were a bit mixed up, with ThunderX2 code in ARMv8 mode (which is not right because TX2 is ARMv8.1) as well as requiring a few redundancies in the defines, making it harder to maintain and understand what core has what. A few other minor issues were also fixed. Tests were made on the following cores: A53, A57, A72, Falkor, ThunderX, ThunderX2, and XGene. Tests were: OpenBLAS/test, OpenBLAS/benchmark, BLAS-Tester. A summary: * Removed TX2 code from ARMv8 build, to make sure it is compatible with all ARMv8 cores, not just v8.1. Also, the TX2 code has actually harmed performance on big cores. * Commoned up ARMv8 architectures' defines in params.h, to make sure that all will benefit from ARMv8 settings, in addition to their own. * Adding a few more cores, using ARMv8's include strategy, to benefit from compiler optimisations using mtune. Also updated cache information from the manuals, making sure we set good conservative values by default. Removed Vulcan, as it's an alias to TX2. * Auto-detecting most of those cores, but also updating the forced compilation in getarch.c, to make sure the parameters are the same whether compiled natively or forced arch. Benefits: * ARMv8 build is now guaranteed to work on all ARMv8 cores * Improved performance for ARMv8 builds on some cores (A72, Falkor, ThunderX1 and 2: up to 11%) over current develop * Improved performance for *all* cores comparing to develop branch before TX2's patch (9% ~ 36%) * ThunderX1 builds are 14% faster than ARMv8 on TX1, 9% faster than current develop's branch and 8% faster than deveop before tx2 patches Issues: * Regression from current develop branch for A53 (-12%) and A57 (-3%) with ARMv8 builds, but still faster than before TX2's commit (+15% and +24% respectively). This can be improved with a simplification of TX2's code, to be done in future patches. At least the code is guaranteed to be ARMv8.0 now. Comments: * CortexA57 builds are unchanged on A57 hardware from develop's branch, which makes sense, as it's untouched. * CortexA72 builds improve over A57 on A72 hardware, even if they're using the same includes due to new compiler tunning in the makefile.
6 years ago
Simplifying ARMv8 build parameters ARMv8 builds were a bit mixed up, with ThunderX2 code in ARMv8 mode (which is not right because TX2 is ARMv8.1) as well as requiring a few redundancies in the defines, making it harder to maintain and understand what core has what. A few other minor issues were also fixed. Tests were made on the following cores: A53, A57, A72, Falkor, ThunderX, ThunderX2, and XGene. Tests were: OpenBLAS/test, OpenBLAS/benchmark, BLAS-Tester. A summary: * Removed TX2 code from ARMv8 build, to make sure it is compatible with all ARMv8 cores, not just v8.1. Also, the TX2 code has actually harmed performance on big cores. * Commoned up ARMv8 architectures' defines in params.h, to make sure that all will benefit from ARMv8 settings, in addition to their own. * Adding a few more cores, using ARMv8's include strategy, to benefit from compiler optimisations using mtune. Also updated cache information from the manuals, making sure we set good conservative values by default. Removed Vulcan, as it's an alias to TX2. * Auto-detecting most of those cores, but also updating the forced compilation in getarch.c, to make sure the parameters are the same whether compiled natively or forced arch. Benefits: * ARMv8 build is now guaranteed to work on all ARMv8 cores * Improved performance for ARMv8 builds on some cores (A72, Falkor, ThunderX1 and 2: up to 11%) over current develop * Improved performance for *all* cores comparing to develop branch before TX2's patch (9% ~ 36%) * ThunderX1 builds are 14% faster than ARMv8 on TX1, 9% faster than current develop's branch and 8% faster than deveop before tx2 patches Issues: * Regression from current develop branch for A53 (-12%) and A57 (-3%) with ARMv8 builds, but still faster than before TX2's commit (+15% and +24% respectively). This can be improved with a simplification of TX2's code, to be done in future patches. At least the code is guaranteed to be ARMv8.0 now. Comments: * CortexA57 builds are unchanged on A57 hardware from develop's branch, which makes sense, as it's untouched. * CortexA72 builds improve over A57 on A72 hardware, even if they're using the same includes due to new compiler tunning in the makefile.
6 years ago
Simplifying ARMv8 build parameters ARMv8 builds were a bit mixed up, with ThunderX2 code in ARMv8 mode (which is not right because TX2 is ARMv8.1) as well as requiring a few redundancies in the defines, making it harder to maintain and understand what core has what. A few other minor issues were also fixed. Tests were made on the following cores: A53, A57, A72, Falkor, ThunderX, ThunderX2, and XGene. Tests were: OpenBLAS/test, OpenBLAS/benchmark, BLAS-Tester. A summary: * Removed TX2 code from ARMv8 build, to make sure it is compatible with all ARMv8 cores, not just v8.1. Also, the TX2 code has actually harmed performance on big cores. * Commoned up ARMv8 architectures' defines in params.h, to make sure that all will benefit from ARMv8 settings, in addition to their own. * Adding a few more cores, using ARMv8's include strategy, to benefit from compiler optimisations using mtune. Also updated cache information from the manuals, making sure we set good conservative values by default. Removed Vulcan, as it's an alias to TX2. * Auto-detecting most of those cores, but also updating the forced compilation in getarch.c, to make sure the parameters are the same whether compiled natively or forced arch. Benefits: * ARMv8 build is now guaranteed to work on all ARMv8 cores * Improved performance for ARMv8 builds on some cores (A72, Falkor, ThunderX1 and 2: up to 11%) over current develop * Improved performance for *all* cores comparing to develop branch before TX2's patch (9% ~ 36%) * ThunderX1 builds are 14% faster than ARMv8 on TX1, 9% faster than current develop's branch and 8% faster than deveop before tx2 patches Issues: * Regression from current develop branch for A53 (-12%) and A57 (-3%) with ARMv8 builds, but still faster than before TX2's commit (+15% and +24% respectively). This can be improved with a simplification of TX2's code, to be done in future patches. At least the code is guaranteed to be ARMv8.0 now. Comments: * CortexA57 builds are unchanged on A57 hardware from develop's branch, which makes sense, as it's untouched. * CortexA72 builds improve over A57 on A72 hardware, even if they're using the same includes due to new compiler tunning in the makefile.
6 years ago
Simplifying ARMv8 build parameters ARMv8 builds were a bit mixed up, with ThunderX2 code in ARMv8 mode (which is not right because TX2 is ARMv8.1) as well as requiring a few redundancies in the defines, making it harder to maintain and understand what core has what. A few other minor issues were also fixed. Tests were made on the following cores: A53, A57, A72, Falkor, ThunderX, ThunderX2, and XGene. Tests were: OpenBLAS/test, OpenBLAS/benchmark, BLAS-Tester. A summary: * Removed TX2 code from ARMv8 build, to make sure it is compatible with all ARMv8 cores, not just v8.1. Also, the TX2 code has actually harmed performance on big cores. * Commoned up ARMv8 architectures' defines in params.h, to make sure that all will benefit from ARMv8 settings, in addition to their own. * Adding a few more cores, using ARMv8's include strategy, to benefit from compiler optimisations using mtune. Also updated cache information from the manuals, making sure we set good conservative values by default. Removed Vulcan, as it's an alias to TX2. * Auto-detecting most of those cores, but also updating the forced compilation in getarch.c, to make sure the parameters are the same whether compiled natively or forced arch. Benefits: * ARMv8 build is now guaranteed to work on all ARMv8 cores * Improved performance for ARMv8 builds on some cores (A72, Falkor, ThunderX1 and 2: up to 11%) over current develop * Improved performance for *all* cores comparing to develop branch before TX2's patch (9% ~ 36%) * ThunderX1 builds are 14% faster than ARMv8 on TX1, 9% faster than current develop's branch and 8% faster than deveop before tx2 patches Issues: * Regression from current develop branch for A53 (-12%) and A57 (-3%) with ARMv8 builds, but still faster than before TX2's commit (+15% and +24% respectively). This can be improved with a simplification of TX2's code, to be done in future patches. At least the code is guaranteed to be ARMv8.0 now. Comments: * CortexA57 builds are unchanged on A57 hardware from develop's branch, which makes sense, as it's untouched. * CortexA72 builds improve over A57 on A72 hardware, even if they're using the same includes due to new compiler tunning in the makefile.
6 years ago
Simplifying ARMv8 build parameters ARMv8 builds were a bit mixed up, with ThunderX2 code in ARMv8 mode (which is not right because TX2 is ARMv8.1) as well as requiring a few redundancies in the defines, making it harder to maintain and understand what core has what. A few other minor issues were also fixed. Tests were made on the following cores: A53, A57, A72, Falkor, ThunderX, ThunderX2, and XGene. Tests were: OpenBLAS/test, OpenBLAS/benchmark, BLAS-Tester. A summary: * Removed TX2 code from ARMv8 build, to make sure it is compatible with all ARMv8 cores, not just v8.1. Also, the TX2 code has actually harmed performance on big cores. * Commoned up ARMv8 architectures' defines in params.h, to make sure that all will benefit from ARMv8 settings, in addition to their own. * Adding a few more cores, using ARMv8's include strategy, to benefit from compiler optimisations using mtune. Also updated cache information from the manuals, making sure we set good conservative values by default. Removed Vulcan, as it's an alias to TX2. * Auto-detecting most of those cores, but also updating the forced compilation in getarch.c, to make sure the parameters are the same whether compiled natively or forced arch. Benefits: * ARMv8 build is now guaranteed to work on all ARMv8 cores * Improved performance for ARMv8 builds on some cores (A72, Falkor, ThunderX1 and 2: up to 11%) over current develop * Improved performance for *all* cores comparing to develop branch before TX2's patch (9% ~ 36%) * ThunderX1 builds are 14% faster than ARMv8 on TX1, 9% faster than current develop's branch and 8% faster than deveop before tx2 patches Issues: * Regression from current develop branch for A53 (-12%) and A57 (-3%) with ARMv8 builds, but still faster than before TX2's commit (+15% and +24% respectively). This can be improved with a simplification of TX2's code, to be done in future patches. At least the code is guaranteed to be ARMv8.0 now. Comments: * CortexA57 builds are unchanged on A57 hardware from develop's branch, which makes sense, as it's untouched. * CortexA72 builds improve over A57 on A72 hardware, even if they're using the same includes due to new compiler tunning in the makefile.
6 years ago
Simplifying ARMv8 build parameters ARMv8 builds were a bit mixed up, with ThunderX2 code in ARMv8 mode (which is not right because TX2 is ARMv8.1) as well as requiring a few redundancies in the defines, making it harder to maintain and understand what core has what. A few other minor issues were also fixed. Tests were made on the following cores: A53, A57, A72, Falkor, ThunderX, ThunderX2, and XGene. Tests were: OpenBLAS/test, OpenBLAS/benchmark, BLAS-Tester. A summary: * Removed TX2 code from ARMv8 build, to make sure it is compatible with all ARMv8 cores, not just v8.1. Also, the TX2 code has actually harmed performance on big cores. * Commoned up ARMv8 architectures' defines in params.h, to make sure that all will benefit from ARMv8 settings, in addition to their own. * Adding a few more cores, using ARMv8's include strategy, to benefit from compiler optimisations using mtune. Also updated cache information from the manuals, making sure we set good conservative values by default. Removed Vulcan, as it's an alias to TX2. * Auto-detecting most of those cores, but also updating the forced compilation in getarch.c, to make sure the parameters are the same whether compiled natively or forced arch. Benefits: * ARMv8 build is now guaranteed to work on all ARMv8 cores * Improved performance for ARMv8 builds on some cores (A72, Falkor, ThunderX1 and 2: up to 11%) over current develop * Improved performance for *all* cores comparing to develop branch before TX2's patch (9% ~ 36%) * ThunderX1 builds are 14% faster than ARMv8 on TX1, 9% faster than current develop's branch and 8% faster than deveop before tx2 patches Issues: * Regression from current develop branch for A53 (-12%) and A57 (-3%) with ARMv8 builds, but still faster than before TX2's commit (+15% and +24% respectively). This can be improved with a simplification of TX2's code, to be done in future patches. At least the code is guaranteed to be ARMv8.0 now. Comments: * CortexA57 builds are unchanged on A57 hardware from develop's branch, which makes sense, as it's untouched. * CortexA72 builds improve over A57 on A72 hardware, even if they're using the same includes due to new compiler tunning in the makefile.
6 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339
  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. #if (( defined(__GNUC__) && __GNUC__ > 6 && defined(__AVX2__)) || (defined(__clang__) && __clang_major__ >= 6))
  85. #else
  86. #define NO_AVX512
  87. #endif
  88. /* #define FORCE_P2 */
  89. /* #define FORCE_KATMAI */
  90. /* #define FORCE_COPPERMINE */
  91. /* #define FORCE_NORTHWOOD */
  92. /* #define FORCE_PRESCOTT */
  93. /* #define FORCE_BANIAS */
  94. /* #define FORCE_YONAH */
  95. /* #define FORCE_CORE2 */
  96. /* #define FORCE_PENRYN */
  97. /* #define FORCE_DUNNINGTON */
  98. /* #define FORCE_NEHALEM */
  99. /* #define FORCE_SANDYBRIDGE */
  100. /* #define FORCE_ATOM */
  101. /* #define FORCE_ATHLON */
  102. /* #define FORCE_OPTERON */
  103. /* #define FORCE_OPTERON_SSE3 */
  104. /* #define FORCE_BARCELONA */
  105. /* #define FORCE_SHANGHAI */
  106. /* #define FORCE_ISTANBUL */
  107. /* #define FORCE_BOBCAT */
  108. /* #define FORCE_BULLDOZER */
  109. /* #define FORCE_PILEDRIVER */
  110. /* #define FORCE_SSE_GENERIC */
  111. /* #define FORCE_VIAC3 */
  112. /* #define FORCE_NANO */
  113. /* #define FORCE_POWER3 */
  114. /* #define FORCE_POWER4 */
  115. /* #define FORCE_POWER5 */
  116. /* #define FORCE_POWER6 */
  117. /* #define FORCE_POWER7 */
  118. /* #define FORCE_POWER8 */
  119. /* #define FORCE_PPCG4 */
  120. /* #define FORCE_PPC970 */
  121. /* #define FORCE_PPC970MP */
  122. /* #define FORCE_PPC440 */
  123. /* #define FORCE_PPC440FP2 */
  124. /* #define FORCE_CELL */
  125. /* #define FORCE_SICORTEX */
  126. /* #define FORCE_LOONGSON3A */
  127. /* #define FORCE_LOONGSON3B */
  128. /* #define FORCE_I6400 */
  129. /* #define FORCE_P6600 */
  130. /* #define FORCE_P5600 */
  131. /* #define FORCE_I6500 */
  132. /* #define FORCE_ITANIUM2 */
  133. /* #define FORCE_SPARC */
  134. /* #define FORCE_SPARCV7 */
  135. /* #define FORCE_ZARCH_GENERIC */
  136. /* #define FORCE_Z13 */
  137. /* #define FORCE_GENERIC */
  138. #ifdef FORCE_P2
  139. #define FORCE
  140. #define FORCE_INTEL
  141. #define ARCHITECTURE "X86"
  142. #define SUBARCHITECTURE "PENTIUM2"
  143. #define ARCHCONFIG "-DPENTIUM2 " \
  144. "-DL1_DATA_SIZE=16384 -DL1_DATA_LINESIZE=32 " \
  145. "-DL2_SIZE=512488 -DL2_LINESIZE=32 " \
  146. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  147. "-DHAVE_CMOV -DHAVE_MMX"
  148. #define LIBNAME "p2"
  149. #define CORENAME "P5"
  150. #endif
  151. #ifdef FORCE_KATMAI
  152. #define FORCE
  153. #define FORCE_INTEL
  154. #define ARCHITECTURE "X86"
  155. #define SUBARCHITECTURE "PENTIUM3"
  156. #define ARCHCONFIG "-DPENTIUM3 " \
  157. "-DL1_DATA_SIZE=16384 -DL1_DATA_LINESIZE=32 " \
  158. "-DL2_SIZE=524288 -DL2_LINESIZE=32 " \
  159. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  160. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE "
  161. #define LIBNAME "katmai"
  162. #define CORENAME "KATMAI"
  163. #endif
  164. #ifdef FORCE_COPPERMINE
  165. #define FORCE
  166. #define FORCE_INTEL
  167. #define ARCHITECTURE "X86"
  168. #define SUBARCHITECTURE "PENTIUM3"
  169. #define ARCHCONFIG "-DPENTIUM3 " \
  170. "-DL1_DATA_SIZE=16384 -DL1_DATA_LINESIZE=32 " \
  171. "-DL2_SIZE=262144 -DL2_LINESIZE=32 " \
  172. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  173. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE "
  174. #define LIBNAME "coppermine"
  175. #define CORENAME "COPPERMINE"
  176. #endif
  177. #ifdef FORCE_NORTHWOOD
  178. #define FORCE
  179. #define FORCE_INTEL
  180. #define ARCHITECTURE "X86"
  181. #define SUBARCHITECTURE "PENTIUM4"
  182. #define ARCHCONFIG "-DPENTIUM4 " \
  183. "-DL1_DATA_SIZE=8192 -DL1_DATA_LINESIZE=64 " \
  184. "-DL2_SIZE=524288 -DL2_LINESIZE=64 " \
  185. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 " \
  186. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 "
  187. #define LIBNAME "northwood"
  188. #define CORENAME "NORTHWOOD"
  189. #endif
  190. #ifdef FORCE_PRESCOTT
  191. #define FORCE
  192. #define FORCE_INTEL
  193. #define ARCHITECTURE "X86"
  194. #define SUBARCHITECTURE "PENTIUM4"
  195. #define ARCHCONFIG "-DPENTIUM4 " \
  196. "-DL1_DATA_SIZE=16384 -DL1_DATA_LINESIZE=64 " \
  197. "-DL2_SIZE=1048576 -DL2_LINESIZE=64 " \
  198. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 " \
  199. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3"
  200. #define LIBNAME "prescott"
  201. #define CORENAME "PRESCOTT"
  202. #endif
  203. #ifdef FORCE_BANIAS
  204. #define FORCE
  205. #define FORCE_INTEL
  206. #define ARCHITECTURE "X86"
  207. #define SUBARCHITECTURE "BANIAS"
  208. #define ARCHCONFIG "-DPENTIUMM " \
  209. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 " \
  210. "-DL2_SIZE=1048576 -DL2_LINESIZE=64 " \
  211. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  212. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 "
  213. #define LIBNAME "banias"
  214. #define CORENAME "BANIAS"
  215. #endif
  216. #ifdef FORCE_YONAH
  217. #define FORCE
  218. #define FORCE_INTEL
  219. #define ARCHITECTURE "X86"
  220. #define SUBARCHITECTURE "YONAH"
  221. #define ARCHCONFIG "-DPENTIUMM " \
  222. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 " \
  223. "-DL2_SIZE=1048576 -DL2_LINESIZE=64 " \
  224. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  225. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 "
  226. #define LIBNAME "yonah"
  227. #define CORENAME "YONAH"
  228. #endif
  229. #ifdef FORCE_CORE2
  230. #define FORCE
  231. #define FORCE_INTEL
  232. #define ARCHITECTURE "X86"
  233. #define SUBARCHITECTURE "CONRORE"
  234. #define ARCHCONFIG "-DCORE2 " \
  235. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 " \
  236. "-DL2_SIZE=1048576 -DL2_LINESIZE=64 " \
  237. "-DDTB_DEFAULT_ENTRIES=256 -DDTB_SIZE=4096 " \
  238. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_SSSE3"
  239. #define LIBNAME "core2"
  240. #define CORENAME "CORE2"
  241. #endif
  242. #ifdef FORCE_PENRYN
  243. #define FORCE
  244. #define FORCE_INTEL
  245. #define ARCHITECTURE "X86"
  246. #define SUBARCHITECTURE "PENRYN"
  247. #define ARCHCONFIG "-DPENRYN " \
  248. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 " \
  249. "-DL2_SIZE=1048576 -DL2_LINESIZE=64 " \
  250. "-DDTB_DEFAULT_ENTRIES=256 -DDTB_SIZE=4096 " \
  251. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_SSSE3 -DHAVE_SSE4_1"
  252. #define LIBNAME "penryn"
  253. #define CORENAME "PENRYN"
  254. #endif
  255. #ifdef FORCE_DUNNINGTON
  256. #define FORCE
  257. #define FORCE_INTEL
  258. #define ARCHITECTURE "X86"
  259. #define SUBARCHITECTURE "DUNNINGTON"
  260. #define ARCHCONFIG "-DDUNNINGTON " \
  261. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 " \
  262. "-DL2_SIZE=1048576 -DL2_LINESIZE=64 " \
  263. "-DL3_SIZE=16777216 -DL3_LINESIZE=64 " \
  264. "-DDTB_DEFAULT_ENTRIES=256 -DDTB_SIZE=4096 " \
  265. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_SSSE3 -DHAVE_SSE4_1"
  266. #define LIBNAME "dunnington"
  267. #define CORENAME "DUNNINGTON"
  268. #endif
  269. #ifdef FORCE_NEHALEM
  270. #define FORCE
  271. #define FORCE_INTEL
  272. #define ARCHITECTURE "X86"
  273. #define SUBARCHITECTURE "NEHALEM"
  274. #define ARCHCONFIG "-DNEHALEM " \
  275. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 " \
  276. "-DL2_SIZE=262144 -DL2_LINESIZE=64 " \
  277. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  278. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_SSSE3 -DHAVE_SSE4_1 -DHAVE_SSE4_2"
  279. #define LIBNAME "nehalem"
  280. #define CORENAME "NEHALEM"
  281. #endif
  282. #ifdef FORCE_SANDYBRIDGE
  283. #define FORCE
  284. #define FORCE_INTEL
  285. #define ARCHITECTURE "X86"
  286. #define SUBARCHITECTURE "SANDYBRIDGE"
  287. #define ARCHCONFIG "-DSANDYBRIDGE " \
  288. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 " \
  289. "-DL2_SIZE=262144 -DL2_LINESIZE=64 " \
  290. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  291. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_SSSE3 -DHAVE_SSE4_1 -DHAVE_SSE4_2 -DHAVE_AVX"
  292. #define LIBNAME "sandybridge"
  293. #define CORENAME "SANDYBRIDGE"
  294. #endif
  295. #ifdef FORCE_HASWELL
  296. #define FORCE
  297. #define FORCE_INTEL
  298. #define ARCHITECTURE "X86"
  299. #define SUBARCHITECTURE "HASWELL"
  300. #define ARCHCONFIG "-DHASWELL " \
  301. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 " \
  302. "-DL2_SIZE=262144 -DL2_LINESIZE=64 " \
  303. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  304. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_SSSE3 -DHAVE_SSE4_1 -DHAVE_SSE4_2 -DHAVE_AVX " \
  305. "-DFMA3"
  306. #define LIBNAME "haswell"
  307. #define CORENAME "HASWELL"
  308. #endif
  309. #ifdef FORCE_SKYLAKEX
  310. #ifdef NO_AVX512
  311. #define FORCE
  312. #define FORCE_INTEL
  313. #define ARCHITECTURE "X86"
  314. #define SUBARCHITECTURE "HASWELL"
  315. #define ARCHCONFIG "-DHASWELL " \
  316. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 " \
  317. "-DL2_SIZE=262144 -DL2_LINESIZE=64 " \
  318. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  319. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_SSSE3 -DHAVE_SSE4_1 -DHAVE_SSE4_2 -DHAVE_AVX " \
  320. "-DFMA3"
  321. #define LIBNAME "haswell"
  322. #define CORENAME "HASWELL"
  323. #else
  324. #define FORCE
  325. #define FORCE_INTEL
  326. #define ARCHITECTURE "X86"
  327. #define SUBARCHITECTURE "SKYLAKEX"
  328. #define ARCHCONFIG "-DSKYLAKEX " \
  329. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 " \
  330. "-DL2_SIZE=262144 -DL2_LINESIZE=64 " \
  331. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  332. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_SSSE3 -DHAVE_SSE4_1 -DHAVE_SSE4_2 -DHAVE_AVX " \
  333. "-DFMA3 -DHAVE_AVX512VL -march=skylake-avx512"
  334. #define LIBNAME "skylakex"
  335. #define CORENAME "SKYLAKEX"
  336. #endif
  337. #endif
  338. #ifdef FORCE_ATOM
  339. #define FORCE
  340. #define FORCE_INTEL
  341. #define ARCHITECTURE "X86"
  342. #define SUBARCHITECTURE "ATOM"
  343. #define ARCHCONFIG "-DATOM " \
  344. "-DL1_DATA_SIZE=24576 -DL1_DATA_LINESIZE=64 " \
  345. "-DL2_SIZE=524288 -DL2_LINESIZE=64 " \
  346. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 " \
  347. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_SSSE3"
  348. #define LIBNAME "atom"
  349. #define CORENAME "ATOM"
  350. #endif
  351. #ifdef FORCE_ATHLON
  352. #define FORCE
  353. #define FORCE_INTEL
  354. #define ARCHITECTURE "X86"
  355. #define SUBARCHITECTURE "ATHLON"
  356. #define ARCHCONFIG "-DATHLON " \
  357. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=64 " \
  358. "-DL2_SIZE=1048576 -DL2_LINESIZE=64 " \
  359. "-DDTB_DEFAULT_ENTRIES=32 -DDTB_SIZE=4096 -DHAVE_3DNOW " \
  360. "-DHAVE_3DNOWEX -DHAVE_MMX -DHAVE_SSE "
  361. #define LIBNAME "athlon"
  362. #define CORENAME "ATHLON"
  363. #endif
  364. #ifdef FORCE_OPTERON
  365. #define FORCE
  366. #define FORCE_INTEL
  367. #define ARCHITECTURE "X86"
  368. #define SUBARCHITECTURE "OPTERON"
  369. #define ARCHCONFIG "-DOPTERON " \
  370. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=64 " \
  371. "-DL2_SIZE=1048576 -DL2_LINESIZE=64 " \
  372. "-DDTB_DEFAULT_ENTRIES=32 -DDTB_SIZE=4096 -DHAVE_3DNOW " \
  373. "-DHAVE_3DNOWEX -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 "
  374. #define LIBNAME "opteron"
  375. #define CORENAME "OPTERON"
  376. #endif
  377. #ifdef FORCE_OPTERON_SSE3
  378. #define FORCE
  379. #define FORCE_INTEL
  380. #define ARCHITECTURE "X86"
  381. #define SUBARCHITECTURE "OPTERON"
  382. #define ARCHCONFIG "-DOPTERON " \
  383. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=64 " \
  384. "-DL2_SIZE=1048576 -DL2_LINESIZE=64 " \
  385. "-DDTB_DEFAULT_ENTRIES=32 -DDTB_SIZE=4096 -DHAVE_3DNOW " \
  386. "-DHAVE_3DNOWEX -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3"
  387. #define LIBNAME "opteron"
  388. #define CORENAME "OPTERON"
  389. #endif
  390. #if defined(FORCE_BARCELONA) || defined(FORCE_SHANGHAI) || defined(FORCE_ISTANBUL)
  391. #define FORCE
  392. #define FORCE_INTEL
  393. #define ARCHITECTURE "X86"
  394. #define SUBARCHITECTURE "BARCELONA"
  395. #define ARCHCONFIG "-DBARCELONA " \
  396. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=64 " \
  397. "-DL2_SIZE=524288 -DL2_LINESIZE=64 -DL3_SIZE=2097152 " \
  398. "-DDTB_DEFAULT_ENTRIES=48 -DDTB_SIZE=4096 " \
  399. "-DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 " \
  400. "-DHAVE_SSE4A -DHAVE_MISALIGNSSE -DHAVE_128BITFPU -DHAVE_FASTMOVU"
  401. #define LIBNAME "barcelona"
  402. #define CORENAME "BARCELONA"
  403. #endif
  404. #if defined(FORCE_BOBCAT)
  405. #define FORCE
  406. #define FORCE_INTEL
  407. #define ARCHITECTURE "X86"
  408. #define SUBARCHITECTURE "BOBCAT"
  409. #define ARCHCONFIG "-DBOBCAT " \
  410. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 " \
  411. "-DL2_SIZE=524288 -DL2_LINESIZE=64 " \
  412. "-DDTB_DEFAULT_ENTRIES=40 -DDTB_SIZE=4096 " \
  413. "-DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_SSSE3 " \
  414. "-DHAVE_SSE4A -DHAVE_MISALIGNSSE -DHAVE_CFLUSH -DHAVE_CMOV"
  415. #define LIBNAME "bobcat"
  416. #define CORENAME "BOBCAT"
  417. #endif
  418. #if defined (FORCE_BULLDOZER)
  419. #define FORCE
  420. #define FORCE_INTEL
  421. #define ARCHITECTURE "X86"
  422. #define SUBARCHITECTURE "BULLDOZER"
  423. #define ARCHCONFIG "-DBULLDOZER " \
  424. "-DL1_DATA_SIZE=49152 -DL1_DATA_LINESIZE=64 " \
  425. "-DL2_SIZE=1024000 -DL2_LINESIZE=64 -DL3_SIZE=16777216 " \
  426. "-DDTB_DEFAULT_ENTRIES=32 -DDTB_SIZE=4096 " \
  427. "-DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 " \
  428. "-DHAVE_SSE4A -DHAVE_MISALIGNSSE -DHAVE_128BITFPU -DHAVE_FASTMOVU " \
  429. "-DHAVE_AVX -DHAVE_FMA4"
  430. #define LIBNAME "bulldozer"
  431. #define CORENAME "BULLDOZER"
  432. #endif
  433. #if defined (FORCE_PILEDRIVER)
  434. #define FORCE
  435. #define FORCE_INTEL
  436. #define ARCHITECTURE "X86"
  437. #define SUBARCHITECTURE "PILEDRIVER"
  438. #define ARCHCONFIG "-DPILEDRIVER " \
  439. "-DL1_DATA_SIZE=16384 -DL1_DATA_LINESIZE=64 " \
  440. "-DL2_SIZE=2097152 -DL2_LINESIZE=64 -DL3_SIZE=12582912 " \
  441. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  442. "-DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_SSE4_1 -DHAVE_SSE4_2 " \
  443. "-DHAVE_SSE4A -DHAVE_MISALIGNSSE -DHAVE_128BITFPU -DHAVE_FASTMOVU -DHAVE_CFLUSH " \
  444. "-DHAVE_AVX -DHAVE_FMA4 -DHAVE_FMA3"
  445. #define LIBNAME "piledriver"
  446. #define CORENAME "PILEDRIVER"
  447. #endif
  448. #if defined (FORCE_STEAMROLLER)
  449. #define FORCE
  450. #define FORCE_INTEL
  451. #define ARCHITECTURE "X86"
  452. #define SUBARCHITECTURE "STEAMROLLER"
  453. #define ARCHCONFIG "-DSTEAMROLLER " \
  454. "-DL1_DATA_SIZE=16384 -DL1_DATA_LINESIZE=64 " \
  455. "-DL2_SIZE=2097152 -DL2_LINESIZE=64 -DL3_SIZE=12582912 " \
  456. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  457. "-DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_SSE4_1 -DHAVE_SSE4_2 " \
  458. "-DHAVE_SSE4A -DHAVE_MISALIGNSSE -DHAVE_128BITFPU -DHAVE_FASTMOVU -DHAVE_CFLUSH " \
  459. "-DHAVE_AVX -DHAVE_FMA4 -DHAVE_FMA3"
  460. #define LIBNAME "steamroller"
  461. #define CORENAME "STEAMROLLER"
  462. #endif
  463. #if defined (FORCE_EXCAVATOR)
  464. #define FORCE
  465. #define FORCE_INTEL
  466. #define ARCHITECTURE "X86"
  467. #define SUBARCHITECTURE "EXCAVATOR"
  468. #define ARCHCONFIG "-DEXCAVATOR " \
  469. "-DL1_DATA_SIZE=16384 -DL1_DATA_LINESIZE=64 " \
  470. "-DL2_SIZE=2097152 -DL2_LINESIZE=64 -DL3_SIZE=12582912 " \
  471. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  472. "-DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_SSE4_1 -DHAVE_SSE4_2 " \
  473. "-DHAVE_SSE4A -DHAVE_MISALIGNSSE -DHAVE_128BITFPU -DHAVE_FASTMOVU -DHAVE_CFLUSH " \
  474. "-DHAVE_AVX -DHAVE_FMA4 -DHAVE_FMA3"
  475. #define LIBNAME "excavator"
  476. #define CORENAME "EXCAVATOR"
  477. #endif
  478. #if defined (FORCE_ZEN)
  479. #define FORCE
  480. #define FORCE_INTEL
  481. #define ARCHITECTURE "X86"
  482. #define SUBARCHITECTURE "ZEN"
  483. #define ARCHCONFIG "-DZEN " \
  484. "-DL1_CODE_SIZE=32768 -DL1_CODE_LINESIZE=64 -DL1_CODE_ASSOCIATIVE=8 " \
  485. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 -DL2_CODE_ASSOCIATIVE=8 " \
  486. "-DL2_SIZE=524288 -DL2_LINESIZE=64 -DL2_ASSOCIATIVE=8 " \
  487. "-DL3_SIZE=16777216 -DL3_LINESIZE=64 -DL3_ASSOCIATIVE=8 " \
  488. "-DITB_DEFAULT_ENTRIES=64 -DITB_SIZE=4096 " \
  489. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  490. "-DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_SSE4_1 -DHAVE_SSE4_2 " \
  491. "-DHAVE_SSE4A -DHAVE_MISALIGNSSE -DHAVE_128BITFPU -DHAVE_FASTMOVU -DHAVE_CFLUSH " \
  492. "-DHAVE_AVX -DHAVE_FMA3 -DFMA3"
  493. #define LIBNAME "zen"
  494. #define CORENAME "ZEN"
  495. #endif
  496. #ifdef FORCE_SSE_GENERIC
  497. #define FORCE
  498. #define FORCE_INTEL
  499. #define ARCHITECTURE "X86"
  500. #define SUBARCHITECTURE "GENERIC"
  501. #define ARCHCONFIG "-DGENERIC " \
  502. "-DL1_DATA_SIZE=16384 -DL1_DATA_LINESIZE=64 " \
  503. "-DL2_SIZE=524288 -DL2_LINESIZE=64 " \
  504. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 " \
  505. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2"
  506. #define LIBNAME "generic"
  507. #define CORENAME "GENERIC"
  508. #endif
  509. #ifdef FORCE_VIAC3
  510. #define FORCE
  511. #define FORCE_INTEL
  512. #define ARCHITECTURE "X86"
  513. #define SUBARCHITECTURE "VIAC3"
  514. #define ARCHCONFIG "-DVIAC3 " \
  515. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \
  516. "-DL2_SIZE=65536 -DL2_LINESIZE=32 " \
  517. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 " \
  518. "-DHAVE_MMX -DHAVE_SSE "
  519. #define LIBNAME "viac3"
  520. #define CORENAME "VIAC3"
  521. #endif
  522. #ifdef FORCE_NANO
  523. #define FORCE
  524. #define FORCE_INTEL
  525. #define ARCHITECTURE "X86"
  526. #define SUBARCHITECTURE "NANO"
  527. #define ARCHCONFIG "-DNANO " \
  528. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=64 " \
  529. "-DL2_SIZE=1048576 -DL2_LINESIZE=64 " \
  530. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 " \
  531. "-DHAVE_CMOV -DHAVE_MMX -DHAVE_SSE -DHAVE_SSE2 -DHAVE_SSE3 -DHAVE_SSSE3"
  532. #define LIBNAME "nano"
  533. #define CORENAME "NANO"
  534. #endif
  535. #ifdef FORCE_POWER3
  536. #define FORCE
  537. #define ARCHITECTURE "POWER"
  538. #define SUBARCHITECTURE "POWER3"
  539. #define SUBDIRNAME "power"
  540. #define ARCHCONFIG "-DPOWER3 " \
  541. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=128 " \
  542. "-DL2_SIZE=2097152 -DL2_LINESIZE=128 " \
  543. "-DDTB_DEFAULT_ENTRIES=256 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  544. #define LIBNAME "power3"
  545. #define CORENAME "POWER3"
  546. #endif
  547. #ifdef FORCE_POWER4
  548. #define FORCE
  549. #define ARCHITECTURE "POWER"
  550. #define SUBARCHITECTURE "POWER4"
  551. #define SUBDIRNAME "power"
  552. #define ARCHCONFIG "-DPOWER4 " \
  553. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=128 " \
  554. "-DL2_SIZE=1509949 -DL2_LINESIZE=128 " \
  555. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=6 "
  556. #define LIBNAME "power4"
  557. #define CORENAME "POWER4"
  558. #endif
  559. #ifdef FORCE_POWER5
  560. #define FORCE
  561. #define ARCHITECTURE "POWER"
  562. #define SUBARCHITECTURE "POWER5"
  563. #define SUBDIRNAME "power"
  564. #define ARCHCONFIG "-DPOWER5 " \
  565. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=128 " \
  566. "-DL2_SIZE=1509949 -DL2_LINESIZE=128 " \
  567. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=6 "
  568. #define LIBNAME "power5"
  569. #define CORENAME "POWER5"
  570. #endif
  571. #if defined(FORCE_POWER6) || defined(FORCE_POWER7)
  572. #define FORCE
  573. #define ARCHITECTURE "POWER"
  574. #define SUBARCHITECTURE "POWER6"
  575. #define SUBDIRNAME "power"
  576. #define ARCHCONFIG "-DPOWER6 " \
  577. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=128 " \
  578. "-DL2_SIZE=4194304 -DL2_LINESIZE=128 " \
  579. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  580. #define LIBNAME "power6"
  581. #define CORENAME "POWER6"
  582. #endif
  583. #if defined(FORCE_POWER8)
  584. #define FORCE
  585. #define ARCHITECTURE "POWER"
  586. #define SUBARCHITECTURE "POWER8"
  587. #define SUBDIRNAME "power"
  588. #define ARCHCONFIG "-DPOWER8 " \
  589. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=128 " \
  590. "-DL2_SIZE=4194304 -DL2_LINESIZE=128 " \
  591. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  592. #define LIBNAME "power8"
  593. #define CORENAME "POWER8"
  594. #endif
  595. #ifdef FORCE_PPCG4
  596. #define FORCE
  597. #define ARCHITECTURE "POWER"
  598. #define SUBARCHITECTURE "PPCG4"
  599. #define SUBDIRNAME "power"
  600. #define ARCHCONFIG "-DPPCG4 " \
  601. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=32 " \
  602. "-DL2_SIZE=262144 -DL2_LINESIZE=32 " \
  603. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  604. #define LIBNAME "ppcg4"
  605. #define CORENAME "PPCG4"
  606. #endif
  607. #ifdef FORCE_PPC970
  608. #define FORCE
  609. #define ARCHITECTURE "POWER"
  610. #define SUBARCHITECTURE "PPC970"
  611. #define SUBDIRNAME "power"
  612. #define ARCHCONFIG "-DPPC970 " \
  613. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=128 " \
  614. "-DL2_SIZE=512488 -DL2_LINESIZE=128 " \
  615. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  616. #define LIBNAME "ppc970"
  617. #define CORENAME "PPC970"
  618. #endif
  619. #ifdef FORCE_PPC970MP
  620. #define FORCE
  621. #define ARCHITECTURE "POWER"
  622. #define SUBARCHITECTURE "PPC970"
  623. #define SUBDIRNAME "power"
  624. #define ARCHCONFIG "-DPPC970 " \
  625. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=128 " \
  626. "-DL2_SIZE=1024976 -DL2_LINESIZE=128 " \
  627. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  628. #define LIBNAME "ppc970mp"
  629. #define CORENAME "PPC970"
  630. #endif
  631. #ifdef FORCE_PPC440
  632. #define FORCE
  633. #define ARCHITECTURE "POWER"
  634. #define SUBARCHITECTURE "PPC440"
  635. #define SUBDIRNAME "power"
  636. #define ARCHCONFIG "-DPPC440 " \
  637. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=32 " \
  638. "-DL2_SIZE=16384 -DL2_LINESIZE=128 " \
  639. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=16 "
  640. #define LIBNAME "ppc440"
  641. #define CORENAME "PPC440"
  642. #endif
  643. #ifdef FORCE_PPC440FP2
  644. #define FORCE
  645. #define ARCHITECTURE "POWER"
  646. #define SUBARCHITECTURE "PPC440FP2"
  647. #define SUBDIRNAME "power"
  648. #define ARCHCONFIG "-DPPC440FP2 " \
  649. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=32 " \
  650. "-DL2_SIZE=16384 -DL2_LINESIZE=128 " \
  651. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=16 "
  652. #define LIBNAME "ppc440FP2"
  653. #define CORENAME "PPC440FP2"
  654. #endif
  655. #ifdef FORCE_CELL
  656. #define FORCE
  657. #define ARCHITECTURE "POWER"
  658. #define SUBARCHITECTURE "CELL"
  659. #define SUBDIRNAME "power"
  660. #define ARCHCONFIG "-DCELL " \
  661. "-DL1_DATA_SIZE=262144 -DL1_DATA_LINESIZE=128 " \
  662. "-DL2_SIZE=512488 -DL2_LINESIZE=128 " \
  663. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  664. #define LIBNAME "cell"
  665. #define CORENAME "CELL"
  666. #endif
  667. #ifdef FORCE_SICORTEX
  668. #define FORCE
  669. #define ARCHITECTURE "MIPS"
  670. #define SUBARCHITECTURE "SICORTEX"
  671. #define SUBDIRNAME "mips"
  672. #define ARCHCONFIG "-DSICORTEX " \
  673. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=32 " \
  674. "-DL2_SIZE=512488 -DL2_LINESIZE=32 " \
  675. "-DDTB_DEFAULT_ENTRIES=32 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  676. #define LIBNAME "mips"
  677. #define CORENAME "sicortex"
  678. #endif
  679. #ifdef FORCE_LOONGSON3A
  680. #define FORCE
  681. #define ARCHITECTURE "MIPS"
  682. #define SUBARCHITECTURE "LOONGSON3A"
  683. #define SUBDIRNAME "mips64"
  684. #define ARCHCONFIG "-DLOONGSON3A " \
  685. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \
  686. "-DL2_SIZE=512488 -DL2_LINESIZE=32 " \
  687. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 "
  688. #define LIBNAME "loongson3a"
  689. #define CORENAME "LOONGSON3A"
  690. #else
  691. #endif
  692. #ifdef FORCE_LOONGSON3B
  693. #define FORCE
  694. #define ARCHITECTURE "MIPS"
  695. #define SUBARCHITECTURE "LOONGSON3B"
  696. #define SUBDIRNAME "mips64"
  697. #define ARCHCONFIG "-DLOONGSON3B " \
  698. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \
  699. "-DL2_SIZE=512488 -DL2_LINESIZE=32 " \
  700. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 "
  701. #define LIBNAME "loongson3b"
  702. #define CORENAME "LOONGSON3B"
  703. #else
  704. #endif
  705. #ifdef FORCE_I6400
  706. #define FORCE
  707. #define ARCHITECTURE "MIPS"
  708. #define SUBARCHITECTURE "I6400"
  709. #define SUBDIRNAME "mips64"
  710. #define ARCHCONFIG "-DI6400 " \
  711. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \
  712. "-DL2_SIZE=1048576 -DL2_LINESIZE=32 " \
  713. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  714. #define LIBNAME "i6400"
  715. #define CORENAME "I6400"
  716. #else
  717. #endif
  718. #ifdef FORCE_P6600
  719. #define FORCE
  720. #define ARCHITECTURE "MIPS"
  721. #define SUBARCHITECTURE "P6600"
  722. #define SUBDIRNAME "mips64"
  723. #define ARCHCONFIG "-DP6600 " \
  724. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \
  725. "-DL2_SIZE=1048576 -DL2_LINESIZE=32 " \
  726. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  727. #define LIBNAME "p6600"
  728. #define CORENAME "P6600"
  729. #else
  730. #endif
  731. #ifdef FORCE_P5600
  732. #define FORCE
  733. #define ARCHITECTURE "MIPS"
  734. #define SUBARCHITECTURE "P5600"
  735. #define SUBDIRNAME "mips"
  736. #define ARCHCONFIG "-DP5600 " \
  737. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \
  738. "-DL2_SIZE=1048576 -DL2_LINESIZE=32 " \
  739. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  740. #define LIBNAME "p5600"
  741. #define CORENAME "P5600"
  742. #else
  743. #endif
  744. #ifdef FORCE_I6500
  745. #define FORCE
  746. #define ARCHITECTURE "MIPS"
  747. #define SUBARCHITECTURE "I6500"
  748. #define SUBDIRNAME "mips64"
  749. #define ARCHCONFIG "-DI6500 " \
  750. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \
  751. "-DL2_SIZE=1048576 -DL2_LINESIZE=32 " \
  752. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  753. #define LIBNAME "i6500"
  754. #define CORENAME "I6500"
  755. #else
  756. #endif
  757. #ifdef FORCE_ITANIUM2
  758. #define FORCE
  759. #define ARCHITECTURE "IA64"
  760. #define SUBARCHITECTURE "ITANIUM2"
  761. #define SUBDIRNAME "ia64"
  762. #define ARCHCONFIG "-DITANIUM2 " \
  763. "-DL1_DATA_SIZE=262144 -DL1_DATA_LINESIZE=128 " \
  764. "-DL2_SIZE=1572864 -DL2_LINESIZE=128 -DDTB_SIZE=16384 -DDTB_DEFAULT_ENTRIES=128 "
  765. #define LIBNAME "itanium2"
  766. #define CORENAME "itanium2"
  767. #endif
  768. #ifdef FORCE_SPARC
  769. #define FORCE
  770. #define ARCHITECTURE "SPARC"
  771. #define SUBARCHITECTURE "SPARC"
  772. #define SUBDIRNAME "sparc"
  773. #define ARCHCONFIG "-DSPARC -DV9 " \
  774. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=64 " \
  775. "-DL2_SIZE=1572864 -DL2_LINESIZE=64 -DDTB_SIZE=8192 -DDTB_DEFAULT_ENTRIES=64 "
  776. #define LIBNAME "sparc"
  777. #define CORENAME "sparc"
  778. #endif
  779. #ifdef FORCE_SPARCV7
  780. #define FORCE
  781. #define ARCHITECTURE "SPARC"
  782. #define SUBARCHITECTURE "SPARC"
  783. #define SUBDIRNAME "sparc"
  784. #define ARCHCONFIG "-DSPARC -DV7 " \
  785. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=64 " \
  786. "-DL2_SIZE=1572864 -DL2_LINESIZE=64 -DDTB_SIZE=8192 -DDTB_DEFAULT_ENTRIES=64 "
  787. #define LIBNAME "sparcv7"
  788. #define CORENAME "sparcv7"
  789. #endif
  790. #ifdef FORCE_GENERIC
  791. #define FORCE
  792. #define ARCHITECTURE "GENERIC"
  793. #define SUBARCHITECTURE "GENERIC"
  794. #define SUBDIRNAME "generic"
  795. #define ARCHCONFIG "-DGENERIC " \
  796. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=128 " \
  797. "-DL2_SIZE=512488 -DL2_LINESIZE=128 " \
  798. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  799. #define LIBNAME "generic"
  800. #define CORENAME "generic"
  801. #endif
  802. #ifdef FORCE_ARMV7
  803. #define FORCE
  804. #define ARCHITECTURE "ARM"
  805. #define SUBARCHITECTURE "ARMV7"
  806. #define SUBDIRNAME "arm"
  807. #define ARCHCONFIG "-DARMV7 " \
  808. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \
  809. "-DL2_SIZE=512488 -DL2_LINESIZE=32 " \
  810. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 " \
  811. "-DHAVE_VFPV3 -DHAVE_VFP"
  812. #define LIBNAME "armv7"
  813. #define CORENAME "ARMV7"
  814. #else
  815. #endif
  816. #ifdef FORCE_CORTEXA9
  817. #define FORCE
  818. #define ARCHITECTURE "ARM"
  819. #define SUBARCHITECTURE "CORTEXA9"
  820. #define SUBDIRNAME "arm"
  821. #define ARCHCONFIG "-DCORTEXA9 -DARMV7 " \
  822. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=32 " \
  823. "-DL2_SIZE=1048576 -DL2_LINESIZE=32 " \
  824. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 " \
  825. "-DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON"
  826. #define LIBNAME "cortexa9"
  827. #define CORENAME "CORTEXA9"
  828. #else
  829. #endif
  830. #ifdef FORCE_CORTEXA15
  831. #define FORCE
  832. #define ARCHITECTURE "ARM"
  833. #define SUBARCHITECTURE "CORTEXA15"
  834. #define SUBDIRNAME "arm"
  835. #define ARCHCONFIG "-DCORTEXA15 -DARMV7 " \
  836. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=32 " \
  837. "-DL2_SIZE=1048576 -DL2_LINESIZE=32 " \
  838. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 " \
  839. "-DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON"
  840. #define LIBNAME "cortexa15"
  841. #define CORENAME "CORTEXA15"
  842. #else
  843. #endif
  844. #ifdef FORCE_ARMV6
  845. #define FORCE
  846. #define ARCHITECTURE "ARM"
  847. #define SUBARCHITECTURE "ARMV6"
  848. #define SUBDIRNAME "arm"
  849. #define ARCHCONFIG "-DARMV6 " \
  850. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \
  851. "-DL2_SIZE=512488 -DL2_LINESIZE=32 " \
  852. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 " \
  853. "-DHAVE_VFP"
  854. #define LIBNAME "armv6"
  855. #define CORENAME "ARMV6"
  856. #else
  857. #endif
  858. #ifdef FORCE_ARMV5
  859. #define FORCE
  860. #define ARCHITECTURE "ARM"
  861. #define SUBARCHITECTURE "ARMV5"
  862. #define SUBDIRNAME "arm"
  863. #define ARCHCONFIG "-DARMV5 " \
  864. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \
  865. "-DL2_SIZE=512488 -DL2_LINESIZE=32 " \
  866. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 "
  867. #define LIBNAME "armv5"
  868. #define CORENAME "ARMV5"
  869. #else
  870. #endif
  871. #ifdef FORCE_ARMV8
  872. #define FORCE
  873. #define ARCHITECTURE "ARM64"
  874. #define SUBARCHITECTURE "ARMV8"
  875. #define SUBDIRNAME "arm64"
  876. #define ARCHCONFIG "-DARMV8 " \
  877. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 " \
  878. "-DL2_SIZE=262144 -DL2_LINESIZE=64 " \
  879. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=32 " \
  880. "-DHAVE_VFPV4 -DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON -DARMV8"
  881. #define LIBNAME "armv8"
  882. #define CORENAME "ARMV8"
  883. #endif
  884. #ifdef FORCE_CORTEXA53
  885. #define FORCE
  886. #define ARCHITECTURE "ARM64"
  887. #define SUBARCHITECTURE "CORTEXA53"
  888. #define SUBDIRNAME "arm64"
  889. #define ARCHCONFIG "-DCORTEXA53 " \
  890. "-DL1_CODE_SIZE=32768 -DL1_CODE_LINESIZE=64 -DL1_CODE_ASSOCIATIVE=3 " \
  891. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 -DL1_DATA_ASSOCIATIVE=2 " \
  892. "-DL2_SIZE=262144 -DL2_LINESIZE=64 -DL2_ASSOCIATIVE=16 " \
  893. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  894. "-DHAVE_VFPV4 -DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON -DARMV8"
  895. #define LIBNAME "cortexa53"
  896. #define CORENAME "CORTEXA53"
  897. #else
  898. #endif
  899. #ifdef FORCE_CORTEXA57
  900. #define FORCE
  901. #define ARCHITECTURE "ARM64"
  902. #define SUBARCHITECTURE "CORTEXA57"
  903. #define SUBDIRNAME "arm64"
  904. #define ARCHCONFIG "-DCORTEXA57 " \
  905. "-DL1_CODE_SIZE=49152 -DL1_CODE_LINESIZE=64 -DL1_CODE_ASSOCIATIVE=3 " \
  906. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 -DL1_DATA_ASSOCIATIVE=2 " \
  907. "-DL2_SIZE=2097152 -DL2_LINESIZE=64 -DL2_ASSOCIATIVE=16 " \
  908. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  909. "-DHAVE_VFPV4 -DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON -DARMV8"
  910. #define LIBNAME "cortexa57"
  911. #define CORENAME "CORTEXA57"
  912. #else
  913. #endif
  914. #ifdef FORCE_CORTEXA72
  915. #define FORCE
  916. #define ARCHITECTURE "ARM64"
  917. #define SUBARCHITECTURE "CORTEXA72"
  918. #define SUBDIRNAME "arm64"
  919. #define ARCHCONFIG "-DCORTEXA72 " \
  920. "-DL1_CODE_SIZE=49152 -DL1_CODE_LINESIZE=64 -DL1_CODE_ASSOCIATIVE=3 " \
  921. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 -DL1_DATA_ASSOCIATIVE=2 " \
  922. "-DL2_SIZE=2097152 -DL2_LINESIZE=64 -DL2_ASSOCIATIVE=16 " \
  923. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  924. "-DHAVE_VFPV4 -DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON -DARMV8"
  925. #define LIBNAME "cortexa72"
  926. #define CORENAME "CORTEXA72"
  927. #else
  928. #endif
  929. #ifdef FORCE_CORTEXA73
  930. #define FORCE
  931. #define ARCHITECTURE "ARM64"
  932. #define SUBARCHITECTURE "CORTEXA73"
  933. #define SUBDIRNAME "arm64"
  934. #define ARCHCONFIG "-DCORTEXA73 " \
  935. "-DL1_CODE_SIZE=49152 -DL1_CODE_LINESIZE=64 -DL1_CODE_ASSOCIATIVE=3 " \
  936. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 -DL1_DATA_ASSOCIATIVE=2 " \
  937. "-DL2_SIZE=2097152 -DL2_LINESIZE=64 -DL2_ASSOCIATIVE=16 " \
  938. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  939. "-DHAVE_VFPV4 -DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON -DARMV8"
  940. #define LIBNAME "cortexa73"
  941. #define CORENAME "CORTEXA73"
  942. #else
  943. #endif
  944. #ifdef FORCE_FALKOR
  945. #define FORCE
  946. #define ARCHITECTURE "ARM64"
  947. #define SUBARCHITECTURE "FALKOR"
  948. #define SUBDIRNAME "arm64"
  949. #define ARCHCONFIG "-DFALKOR " \
  950. "-DL1_CODE_SIZE=49152 -DL1_CODE_LINESIZE=64 -DL1_CODE_ASSOCIATIVE=3 " \
  951. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 -DL1_DATA_ASSOCIATIVE=2 " \
  952. "-DL2_SIZE=2097152 -DL2_LINESIZE=64 -DL2_ASSOCIATIVE=16 " \
  953. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  954. "-DHAVE_VFPV4 -DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON -DARMV8"
  955. #define LIBNAME "falkor"
  956. #define CORENAME "FALKOR"
  957. #else
  958. #endif
  959. #ifdef FORCE_THUNDERX
  960. #define FORCE
  961. #define ARCHITECTURE "ARM64"
  962. #define SUBARCHITECTURE "THUNDERX"
  963. #define SUBDIRNAME "arm64"
  964. #define ARCHCONFIG "-DTHUNDERX " \
  965. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=128 " \
  966. "-DL2_SIZE=16777216 -DL2_LINESIZE=128 -DL2_ASSOCIATIVE=16 " \
  967. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  968. "-DHAVE_VFPV4 -DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON -DARMV8"
  969. #define LIBNAME "thunderx"
  970. #define CORENAME "THUNDERX"
  971. #else
  972. #endif
  973. #ifdef FORCE_THUNDERX2T99
  974. #define ARMV8
  975. #define FORCE
  976. #define ARCHITECTURE "ARM64"
  977. #define SUBARCHITECTURE "THUNDERX2T99"
  978. #define SUBDIRNAME "arm64"
  979. #define ARCHCONFIG "-DTHUNDERX2T99 " \
  980. "-DL1_CODE_SIZE=32768 -DL1_CODE_LINESIZE=64 -DL1_CODE_ASSOCIATIVE=8 " \
  981. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 -DL1_DATA_ASSOCIATIVE=8 " \
  982. "-DL2_SIZE=262144 -DL2_LINESIZE=64 -DL2_ASSOCIATIVE=8 " \
  983. "-DL3_SIZE=33554432 -DL3_LINESIZE=64 -DL3_ASSOCIATIVE=32 " \
  984. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  985. "-DHAVE_VFPV4 -DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON -DARMV8"
  986. #define LIBNAME "thunderx2t99"
  987. #define CORENAME "THUNDERX2T99"
  988. #else
  989. #endif
  990. #ifdef FORCE_ZARCH_GENERIC
  991. #define FORCE
  992. #define ARCHITECTURE "ZARCH"
  993. #define SUBARCHITECTURE "ZARCH_GENERIC"
  994. #define ARCHCONFIG "-DZARCH_GENERIC " \
  995. "-DDTB_DEFAULT_ENTRIES=64"
  996. #define LIBNAME "zarch_generic"
  997. #define CORENAME "ZARCH_GENERIC"
  998. #endif
  999. #ifdef FORCE_Z13
  1000. #define FORCE
  1001. #define ARCHITECTURE "ZARCH"
  1002. #define SUBARCHITECTURE "Z13"
  1003. #define ARCHCONFIG "-DZ13 " \
  1004. "-DDTB_DEFAULT_ENTRIES=64"
  1005. #define LIBNAME "z13"
  1006. #define CORENAME "Z13"
  1007. #endif
  1008. #ifdef FORCE_Z14
  1009. #define FORCE
  1010. #define ARCHITECTURE "ZARCH"
  1011. #define SUBARCHITECTURE "Z14"
  1012. #define ARCHCONFIG "-DZ14 " \
  1013. "-DDTB_DEFAULT_ENTRIES=64"
  1014. #define LIBNAME "z14"
  1015. #define CORENAME "Z14"
  1016. #endif
  1017. #ifndef FORCE
  1018. #ifdef USER_TARGET
  1019. #error "The TARGET specified on the command line or in Makefile.rule is not supported. Please choose a target from TargetList.txt"
  1020. #endif
  1021. #if defined(__powerpc__) || defined(__powerpc) || defined(powerpc) || \
  1022. defined(__PPC__) || defined(PPC) || defined(_POWER) || defined(__POWERPC__)
  1023. #ifndef POWER
  1024. #define POWER
  1025. #endif
  1026. #define OPENBLAS_SUPPORTED
  1027. #endif
  1028. #if defined(__zarch__) || defined(__s390x__)
  1029. #define ZARCH
  1030. #include "cpuid_zarch.c"
  1031. #define OPENBLAS_SUPPORTED
  1032. #endif
  1033. #ifdef INTEL_AMD
  1034. #include "cpuid_x86.c"
  1035. #define OPENBLAS_SUPPORTED
  1036. #endif
  1037. #ifdef __ia64__
  1038. #include "cpuid_ia64.c"
  1039. #define OPENBLAS_SUPPORTED
  1040. #endif
  1041. #ifdef __alpha
  1042. #include "cpuid_alpha.c"
  1043. #define OPENBLAS_SUPPORTED
  1044. #endif
  1045. #ifdef POWER
  1046. #include "cpuid_power.c"
  1047. #define OPENBLAS_SUPPORTED
  1048. #endif
  1049. #ifdef sparc
  1050. #include "cpuid_sparc.c"
  1051. #define OPENBLAS_SUPPORTED
  1052. #endif
  1053. #ifdef __mips__
  1054. #ifdef __mips64
  1055. #include "cpuid_mips64.c"
  1056. #else
  1057. #include "cpuid_mips.c"
  1058. #endif
  1059. #define OPENBLAS_SUPPORTED
  1060. #endif
  1061. #ifdef __arm__
  1062. #include "cpuid_arm.c"
  1063. #define OPENBLAS_SUPPORTED
  1064. #endif
  1065. #ifdef __aarch64__
  1066. #include "cpuid_arm64.c"
  1067. #define OPENBLAS_SUPPORTED
  1068. #endif
  1069. #ifndef OPENBLAS_SUPPORTED
  1070. #error "This arch/CPU is not supported by OpenBLAS."
  1071. #endif
  1072. #else
  1073. #endif
  1074. static int get_num_cores(void) {
  1075. #ifdef OS_WINDOWS
  1076. SYSTEM_INFO sysinfo;
  1077. #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
  1078. int m[2], count;
  1079. size_t len;
  1080. #endif
  1081. #if defined(linux) || defined(__sun__)
  1082. //returns the number of processors which are currently online
  1083. return sysconf(_SC_NPROCESSORS_CONF);
  1084. #elif defined(OS_WINDOWS)
  1085. GetSystemInfo(&sysinfo);
  1086. return sysinfo.dwNumberOfProcessors;
  1087. #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
  1088. m[0] = CTL_HW;
  1089. m[1] = HW_NCPU;
  1090. len = sizeof(int);
  1091. sysctl(m, 2, &count, &len, NULL, 0);
  1092. return count;
  1093. #else
  1094. return 2;
  1095. #endif
  1096. }
  1097. int main(int argc, char *argv[]){
  1098. #ifdef FORCE
  1099. char buffer[8192], *p, *q;
  1100. int length;
  1101. #endif
  1102. if (argc == 1) return 0;
  1103. switch (argv[1][0]) {
  1104. case '0' : /* for Makefile */
  1105. #ifdef FORCE
  1106. printf("CORE=%s\n", CORENAME);
  1107. #else
  1108. #if defined(INTEL_AMD) || defined(POWER) || defined(__mips__) || defined(__arm__) || defined(__aarch64__) || defined(ZARCH) || defined(sparc)
  1109. printf("CORE=%s\n", get_corename());
  1110. #endif
  1111. #endif
  1112. #ifdef FORCE
  1113. printf("LIBCORE=%s\n", LIBNAME);
  1114. #else
  1115. printf("LIBCORE=");
  1116. get_libname();
  1117. printf("\n");
  1118. #endif
  1119. printf("NUM_CORES=%d\n", get_num_cores());
  1120. #if defined(__arm__) && !defined(FORCE)
  1121. get_features();
  1122. #endif
  1123. #ifdef INTEL_AMD
  1124. #ifndef FORCE
  1125. get_sse();
  1126. #else
  1127. sprintf(buffer, "%s", ARCHCONFIG);
  1128. p = &buffer[0];
  1129. while (*p) {
  1130. if ((*p == '-') && (*(p + 1) == 'D')) {
  1131. p += 2;
  1132. while ((*p != ' ') && (*p != '\0')) {
  1133. if (*p == '=') {
  1134. printf("=");
  1135. p ++;
  1136. while ((*p != ' ') && (*p != '\0')) {
  1137. printf("%c", *p);
  1138. p ++;
  1139. }
  1140. } else {
  1141. printf("%c", *p);
  1142. p ++;
  1143. if ((*p == ' ') || (*p =='\0')) printf("=1");
  1144. }
  1145. }
  1146. printf("\n");
  1147. } else p ++;
  1148. }
  1149. #endif
  1150. #endif
  1151. #ifdef MAKE_NB_JOBS
  1152. #if MAKE_NB_JOBS > 0
  1153. printf("MAKE += -j %d\n", MAKE_NB_JOBS);
  1154. #else
  1155. // Let make use parent -j argument or -j1 if there
  1156. // is no make parent
  1157. #endif
  1158. #elif NO_PARALLEL_MAKE==1
  1159. printf("MAKE += -j 1\n");
  1160. #else
  1161. printf("MAKE += -j %d\n", get_num_cores());
  1162. #endif
  1163. break;
  1164. case '1' : /* For config.h */
  1165. #ifdef FORCE
  1166. sprintf(buffer, "%s -DCORE_%s\n", ARCHCONFIG, CORENAME);
  1167. p = &buffer[0];
  1168. while (*p) {
  1169. if ((*p == '-') && (*(p + 1) == 'D')) {
  1170. p += 2;
  1171. printf("#define ");
  1172. while ((*p != ' ') && (*p != '\0')) {
  1173. if (*p == '=') {
  1174. printf(" ");
  1175. p ++;
  1176. while ((*p != ' ') && (*p != '\0')) {
  1177. printf("%c", *p);
  1178. p ++;
  1179. }
  1180. } else {
  1181. if (*p != '\n')
  1182. printf("%c", *p);
  1183. p ++;
  1184. }
  1185. }
  1186. printf("\n");
  1187. } else p ++;
  1188. }
  1189. #else
  1190. get_cpuconfig();
  1191. #endif
  1192. #ifdef FORCE
  1193. printf("#define CHAR_CORENAME \"%s\"\n", CORENAME);
  1194. #else
  1195. #if defined(INTEL_AMD) || defined(POWER) || defined(__mips__) || defined(__arm__) || defined(__aarch64__) || defined(ZARCH) || defined(sparc)
  1196. printf("#define CHAR_CORENAME \"%s\"\n", get_corename());
  1197. #endif
  1198. #endif
  1199. break;
  1200. case '2' : /* SMP */
  1201. if (get_num_cores() > 1) printf("SMP=1\n");
  1202. break;
  1203. }
  1204. fflush(stdout);
  1205. return 0;
  1206. }