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

6 years ago
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
6 years ago
6 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368
  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(__NetBSD__) || 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. #if defined(FORCE_POWER9)
  596. #define FORCE
  597. #define ARCHITECTURE "POWER"
  598. #define SUBARCHITECTURE "POWER9"
  599. #define SUBDIRNAME "power"
  600. #define ARCHCONFIG "-DPOWER9 " \
  601. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=128 " \
  602. "-DL2_SIZE=4194304 -DL2_LINESIZE=128 " \
  603. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  604. #define LIBNAME "power9"
  605. #define CORENAME "POWER9"
  606. #endif
  607. #ifdef FORCE_PPCG4
  608. #define FORCE
  609. #define ARCHITECTURE "POWER"
  610. #define SUBARCHITECTURE "PPCG4"
  611. #define SUBDIRNAME "power"
  612. #define ARCHCONFIG "-DPPCG4 " \
  613. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=32 " \
  614. "-DL2_SIZE=262144 -DL2_LINESIZE=32 " \
  615. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  616. #define LIBNAME "ppcg4"
  617. #define CORENAME "PPCG4"
  618. #endif
  619. #ifdef FORCE_PPC970
  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=512488 -DL2_LINESIZE=128 " \
  627. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  628. #define LIBNAME "ppc970"
  629. #define CORENAME "PPC970"
  630. #endif
  631. #ifdef FORCE_PPC970MP
  632. #define FORCE
  633. #define ARCHITECTURE "POWER"
  634. #define SUBARCHITECTURE "PPC970"
  635. #define SUBDIRNAME "power"
  636. #define ARCHCONFIG "-DPPC970 " \
  637. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=128 " \
  638. "-DL2_SIZE=1024976 -DL2_LINESIZE=128 " \
  639. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  640. #define LIBNAME "ppc970mp"
  641. #define CORENAME "PPC970"
  642. #endif
  643. #ifdef FORCE_PPC440
  644. #define FORCE
  645. #define ARCHITECTURE "POWER"
  646. #define SUBARCHITECTURE "PPC440"
  647. #define SUBDIRNAME "power"
  648. #define ARCHCONFIG "-DPPC440 " \
  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 "ppc440"
  653. #define CORENAME "PPC440"
  654. #endif
  655. #ifdef FORCE_PPC440FP2
  656. #define FORCE
  657. #define ARCHITECTURE "POWER"
  658. #define SUBARCHITECTURE "PPC440FP2"
  659. #define SUBDIRNAME "power"
  660. #define ARCHCONFIG "-DPPC440FP2 " \
  661. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=32 " \
  662. "-DL2_SIZE=16384 -DL2_LINESIZE=128 " \
  663. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=16 "
  664. #define LIBNAME "ppc440FP2"
  665. #define CORENAME "PPC440FP2"
  666. #endif
  667. #ifdef FORCE_CELL
  668. #define FORCE
  669. #define ARCHITECTURE "POWER"
  670. #define SUBARCHITECTURE "CELL"
  671. #define SUBDIRNAME "power"
  672. #define ARCHCONFIG "-DCELL " \
  673. "-DL1_DATA_SIZE=262144 -DL1_DATA_LINESIZE=128 " \
  674. "-DL2_SIZE=512488 -DL2_LINESIZE=128 " \
  675. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  676. #define LIBNAME "cell"
  677. #define CORENAME "CELL"
  678. #endif
  679. #ifdef FORCE_SICORTEX
  680. #define FORCE
  681. #define ARCHITECTURE "MIPS"
  682. #define SUBARCHITECTURE "SICORTEX"
  683. #define SUBDIRNAME "mips"
  684. #define ARCHCONFIG "-DSICORTEX " \
  685. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=32 " \
  686. "-DL2_SIZE=512488 -DL2_LINESIZE=32 " \
  687. "-DDTB_DEFAULT_ENTRIES=32 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  688. #define LIBNAME "mips"
  689. #define CORENAME "sicortex"
  690. #endif
  691. #ifdef FORCE_LOONGSON3A
  692. #define FORCE
  693. #define ARCHITECTURE "MIPS"
  694. #define SUBARCHITECTURE "LOONGSON3A"
  695. #define SUBDIRNAME "mips64"
  696. #define ARCHCONFIG "-DLOONGSON3A " \
  697. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \
  698. "-DL2_SIZE=512488 -DL2_LINESIZE=32 " \
  699. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 "
  700. #define LIBNAME "loongson3a"
  701. #define CORENAME "LOONGSON3A"
  702. #else
  703. #endif
  704. #ifdef FORCE_LOONGSON3B
  705. #define FORCE
  706. #define ARCHITECTURE "MIPS"
  707. #define SUBARCHITECTURE "LOONGSON3B"
  708. #define SUBDIRNAME "mips64"
  709. #define ARCHCONFIG "-DLOONGSON3B " \
  710. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \
  711. "-DL2_SIZE=512488 -DL2_LINESIZE=32 " \
  712. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 "
  713. #define LIBNAME "loongson3b"
  714. #define CORENAME "LOONGSON3B"
  715. #else
  716. #endif
  717. #ifdef FORCE_I6400
  718. #define FORCE
  719. #define ARCHITECTURE "MIPS"
  720. #define SUBARCHITECTURE "I6400"
  721. #define SUBDIRNAME "mips64"
  722. #define ARCHCONFIG "-DI6400 " \
  723. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \
  724. "-DL2_SIZE=1048576 -DL2_LINESIZE=32 " \
  725. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  726. #define LIBNAME "i6400"
  727. #define CORENAME "I6400"
  728. #else
  729. #endif
  730. #ifdef FORCE_P6600
  731. #define FORCE
  732. #define ARCHITECTURE "MIPS"
  733. #define SUBARCHITECTURE "P6600"
  734. #define SUBDIRNAME "mips64"
  735. #define ARCHCONFIG "-DP6600 " \
  736. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \
  737. "-DL2_SIZE=1048576 -DL2_LINESIZE=32 " \
  738. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  739. #define LIBNAME "p6600"
  740. #define CORENAME "P6600"
  741. #else
  742. #endif
  743. #ifdef FORCE_P5600
  744. #define FORCE
  745. #define ARCHITECTURE "MIPS"
  746. #define SUBARCHITECTURE "P5600"
  747. #define SUBDIRNAME "mips"
  748. #define ARCHCONFIG "-DP5600 " \
  749. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \
  750. "-DL2_SIZE=1048576 -DL2_LINESIZE=32 " \
  751. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  752. #define LIBNAME "p5600"
  753. #define CORENAME "P5600"
  754. #else
  755. #endif
  756. #ifdef FORCE_I6500
  757. #define FORCE
  758. #define ARCHITECTURE "MIPS"
  759. #define SUBARCHITECTURE "I6500"
  760. #define SUBDIRNAME "mips64"
  761. #define ARCHCONFIG "-DI6500 " \
  762. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \
  763. "-DL2_SIZE=1048576 -DL2_LINESIZE=32 " \
  764. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  765. #define LIBNAME "i6500"
  766. #define CORENAME "I6500"
  767. #else
  768. #endif
  769. #ifdef FORCE_ITANIUM2
  770. #define FORCE
  771. #define ARCHITECTURE "IA64"
  772. #define SUBARCHITECTURE "ITANIUM2"
  773. #define SUBDIRNAME "ia64"
  774. #define ARCHCONFIG "-DITANIUM2 " \
  775. "-DL1_DATA_SIZE=262144 -DL1_DATA_LINESIZE=128 " \
  776. "-DL2_SIZE=1572864 -DL2_LINESIZE=128 -DDTB_SIZE=16384 -DDTB_DEFAULT_ENTRIES=128 "
  777. #define LIBNAME "itanium2"
  778. #define CORENAME "itanium2"
  779. #endif
  780. #ifdef FORCE_SPARC
  781. #define FORCE
  782. #define ARCHITECTURE "SPARC"
  783. #define SUBARCHITECTURE "SPARC"
  784. #define SUBDIRNAME "sparc"
  785. #define ARCHCONFIG "-DSPARC -DV9 " \
  786. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=64 " \
  787. "-DL2_SIZE=1572864 -DL2_LINESIZE=64 -DDTB_SIZE=8192 -DDTB_DEFAULT_ENTRIES=64 "
  788. #define LIBNAME "sparc"
  789. #define CORENAME "sparc"
  790. #endif
  791. #ifdef FORCE_SPARCV7
  792. #define FORCE
  793. #define ARCHITECTURE "SPARC"
  794. #define SUBARCHITECTURE "SPARC"
  795. #define SUBDIRNAME "sparc"
  796. #define ARCHCONFIG "-DSPARC -DV7 " \
  797. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=64 " \
  798. "-DL2_SIZE=1572864 -DL2_LINESIZE=64 -DDTB_SIZE=8192 -DDTB_DEFAULT_ENTRIES=64 "
  799. #define LIBNAME "sparcv7"
  800. #define CORENAME "sparcv7"
  801. #endif
  802. #ifdef FORCE_GENERIC
  803. #define FORCE
  804. #define ARCHITECTURE "GENERIC"
  805. #define SUBARCHITECTURE "GENERIC"
  806. #define SUBDIRNAME "generic"
  807. #define ARCHCONFIG "-DGENERIC " \
  808. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=128 " \
  809. "-DL2_SIZE=512488 -DL2_LINESIZE=128 " \
  810. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=8 "
  811. #define LIBNAME "generic"
  812. #define CORENAME "generic"
  813. #endif
  814. #ifdef FORCE_ARMV7
  815. #define FORCE
  816. #define ARCHITECTURE "ARM"
  817. #define SUBARCHITECTURE "ARMV7"
  818. #define SUBDIRNAME "arm"
  819. #define ARCHCONFIG "-DARMV7 " \
  820. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \
  821. "-DL2_SIZE=512488 -DL2_LINESIZE=32 " \
  822. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 " \
  823. "-DHAVE_VFPV3 -DHAVE_VFP"
  824. #define LIBNAME "armv7"
  825. #define CORENAME "ARMV7"
  826. #else
  827. #endif
  828. #ifdef FORCE_CORTEXA9
  829. #define FORCE
  830. #define ARCHITECTURE "ARM"
  831. #define SUBARCHITECTURE "CORTEXA9"
  832. #define SUBDIRNAME "arm"
  833. #define ARCHCONFIG "-DCORTEXA9 -DARMV7 " \
  834. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=32 " \
  835. "-DL2_SIZE=1048576 -DL2_LINESIZE=32 " \
  836. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 " \
  837. "-DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON"
  838. #define LIBNAME "cortexa9"
  839. #define CORENAME "CORTEXA9"
  840. #else
  841. #endif
  842. #ifdef FORCE_CORTEXA15
  843. #define FORCE
  844. #define ARCHITECTURE "ARM"
  845. #define SUBARCHITECTURE "CORTEXA15"
  846. #define SUBDIRNAME "arm"
  847. #define ARCHCONFIG "-DCORTEXA15 -DARMV7 " \
  848. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=32 " \
  849. "-DL2_SIZE=1048576 -DL2_LINESIZE=32 " \
  850. "-DDTB_DEFAULT_ENTRIES=128 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 " \
  851. "-DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON"
  852. #define LIBNAME "cortexa15"
  853. #define CORENAME "CORTEXA15"
  854. #else
  855. #endif
  856. #ifdef FORCE_ARMV6
  857. #define FORCE
  858. #define ARCHITECTURE "ARM"
  859. #define SUBARCHITECTURE "ARMV6"
  860. #define SUBDIRNAME "arm"
  861. #define ARCHCONFIG "-DARMV6 " \
  862. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \
  863. "-DL2_SIZE=512488 -DL2_LINESIZE=32 " \
  864. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 " \
  865. "-DHAVE_VFP"
  866. #define LIBNAME "armv6"
  867. #define CORENAME "ARMV6"
  868. #else
  869. #endif
  870. #ifdef FORCE_ARMV5
  871. #define FORCE
  872. #define ARCHITECTURE "ARM"
  873. #define SUBARCHITECTURE "ARMV5"
  874. #define SUBDIRNAME "arm"
  875. #define ARCHCONFIG "-DARMV5 " \
  876. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=32 " \
  877. "-DL2_SIZE=512488 -DL2_LINESIZE=32 " \
  878. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=4 "
  879. #define LIBNAME "armv5"
  880. #define CORENAME "ARMV5"
  881. #else
  882. #endif
  883. #ifdef FORCE_ARMV8
  884. #define FORCE
  885. #define ARCHITECTURE "ARM64"
  886. #define SUBARCHITECTURE "ARMV8"
  887. #define SUBDIRNAME "arm64"
  888. #define ARCHCONFIG "-DARMV8 " \
  889. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 " \
  890. "-DL2_SIZE=262144 -DL2_LINESIZE=64 " \
  891. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 -DL2_ASSOCIATIVE=32 " \
  892. "-DHAVE_VFPV4 -DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON -DARMV8"
  893. #define LIBNAME "armv8"
  894. #define CORENAME "ARMV8"
  895. #endif
  896. #ifdef FORCE_CORTEXA53
  897. #define FORCE
  898. #define ARCHITECTURE "ARM64"
  899. #define SUBARCHITECTURE "CORTEXA53"
  900. #define SUBDIRNAME "arm64"
  901. #define ARCHCONFIG "-DCORTEXA53 " \
  902. "-DL1_CODE_SIZE=32768 -DL1_CODE_LINESIZE=64 -DL1_CODE_ASSOCIATIVE=3 " \
  903. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 -DL1_DATA_ASSOCIATIVE=2 " \
  904. "-DL2_SIZE=262144 -DL2_LINESIZE=64 -DL2_ASSOCIATIVE=16 " \
  905. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  906. "-DHAVE_VFPV4 -DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON -DARMV8"
  907. #define LIBNAME "cortexa53"
  908. #define CORENAME "CORTEXA53"
  909. #else
  910. #endif
  911. #ifdef FORCE_CORTEXA57
  912. #define FORCE
  913. #define ARCHITECTURE "ARM64"
  914. #define SUBARCHITECTURE "CORTEXA57"
  915. #define SUBDIRNAME "arm64"
  916. #define ARCHCONFIG "-DCORTEXA57 " \
  917. "-DL1_CODE_SIZE=49152 -DL1_CODE_LINESIZE=64 -DL1_CODE_ASSOCIATIVE=3 " \
  918. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 -DL1_DATA_ASSOCIATIVE=2 " \
  919. "-DL2_SIZE=2097152 -DL2_LINESIZE=64 -DL2_ASSOCIATIVE=16 " \
  920. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  921. "-DHAVE_VFPV4 -DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON -DARMV8"
  922. #define LIBNAME "cortexa57"
  923. #define CORENAME "CORTEXA57"
  924. #else
  925. #endif
  926. #ifdef FORCE_CORTEXA72
  927. #define FORCE
  928. #define ARCHITECTURE "ARM64"
  929. #define SUBARCHITECTURE "CORTEXA72"
  930. #define SUBDIRNAME "arm64"
  931. #define ARCHCONFIG "-DCORTEXA72 " \
  932. "-DL1_CODE_SIZE=49152 -DL1_CODE_LINESIZE=64 -DL1_CODE_ASSOCIATIVE=3 " \
  933. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 -DL1_DATA_ASSOCIATIVE=2 " \
  934. "-DL2_SIZE=2097152 -DL2_LINESIZE=64 -DL2_ASSOCIATIVE=16 " \
  935. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  936. "-DHAVE_VFPV4 -DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON -DARMV8"
  937. #define LIBNAME "cortexa72"
  938. #define CORENAME "CORTEXA72"
  939. #else
  940. #endif
  941. #ifdef FORCE_CORTEXA73
  942. #define FORCE
  943. #define ARCHITECTURE "ARM64"
  944. #define SUBARCHITECTURE "CORTEXA73"
  945. #define SUBDIRNAME "arm64"
  946. #define ARCHCONFIG "-DCORTEXA73 " \
  947. "-DL1_CODE_SIZE=49152 -DL1_CODE_LINESIZE=64 -DL1_CODE_ASSOCIATIVE=3 " \
  948. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 -DL1_DATA_ASSOCIATIVE=2 " \
  949. "-DL2_SIZE=2097152 -DL2_LINESIZE=64 -DL2_ASSOCIATIVE=16 " \
  950. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  951. "-DHAVE_VFPV4 -DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON -DARMV8"
  952. #define LIBNAME "cortexa73"
  953. #define CORENAME "CORTEXA73"
  954. #else
  955. #endif
  956. #ifdef FORCE_FALKOR
  957. #define FORCE
  958. #define ARCHITECTURE "ARM64"
  959. #define SUBARCHITECTURE "FALKOR"
  960. #define SUBDIRNAME "arm64"
  961. #define ARCHCONFIG "-DFALKOR " \
  962. "-DL1_CODE_SIZE=49152 -DL1_CODE_LINESIZE=64 -DL1_CODE_ASSOCIATIVE=3 " \
  963. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 -DL1_DATA_ASSOCIATIVE=2 " \
  964. "-DL2_SIZE=2097152 -DL2_LINESIZE=64 -DL2_ASSOCIATIVE=16 " \
  965. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  966. "-DHAVE_VFPV4 -DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON -DARMV8"
  967. #define LIBNAME "falkor"
  968. #define CORENAME "FALKOR"
  969. #else
  970. #endif
  971. #ifdef FORCE_THUNDERX
  972. #define FORCE
  973. #define ARCHITECTURE "ARM64"
  974. #define SUBARCHITECTURE "THUNDERX"
  975. #define SUBDIRNAME "arm64"
  976. #define ARCHCONFIG "-DTHUNDERX " \
  977. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=128 " \
  978. "-DL2_SIZE=16777216 -DL2_LINESIZE=128 -DL2_ASSOCIATIVE=16 " \
  979. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  980. "-DHAVE_VFPV4 -DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON -DARMV8"
  981. #define LIBNAME "thunderx"
  982. #define CORENAME "THUNDERX"
  983. #else
  984. #endif
  985. #ifdef FORCE_THUNDERX2T99
  986. #define ARMV8
  987. #define FORCE
  988. #define ARCHITECTURE "ARM64"
  989. #define SUBARCHITECTURE "THUNDERX2T99"
  990. #define SUBDIRNAME "arm64"
  991. #define ARCHCONFIG "-DTHUNDERX2T99 " \
  992. "-DL1_CODE_SIZE=32768 -DL1_CODE_LINESIZE=64 -DL1_CODE_ASSOCIATIVE=8 " \
  993. "-DL1_DATA_SIZE=32768 -DL1_DATA_LINESIZE=64 -DL1_DATA_ASSOCIATIVE=8 " \
  994. "-DL2_SIZE=262144 -DL2_LINESIZE=64 -DL2_ASSOCIATIVE=8 " \
  995. "-DL3_SIZE=33554432 -DL3_LINESIZE=64 -DL3_ASSOCIATIVE=32 " \
  996. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  997. "-DHAVE_VFPV4 -DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON -DARMV8"
  998. #define LIBNAME "thunderx2t99"
  999. #define CORENAME "THUNDERX2T99"
  1000. #else
  1001. #endif
  1002. #ifdef FORCE_TSV110
  1003. #define FORCE
  1004. #define ARCHITECTURE "ARM64"
  1005. #define SUBARCHITECTURE "TSV110"
  1006. #define SUBDIRNAME "arm64"
  1007. #define ARCHCONFIG "-DTSV110 " \
  1008. "-DL1_CODE_SIZE=65536 -DL1_CODE_LINESIZE=64 -DL1_CODE_ASSOCIATIVE=4 " \
  1009. "-DL1_DATA_SIZE=65536 -DL1_DATA_LINESIZE=64 -DL1_DATA_ASSOCIATIVE=4 " \
  1010. "-DL2_SIZE=524288 -DL2_LINESIZE=64 -DL2_ASSOCIATIVE=8 " \
  1011. "-DDTB_DEFAULT_ENTRIES=64 -DDTB_SIZE=4096 " \
  1012. "-DHAVE_VFPV4 -DHAVE_VFPV3 -DHAVE_VFP -DHAVE_NEON -DARMV8"
  1013. #define LIBNAME "tsv110"
  1014. #define CORENAME "TSV110"
  1015. #else
  1016. #endif
  1017. #ifdef FORCE_ZARCH_GENERIC
  1018. #define FORCE
  1019. #define ARCHITECTURE "ZARCH"
  1020. #define SUBARCHITECTURE "ZARCH_GENERIC"
  1021. #define ARCHCONFIG "-DZARCH_GENERIC " \
  1022. "-DDTB_DEFAULT_ENTRIES=64"
  1023. #define LIBNAME "zarch_generic"
  1024. #define CORENAME "ZARCH_GENERIC"
  1025. #endif
  1026. #ifdef FORCE_Z13
  1027. #define FORCE
  1028. #define ARCHITECTURE "ZARCH"
  1029. #define SUBARCHITECTURE "Z13"
  1030. #define ARCHCONFIG "-DZ13 " \
  1031. "-DDTB_DEFAULT_ENTRIES=64"
  1032. #define LIBNAME "z13"
  1033. #define CORENAME "Z13"
  1034. #endif
  1035. #ifdef FORCE_Z14
  1036. #define FORCE
  1037. #define ARCHITECTURE "ZARCH"
  1038. #define SUBARCHITECTURE "Z14"
  1039. #define ARCHCONFIG "-DZ14 " \
  1040. "-DDTB_DEFAULT_ENTRIES=64"
  1041. #define LIBNAME "z14"
  1042. #define CORENAME "Z14"
  1043. #endif
  1044. #ifndef FORCE
  1045. #ifdef USER_TARGET
  1046. #error "The TARGET specified on the command line or in Makefile.rule is not supported. Please choose a target from TargetList.txt"
  1047. #endif
  1048. #if defined(__powerpc__) || defined(__powerpc) || defined(powerpc) || \
  1049. defined(__PPC__) || defined(PPC) || defined(_POWER) || defined(__POWERPC__)
  1050. #ifndef POWER
  1051. #define POWER
  1052. #endif
  1053. #define OPENBLAS_SUPPORTED
  1054. #endif
  1055. #if defined(__zarch__) || defined(__s390x__)
  1056. #define ZARCH
  1057. #include "cpuid_zarch.c"
  1058. #define OPENBLAS_SUPPORTED
  1059. #endif
  1060. #ifdef INTEL_AMD
  1061. #include "cpuid_x86.c"
  1062. #define OPENBLAS_SUPPORTED
  1063. #endif
  1064. #ifdef __ia64__
  1065. #include "cpuid_ia64.c"
  1066. #define OPENBLAS_SUPPORTED
  1067. #endif
  1068. #ifdef __alpha
  1069. #include "cpuid_alpha.c"
  1070. #define OPENBLAS_SUPPORTED
  1071. #endif
  1072. #ifdef POWER
  1073. #include "cpuid_power.c"
  1074. #define OPENBLAS_SUPPORTED
  1075. #endif
  1076. #ifdef sparc
  1077. #include "cpuid_sparc.c"
  1078. #define OPENBLAS_SUPPORTED
  1079. #endif
  1080. #ifdef __mips__
  1081. #ifdef __mips64
  1082. #include "cpuid_mips64.c"
  1083. #else
  1084. #include "cpuid_mips.c"
  1085. #endif
  1086. #define OPENBLAS_SUPPORTED
  1087. #endif
  1088. #ifdef __arm__
  1089. #include "cpuid_arm.c"
  1090. #define OPENBLAS_SUPPORTED
  1091. #endif
  1092. #ifdef __aarch64__
  1093. #include "cpuid_arm64.c"
  1094. #define OPENBLAS_SUPPORTED
  1095. #endif
  1096. #ifndef OPENBLAS_SUPPORTED
  1097. #error "This arch/CPU is not supported by OpenBLAS."
  1098. #endif
  1099. #else
  1100. #endif
  1101. static int get_num_cores(void) {
  1102. #ifdef OS_WINDOWS
  1103. SYSTEM_INFO sysinfo;
  1104. #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__APPLE__)
  1105. int m[2], count;
  1106. size_t len;
  1107. #endif
  1108. #if defined(linux) || defined(__sun__)
  1109. //returns the number of processors which are currently online
  1110. return sysconf(_SC_NPROCESSORS_CONF);
  1111. #elif defined(OS_WINDOWS)
  1112. GetSystemInfo(&sysinfo);
  1113. return sysinfo.dwNumberOfProcessors;
  1114. #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__APPLE__)
  1115. m[0] = CTL_HW;
  1116. m[1] = HW_NCPU;
  1117. len = sizeof(int);
  1118. sysctl(m, 2, &count, &len, NULL, 0);
  1119. return count;
  1120. #else
  1121. return 2;
  1122. #endif
  1123. }
  1124. int main(int argc, char *argv[]){
  1125. #ifdef FORCE
  1126. char buffer[8192], *p, *q;
  1127. int length;
  1128. #endif
  1129. if (argc == 1) return 0;
  1130. switch (argv[1][0]) {
  1131. case '0' : /* for Makefile */
  1132. #ifdef FORCE
  1133. printf("CORE=%s\n", CORENAME);
  1134. #else
  1135. #if defined(INTEL_AMD) || defined(POWER) || defined(__mips__) || defined(__arm__) || defined(__aarch64__) || defined(ZARCH) || defined(sparc)
  1136. printf("CORE=%s\n", get_corename());
  1137. #endif
  1138. #endif
  1139. #ifdef FORCE
  1140. printf("LIBCORE=%s\n", LIBNAME);
  1141. #else
  1142. printf("LIBCORE=");
  1143. get_libname();
  1144. printf("\n");
  1145. #endif
  1146. printf("NUM_CORES=%d\n", get_num_cores());
  1147. #if defined(__arm__) && !defined(FORCE)
  1148. get_features();
  1149. #endif
  1150. #ifdef INTEL_AMD
  1151. #ifndef FORCE
  1152. get_sse();
  1153. #else
  1154. sprintf(buffer, "%s", ARCHCONFIG);
  1155. p = &buffer[0];
  1156. while (*p) {
  1157. if ((*p == '-') && (*(p + 1) == 'D')) {
  1158. p += 2;
  1159. while ((*p != ' ') && (*p != '\0')) {
  1160. if (*p == '=') {
  1161. printf("=");
  1162. p ++;
  1163. while ((*p != ' ') && (*p != '\0')) {
  1164. printf("%c", *p);
  1165. p ++;
  1166. }
  1167. } else {
  1168. printf("%c", *p);
  1169. p ++;
  1170. if ((*p == ' ') || (*p =='\0')) printf("=1");
  1171. }
  1172. }
  1173. printf("\n");
  1174. } else p ++;
  1175. }
  1176. #endif
  1177. #endif
  1178. #ifdef MAKE_NB_JOBS
  1179. #if MAKE_NB_JOBS > 0
  1180. printf("MAKE += -j %d\n", MAKE_NB_JOBS);
  1181. #else
  1182. // Let make use parent -j argument or -j1 if there
  1183. // is no make parent
  1184. #endif
  1185. #elif NO_PARALLEL_MAKE==1
  1186. printf("MAKE += -j 1\n");
  1187. #else
  1188. printf("MAKE += -j %d\n", get_num_cores());
  1189. #endif
  1190. break;
  1191. case '1' : /* For config.h */
  1192. #ifdef FORCE
  1193. sprintf(buffer, "%s -DCORE_%s\n", ARCHCONFIG, CORENAME);
  1194. p = &buffer[0];
  1195. while (*p) {
  1196. if ((*p == '-') && (*(p + 1) == 'D')) {
  1197. p += 2;
  1198. printf("#define ");
  1199. while ((*p != ' ') && (*p != '\0')) {
  1200. if (*p == '=') {
  1201. printf(" ");
  1202. p ++;
  1203. while ((*p != ' ') && (*p != '\0')) {
  1204. printf("%c", *p);
  1205. p ++;
  1206. }
  1207. } else {
  1208. if (*p != '\n')
  1209. printf("%c", *p);
  1210. p ++;
  1211. }
  1212. }
  1213. printf("\n");
  1214. } else p ++;
  1215. }
  1216. #else
  1217. get_cpuconfig();
  1218. #endif
  1219. #ifdef FORCE
  1220. printf("#define CHAR_CORENAME \"%s\"\n", CORENAME);
  1221. #else
  1222. #if defined(INTEL_AMD) || defined(POWER) || defined(__mips__) || defined(__arm__) || defined(__aarch64__) || defined(ZARCH) || defined(sparc)
  1223. printf("#define CHAR_CORENAME \"%s\"\n", get_corename());
  1224. #endif
  1225. #endif
  1226. break;
  1227. case '2' : /* SMP */
  1228. if (get_num_cores() > 1) printf("SMP=1\n");
  1229. break;
  1230. }
  1231. fflush(stdout);
  1232. return 0;
  1233. }