A command-line tool for analyzing SIMD instruction usage in compiled binaries. Inspects x86-64 binaries (ELF, Mach-O, PE) and provides detailed statistics on SIMD operations by ISA extension.
- SIMD Detection: Automatically identifies and counts SIMD instructions in binary files
- ISA Classification: Categorizes instructions by extension (SSE, SSE2, SSE4, AVX, AVX2, etc.)
- Multiple Output Formats: Support for JSON and YAML output
- Detailed Breakdown: Optional per-ISA instruction analysis with occurrence counts
- Cross-Platform: Works with ELF, Mach-O, and PE binary formats
- Linux system with
objdump
installed - Python 3.6+
- Optional: PyYAML for YAML output format
# Clone or download simdscan.py
chmod +x simdscan.py
./simdscan.py <binary_file>
-f, --format {json,yaml}
: Output format (default: json)--show-insts
: Include detailed per-ISA instruction breakdown-h, --help
: Show help message
Analyze a library file:
./simdscan.py libfaiss.a
Output with instruction details:
./simdscan.py --show-insts libmath.so
YAML format output:
./simdscan.py -f yaml binary_file
{
"binary": "libfaiss.a",
"has_simd": true,
"isa_summary": {
"SSE": 96629,
"SSE2": 26378
},
"total_simd_insts": 123007
}
{
"binary": "libfaiss_avx2.a",
"has_simd": true,
"isa_summary": {
"AVX": 58825,
"SSE4": 4078
},
"total_simd_insts": 62903
}
{
"binary": "example.so",
"has_simd": true,
"isa_summary": {
"SSE": 1024,
"AVX": 512
},
"total_simd_insts": 1536,
"isa_details": {
"SSE": {
"unique_mnemonics": 15,
"occurrences": {
"movaps": 256,
"addps": 128,
"mulps": 64
}
},
"AVX": {
"unique_mnemonics": 12,
"occurrences": {
"vmovaps": 128,
"vaddps": 96,
"vmulps": 48
}
}
}
}
- Disassembly: Uses
objdump
to disassemble the target binary - Pattern Matching: Identifies SIMD instructions using mnemonic patterns
- Classification: Categorizes instructions by their corresponding ISA extensions
- Aggregation: Counts occurrences and provides summary statistics
- SSE (Streaming SIMD Extensions)
- SSE2, SSE3, SSSE3, SSE4.1, SSE4.2
- AVX (Advanced Vector Extensions)
- AVX2, AVX-512
- And other x86-64 SIMD instruction sets
- Performance Analysis: Identify SIMD utilization in optimized code
- Compiler Verification: Verify that auto-vectorization is working
- Library Comparison: Compare SIMD usage between different builds
- Architecture Targeting: Ensure binaries use appropriate instruction sets
- Requires
objdump
to be available in PATH - Only supports x86-64 architecture
- Static analysis only (doesn't consider runtime execution frequency)
Apache License 2.0
As you wish!