28 Jul
2022
28 Jul
'22
20:28
On Thursday 2022-07-28 20:51, Yamaban wrote:
otherwise a short awk program will also give answers: [code] #!/usr/bin/awk -f
BEGIN { while (!/flags/) if (getline < "/proc/cpuinfo" != 1) exit 1 if (/lm/&&/cmov/&&/cx8/&&/fpu/&&/fxsr/&&/mmx/&&/syscall/&&/sse2/) level = 1 if (level == 1 && /cx16/&&/lahf/&&/popcnt/&&/sse4_1/&&/sse4_2/&&/ssse3/) level = 2 if (level == 2 && /avx/&&/avx2/&&/bmi1/&&/bmi2/&&/f16c/&&/fma/&&/abm/&&/movbe/&&/xsave/)
This is slightly incorrect. A hypothetical machine which has AVX2 but lacks AVX1 would still print level 2.