How to check if Target supports various instructions, avx512f

You can access the current cpu from builtin.cpu

const builtin = @import("builtin");
const cpu: std.Target.Cpu = builtin.cpu;
_ = cpu.features;

cpu.features is a list with all the features.

Use zig build-exe --show-builtin or zig build-exe --show-builtin -target aarch64-linux-musl to view all the builtin declarations with values for the current target.

1 Like