Last active
May 2, 2022 08:25
-
-
Save fakeboboliu/ecbedafdba0ce979d587b2e844111365 to your computer and use it in GitHub Desktop.
Which X86-64 Microarchitecture level should I use?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ `lscpu|grep x86_64|wc -l` -ge 1 ]; then # v1 / baseline | |
if [ `lscpu|grep sse3|grep sse4_1|grep sse4_2|grep ssse3|grep popcnt|grep lahf|grep cx16|wc -l` -ge 1 ]; then # v2 | |
if [ `lscpu|grep avx|grep avx2|grep bmi1|grep bmi2|grep f16c|grep fma|grep abm|grep movbe|grep xsave|wc -l` -ge 1 ]; then # v3 | |
if [ `lscpu|grep avx512f|grep avx512bw|grep avx512cd|grep avx512dq|grep avx512vl|wc -l` -ge 1 ]; then # v4 | |
echo "v4" | |
else echo "v3"; fi | |
else echo "v2"; fi | |
else echo "v1"; fi | |
else echo "none x86_64"; fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
howto:
curl https://gist.githubusercontent.com/fakeboboliu/ecbedafdba0ce979d587b2e844111365/raw/62068ceff4a5b0285d1e6a03bb07807ae255861d/x86-64-level.sh | sh