Last active
September 23, 2025 04:45
-
-
Save mrspartak/72452c5f72b886f4422c8182190dc5ea to your computer and use it in GitHub Desktop.
Detect GOAMD64 level on linux machine
This file contains hidden or 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
| $script = { | |
| $cpu = Get-WmiObject Win32_Processor | |
| $flags = $cpu.Caption + " " + $cpu.Name + " " + $cpu.Description | |
| function Check-Flag { | |
| param([string]$flag) | |
| return $flags -match $flag | |
| } | |
| if ((Check-Flag "AVX512F") -and (Check-Flag "AVX512BW") -and (Check-Flag "AVX512CD") -and (Check-Flag "AVX512DQ") -and (Check-Flag "AVX512VL")) { | |
| return "v4" | |
| } elseif ((Check-Flag "AVX") -and (Check-Flag "AVX2") -and (Check-Flag "BMI1") -and (Check-Flag "BMI2") -and (Check-Flag "FMA") -and (Check-Flag "MOVBE")) { | |
| return "v3" | |
| } elseif ((Check-Flag "CMPXCHG16B") -and (Check-Flag "POPCNT") -and (Check-Flag "SSE3") -and (Check-Flag "SSE4.1") -and (Check-Flag "SSE4.2") -and (Check-Flag "SSSE3")) { | |
| return "v2" | |
| } else { | |
| return "v1" | |
| } | |
| } | |
| $result = powershell -Command $script | |
| Write-Output "Supported GOAMD64 level: $result" |
This file contains hidden or 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/bash | |
| check_flag() { | |
| grep -q "$1" /proc/cpuinfo | |
| return $? | |
| } | |
| if check_flag "avx512f" && check_flag "avx512bw" && check_flag "avx512cd" && check_flag "avx512dq" && check_flag "avx512vl"; then | |
| echo "v4" | |
| elif check_flag "avx" && check_flag "avx2" && check_flag "bmi1" && check_flag "bmi2" && check_flag "f16c" && check_flag "fma" && check_flag "abm" && check_flag "movbe"; then | |
| echo "v3" | |
| elif check_flag "cx16" && check_flag "lahf_lm" && check_flag "popcnt" && check_flag "sse3" && check_flag "sse4_1" && check_flag "sse4_2" && check_flag "ssse3"; then | |
| echo "v2" | |
| else | |
| echo "v1" | |
| fi |
Author
Author
For windows:
powershell -Command "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; iex ((New-Object System.Net.WebClient).DownloadString('https://gist.githubusercontent.com/mrspartak/72452c5f72b886f4422c8182190dc5ea/raw/7690fd129468de418c45ffa32a887e8feaffed95/detect_goamd64.ps1'))"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage: