cpufeat

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package cpufeat classifies disassembled instructions into the CPU-feature families they require, so a binary can be summarised as "needs AVX2, SSE4.2, FMA" → an implied baseline (x86-64-v3). The classification is by mnemonic (and, where needed, operand shape) from the GNU-syntax assembly text the disassembler already produces, so no second decode is needed.

Index

Constants

This section is empty.

Variables

View Source
var DisplayOrder = []string{

	"SSE3", "SSSE3", "SSE4.1", "SSE4.2", "POPCNT", "ABM", "LZCNT",
	"AVX", "AVX2", "FMA", "F16C", "BMI1", "BMI2", "MOVBE", "ADX", "AVX-512",
	"AES", "PCLMUL", "SHA", "RDRAND", "RDSEED",

	"NEON/ASIMD", "LSE atomics", "CRC32", "Pointer auth", "DotProd", "BF16", "SVE",
	"AES (crypto)", "SHA (crypto)", "PMULL (crypto)",
}

DisplayOrder lists features in a stable, roughly-increasing-requirement order for reporting.

Functions

func ARM64

func ARM64(text string) string

ARM64 reports the (mostly optional) ARMv8 extension an instruction requires, or "" for base instructions. NEON/ASIMD is mandatory in ARMv8-A but is reported so SIMD use is visible.

func BaselineX86

func BaselineX86(feats map[string]int) string

BaselineX86 names the minimum x86-64 microarchitecture level implied by the set of features used (the highest level any used feature belongs to).

func Mnemonic

func Mnemonic(text string) (op, operands string)

Mnemonic splits assembly text into its lower-cased opcode and the operand remainder.

func X86

func X86(text string) string

X86 reports the feature an x86/x86-64 instruction requires beyond the baseline, or "" for a baseline (or unclassified) instruction. SSE/SSE2 are the x86-64 baseline, so they're not reported.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL