fixups to arch data, support any number of cpu features

master
Andrew Kelley 2020-01-21 00:34:54 -05:00
parent 6118b11afa
commit e640d01535
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
22 changed files with 777 additions and 702 deletions

View File

@ -1983,7 +1983,7 @@ pub const LibExeObjStep = struct {
var feature_str_buffer = try std.Buffer.initSize(builder.allocator, 0);
for (self.target.getArch().allFeaturesList()) |feature, i| {
if (Target.Cpu.Feature.isEnabled(features, @intCast(u7, i))) {
if (features.isEnabled(@intCast(u8, i))) {
try feature_str_buffer.append(feature.name);
try feature_str_buffer.append(",");
}

View File

@ -219,7 +219,8 @@ pub const Target = union(enum) {
pub fn parseCpuFeatureSet(arch: Arch, features_text: []const u8) !Cpu.Feature.Set {
// Here we compute both and choose the correct result at the end, based
// on whether or not we saw + and - signs.
var set: @Vector(2, Cpu.Feature.Set) = [2]Cpu.Feature.Set{ 0, arch.baselineFeatures() };
var whitelist_set = Cpu.Feature.Set.empty();
var baseline_set = arch.baselineFeatures();
var mode: enum {
unknown,
baseline,
@ -257,10 +258,15 @@ pub const Target = union(enum) {
}
for (arch.allFeaturesList()) |feature, index| {
if (mem.eql(u8, feature_name, feature.name)) {
const one_bit = @as(Cpu.Feature.Set, 1) << @intCast(u7, index);
switch (op) {
.add => set |= @splat(2, one_bit),
.sub => set &= @splat(2, ~one_bit),
.add => {
baseline_set.addFeature(@intCast(u8, index));
whitelist_set.addFeature(@intCast(u8, index));
},
.sub => {
baseline_set.removeFeature(@intCast(u8, index));
whitelist_set.removeFeature(@intCast(u8, index));
},
}
break;
}
@ -270,8 +276,8 @@ pub const Target = union(enum) {
}
return switch (mode) {
.unknown, .whitelist => set[0],
.baseline => set[1],
.unknown, .whitelist => whitelist_set,
.baseline => baseline_set,
};
}
@ -413,21 +419,21 @@ pub const Target = union(enum) {
/// All CPU features Zig is aware of, sorted lexicographically by name.
pub fn allFeaturesList(arch: Arch) []const Cpu.Feature {
return switch (arch) {
.arm, .armeb, .thumb, .thumbeb => arm.all_features,
.arm, .armeb, .thumb, .thumbeb => &arm.all_features,
.aarch64, .aarch64_be, .aarch64_32 => &aarch64.all_features,
.avr => avr.all_features,
.bpfel, .bpfeb => bpf.all_features,
.hexagon => hexagon.all_features,
.mips, .mipsel, .mips64, .mips64el => mips.all_features,
.msp430 => msp430.all_features,
.powerpc, .powerpc64, .powerpc64le => powerpc.all_features,
.amdgcn => amdgpu.all_features,
.riscv32, .riscv64 => riscv.all_features,
.sparc, .sparcv9, .sparcel => sparc.all_features,
.s390x => systemz.all_features,
.avr => &avr.all_features,
.bpfel, .bpfeb => &bpf.all_features,
.hexagon => &hexagon.all_features,
.mips, .mipsel, .mips64, .mips64el => &mips.all_features,
.msp430 => &msp430.all_features,
.powerpc, .powerpc64, .powerpc64le => &powerpc.all_features,
.amdgcn => &amdgpu.all_features,
.riscv32, .riscv64 => &riscv.all_features,
.sparc, .sparcv9, .sparcel => &sparc.all_features,
.s390x => &systemz.all_features,
.i386, .x86_64 => &x86.all_features,
.nvptx, .nvptx64 => nvptx.all_features,
.wasm32, .wasm64 => wasm.all_features,
.nvptx, .nvptx64 => &nvptx.all_features,
.wasm32, .wasm64 => &wasm.all_features,
else => &[0]Cpu.Feature{},
};
@ -439,10 +445,11 @@ pub const Target = union(enum) {
return switch (arch) {
.arm, .armeb, .thumb, .thumbeb => arm.cpu.generic.features,
.aarch64, .aarch64_be, .aarch64_32 => aarch64.cpu.generic.features,
.avr => avr.cpu.generic.features,
.avr => avr.baseline_features,
.bpfel, .bpfeb => bpf.cpu.generic.features,
.hexagon => hexagon.cpu.generic.features,
.mips, .mipsel, .mips64, .mips64el => mips.cpu.generic.features,
.mips, .mipsel => mips.cpu.mips32.features,
.mips64, .mips64el => mips.cpu.mips64.features,
.msp430 => msp430.cpu.generic.features,
.powerpc, .powerpc64, .powerpc64le => powerpc.cpu.generic.features,
.amdgcn => amdgpu.cpu.generic.features,
@ -452,10 +459,10 @@ pub const Target = union(enum) {
.s390x => systemz.cpu.generic.features,
.i386 => x86.cpu.pentium4.features,
.x86_64 => x86.cpu.x86_64.features,
.nvptx, .nvptx64 => nvptx.cpu.generic.features,
.nvptx, .nvptx64 => nvptx.cpu.sm_20.features,
.wasm32, .wasm64 => wasm.cpu.generic.features,
else => 0,
else => Cpu.Feature.Set.empty(),
};
}
@ -522,24 +529,46 @@ pub const Target = union(enum) {
dependencies: Set,
/// A bit set of all the features.
pub const Set = u128;
pub const Set = struct {
bytes: [bit_count / 8]u8,
pub fn isEnabled(set: Set, arch_feature_index: u7) bool {
return (set & (@as(Set, 1) << arch_feature_index)) != 0;
}
pub const bit_count = 22 * 8;
pub fn empty() Set {
return .{ .bytes = [1]u8{0} ** 22 };
}
pub fn isEnabled(set: Set, arch_feature_index: u8) bool {
const byte_index = arch_feature_index / 8;
const bit_index = @intCast(u3, arch_feature_index % 8);
return (set.bytes[byte_index] & (@as(u8, 1) << bit_index)) != 0;
}
pub fn addFeature(set: *Set, arch_feature_index: u8) void {
const byte_index = arch_feature_index / 8;
const bit_index = @intCast(u3, arch_feature_index % 8);
set.bytes[byte_index] |= @as(u8, 1) << bit_index;
}
pub fn removeFeature(set: *Set, arch_feature_index: u8) void {
const byte_index = arch_feature_index / 8;
const bit_index = @intCast(u3, arch_feature_index % 8);
set.bytes[byte_index] &= ~(@as(u8, 1) << bit_index);
}
};
pub fn feature_set_fns(comptime F: type) type {
return struct {
pub fn featureSet(features: []const F) Set {
var x: Set = 0;
var x = Set.empty();
for (features) |feature| {
x |= @as(Set, 1) << @enumToInt(feature);
x.addFeature(@enumToInt(feature));
}
return x;
}
pub fn featureSetHas(set: Set, feature: F) bool {
return (set & (@as(Set, 1) << @enumToInt(feature))) != 0;
return set.isEnabled(@enumToInt(feature));
}
};
}
@ -748,7 +777,7 @@ pub const Target = union(enum) {
pub fn parseArchSub(text: []const u8) ParseArchSubError!Arch {
const info = @typeInfo(Arch);
inline for (info.Union.fields) |field| {
if (mem.eql(u8, text, field.name)) {
if (mem.startsWith(u8, text, field.name)) {
if (field.field_type == void) {
return @as(Arch, @field(Arch, field.name));
} else {

View File

@ -154,7 +154,7 @@ pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= @typeInfo(Cpu.Feature.Set).Int.bits);
std.debug.assert(len <= Cpu.Feature.Set.bit_count);
var result: [len]Cpu.Feature = undefined;
result[@enumToInt(Feature.a35)] = .{
.index = @enumToInt(Feature.a35),
@ -298,140 +298,140 @@ pub const all_features = blk: {
.name = @tagName(Feature.aggressive_fma),
.llvm_name = "aggressive-fma",
.description = "Enable Aggressive FMA for floating-point.",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.alternate_sextload_cvt_f32_pattern)] = .{
.index = @enumToInt(Feature.alternate_sextload_cvt_f32_pattern),
.name = @tagName(Feature.alternate_sextload_cvt_f32_pattern),
.llvm_name = "alternate-sextload-cvt-f32-pattern",
.description = "Use alternative pattern for sextload convert to f32",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.altnzcv)] = .{
.index = @enumToInt(Feature.altnzcv),
.name = @tagName(Feature.altnzcv),
.llvm_name = "altnzcv",
.description = "Enable alternative NZCV format for floating point comparisons",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.am)] = .{
.index = @enumToInt(Feature.am),
.name = @tagName(Feature.am),
.llvm_name = "am",
.description = "Enable v8.4-A Activity Monitors extension",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.arith_bcc_fusion)] = .{
.index = @enumToInt(Feature.arith_bcc_fusion),
.name = @tagName(Feature.arith_bcc_fusion),
.llvm_name = "arith-bcc-fusion",
.description = "CPU fuses arithmetic+bcc operations",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.arith_cbz_fusion)] = .{
.index = @enumToInt(Feature.arith_cbz_fusion),
.name = @tagName(Feature.arith_cbz_fusion),
.llvm_name = "arith-cbz-fusion",
.description = "CPU fuses arithmetic + cbz/cbnz operations",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.balance_fp_ops)] = .{
.index = @enumToInt(Feature.balance_fp_ops),
.name = @tagName(Feature.balance_fp_ops),
.llvm_name = "balance-fp-ops",
.description = "balance mix of odd and even D-registers for fp multiply(-accumulate) ops",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.bti)] = .{
.index = @enumToInt(Feature.bti),
.name = @tagName(Feature.bti),
.llvm_name = "bti",
.description = "Enable Branch Target Identification",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.call_saved_x10)] = .{
.index = @enumToInt(Feature.call_saved_x10),
.name = @tagName(Feature.call_saved_x10),
.llvm_name = "call-saved-x10",
.description = "Make X10 callee saved.",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.call_saved_x11)] = .{
.index = @enumToInt(Feature.call_saved_x11),
.name = @tagName(Feature.call_saved_x11),
.llvm_name = "call-saved-x11",
.description = "Make X11 callee saved.",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.call_saved_x12)] = .{
.index = @enumToInt(Feature.call_saved_x12),
.name = @tagName(Feature.call_saved_x12),
.llvm_name = "call-saved-x12",
.description = "Make X12 callee saved.",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.call_saved_x13)] = .{
.index = @enumToInt(Feature.call_saved_x13),
.name = @tagName(Feature.call_saved_x13),
.llvm_name = "call-saved-x13",
.description = "Make X13 callee saved.",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.call_saved_x14)] = .{
.index = @enumToInt(Feature.call_saved_x14),
.name = @tagName(Feature.call_saved_x14),
.llvm_name = "call-saved-x14",
.description = "Make X14 callee saved.",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.call_saved_x15)] = .{
.index = @enumToInt(Feature.call_saved_x15),
.name = @tagName(Feature.call_saved_x15),
.llvm_name = "call-saved-x15",
.description = "Make X15 callee saved.",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.call_saved_x18)] = .{
.index = @enumToInt(Feature.call_saved_x18),
.name = @tagName(Feature.call_saved_x18),
.llvm_name = "call-saved-x18",
.description = "Make X18 callee saved.",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.call_saved_x8)] = .{
.index = @enumToInt(Feature.call_saved_x8),
.name = @tagName(Feature.call_saved_x8),
.llvm_name = "call-saved-x8",
.description = "Make X8 callee saved.",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.call_saved_x9)] = .{
.index = @enumToInt(Feature.call_saved_x9),
.name = @tagName(Feature.call_saved_x9),
.llvm_name = "call-saved-x9",
.description = "Make X9 callee saved.",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ccdp)] = .{
.index = @enumToInt(Feature.ccdp),
.name = @tagName(Feature.ccdp),
.llvm_name = "ccdp",
.description = "Enable v8.5 Cache Clean to Point of Deep Persistence",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ccidx)] = .{
.index = @enumToInt(Feature.ccidx),
.name = @tagName(Feature.ccidx),
.llvm_name = "ccidx",
.description = "Enable v8.3-A Extend of the CCSIDR number of sets",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ccpp)] = .{
.index = @enumToInt(Feature.ccpp),
.name = @tagName(Feature.ccpp),
.llvm_name = "ccpp",
.description = "Enable v8.2 data Cache Clean to Point of Persistence",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.complxnum)] = .{
.index = @enumToInt(Feature.complxnum),
@ -447,7 +447,7 @@ pub const all_features = blk: {
.name = @tagName(Feature.crc),
.llvm_name = "crc",
.description = "Enable ARMv8 CRC-32 checksum instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.crypto)] = .{
.index = @enumToInt(Feature.crypto),
@ -465,7 +465,7 @@ pub const all_features = blk: {
.name = @tagName(Feature.custom_cheap_as_move),
.llvm_name = "custom-cheap-as-move",
.description = "Use custom handling of cheap instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.cyclone)] = .{
.index = @enumToInt(Feature.cyclone),
@ -493,21 +493,21 @@ pub const all_features = blk: {
.name = @tagName(Feature.disable_latency_sched_heuristic),
.llvm_name = "disable-latency-sched-heuristic",
.description = "Disable latency scheduling heuristic",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.dit)] = .{
.index = @enumToInt(Feature.dit),
.name = @tagName(Feature.dit),
.llvm_name = "dit",
.description = "Enable v8.4-A Data Independent Timing instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.dotprod)] = .{
.index = @enumToInt(Feature.dotprod),
.name = @tagName(Feature.dotprod),
.llvm_name = "dotprod",
.description = "Enable dot product support",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.exynos_cheap_as_move)] = .{
.index = @enumToInt(Feature.exynos_cheap_as_move),
@ -626,21 +626,21 @@ pub const all_features = blk: {
.name = @tagName(Feature.fmi),
.llvm_name = "fmi",
.description = "Enable v8.4-A Flag Manipulation Instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.force_32bit_jump_tables)] = .{
.index = @enumToInt(Feature.force_32bit_jump_tables),
.name = @tagName(Feature.force_32bit_jump_tables),
.llvm_name = "force-32bit-jump-tables",
.description = "Force jump table entries to be 32-bits wide except at MinSize",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fp_armv8)] = .{
.index = @enumToInt(Feature.fp_armv8),
.name = @tagName(Feature.fp_armv8),
.llvm_name = "fp-armv8",
.description = "Enable ARMv8 FP",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fp16fml)] = .{
.index = @enumToInt(Feature.fp16fml),
@ -656,7 +656,7 @@ pub const all_features = blk: {
.name = @tagName(Feature.fptoint),
.llvm_name = "fptoint",
.description = "Enable FRInt[32|64][Z|X] instructions that round a floating-point number to an integer (in FP format) forcing it to fit into a 32- or 64-bit int",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fullfp16)] = .{
.index = @enumToInt(Feature.fullfp16),
@ -672,42 +672,42 @@ pub const all_features = blk: {
.name = @tagName(Feature.fuse_address),
.llvm_name = "fuse-address",
.description = "CPU fuses address generation and memory operations",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fuse_aes)] = .{
.index = @enumToInt(Feature.fuse_aes),
.name = @tagName(Feature.fuse_aes),
.llvm_name = "fuse-aes",
.description = "CPU fuses AES crypto operations",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fuse_arith_logic)] = .{
.index = @enumToInt(Feature.fuse_arith_logic),
.name = @tagName(Feature.fuse_arith_logic),
.llvm_name = "fuse-arith-logic",
.description = "CPU fuses arithmetic and logic operations",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fuse_crypto_eor)] = .{
.index = @enumToInt(Feature.fuse_crypto_eor),
.name = @tagName(Feature.fuse_crypto_eor),
.llvm_name = "fuse-crypto-eor",
.description = "CPU fuses AES/PMULL and EOR operations",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fuse_csel)] = .{
.index = @enumToInt(Feature.fuse_csel),
.name = @tagName(Feature.fuse_csel),
.llvm_name = "fuse-csel",
.description = "CPU fuses conditional select operations",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fuse_literals)] = .{
.index = @enumToInt(Feature.fuse_literals),
.name = @tagName(Feature.fuse_literals),
.llvm_name = "fuse-literals",
.description = "CPU fuses literal generation operations",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.jsconv)] = .{
.index = @enumToInt(Feature.jsconv),
@ -741,35 +741,35 @@ pub const all_features = blk: {
.name = @tagName(Feature.lor),
.llvm_name = "lor",
.description = "Enables ARM v8.1 Limited Ordering Regions extension",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.lse)] = .{
.index = @enumToInt(Feature.lse),
.name = @tagName(Feature.lse),
.llvm_name = "lse",
.description = "Enable ARMv8.1 Large System Extension (LSE) atomic instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.lsl_fast)] = .{
.index = @enumToInt(Feature.lsl_fast),
.name = @tagName(Feature.lsl_fast),
.llvm_name = "lsl-fast",
.description = "CPU has a fastpath logical shift of up to 3 places",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.mpam)] = .{
.index = @enumToInt(Feature.mpam),
.name = @tagName(Feature.mpam),
.llvm_name = "mpam",
.description = "Enable v8.4-A Memory system Partitioning and Monitoring extension",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.mte)] = .{
.index = @enumToInt(Feature.mte),
.name = @tagName(Feature.mte),
.llvm_name = "mte",
.description = "Enable Memory Tagging Extension",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.neon)] = .{
.index = @enumToInt(Feature.neon),
@ -785,28 +785,28 @@ pub const all_features = blk: {
.name = @tagName(Feature.no_neg_immediates),
.llvm_name = "no-neg-immediates",
.description = "Convert immediates and instructions to their negated or complemented equivalent when the immediate does not fit in the encoding.",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.nv)] = .{
.index = @enumToInt(Feature.nv),
.name = @tagName(Feature.nv),
.llvm_name = "nv",
.description = "Enable v8.4-A Nested Virtualization Enchancement",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.pa)] = .{
.index = @enumToInt(Feature.pa),
.name = @tagName(Feature.pa),
.llvm_name = "pa",
.description = "Enable v8.3-A Pointer Authentication enchancement",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.pan)] = .{
.index = @enumToInt(Feature.pan),
.name = @tagName(Feature.pan),
.llvm_name = "pan",
.description = "Enables ARM v8.1 Privileged Access-Never extension",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.pan_rwv)] = .{
.index = @enumToInt(Feature.pan_rwv),
@ -822,35 +822,35 @@ pub const all_features = blk: {
.name = @tagName(Feature.perfmon),
.llvm_name = "perfmon",
.description = "Enable ARMv8 PMUv3 Performance Monitors extension",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.predictable_select_expensive)] = .{
.index = @enumToInt(Feature.predictable_select_expensive),
.name = @tagName(Feature.predictable_select_expensive),
.llvm_name = "predictable-select-expensive",
.description = "Prefer likely predicted branches over selects",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.predres)] = .{
.index = @enumToInt(Feature.predres),
.name = @tagName(Feature.predres),
.llvm_name = "predres",
.description = "Enable v8.5a execution and data prediction invalidation instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.rand)] = .{
.index = @enumToInt(Feature.rand),
.name = @tagName(Feature.rand),
.llvm_name = "rand",
.description = "Enable Random Number generation instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ras)] = .{
.index = @enumToInt(Feature.ras),
.name = @tagName(Feature.ras),
.llvm_name = "ras",
.description = "Enable ARMv8 Reliability, Availability and Serviceability Extensions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.rasv8_4)] = .{
.index = @enumToInt(Feature.rasv8_4),
@ -866,7 +866,7 @@ pub const all_features = blk: {
.name = @tagName(Feature.rcpc),
.llvm_name = "rcpc",
.description = "Enable support for RCPC extension",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.rcpc_immo)] = .{
.index = @enumToInt(Feature.rcpc_immo),
@ -882,175 +882,175 @@ pub const all_features = blk: {
.name = @tagName(Feature.rdm),
.llvm_name = "rdm",
.description = "Enable ARMv8.1 Rounding Double Multiply Add/Subtract instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.reserve_x1)] = .{
.index = @enumToInt(Feature.reserve_x1),
.name = @tagName(Feature.reserve_x1),
.llvm_name = "reserve-x1",
.description = "Reserve X1, making it unavailable as a GPR",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.reserve_x10)] = .{
.index = @enumToInt(Feature.reserve_x10),
.name = @tagName(Feature.reserve_x10),
.llvm_name = "reserve-x10",
.description = "Reserve X10, making it unavailable as a GPR",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.reserve_x11)] = .{
.index = @enumToInt(Feature.reserve_x11),
.name = @tagName(Feature.reserve_x11),
.llvm_name = "reserve-x11",
.description = "Reserve X11, making it unavailable as a GPR",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.reserve_x12)] = .{
.index = @enumToInt(Feature.reserve_x12),
.name = @tagName(Feature.reserve_x12),
.llvm_name = "reserve-x12",
.description = "Reserve X12, making it unavailable as a GPR",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.reserve_x13)] = .{
.index = @enumToInt(Feature.reserve_x13),
.name = @tagName(Feature.reserve_x13),
.llvm_name = "reserve-x13",
.description = "Reserve X13, making it unavailable as a GPR",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.reserve_x14)] = .{
.index = @enumToInt(Feature.reserve_x14),
.name = @tagName(Feature.reserve_x14),
.llvm_name = "reserve-x14",
.description = "Reserve X14, making it unavailable as a GPR",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.reserve_x15)] = .{
.index = @enumToInt(Feature.reserve_x15),
.name = @tagName(Feature.reserve_x15),
.llvm_name = "reserve-x15",
.description = "Reserve X15, making it unavailable as a GPR",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.reserve_x18)] = .{
.index = @enumToInt(Feature.reserve_x18),
.name = @tagName(Feature.reserve_x18),
.llvm_name = "reserve-x18",
.description = "Reserve X18, making it unavailable as a GPR",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.reserve_x2)] = .{
.index = @enumToInt(Feature.reserve_x2),
.name = @tagName(Feature.reserve_x2),
.llvm_name = "reserve-x2",
.description = "Reserve X2, making it unavailable as a GPR",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.reserve_x20)] = .{
.index = @enumToInt(Feature.reserve_x20),
.name = @tagName(Feature.reserve_x20),
.llvm_name = "reserve-x20",
.description = "Reserve X20, making it unavailable as a GPR",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.reserve_x21)] = .{
.index = @enumToInt(Feature.reserve_x21),
.name = @tagName(Feature.reserve_x21),
.llvm_name = "reserve-x21",
.description = "Reserve X21, making it unavailable as a GPR",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.reserve_x22)] = .{
.index = @enumToInt(Feature.reserve_x22),
.name = @tagName(Feature.reserve_x22),
.llvm_name = "reserve-x22",
.description = "Reserve X22, making it unavailable as a GPR",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.reserve_x23)] = .{
.index = @enumToInt(Feature.reserve_x23),
.name = @tagName(Feature.reserve_x23),
.llvm_name = "reserve-x23",
.description = "Reserve X23, making it unavailable as a GPR",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.reserve_x24)] = .{
.index = @enumToInt(Feature.reserve_x24),
.name = @tagName(Feature.reserve_x24),
.llvm_name = "reserve-x24",
.description = "Reserve X24, making it unavailable as a GPR",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.reserve_x25)] = .{
.index = @enumToInt(Feature.reserve_x25),
.name = @tagName(Feature.reserve_x25),
.llvm_name = "reserve-x25",
.description = "Reserve X25, making it unavailable as a GPR",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.reserve_x26)] = .{
.index = @enumToInt(Feature.reserve_x26),
.name = @tagName(Feature.reserve_x26),
.llvm_name = "reserve-x26",
.description = "Reserve X26, making it unavailable as a GPR",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.reserve_x27)] = .{
.index = @enumToInt(Feature.reserve_x27),
.name = @tagName(Feature.reserve_x27),
.llvm_name = "reserve-x27",
.description = "Reserve X27, making it unavailable as a GPR",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.reserve_x28)] = .{
.index = @enumToInt(Feature.reserve_x28),
.name = @tagName(Feature.reserve_x28),
.llvm_name = "reserve-x28",
.description = "Reserve X28, making it unavailable as a GPR",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.reserve_x3)] = .{
.index = @enumToInt(Feature.reserve_x3),
.name = @tagName(Feature.reserve_x3),
.llvm_name = "reserve-x3",
.description = "Reserve X3, making it unavailable as a GPR",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.reserve_x4)] = .{
.index = @enumToInt(Feature.reserve_x4),
.name = @tagName(Feature.reserve_x4),
.llvm_name = "reserve-x4",
.description = "Reserve X4, making it unavailable as a GPR",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.reserve_x5)] = .{
.index = @enumToInt(Feature.reserve_x5),
.name = @tagName(Feature.reserve_x5),
.llvm_name = "reserve-x5",
.description = "Reserve X5, making it unavailable as a GPR",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.reserve_x6)] = .{
.index = @enumToInt(Feature.reserve_x6),
.name = @tagName(Feature.reserve_x6),
.llvm_name = "reserve-x6",
.description = "Reserve X6, making it unavailable as a GPR",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.reserve_x7)] = .{
.index = @enumToInt(Feature.reserve_x7),
.name = @tagName(Feature.reserve_x7),
.llvm_name = "reserve-x7",
.description = "Reserve X7, making it unavailable as a GPR",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.reserve_x9)] = .{
.index = @enumToInt(Feature.reserve_x9),
.name = @tagName(Feature.reserve_x9),
.llvm_name = "reserve-x9",
.description = "Reserve X9, making it unavailable as a GPR",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.saphira)] = .{
.index = @enumToInt(Feature.saphira),
@ -1076,14 +1076,14 @@ pub const all_features = blk: {
.name = @tagName(Feature.sb),
.llvm_name = "sb",
.description = "Enable v8.5 Speculation Barrier",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sel2)] = .{
.index = @enumToInt(Feature.sel2),
.name = @tagName(Feature.sel2),
.llvm_name = "sel2",
.description = "Enable v8.4-A Secure Exception Level 2 extension",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sha2)] = .{
.index = @enumToInt(Feature.sha2),
@ -1109,21 +1109,21 @@ pub const all_features = blk: {
.name = @tagName(Feature.slow_misaligned_128store),
.llvm_name = "slow-misaligned-128store",
.description = "Misaligned 128 bit stores are slow",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.slow_paired_128)] = .{
.index = @enumToInt(Feature.slow_paired_128),
.name = @tagName(Feature.slow_paired_128),
.llvm_name = "slow-paired-128",
.description = "Paired 128 bit loads and stores are slow",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.slow_strqro_store)] = .{
.index = @enumToInt(Feature.slow_strqro_store),
.name = @tagName(Feature.slow_strqro_store),
.llvm_name = "slow-strqro-store",
.description = "STR of Q register with register offset is slow",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sm4)] = .{
.index = @enumToInt(Feature.sm4),
@ -1139,35 +1139,35 @@ pub const all_features = blk: {
.name = @tagName(Feature.spe),
.llvm_name = "spe",
.description = "Enable Statistical Profiling extension",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.specrestrict)] = .{
.index = @enumToInt(Feature.specrestrict),
.name = @tagName(Feature.specrestrict),
.llvm_name = "specrestrict",
.description = "Enable architectural speculation restriction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ssbs)] = .{
.index = @enumToInt(Feature.ssbs),
.name = @tagName(Feature.ssbs),
.llvm_name = "ssbs",
.description = "Enable Speculative Store Bypass Safe bit",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.strict_align)] = .{
.index = @enumToInt(Feature.strict_align),
.name = @tagName(Feature.strict_align),
.llvm_name = "strict-align",
.description = "Disallow all unaligned memory access",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sve)] = .{
.index = @enumToInt(Feature.sve),
.name = @tagName(Feature.sve),
.llvm_name = "sve",
.description = "Enable Scalable Vector Extension (SVE) instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sve2)] = .{
.index = @enumToInt(Feature.sve2),
@ -1300,35 +1300,35 @@ pub const all_features = blk: {
.name = @tagName(Feature.tlb_rmi),
.llvm_name = "tlb-rmi",
.description = "Enable v8.4-A TLB Range and Maintenance Instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.tpidr_el1)] = .{
.index = @enumToInt(Feature.tpidr_el1),
.name = @tagName(Feature.tpidr_el1),
.llvm_name = "tpidr-el1",
.description = "Permit use of TPIDR_EL1 for the TLS base",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.tpidr_el2)] = .{
.index = @enumToInt(Feature.tpidr_el2),
.name = @tagName(Feature.tpidr_el2),
.llvm_name = "tpidr-el2",
.description = "Permit use of TPIDR_EL2 for the TLS base",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.tpidr_el3)] = .{
.index = @enumToInt(Feature.tpidr_el3),
.name = @tagName(Feature.tpidr_el3),
.llvm_name = "tpidr-el3",
.description = "Permit use of TPIDR_EL3 for the TLS base",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.tracev8_4)] = .{
.index = @enumToInt(Feature.tracev8_4),
.name = @tagName(Feature.tracev8_4),
.llvm_name = "tracev8.4",
.description = "Enable v8.4-A Trace extension",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.tsv110)] = .{
.index = @enumToInt(Feature.tsv110),
@ -1355,28 +1355,28 @@ pub const all_features = blk: {
.name = @tagName(Feature.uaops),
.llvm_name = "uaops",
.description = "Enable v8.2 UAO PState",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.use_aa)] = .{
.index = @enumToInt(Feature.use_aa),
.name = @tagName(Feature.use_aa),
.llvm_name = "use-aa",
.description = "Use alias analysis during codegen",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.use_postra_scheduler)] = .{
.index = @enumToInt(Feature.use_postra_scheduler),
.name = @tagName(Feature.use_postra_scheduler),
.llvm_name = "use-postra-scheduler",
.description = "Schedule again after register allocation",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.use_reciprocal_square_root)] = .{
.index = @enumToInt(Feature.use_reciprocal_square_root),
.name = @tagName(Feature.use_reciprocal_square_root),
.llvm_name = "use-reciprocal-square-root",
.description = "Use the reciprocal square root approximation",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.v8_1a)] = .{
.index = @enumToInt(Feature.v8_1a),
@ -1461,14 +1461,14 @@ pub const all_features = blk: {
.name = @tagName(Feature.vh),
.llvm_name = "vh",
.description = "Enables ARM v8.1 Virtual Host extension",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.zcm)] = .{
.index = @enumToInt(Feature.zcm),
.name = @tagName(Feature.zcm),
.llvm_name = "zcm",
.description = "Has zero-cycle register moves",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.zcz)] = .{
.index = @enumToInt(Feature.zcz),
@ -1485,21 +1485,21 @@ pub const all_features = blk: {
.name = @tagName(Feature.zcz_fp),
.llvm_name = "zcz-fp",
.description = "Has zero-cycle zeroing instructions for FP registers",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.zcz_fp_workaround)] = .{
.index = @enumToInt(Feature.zcz_fp_workaround),
.name = @tagName(Feature.zcz_fp_workaround),
.llvm_name = "zcz-fp-workaround",
.description = "The zero-cycle floating-point zeroing instruction has a bug",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.zcz_gp)] = .{
.index = @enumToInt(Feature.zcz_gp),
.name = @tagName(Feature.zcz_gp),
.llvm_name = "zcz-gp",
.description = "Has zero-cycle zeroing instructions for generic registers",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
break :blk result;
};

View File

@ -115,224 +115,224 @@ pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= @typeInfo(Cpu.Feature.Set).Int.bits);
std.debug.assert(len <= Cpu.Feature.Set.bit_count);
var result: [len]Cpu.Feature = undefined;
result[@enumToInt(Feature.@"16_bit_insts")] = .{
.index = @enumToInt(Feature.@"16_bit_insts"),
.name = @tagName(Feature.@"16_bit_insts"),
.llvm_name = "16-bit-insts",
.description = "Has i16/f16 instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.DumpCode)] = .{
.index = @enumToInt(Feature.DumpCode),
.name = @tagName(Feature.DumpCode),
.llvm_name = "DumpCode",
.description = "Dump MachineInstrs in the CodeEmitter",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.add_no_carry_insts)] = .{
.index = @enumToInt(Feature.add_no_carry_insts),
.name = @tagName(Feature.add_no_carry_insts),
.llvm_name = "add-no-carry-insts",
.description = "Have VALU add/sub instructions without carry out",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.aperture_regs)] = .{
.index = @enumToInt(Feature.aperture_regs),
.name = @tagName(Feature.aperture_regs),
.llvm_name = "aperture-regs",
.description = "Has Memory Aperture Base and Size Registers",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.atomic_fadd_insts)] = .{
.index = @enumToInt(Feature.atomic_fadd_insts),
.name = @tagName(Feature.atomic_fadd_insts),
.llvm_name = "atomic-fadd-insts",
.description = "Has buffer_atomic_add_f32, buffer_atomic_pk_add_f16, global_atomic_add_f32, global_atomic_pk_add_f16 instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.auto_waitcnt_before_barrier)] = .{
.index = @enumToInt(Feature.auto_waitcnt_before_barrier),
.name = @tagName(Feature.auto_waitcnt_before_barrier),
.llvm_name = "auto-waitcnt-before-barrier",
.description = "Hardware automatically inserts waitcnt before barrier",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ci_insts)] = .{
.index = @enumToInt(Feature.ci_insts),
.name = @tagName(Feature.ci_insts),
.llvm_name = "ci-insts",
.description = "Additional instructions for CI+",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.code_object_v3)] = .{
.index = @enumToInt(Feature.code_object_v3),
.name = @tagName(Feature.code_object_v3),
.llvm_name = "code-object-v3",
.description = "Generate code object version 3",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.cumode)] = .{
.index = @enumToInt(Feature.cumode),
.name = @tagName(Feature.cumode),
.llvm_name = "cumode",
.description = "Enable CU wavefront execution mode",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.dl_insts)] = .{
.index = @enumToInt(Feature.dl_insts),
.name = @tagName(Feature.dl_insts),
.llvm_name = "dl-insts",
.description = "Has v_fmac_f32 and v_xnor_b32 instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.dot1_insts)] = .{
.index = @enumToInt(Feature.dot1_insts),
.name = @tagName(Feature.dot1_insts),
.llvm_name = "dot1-insts",
.description = "Has v_dot4_i32_i8 and v_dot8_i32_i4 instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.dot2_insts)] = .{
.index = @enumToInt(Feature.dot2_insts),
.name = @tagName(Feature.dot2_insts),
.llvm_name = "dot2-insts",
.description = "Has v_dot2_f32_f16, v_dot2_i32_i16, v_dot2_u32_u16, v_dot4_u32_u8, v_dot8_u32_u4 instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.dot3_insts)] = .{
.index = @enumToInt(Feature.dot3_insts),
.name = @tagName(Feature.dot3_insts),
.llvm_name = "dot3-insts",
.description = "Has v_dot8c_i32_i4 instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.dot4_insts)] = .{
.index = @enumToInt(Feature.dot4_insts),
.name = @tagName(Feature.dot4_insts),
.llvm_name = "dot4-insts",
.description = "Has v_dot2c_i32_i16 instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.dot5_insts)] = .{
.index = @enumToInt(Feature.dot5_insts),
.name = @tagName(Feature.dot5_insts),
.llvm_name = "dot5-insts",
.description = "Has v_dot2c_f32_f16 instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.dot6_insts)] = .{
.index = @enumToInt(Feature.dot6_insts),
.name = @tagName(Feature.dot6_insts),
.llvm_name = "dot6-insts",
.description = "Has v_dot4c_i32_i8 instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.dpp)] = .{
.index = @enumToInt(Feature.dpp),
.name = @tagName(Feature.dpp),
.llvm_name = "dpp",
.description = "Support DPP (Data Parallel Primitives) extension",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.dpp8)] = .{
.index = @enumToInt(Feature.dpp8),
.name = @tagName(Feature.dpp8),
.llvm_name = "dpp8",
.description = "Support DPP8 (Data Parallel Primitives) extension",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.dumpcode)] = .{
.index = @enumToInt(Feature.dumpcode),
.name = @tagName(Feature.dumpcode),
.llvm_name = "dumpcode",
.description = "Dump MachineInstrs in the CodeEmitter",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.enable_ds128)] = .{
.index = @enumToInt(Feature.enable_ds128),
.name = @tagName(Feature.enable_ds128),
.llvm_name = "enable-ds128",
.description = "Use ds_read|write_b128",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.enable_prt_strict_null)] = .{
.index = @enumToInt(Feature.enable_prt_strict_null),
.name = @tagName(Feature.enable_prt_strict_null),
.llvm_name = "enable-prt-strict-null",
.description = "Enable zeroing of result registers for sparse texture fetches",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fast_fmaf)] = .{
.index = @enumToInt(Feature.fast_fmaf),
.name = @tagName(Feature.fast_fmaf),
.llvm_name = "fast-fmaf",
.description = "Assuming f32 fma is at least as fast as mul + add",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.flat_address_space)] = .{
.index = @enumToInt(Feature.flat_address_space),
.name = @tagName(Feature.flat_address_space),
.llvm_name = "flat-address-space",
.description = "Support flat address space",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.flat_for_global)] = .{
.index = @enumToInt(Feature.flat_for_global),
.name = @tagName(Feature.flat_for_global),
.llvm_name = "flat-for-global",
.description = "Force to generate flat instruction for global",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.flat_global_insts)] = .{
.index = @enumToInt(Feature.flat_global_insts),
.name = @tagName(Feature.flat_global_insts),
.llvm_name = "flat-global-insts",
.description = "Have global_* flat memory instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.flat_inst_offsets)] = .{
.index = @enumToInt(Feature.flat_inst_offsets),
.name = @tagName(Feature.flat_inst_offsets),
.llvm_name = "flat-inst-offsets",
.description = "Flat instructions have immediate offset addressing mode",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.flat_scratch_insts)] = .{
.index = @enumToInt(Feature.flat_scratch_insts),
.name = @tagName(Feature.flat_scratch_insts),
.llvm_name = "flat-scratch-insts",
.description = "Have scratch_* flat memory instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.flat_segment_offset_bug)] = .{
.index = @enumToInt(Feature.flat_segment_offset_bug),
.name = @tagName(Feature.flat_segment_offset_bug),
.llvm_name = "flat-segment-offset-bug",
.description = "GFX10 bug, inst_offset ignored in flat segment",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fma_mix_insts)] = .{
.index = @enumToInt(Feature.fma_mix_insts),
.name = @tagName(Feature.fma_mix_insts),
.llvm_name = "fma-mix-insts",
.description = "Has v_fma_mix_f32, v_fma_mixlo_f16, v_fma_mixhi_f16 instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fmaf)] = .{
.index = @enumToInt(Feature.fmaf),
.name = @tagName(Feature.fmaf),
.llvm_name = "fmaf",
.description = "Enable single precision FMA (not as fast as mul+add, but fused)",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fp_exceptions)] = .{
.index = @enumToInt(Feature.fp_exceptions),
.name = @tagName(Feature.fp_exceptions),
.llvm_name = "fp-exceptions",
.description = "Enable floating point exceptions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fp16_denormals)] = .{
.index = @enumToInt(Feature.fp16_denormals),
@ -348,14 +348,14 @@ pub const all_features = blk: {
.name = @tagName(Feature.fp32_denormals),
.llvm_name = "fp32-denormals",
.description = "Enable single precision denormal handling",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fp64)] = .{
.index = @enumToInt(Feature.fp64),
.name = @tagName(Feature.fp64),
.llvm_name = "fp64",
.description = "Enable double precision operations",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fp64_denormals)] = .{
.index = @enumToInt(Feature.fp64_denormals),
@ -381,7 +381,7 @@ pub const all_features = blk: {
.name = @tagName(Feature.gcn3_encoding),
.llvm_name = "gcn3-encoding",
.description = "Encoding format for VI",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.gfx10)] = .{
.index = @enumToInt(Feature.gfx10),
@ -430,21 +430,21 @@ pub const all_features = blk: {
.name = @tagName(Feature.gfx10_insts),
.llvm_name = "gfx10-insts",
.description = "Additional instructions for GFX10+",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.gfx7_gfx8_gfx9_insts)] = .{
.index = @enumToInt(Feature.gfx7_gfx8_gfx9_insts),
.name = @tagName(Feature.gfx7_gfx8_gfx9_insts),
.llvm_name = "gfx7-gfx8-gfx9-insts",
.description = "Instructions shared in GFX7, GFX8, GFX9",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.gfx8_insts)] = .{
.index = @enumToInt(Feature.gfx8_insts),
.name = @tagName(Feature.gfx8_insts),
.llvm_name = "gfx8-insts",
.description = "Additional instructions for GFX8+",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.gfx9)] = .{
.index = @enumToInt(Feature.gfx9),
@ -489,287 +489,287 @@ pub const all_features = blk: {
.name = @tagName(Feature.gfx9_insts),
.llvm_name = "gfx9-insts",
.description = "Additional instructions for GFX9+",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.half_rate_64_ops)] = .{
.index = @enumToInt(Feature.half_rate_64_ops),
.name = @tagName(Feature.half_rate_64_ops),
.llvm_name = "half-rate-64-ops",
.description = "Most fp64 instructions are half rate instead of quarter",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.inst_fwd_prefetch_bug)] = .{
.index = @enumToInt(Feature.inst_fwd_prefetch_bug),
.name = @tagName(Feature.inst_fwd_prefetch_bug),
.llvm_name = "inst-fwd-prefetch-bug",
.description = "S_INST_PREFETCH instruction causes shader to hang",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.int_clamp_insts)] = .{
.index = @enumToInt(Feature.int_clamp_insts),
.name = @tagName(Feature.int_clamp_insts),
.llvm_name = "int-clamp-insts",
.description = "Support clamp for integer destination",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.inv_2pi_inline_imm)] = .{
.index = @enumToInt(Feature.inv_2pi_inline_imm),
.name = @tagName(Feature.inv_2pi_inline_imm),
.llvm_name = "inv-2pi-inline-imm",
.description = "Has 1 / (2 * pi) as inline immediate",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.lds_branch_vmem_war_hazard)] = .{
.index = @enumToInt(Feature.lds_branch_vmem_war_hazard),
.name = @tagName(Feature.lds_branch_vmem_war_hazard),
.llvm_name = "lds-branch-vmem-war-hazard",
.description = "Switching between LDS and VMEM-tex not waiting VM_VSRC=0",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.lds_misaligned_bug)] = .{
.index = @enumToInt(Feature.lds_misaligned_bug),
.name = @tagName(Feature.lds_misaligned_bug),
.llvm_name = "lds-misaligned-bug",
.description = "Some GFX10 bug with misaligned multi-dword LDS access in WGP mode",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ldsbankcount16)] = .{
.index = @enumToInt(Feature.ldsbankcount16),
.name = @tagName(Feature.ldsbankcount16),
.llvm_name = "ldsbankcount16",
.description = "The number of LDS banks per compute unit.",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ldsbankcount32)] = .{
.index = @enumToInt(Feature.ldsbankcount32),
.name = @tagName(Feature.ldsbankcount32),
.llvm_name = "ldsbankcount32",
.description = "The number of LDS banks per compute unit.",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.load_store_opt)] = .{
.index = @enumToInt(Feature.load_store_opt),
.name = @tagName(Feature.load_store_opt),
.llvm_name = "load-store-opt",
.description = "Enable SI load/store optimizer pass",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.localmemorysize0)] = .{
.index = @enumToInt(Feature.localmemorysize0),
.name = @tagName(Feature.localmemorysize0),
.llvm_name = "localmemorysize0",
.description = "The size of local memory in bytes",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.localmemorysize32768)] = .{
.index = @enumToInt(Feature.localmemorysize32768),
.name = @tagName(Feature.localmemorysize32768),
.llvm_name = "localmemorysize32768",
.description = "The size of local memory in bytes",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.localmemorysize65536)] = .{
.index = @enumToInt(Feature.localmemorysize65536),
.name = @tagName(Feature.localmemorysize65536),
.llvm_name = "localmemorysize65536",
.description = "The size of local memory in bytes",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.mad_mix_insts)] = .{
.index = @enumToInt(Feature.mad_mix_insts),
.name = @tagName(Feature.mad_mix_insts),
.llvm_name = "mad-mix-insts",
.description = "Has v_mad_mix_f32, v_mad_mixlo_f16, v_mad_mixhi_f16 instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.mai_insts)] = .{
.index = @enumToInt(Feature.mai_insts),
.name = @tagName(Feature.mai_insts),
.llvm_name = "mai-insts",
.description = "Has mAI instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.max_private_element_size_16)] = .{
.index = @enumToInt(Feature.max_private_element_size_16),
.name = @tagName(Feature.max_private_element_size_16),
.llvm_name = "max-private-element-size-16",
.description = "Maximum private access size may be 16",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.max_private_element_size_4)] = .{
.index = @enumToInt(Feature.max_private_element_size_4),
.name = @tagName(Feature.max_private_element_size_4),
.llvm_name = "max-private-element-size-4",
.description = "Maximum private access size may be 4",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.max_private_element_size_8)] = .{
.index = @enumToInt(Feature.max_private_element_size_8),
.name = @tagName(Feature.max_private_element_size_8),
.llvm_name = "max-private-element-size-8",
.description = "Maximum private access size may be 8",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.mimg_r128)] = .{
.index = @enumToInt(Feature.mimg_r128),
.name = @tagName(Feature.mimg_r128),
.llvm_name = "mimg-r128",
.description = "Support 128-bit texture resources",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.movrel)] = .{
.index = @enumToInt(Feature.movrel),
.name = @tagName(Feature.movrel),
.llvm_name = "movrel",
.description = "Has v_movrel*_b32 instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.no_data_dep_hazard)] = .{
.index = @enumToInt(Feature.no_data_dep_hazard),
.name = @tagName(Feature.no_data_dep_hazard),
.llvm_name = "no-data-dep-hazard",
.description = "Does not need SW waitstates",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.no_sdst_cmpx)] = .{
.index = @enumToInt(Feature.no_sdst_cmpx),
.name = @tagName(Feature.no_sdst_cmpx),
.llvm_name = "no-sdst-cmpx",
.description = "V_CMPX does not write VCC/SGPR in addition to EXEC",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.no_sram_ecc_support)] = .{
.index = @enumToInt(Feature.no_sram_ecc_support),
.name = @tagName(Feature.no_sram_ecc_support),
.llvm_name = "no-sram-ecc-support",
.description = "Hardware does not support SRAM ECC",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.no_xnack_support)] = .{
.index = @enumToInt(Feature.no_xnack_support),
.name = @tagName(Feature.no_xnack_support),
.llvm_name = "no-xnack-support",
.description = "Hardware does not support XNACK",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.nsa_encoding)] = .{
.index = @enumToInt(Feature.nsa_encoding),
.name = @tagName(Feature.nsa_encoding),
.llvm_name = "nsa-encoding",
.description = "Support NSA encoding for image instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.nsa_to_vmem_bug)] = .{
.index = @enumToInt(Feature.nsa_to_vmem_bug),
.name = @tagName(Feature.nsa_to_vmem_bug),
.llvm_name = "nsa-to-vmem-bug",
.description = "MIMG-NSA followed by VMEM fail if EXEC_LO or EXEC_HI equals zero",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.offset_3f_bug)] = .{
.index = @enumToInt(Feature.offset_3f_bug),
.name = @tagName(Feature.offset_3f_bug),
.llvm_name = "offset-3f-bug",
.description = "Branch offset of 3f hardware bug",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.pk_fmac_f16_inst)] = .{
.index = @enumToInt(Feature.pk_fmac_f16_inst),
.name = @tagName(Feature.pk_fmac_f16_inst),
.llvm_name = "pk-fmac-f16-inst",
.description = "Has v_pk_fmac_f16 instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.promote_alloca)] = .{
.index = @enumToInt(Feature.promote_alloca),
.name = @tagName(Feature.promote_alloca),
.llvm_name = "promote-alloca",
.description = "Enable promote alloca pass",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.r128_a16)] = .{
.index = @enumToInt(Feature.r128_a16),
.name = @tagName(Feature.r128_a16),
.llvm_name = "r128-a16",
.description = "Support 16 bit coordindates/gradients/lod/clamp/mip types on gfx9",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.register_banking)] = .{
.index = @enumToInt(Feature.register_banking),
.name = @tagName(Feature.register_banking),
.llvm_name = "register-banking",
.description = "Has register banking",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.s_memrealtime)] = .{
.index = @enumToInt(Feature.s_memrealtime),
.name = @tagName(Feature.s_memrealtime),
.llvm_name = "s-memrealtime",
.description = "Has s_memrealtime instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.scalar_atomics)] = .{
.index = @enumToInt(Feature.scalar_atomics),
.name = @tagName(Feature.scalar_atomics),
.llvm_name = "scalar-atomics",
.description = "Has atomic scalar memory instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.scalar_flat_scratch_insts)] = .{
.index = @enumToInt(Feature.scalar_flat_scratch_insts),
.name = @tagName(Feature.scalar_flat_scratch_insts),
.llvm_name = "scalar-flat-scratch-insts",
.description = "Have s_scratch_* flat memory instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.scalar_stores)] = .{
.index = @enumToInt(Feature.scalar_stores),
.name = @tagName(Feature.scalar_stores),
.llvm_name = "scalar-stores",
.description = "Has store scalar memory instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sdwa)] = .{
.index = @enumToInt(Feature.sdwa),
.name = @tagName(Feature.sdwa),
.llvm_name = "sdwa",
.description = "Support SDWA (Sub-DWORD Addressing) extension",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sdwa_mav)] = .{
.index = @enumToInt(Feature.sdwa_mav),
.name = @tagName(Feature.sdwa_mav),
.llvm_name = "sdwa-mav",
.description = "Support v_mac_f32/f16 with SDWA (Sub-DWORD Addressing) extension",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sdwa_omod)] = .{
.index = @enumToInt(Feature.sdwa_omod),
.name = @tagName(Feature.sdwa_omod),
.llvm_name = "sdwa-omod",
.description = "Support OMod with SDWA (Sub-DWORD Addressing) extension",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sdwa_out_mods_vopc)] = .{
.index = @enumToInt(Feature.sdwa_out_mods_vopc),
.name = @tagName(Feature.sdwa_out_mods_vopc),
.llvm_name = "sdwa-out-mods-vopc",
.description = "Support clamp for VOPC with SDWA (Sub-DWORD Addressing) extension",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sdwa_scalar)] = .{
.index = @enumToInt(Feature.sdwa_scalar),
.name = @tagName(Feature.sdwa_scalar),
.llvm_name = "sdwa-scalar",
.description = "Support scalar register with SDWA (Sub-DWORD Addressing) extension",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sdwa_sdst)] = .{
.index = @enumToInt(Feature.sdwa_sdst),
.name = @tagName(Feature.sdwa_sdst),
.llvm_name = "sdwa-sdst",
.description = "Support scalar dst for VOPC with SDWA (Sub-DWORD Addressing) extension",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sea_islands)] = .{
.index = @enumToInt(Feature.sea_islands),
@ -794,21 +794,21 @@ pub const all_features = blk: {
.name = @tagName(Feature.sgpr_init_bug),
.llvm_name = "sgpr-init-bug",
.description = "VI SGPR initialization bug requiring a fixed SGPR allocation size",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.si_scheduler)] = .{
.index = @enumToInt(Feature.si_scheduler),
.name = @tagName(Feature.si_scheduler),
.llvm_name = "si-scheduler",
.description = "Enable SI Machine Scheduler",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.smem_to_vector_write_hazard)] = .{
.index = @enumToInt(Feature.smem_to_vector_write_hazard),
.name = @tagName(Feature.smem_to_vector_write_hazard),
.llvm_name = "smem-to-vector-write-hazard",
.description = "s_load_dword followed by v_cmp page faults",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.southern_islands)] = .{
.index = @enumToInt(Feature.southern_islands),
@ -832,77 +832,77 @@ pub const all_features = blk: {
.name = @tagName(Feature.sram_ecc),
.llvm_name = "sram-ecc",
.description = "Enable SRAM ECC",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.trap_handler)] = .{
.index = @enumToInt(Feature.trap_handler),
.name = @tagName(Feature.trap_handler),
.llvm_name = "trap-handler",
.description = "Trap handler support",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.trig_reduced_range)] = .{
.index = @enumToInt(Feature.trig_reduced_range),
.name = @tagName(Feature.trig_reduced_range),
.llvm_name = "trig-reduced-range",
.description = "Requires use of fract on arguments to trig instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.unaligned_buffer_access)] = .{
.index = @enumToInt(Feature.unaligned_buffer_access),
.name = @tagName(Feature.unaligned_buffer_access),
.llvm_name = "unaligned-buffer-access",
.description = "Support unaligned global loads and stores",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.unaligned_scratch_access)] = .{
.index = @enumToInt(Feature.unaligned_scratch_access),
.name = @tagName(Feature.unaligned_scratch_access),
.llvm_name = "unaligned-scratch-access",
.description = "Support unaligned scratch loads and stores",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.unpacked_d16_vmem)] = .{
.index = @enumToInt(Feature.unpacked_d16_vmem),
.name = @tagName(Feature.unpacked_d16_vmem),
.llvm_name = "unpacked-d16-vmem",
.description = "Has unpacked d16 vmem instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.unsafe_ds_offset_folding)] = .{
.index = @enumToInt(Feature.unsafe_ds_offset_folding),
.name = @tagName(Feature.unsafe_ds_offset_folding),
.llvm_name = "unsafe-ds-offset-folding",
.description = "Force using DS instruction immediate offsets on SI",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.vcmpx_exec_war_hazard)] = .{
.index = @enumToInt(Feature.vcmpx_exec_war_hazard),
.name = @tagName(Feature.vcmpx_exec_war_hazard),
.llvm_name = "vcmpx-exec-war-hazard",
.description = "V_CMPX WAR hazard on EXEC (V_CMPX issue ONLY)",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.vcmpx_permlane_hazard)] = .{
.index = @enumToInt(Feature.vcmpx_permlane_hazard),
.name = @tagName(Feature.vcmpx_permlane_hazard),
.llvm_name = "vcmpx-permlane-hazard",
.description = "TODO: describe me",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.vgpr_index_mode)] = .{
.index = @enumToInt(Feature.vgpr_index_mode),
.name = @tagName(Feature.vgpr_index_mode),
.llvm_name = "vgpr-index-mode",
.description = "Has VGPR mode register indexing",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.vmem_to_scalar_write_hazard)] = .{
.index = @enumToInt(Feature.vmem_to_scalar_write_hazard),
.name = @tagName(Feature.vmem_to_scalar_write_hazard),
.llvm_name = "vmem-to-scalar-write-hazard",
.description = "VMEM instruction followed by scalar writing to EXEC mask, M0 or SGPR leads to incorrect execution.",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.volcanic_islands)] = .{
.index = @enumToInt(Feature.volcanic_islands),
@ -939,49 +939,49 @@ pub const all_features = blk: {
.name = @tagName(Feature.vop3_literal),
.llvm_name = "vop3-literal",
.description = "Can use one literal in VOP3",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.vop3p)] = .{
.index = @enumToInt(Feature.vop3p),
.name = @tagName(Feature.vop3p),
.llvm_name = "vop3p",
.description = "Has VOP3P packed instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.vscnt)] = .{
.index = @enumToInt(Feature.vscnt),
.name = @tagName(Feature.vscnt),
.llvm_name = "vscnt",
.description = "Has separate store vscnt counter",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.wavefrontsize16)] = .{
.index = @enumToInt(Feature.wavefrontsize16),
.name = @tagName(Feature.wavefrontsize16),
.llvm_name = "wavefrontsize16",
.description = "The number of threads per wavefront",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.wavefrontsize32)] = .{
.index = @enumToInt(Feature.wavefrontsize32),
.name = @tagName(Feature.wavefrontsize32),
.llvm_name = "wavefrontsize32",
.description = "The number of threads per wavefront",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.wavefrontsize64)] = .{
.index = @enumToInt(Feature.wavefrontsize64),
.name = @tagName(Feature.wavefrontsize64),
.llvm_name = "wavefrontsize64",
.description = "The number of threads per wavefront",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.xnack)] = .{
.index = @enumToInt(Feature.xnack),
.name = @tagName(Feature.xnack),
.llvm_name = "xnack",
.description = "Enable XNACK support",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
break :blk result;
};

View File

@ -182,147 +182,147 @@ pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= @typeInfo(Cpu.Feature.Set).Int.bits);
std.debug.assert(len <= Cpu.Feature.Set.bit_count);
var result: [len]Cpu.Feature = undefined;
result[@enumToInt(Feature.@"32bit")] = .{
.index = @enumToInt(Feature.@"32bit"),
.name = @tagName(Feature.@"32bit"),
.llvm_name = "32bit",
.description = "Prefer 32-bit Thumb instrs",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.@"8msecext")] = .{
.index = @enumToInt(Feature.@"8msecext"),
.name = @tagName(Feature.@"8msecext"),
.llvm_name = "8msecext",
.description = "Enable support for ARMv8-M Security Extensions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.a12)] = .{
.index = @enumToInt(Feature.a12),
.name = @tagName(Feature.a12),
.llvm_name = "a12",
.description = "Cortex-A12 ARM processors",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.a15)] = .{
.index = @enumToInt(Feature.a15),
.name = @tagName(Feature.a15),
.llvm_name = "a15",
.description = "Cortex-A15 ARM processors",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.a17)] = .{
.index = @enumToInt(Feature.a17),
.name = @tagName(Feature.a17),
.llvm_name = "a17",
.description = "Cortex-A17 ARM processors",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.a32)] = .{
.index = @enumToInt(Feature.a32),
.name = @tagName(Feature.a32),
.llvm_name = "a32",
.description = "Cortex-A32 ARM processors",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.a35)] = .{
.index = @enumToInt(Feature.a35),
.name = @tagName(Feature.a35),
.llvm_name = "a35",
.description = "Cortex-A35 ARM processors",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.a5)] = .{
.index = @enumToInt(Feature.a5),
.name = @tagName(Feature.a5),
.llvm_name = "a5",
.description = "Cortex-A5 ARM processors",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.a53)] = .{
.index = @enumToInt(Feature.a53),
.name = @tagName(Feature.a53),
.llvm_name = "a53",
.description = "Cortex-A53 ARM processors",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.a55)] = .{
.index = @enumToInt(Feature.a55),
.name = @tagName(Feature.a55),
.llvm_name = "a55",
.description = "Cortex-A55 ARM processors",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.a57)] = .{
.index = @enumToInt(Feature.a57),
.name = @tagName(Feature.a57),
.llvm_name = "a57",
.description = "Cortex-A57 ARM processors",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.a7)] = .{
.index = @enumToInt(Feature.a7),
.name = @tagName(Feature.a7),
.llvm_name = "a7",
.description = "Cortex-A7 ARM processors",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.a72)] = .{
.index = @enumToInt(Feature.a72),
.name = @tagName(Feature.a72),
.llvm_name = "a72",
.description = "Cortex-A72 ARM processors",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.a73)] = .{
.index = @enumToInt(Feature.a73),
.name = @tagName(Feature.a73),
.llvm_name = "a73",
.description = "Cortex-A73 ARM processors",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.a75)] = .{
.index = @enumToInt(Feature.a75),
.name = @tagName(Feature.a75),
.llvm_name = "a75",
.description = "Cortex-A75 ARM processors",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.a76)] = .{
.index = @enumToInt(Feature.a76),
.name = @tagName(Feature.a76),
.llvm_name = "a76",
.description = "Cortex-A76 ARM processors",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.a8)] = .{
.index = @enumToInt(Feature.a8),
.name = @tagName(Feature.a8),
.llvm_name = "a8",
.description = "Cortex-A8 ARM processors",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.a9)] = .{
.index = @enumToInt(Feature.a9),
.name = @tagName(Feature.a9),
.llvm_name = "a9",
.description = "Cortex-A9 ARM processors",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.aclass)] = .{
.index = @enumToInt(Feature.aclass),
.name = @tagName(Feature.aclass),
.llvm_name = "aclass",
.description = "Is application profile ('A' series)",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.acquire_release)] = .{
.index = @enumToInt(Feature.acquire_release),
.name = @tagName(Feature.acquire_release),
.llvm_name = "acquire-release",
.description = "Has v8 acquire/release (lda/ldaex etc) instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.aes)] = .{
.index = @enumToInt(Feature.aes),
@ -338,35 +338,35 @@ pub const all_features = blk: {
.name = @tagName(Feature.armv2),
.llvm_name = "armv2",
.description = "ARMv2 architecture",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.armv2a)] = .{
.index = @enumToInt(Feature.armv2a),
.name = @tagName(Feature.armv2a),
.llvm_name = "armv2a",
.description = "ARMv2a architecture",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.armv3)] = .{
.index = @enumToInt(Feature.armv3),
.name = @tagName(Feature.armv3),
.llvm_name = "armv3",
.description = "ARMv3 architecture",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.armv3m)] = .{
.index = @enumToInt(Feature.armv3m),
.name = @tagName(Feature.armv3m),
.llvm_name = "armv3m",
.description = "ARMv3m architecture",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.armv4)] = .{
.index = @enumToInt(Feature.armv4),
.name = @tagName(Feature.armv4),
.llvm_name = "armv4",
.description = "ARMv4 architecture",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.armv4t)] = .{
.index = @enumToInt(Feature.armv4t),
@ -766,28 +766,28 @@ pub const all_features = blk: {
.name = @tagName(Feature.avoid_movs_shop),
.llvm_name = "avoid-movs-shop",
.description = "Avoid movs instructions with shifter operand",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.avoid_partial_cpsr)] = .{
.index = @enumToInt(Feature.avoid_partial_cpsr),
.name = @tagName(Feature.avoid_partial_cpsr),
.llvm_name = "avoid-partial-cpsr",
.description = "Avoid CPSR partial update for OOO execution",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.cheap_predicable_cpsr)] = .{
.index = @enumToInt(Feature.cheap_predicable_cpsr),
.name = @tagName(Feature.cheap_predicable_cpsr),
.llvm_name = "cheap-predicable-cpsr",
.description = "Disable +1 predication cost for instructions updating CPSR",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.crc)] = .{
.index = @enumToInt(Feature.crc),
.name = @tagName(Feature.crc),
.llvm_name = "crc",
.description = "Enable support for CRC instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.crypto)] = .{
.index = @enumToInt(Feature.crypto),
@ -805,35 +805,35 @@ pub const all_features = blk: {
.name = @tagName(Feature.d32),
.llvm_name = "d32",
.description = "Extend FP to 32 double registers",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.db)] = .{
.index = @enumToInt(Feature.db),
.name = @tagName(Feature.db),
.llvm_name = "db",
.description = "Has data barrier (dmb/dsb) instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.dfb)] = .{
.index = @enumToInt(Feature.dfb),
.name = @tagName(Feature.dfb),
.llvm_name = "dfb",
.description = "Has full data barrier (dfb) instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.disable_postra_scheduler)] = .{
.index = @enumToInt(Feature.disable_postra_scheduler),
.name = @tagName(Feature.disable_postra_scheduler),
.llvm_name = "disable-postra-scheduler",
.description = "Don't schedule again after register allocation",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.dont_widen_vmovs)] = .{
.index = @enumToInt(Feature.dont_widen_vmovs),
.name = @tagName(Feature.dont_widen_vmovs),
.llvm_name = "dont-widen-vmovs",
.description = "Don't widen VMOVS to VMOVD",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.dotprod)] = .{
.index = @enumToInt(Feature.dotprod),
@ -849,21 +849,21 @@ pub const all_features = blk: {
.name = @tagName(Feature.dsp),
.llvm_name = "dsp",
.description = "Supports DSP instructions in ARM and/or Thumb2",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.execute_only)] = .{
.index = @enumToInt(Feature.execute_only),
.name = @tagName(Feature.execute_only),
.llvm_name = "execute-only",
.description = "Enable the generation of execute only code.",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.expand_fp_mlx)] = .{
.index = @enumToInt(Feature.expand_fp_mlx),
.name = @tagName(Feature.expand_fp_mlx),
.llvm_name = "expand-fp-mlx",
.description = "Expand VFP/NEON MLA/MLS instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.exynos)] = .{
.index = @enumToInt(Feature.exynos),
@ -937,7 +937,7 @@ pub const all_features = blk: {
.name = @tagName(Feature.fp16),
.llvm_name = "fp16",
.description = "Enable half-precision floating point",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fp16fml)] = .{
.index = @enumToInt(Feature.fp16fml),
@ -962,14 +962,14 @@ pub const all_features = blk: {
.name = @tagName(Feature.fpao),
.llvm_name = "fpao",
.description = "Enable fast computation of positive address offsets",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fpregs)] = .{
.index = @enumToInt(Feature.fpregs),
.name = @tagName(Feature.fpregs),
.llvm_name = "fpregs",
.description = "Enable FP registers",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fpregs16)] = .{
.index = @enumToInt(Feature.fpregs16),
@ -1004,28 +1004,28 @@ pub const all_features = blk: {
.name = @tagName(Feature.fuse_aes),
.llvm_name = "fuse-aes",
.description = "CPU fuses AES crypto operations",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fuse_literals)] = .{
.index = @enumToInt(Feature.fuse_literals),
.name = @tagName(Feature.fuse_literals),
.llvm_name = "fuse-literals",
.description = "CPU fuses literal generation operations",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.hwdiv)] = .{
.index = @enumToInt(Feature.hwdiv),
.name = @tagName(Feature.hwdiv),
.llvm_name = "hwdiv",
.description = "Enable divide instructions in Thumb",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.hwdiv_arm)] = .{
.index = @enumToInt(Feature.hwdiv_arm),
.name = @tagName(Feature.hwdiv_arm),
.llvm_name = "hwdiv-arm",
.description = "Enable divide instructions in ARM mode",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.iwmmxt)] = .{
.index = @enumToInt(Feature.iwmmxt),
@ -1050,63 +1050,63 @@ pub const all_features = blk: {
.name = @tagName(Feature.krait),
.llvm_name = "krait",
.description = "Qualcomm Krait processors",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.kryo)] = .{
.index = @enumToInt(Feature.kryo),
.name = @tagName(Feature.kryo),
.llvm_name = "kryo",
.description = "Qualcomm Kryo processors",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.lob)] = .{
.index = @enumToInt(Feature.lob),
.name = @tagName(Feature.lob),
.llvm_name = "lob",
.description = "Enable Low Overhead Branch extensions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.long_calls)] = .{
.index = @enumToInt(Feature.long_calls),
.name = @tagName(Feature.long_calls),
.llvm_name = "long-calls",
.description = "Generate calls via indirect call instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.loop_align)] = .{
.index = @enumToInt(Feature.loop_align),
.name = @tagName(Feature.loop_align),
.llvm_name = "loop-align",
.description = "Prefer 32-bit alignment for loops",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.m3)] = .{
.index = @enumToInt(Feature.m3),
.name = @tagName(Feature.m3),
.llvm_name = "m3",
.description = "Cortex-M3 ARM processors",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.mclass)] = .{
.index = @enumToInt(Feature.mclass),
.name = @tagName(Feature.mclass),
.llvm_name = "mclass",
.description = "Is microcontroller profile ('M' series)",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.mp)] = .{
.index = @enumToInt(Feature.mp),
.name = @tagName(Feature.mp),
.llvm_name = "mp",
.description = "Supports Multiprocessing extension",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.muxed_units)] = .{
.index = @enumToInt(Feature.muxed_units),
.name = @tagName(Feature.muxed_units),
.llvm_name = "muxed-units",
.description = "Has muxed AGU and NEON/FPU",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.mve)] = .{
.index = @enumToInt(Feature.mve),
@ -1136,7 +1136,7 @@ pub const all_features = blk: {
.name = @tagName(Feature.nacl_trap),
.llvm_name = "nacl-trap",
.description = "NaCl trap",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.neon)] = .{
.index = @enumToInt(Feature.neon),
@ -1152,147 +1152,147 @@ pub const all_features = blk: {
.name = @tagName(Feature.neon_fpmovs),
.llvm_name = "neon-fpmovs",
.description = "Convert VMOVSR, VMOVRS, VMOVS to NEON",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.neonfp)] = .{
.index = @enumToInt(Feature.neonfp),
.name = @tagName(Feature.neonfp),
.llvm_name = "neonfp",
.description = "Use NEON for single precision FP",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.no_branch_predictor)] = .{
.index = @enumToInt(Feature.no_branch_predictor),
.name = @tagName(Feature.no_branch_predictor),
.llvm_name = "no-branch-predictor",
.description = "Has no branch predictor",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.no_movt)] = .{
.index = @enumToInt(Feature.no_movt),
.name = @tagName(Feature.no_movt),
.llvm_name = "no-movt",
.description = "Don't use movt/movw pairs for 32-bit imms",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.no_neg_immediates)] = .{
.index = @enumToInt(Feature.no_neg_immediates),
.name = @tagName(Feature.no_neg_immediates),
.llvm_name = "no-neg-immediates",
.description = "Convert immediates and instructions to their negated or complemented equivalent when the immediate does not fit in the encoding.",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.noarm)] = .{
.index = @enumToInt(Feature.noarm),
.name = @tagName(Feature.noarm),
.llvm_name = "noarm",
.description = "Does not support ARM mode execution",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.nonpipelined_vfp)] = .{
.index = @enumToInt(Feature.nonpipelined_vfp),
.name = @tagName(Feature.nonpipelined_vfp),
.llvm_name = "nonpipelined-vfp",
.description = "VFP instructions are not pipelined",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.perfmon)] = .{
.index = @enumToInt(Feature.perfmon),
.name = @tagName(Feature.perfmon),
.llvm_name = "perfmon",
.description = "Enable support for Performance Monitor extensions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.prefer_ishst)] = .{
.index = @enumToInt(Feature.prefer_ishst),
.name = @tagName(Feature.prefer_ishst),
.llvm_name = "prefer-ishst",
.description = "Prefer ISHST barriers",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.prefer_vmovsr)] = .{
.index = @enumToInt(Feature.prefer_vmovsr),
.name = @tagName(Feature.prefer_vmovsr),
.llvm_name = "prefer-vmovsr",
.description = "Prefer VMOVSR",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.prof_unpr)] = .{
.index = @enumToInt(Feature.prof_unpr),
.name = @tagName(Feature.prof_unpr),
.llvm_name = "prof-unpr",
.description = "Is profitable to unpredicate",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.r4)] = .{
.index = @enumToInt(Feature.r4),
.name = @tagName(Feature.r4),
.llvm_name = "r4",
.description = "Cortex-R4 ARM processors",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.r5)] = .{
.index = @enumToInt(Feature.r5),
.name = @tagName(Feature.r5),
.llvm_name = "r5",
.description = "Cortex-R5 ARM processors",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.r52)] = .{
.index = @enumToInt(Feature.r52),
.name = @tagName(Feature.r52),
.llvm_name = "r52",
.description = "Cortex-R52 ARM processors",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.r7)] = .{
.index = @enumToInt(Feature.r7),
.name = @tagName(Feature.r7),
.llvm_name = "r7",
.description = "Cortex-R7 ARM processors",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ras)] = .{
.index = @enumToInt(Feature.ras),
.name = @tagName(Feature.ras),
.llvm_name = "ras",
.description = "Enable Reliability, Availability and Serviceability extensions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.rclass)] = .{
.index = @enumToInt(Feature.rclass),
.name = @tagName(Feature.rclass),
.llvm_name = "rclass",
.description = "Is realtime profile ('R' series)",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.read_tp_hard)] = .{
.index = @enumToInt(Feature.read_tp_hard),
.name = @tagName(Feature.read_tp_hard),
.llvm_name = "read-tp-hard",
.description = "Reading thread pointer from register",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.reserve_r9)] = .{
.index = @enumToInt(Feature.reserve_r9),
.name = @tagName(Feature.reserve_r9),
.llvm_name = "reserve-r9",
.description = "Reserve R9, making it unavailable as GPR",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ret_addr_stack)] = .{
.index = @enumToInt(Feature.ret_addr_stack),
.name = @tagName(Feature.ret_addr_stack),
.llvm_name = "ret-addr-stack",
.description = "Has return address stack",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sb)] = .{
.index = @enumToInt(Feature.sb),
.name = @tagName(Feature.sb),
.llvm_name = "sb",
.description = "Enable v8.5a Speculation Barrier",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sha2)] = .{
.index = @enumToInt(Feature.sha2),
@ -1308,49 +1308,49 @@ pub const all_features = blk: {
.name = @tagName(Feature.slow_fp_brcc),
.llvm_name = "slow-fp-brcc",
.description = "FP compare + branch is slow",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.slow_load_D_subreg)] = .{
.index = @enumToInt(Feature.slow_load_D_subreg),
.name = @tagName(Feature.slow_load_D_subreg),
.llvm_name = "slow-load-D-subreg",
.description = "Loading into D subregs is slow",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.slow_odd_reg)] = .{
.index = @enumToInt(Feature.slow_odd_reg),
.name = @tagName(Feature.slow_odd_reg),
.llvm_name = "slow-odd-reg",
.description = "VLDM/VSTM starting with an odd register is slow",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.slow_vdup32)] = .{
.index = @enumToInt(Feature.slow_vdup32),
.name = @tagName(Feature.slow_vdup32),
.llvm_name = "slow-vdup32",
.description = "Has slow VDUP32 - prefer VMOV",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.slow_vgetlni32)] = .{
.index = @enumToInt(Feature.slow_vgetlni32),
.name = @tagName(Feature.slow_vgetlni32),
.llvm_name = "slow-vgetlni32",
.description = "Has slow VGETLNi32 - prefer VMOV",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.slowfpvmlx)] = .{
.index = @enumToInt(Feature.slowfpvmlx),
.name = @tagName(Feature.slowfpvmlx),
.llvm_name = "slowfpvmlx",
.description = "Disable VFP / NEON MAC instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.soft_float)] = .{
.index = @enumToInt(Feature.soft_float),
.name = @tagName(Feature.soft_float),
.llvm_name = "soft-float",
.description = "Use software floating point features.",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.splat_vfp_neon)] = .{
.index = @enumToInt(Feature.splat_vfp_neon),
@ -1366,56 +1366,56 @@ pub const all_features = blk: {
.name = @tagName(Feature.strict_align),
.llvm_name = "strict-align",
.description = "Disallow all unaligned memory access",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.swift)] = .{
.index = @enumToInt(Feature.swift),
.name = @tagName(Feature.swift),
.llvm_name = "swift",
.description = "Swift ARM processors",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.thumb_mode)] = .{
.index = @enumToInt(Feature.thumb_mode),
.name = @tagName(Feature.thumb_mode),
.llvm_name = "thumb-mode",
.description = "Thumb mode",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.thumb2)] = .{
.index = @enumToInt(Feature.thumb2),
.name = @tagName(Feature.thumb2),
.llvm_name = "thumb2",
.description = "Enable Thumb2 instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.trustzone)] = .{
.index = @enumToInt(Feature.trustzone),
.name = @tagName(Feature.trustzone),
.llvm_name = "trustzone",
.description = "Enable support for TrustZone security extensions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.use_aa)] = .{
.index = @enumToInt(Feature.use_aa),
.name = @tagName(Feature.use_aa),
.llvm_name = "use-aa",
.description = "Use alias analysis during codegen",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.use_misched)] = .{
.index = @enumToInt(Feature.use_misched),
.name = @tagName(Feature.use_misched),
.llvm_name = "use-misched",
.description = "Use the MachineScheduler",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.v4t)] = .{
.index = @enumToInt(Feature.v4t),
.name = @tagName(Feature.v4t),
.llvm_name = "v4t",
.description = "Support ARM v4T instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.v5t)] = .{
.index = @enumToInt(Feature.v5t),
@ -1489,7 +1489,7 @@ pub const all_features = blk: {
.name = @tagName(Feature.v7clrex),
.llvm_name = "v7clrex",
.description = "Has v7 clrex instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.v8)] = .{
.index = @enumToInt(Feature.v8),
@ -1714,28 +1714,28 @@ pub const all_features = blk: {
.name = @tagName(Feature.vldn_align),
.llvm_name = "vldn-align",
.description = "Check for VLDn unaligned access",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.vmlx_forwarding)] = .{
.index = @enumToInt(Feature.vmlx_forwarding),
.name = @tagName(Feature.vmlx_forwarding),
.llvm_name = "vmlx-forwarding",
.description = "Has multiplier accumulator forwarding",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.vmlx_hazards)] = .{
.index = @enumToInt(Feature.vmlx_hazards),
.name = @tagName(Feature.vmlx_hazards),
.llvm_name = "vmlx-hazards",
.description = "Has VMLx hazards",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.wide_stride_vfp)] = .{
.index = @enumToInt(Feature.wide_stride_vfp),
.name = @tagName(Feature.wide_stride_vfp),
.llvm_name = "wide-stride-vfp",
.description = "Use a wide stride when allocating VFP registers",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.xscale)] = .{
.index = @enumToInt(Feature.xscale),
@ -1751,7 +1751,7 @@ pub const all_features = blk: {
.name = @tagName(Feature.zcz),
.llvm_name = "zcz",
.description = "Has zero-cycle zeroing instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
break :blk result;
};
@ -2450,7 +2450,7 @@ pub const cpu = struct {
pub const generic = Cpu{
.name = "generic",
.llvm_name = "generic",
.features = 0,
.features = featureSet(&[_]Feature{}),
};
pub const iwmmxt = Cpu{
.name = "iwmmxt",

View File

@ -15,7 +15,7 @@ pub const Feature = enum {
avr51,
avr6,
avrtiny,
break,
@"break",
des,
eijmpcall,
elpm,
@ -41,21 +41,21 @@ pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= @typeInfo(Cpu.Feature.Set).Int.bits);
std.debug.assert(len <= Cpu.Feature.Set.bit_count);
var result: [len]Cpu.Feature = undefined;
result[@enumToInt(Feature.addsubiw)] = .{
.index = @enumToInt(Feature.addsubiw),
.name = @tagName(Feature.addsubiw),
.llvm_name = "addsubiw",
.description = "Enable 16-bit register-immediate addition and subtraction instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.avr0)] = .{
.index = @enumToInt(Feature.avr0),
.name = @tagName(Feature.avr0),
.llvm_name = "avr0",
.description = "The device is a part of the avr0 family",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.avr1)] = .{
.index = @enumToInt(Feature.avr1),
@ -86,7 +86,7 @@ pub const all_features = blk: {
.description = "The device is a part of the avr25 family",
.dependencies = featureSet(&[_]Feature{
.avr2,
.break,
.@"break",
.lpmx,
.movw,
.spm,
@ -119,7 +119,7 @@ pub const all_features = blk: {
.description = "The device is a part of the avr35 family",
.dependencies = featureSet(&[_]Feature{
.avr3,
.break,
.@"break",
.lpmx,
.movw,
.spm,
@ -132,7 +132,7 @@ pub const all_features = blk: {
.description = "The device is a part of the avr4 family",
.dependencies = featureSet(&[_]Feature{
.avr2,
.break,
.@"break",
.lpmx,
.movw,
.mul,
@ -146,7 +146,7 @@ pub const all_features = blk: {
.description = "The device is a part of the avr5 family",
.dependencies = featureSet(&[_]Feature{
.avr3,
.break,
.@"break",
.lpmx,
.movw,
.mul,
@ -180,101 +180,101 @@ pub const all_features = blk: {
.description = "The device is a part of the avrtiny family",
.dependencies = featureSet(&[_]Feature{
.avr0,
.break,
.@"break",
.sram,
.tinyencoding,
}),
};
result[@enumToInt(Feature.break)] = .{
.index = @enumToInt(Feature.break),
.name = @tagName(Feature.break),
result[@enumToInt(Feature.@"break")] = .{
.index = @enumToInt(Feature.@"break"),
.name = @tagName(Feature.@"break"),
.llvm_name = "break",
.description = "The device supports the `BREAK` debugging instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.des)] = .{
.index = @enumToInt(Feature.des),
.name = @tagName(Feature.des),
.llvm_name = "des",
.description = "The device supports the `DES k` encryption instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.eijmpcall)] = .{
.index = @enumToInt(Feature.eijmpcall),
.name = @tagName(Feature.eijmpcall),
.llvm_name = "eijmpcall",
.description = "The device supports the `EIJMP`/`EICALL` instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.elpm)] = .{
.index = @enumToInt(Feature.elpm),
.name = @tagName(Feature.elpm),
.llvm_name = "elpm",
.description = "The device supports the ELPM instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.elpmx)] = .{
.index = @enumToInt(Feature.elpmx),
.name = @tagName(Feature.elpmx),
.llvm_name = "elpmx",
.description = "The device supports the `ELPM Rd, Z[+]` instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ijmpcall)] = .{
.index = @enumToInt(Feature.ijmpcall),
.name = @tagName(Feature.ijmpcall),
.llvm_name = "ijmpcall",
.description = "The device supports `IJMP`/`ICALL`instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.jmpcall)] = .{
.index = @enumToInt(Feature.jmpcall),
.name = @tagName(Feature.jmpcall),
.llvm_name = "jmpcall",
.description = "The device supports the `JMP` and `CALL` instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.lpm)] = .{
.index = @enumToInt(Feature.lpm),
.name = @tagName(Feature.lpm),
.llvm_name = "lpm",
.description = "The device supports the `LPM` instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.lpmx)] = .{
.index = @enumToInt(Feature.lpmx),
.name = @tagName(Feature.lpmx),
.llvm_name = "lpmx",
.description = "The device supports the `LPM Rd, Z[+]` instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.movw)] = .{
.index = @enumToInt(Feature.movw),
.name = @tagName(Feature.movw),
.llvm_name = "movw",
.description = "The device supports the 16-bit MOVW instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.mul)] = .{
.index = @enumToInt(Feature.mul),
.name = @tagName(Feature.mul),
.llvm_name = "mul",
.description = "The device supports the multiplication instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.rmw)] = .{
.index = @enumToInt(Feature.rmw),
.name = @tagName(Feature.rmw),
.llvm_name = "rmw",
.description = "The device supports the read-write-modify instructions: XCH, LAS, LAC, LAT",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.smallstack)] = .{
.index = @enumToInt(Feature.smallstack),
.name = @tagName(Feature.smallstack),
.llvm_name = "smallstack",
.description = "The device has an 8-bit stack pointer",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.special)] = .{
.index = @enumToInt(Feature.special),
@ -283,7 +283,7 @@ pub const all_features = blk: {
.description = "Enable use of the entire instruction set - used for debugging",
.dependencies = featureSet(&[_]Feature{
.addsubiw,
.break,
.@"break",
.des,
.eijmpcall,
.elpm,
@ -305,28 +305,28 @@ pub const all_features = blk: {
.name = @tagName(Feature.spm),
.llvm_name = "spm",
.description = "The device supports the `SPM` instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.spmx)] = .{
.index = @enumToInt(Feature.spmx),
.name = @tagName(Feature.spmx),
.llvm_name = "spmx",
.description = "The device supports the `SPM Z+` instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sram)] = .{
.index = @enumToInt(Feature.sram),
.name = @tagName(Feature.sram),
.llvm_name = "sram",
.description = "The device has random access memory",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.tinyencoding)] = .{
.index = @enumToInt(Feature.tinyencoding),
.name = @tagName(Feature.tinyencoding),
.llvm_name = "tinyencoding",
.description = "The device has Tiny core specific instruction encodings",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.xmega)] = .{
.index = @enumToInt(Feature.xmega),
@ -2439,3 +2439,7 @@ pub const all_cpus = &[_]*const Cpu{
&cpu.avrxmega7,
&cpu.m3000,
};
pub const baseline_features = featureSet(&[_]Feature{
.avr0,
});

View File

@ -11,28 +11,28 @@ pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= @typeInfo(Cpu.Feature.Set).Int.bits);
std.debug.assert(len <= Cpu.Feature.Set.bit_count);
var result: [len]Cpu.Feature = undefined;
result[@enumToInt(Feature.alu32)] = .{
.index = @enumToInt(Feature.alu32),
.name = @tagName(Feature.alu32),
.llvm_name = "alu32",
.description = "Enable ALU32 instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.dummy)] = .{
.index = @enumToInt(Feature.dummy),
.name = @tagName(Feature.dummy),
.llvm_name = "dummy",
.description = "unused feature",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.dwarfris)] = .{
.index = @enumToInt(Feature.dwarfris),
.name = @tagName(Feature.dwarfris),
.llvm_name = "dwarfris",
.description = "Disable MCAsmInfo DwarfUsesRelocationsAcrossSections",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
break :blk result;
};
@ -41,27 +41,27 @@ pub const cpu = struct {
pub const generic = Cpu{
.name = "generic",
.llvm_name = "generic",
.features = 0,
.features = featureSet(&[_]Feature{}),
};
pub const probe = Cpu{
.name = "probe",
.llvm_name = "probe",
.features = 0,
.features = featureSet(&[_]Feature{}),
};
pub const v1 = Cpu{
.name = "v1",
.llvm_name = "v1",
.features = 0,
.features = featureSet(&[_]Feature{}),
};
pub const v2 = Cpu{
.name = "v2",
.llvm_name = "v2",
.features = 0,
.features = featureSet(&[_]Feature{}),
};
pub const v3 = Cpu{
.name = "v3",
.llvm_name = "v3",
.features = 0,
.features = featureSet(&[_]Feature{}),
};
};

View File

@ -32,21 +32,21 @@ pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= @typeInfo(Cpu.Feature.Set).Int.bits);
std.debug.assert(len <= Cpu.Feature.Set.bit_count);
var result: [len]Cpu.Feature = undefined;
result[@enumToInt(Feature.duplex)] = .{
.index = @enumToInt(Feature.duplex),
.name = @tagName(Feature.duplex),
.llvm_name = "duplex",
.description = "Enable generation of duplex instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.hvx)] = .{
.index = @enumToInt(Feature.hvx),
.name = @tagName(Feature.hvx),
.llvm_name = "hvx",
.description = "Hexagon HVX instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.hvx_length128b)] = .{
.index = @enumToInt(Feature.hvx_length128b),
@ -114,28 +114,28 @@ pub const all_features = blk: {
.name = @tagName(Feature.long_calls),
.llvm_name = "long-calls",
.description = "Use constant-extended calls",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.mem_noshuf)] = .{
.index = @enumToInt(Feature.mem_noshuf),
.name = @tagName(Feature.mem_noshuf),
.llvm_name = "mem_noshuf",
.description = "Supports mem_noshuf feature",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.memops)] = .{
.index = @enumToInt(Feature.memops),
.name = @tagName(Feature.memops),
.llvm_name = "memops",
.description = "Use memop instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.noreturn_stack_elim)] = .{
.index = @enumToInt(Feature.noreturn_stack_elim),
.name = @tagName(Feature.noreturn_stack_elim),
.llvm_name = "noreturn-stack-elim",
.description = "Eliminate stack allocation in a noreturn function when possible",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.nvj)] = .{
.index = @enumToInt(Feature.nvj),
@ -160,70 +160,70 @@ pub const all_features = blk: {
.name = @tagName(Feature.packets),
.llvm_name = "packets",
.description = "Support for instruction packets",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.reserved_r19)] = .{
.index = @enumToInt(Feature.reserved_r19),
.name = @tagName(Feature.reserved_r19),
.llvm_name = "reserved-r19",
.description = "Reserve register R19",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.small_data)] = .{
.index = @enumToInt(Feature.small_data),
.name = @tagName(Feature.small_data),
.llvm_name = "small-data",
.description = "Allow GP-relative addressing of global variables",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.v5)] = .{
.index = @enumToInt(Feature.v5),
.name = @tagName(Feature.v5),
.llvm_name = "v5",
.description = "Enable Hexagon V5 architecture",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.v55)] = .{
.index = @enumToInt(Feature.v55),
.name = @tagName(Feature.v55),
.llvm_name = "v55",
.description = "Enable Hexagon V55 architecture",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.v60)] = .{
.index = @enumToInt(Feature.v60),
.name = @tagName(Feature.v60),
.llvm_name = "v60",
.description = "Enable Hexagon V60 architecture",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.v62)] = .{
.index = @enumToInt(Feature.v62),
.name = @tagName(Feature.v62),
.llvm_name = "v62",
.description = "Enable Hexagon V62 architecture",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.v65)] = .{
.index = @enumToInt(Feature.v65),
.name = @tagName(Feature.v65),
.llvm_name = "v65",
.description = "Enable Hexagon V65 architecture",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.v66)] = .{
.index = @enumToInt(Feature.v66),
.name = @tagName(Feature.v66),
.llvm_name = "v66",
.description = "Enable Hexagon V66 architecture",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.zreg)] = .{
.index = @enumToInt(Feature.zreg),
.name = @tagName(Feature.zreg),
.llvm_name = "zreg",
.description = "Hexagon ZReg extension instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
break :blk result;
};

View File

@ -57,14 +57,14 @@ pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= @typeInfo(Cpu.Feature.Set).Int.bits);
std.debug.assert(len <= Cpu.Feature.Set.bit_count);
var result: [len]Cpu.Feature = undefined;
result[@enumToInt(Feature.abs2008)] = .{
.index = @enumToInt(Feature.abs2008),
.name = @tagName(Feature.abs2008),
.llvm_name = "abs2008",
.description = "Disable IEEE 754-2008 abs.fmt mode",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.cnmips)] = .{
.index = @enumToInt(Feature.cnmips),
@ -80,14 +80,14 @@ pub const all_features = blk: {
.name = @tagName(Feature.crc),
.llvm_name = "crc",
.description = "Mips R6 CRC ASE",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.dsp)] = .{
.index = @enumToInt(Feature.dsp),
.name = @tagName(Feature.dsp),
.llvm_name = "dsp",
.description = "Mips DSP ASE",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.dspr2)] = .{
.index = @enumToInt(Feature.dspr2),
@ -113,63 +113,63 @@ pub const all_features = blk: {
.name = @tagName(Feature.eva),
.llvm_name = "eva",
.description = "Mips EVA ASE",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fp64)] = .{
.index = @enumToInt(Feature.fp64),
.name = @tagName(Feature.fp64),
.llvm_name = "fp64",
.description = "Support 64-bit FP registers",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fpxx)] = .{
.index = @enumToInt(Feature.fpxx),
.name = @tagName(Feature.fpxx),
.llvm_name = "fpxx",
.description = "Support for FPXX",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ginv)] = .{
.index = @enumToInt(Feature.ginv),
.name = @tagName(Feature.ginv),
.llvm_name = "ginv",
.description = "Mips Global Invalidate ASE",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.gp64)] = .{
.index = @enumToInt(Feature.gp64),
.name = @tagName(Feature.gp64),
.llvm_name = "gp64",
.description = "General Purpose Registers are 64-bit wide",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.long_calls)] = .{
.index = @enumToInt(Feature.long_calls),
.name = @tagName(Feature.long_calls),
.llvm_name = "long-calls",
.description = "Disable use of the jal instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.micromips)] = .{
.index = @enumToInt(Feature.micromips),
.name = @tagName(Feature.micromips),
.llvm_name = "micromips",
.description = "microMips mode",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.mips1)] = .{
.index = @enumToInt(Feature.mips1),
.name = @tagName(Feature.mips1),
.llvm_name = "mips1",
.description = "Mips I ISA Support [highly experimental]",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.mips16)] = .{
.index = @enumToInt(Feature.mips16),
.name = @tagName(Feature.mips16),
.llvm_name = "mips16",
.description = "Mips16 mode",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.mips2)] = .{
.index = @enumToInt(Feature.mips2),
@ -251,14 +251,14 @@ pub const all_features = blk: {
.name = @tagName(Feature.mips3_32),
.llvm_name = "mips3_32",
.description = "Subset of MIPS-III that is also in MIPS32 [highly experimental]",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.mips3_32r2)] = .{
.index = @enumToInt(Feature.mips3_32r2),
.name = @tagName(Feature.mips3_32r2),
.llvm_name = "mips3_32r2",
.description = "Subset of MIPS-III that is also in MIPS32r2 [highly experimental]",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.mips4)] = .{
.index = @enumToInt(Feature.mips4),
@ -276,14 +276,14 @@ pub const all_features = blk: {
.name = @tagName(Feature.mips4_32),
.llvm_name = "mips4_32",
.description = "Subset of MIPS-IV that is also in MIPS32 [highly experimental]",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.mips4_32r2)] = .{
.index = @enumToInt(Feature.mips4_32r2),
.name = @tagName(Feature.mips4_32r2),
.llvm_name = "mips4_32r2",
.description = "Subset of MIPS-IV that is also in MIPS32r2 [highly experimental]",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.mips5)] = .{
.index = @enumToInt(Feature.mips5),
@ -300,7 +300,7 @@ pub const all_features = blk: {
.name = @tagName(Feature.mips5_32r2),
.llvm_name = "mips5_32r2",
.description = "Subset of MIPS-V that is also in MIPS32r2 [highly experimental]",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.mips64)] = .{
.index = @enumToInt(Feature.mips64),
@ -359,42 +359,42 @@ pub const all_features = blk: {
.name = @tagName(Feature.msa),
.llvm_name = "msa",
.description = "Mips MSA ASE",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.mt)] = .{
.index = @enumToInt(Feature.mt),
.name = @tagName(Feature.mt),
.llvm_name = "mt",
.description = "Mips MT ASE",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.nan2008)] = .{
.index = @enumToInt(Feature.nan2008),
.name = @tagName(Feature.nan2008),
.llvm_name = "nan2008",
.description = "IEEE 754-2008 NaN encoding",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.noabicalls)] = .{
.index = @enumToInt(Feature.noabicalls),
.name = @tagName(Feature.noabicalls),
.llvm_name = "noabicalls",
.description = "Disable SVR4-style position-independent code",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.nomadd4)] = .{
.index = @enumToInt(Feature.nomadd4),
.name = @tagName(Feature.nomadd4),
.llvm_name = "nomadd4",
.description = "Disable 4-operand madd.fmt and related instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.nooddspreg)] = .{
.index = @enumToInt(Feature.nooddspreg),
.name = @tagName(Feature.nooddspreg),
.llvm_name = "nooddspreg",
.description = "Disable odd numbered single-precision registers",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.p5600)] = .{
.index = @enumToInt(Feature.p5600),
@ -410,56 +410,56 @@ pub const all_features = blk: {
.name = @tagName(Feature.ptr64),
.llvm_name = "ptr64",
.description = "Pointers are 64-bit wide",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.single_float)] = .{
.index = @enumToInt(Feature.single_float),
.name = @tagName(Feature.single_float),
.llvm_name = "single-float",
.description = "Only supports single precision float",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.soft_float)] = .{
.index = @enumToInt(Feature.soft_float),
.name = @tagName(Feature.soft_float),
.llvm_name = "soft-float",
.description = "Does not support floating point instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sym32)] = .{
.index = @enumToInt(Feature.sym32),
.name = @tagName(Feature.sym32),
.llvm_name = "sym32",
.description = "Symbols are 32 bit on Mips64",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.use_indirect_jump_hazard)] = .{
.index = @enumToInt(Feature.use_indirect_jump_hazard),
.name = @tagName(Feature.use_indirect_jump_hazard),
.llvm_name = "use-indirect-jump-hazard",
.description = "Use indirect jump guards to prevent certain speculation based attacks",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.use_tcc_in_div)] = .{
.index = @enumToInt(Feature.use_tcc_in_div),
.name = @tagName(Feature.use_tcc_in_div),
.llvm_name = "use-tcc-in-div",
.description = "Force the assembler to use trapping",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.vfpu)] = .{
.index = @enumToInt(Feature.vfpu),
.name = @tagName(Feature.vfpu),
.llvm_name = "vfpu",
.description = "Enable vector FPU instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.virt)] = .{
.index = @enumToInt(Feature.virt),
.name = @tagName(Feature.virt),
.llvm_name = "virt",
.description = "Mips Virtualization ASE",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
break :blk result;
};

View File

@ -12,35 +12,35 @@ pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= @typeInfo(Cpu.Feature.Set).Int.bits);
std.debug.assert(len <= Cpu.Feature.Set.bit_count);
var result: [len]Cpu.Feature = undefined;
result[@enumToInt(Feature.ext)] = .{
.index = @enumToInt(Feature.ext),
.name = @tagName(Feature.ext),
.llvm_name = "ext",
.description = "Enable MSP430-X extensions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.hwmult16)] = .{
.index = @enumToInt(Feature.hwmult16),
.name = @tagName(Feature.hwmult16),
.llvm_name = "hwmult16",
.description = "Enable 16-bit hardware multiplier",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.hwmult32)] = .{
.index = @enumToInt(Feature.hwmult32),
.name = @tagName(Feature.hwmult32),
.llvm_name = "hwmult32",
.description = "Enable 32-bit hardware multiplier",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.hwmultf5)] = .{
.index = @enumToInt(Feature.hwmultf5),
.name = @tagName(Feature.hwmultf5),
.llvm_name = "hwmultf5",
.description = "Enable F5 series hardware multiplier",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
break :blk result;
};
@ -49,12 +49,12 @@ pub const cpu = struct {
pub const generic = Cpu{
.name = "generic",
.llvm_name = "generic",
.features = 0,
.features = featureSet(&[_]Feature{}),
};
pub const msp430 = Cpu{
.name = "msp430",
.llvm_name = "msp430",
.features = 0,
.features = featureSet(&[_]Feature{}),
};
pub const msp430x = Cpu{
.name = "msp430x",

View File

@ -33,182 +33,182 @@ pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= @typeInfo(Cpu.Feature.Set).Int.bits);
std.debug.assert(len <= Cpu.Feature.Set.bit_count);
var result: [len]Cpu.Feature = undefined;
result[@enumToInt(Feature.ptx32)] = .{
.index = @enumToInt(Feature.ptx32),
.name = @tagName(Feature.ptx32),
.llvm_name = "ptx32",
.description = "Use PTX version 3.2",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ptx40)] = .{
.index = @enumToInt(Feature.ptx40),
.name = @tagName(Feature.ptx40),
.llvm_name = "ptx40",
.description = "Use PTX version 4.0",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ptx41)] = .{
.index = @enumToInt(Feature.ptx41),
.name = @tagName(Feature.ptx41),
.llvm_name = "ptx41",
.description = "Use PTX version 4.1",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ptx42)] = .{
.index = @enumToInt(Feature.ptx42),
.name = @tagName(Feature.ptx42),
.llvm_name = "ptx42",
.description = "Use PTX version 4.2",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ptx43)] = .{
.index = @enumToInt(Feature.ptx43),
.name = @tagName(Feature.ptx43),
.llvm_name = "ptx43",
.description = "Use PTX version 4.3",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ptx50)] = .{
.index = @enumToInt(Feature.ptx50),
.name = @tagName(Feature.ptx50),
.llvm_name = "ptx50",
.description = "Use PTX version 5.0",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ptx60)] = .{
.index = @enumToInt(Feature.ptx60),
.name = @tagName(Feature.ptx60),
.llvm_name = "ptx60",
.description = "Use PTX version 6.0",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ptx61)] = .{
.index = @enumToInt(Feature.ptx61),
.name = @tagName(Feature.ptx61),
.llvm_name = "ptx61",
.description = "Use PTX version 6.1",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ptx63)] = .{
.index = @enumToInt(Feature.ptx63),
.name = @tagName(Feature.ptx63),
.llvm_name = "ptx63",
.description = "Use PTX version 6.3",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ptx64)] = .{
.index = @enumToInt(Feature.ptx64),
.name = @tagName(Feature.ptx64),
.llvm_name = "ptx64",
.description = "Use PTX version 6.4",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sm_20)] = .{
.index = @enumToInt(Feature.sm_20),
.name = @tagName(Feature.sm_20),
.llvm_name = "sm_20",
.description = "Target SM 2.0",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sm_21)] = .{
.index = @enumToInt(Feature.sm_21),
.name = @tagName(Feature.sm_21),
.llvm_name = "sm_21",
.description = "Target SM 2.1",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sm_30)] = .{
.index = @enumToInt(Feature.sm_30),
.name = @tagName(Feature.sm_30),
.llvm_name = "sm_30",
.description = "Target SM 3.0",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sm_32)] = .{
.index = @enumToInt(Feature.sm_32),
.name = @tagName(Feature.sm_32),
.llvm_name = "sm_32",
.description = "Target SM 3.2",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sm_35)] = .{
.index = @enumToInt(Feature.sm_35),
.name = @tagName(Feature.sm_35),
.llvm_name = "sm_35",
.description = "Target SM 3.5",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sm_37)] = .{
.index = @enumToInt(Feature.sm_37),
.name = @tagName(Feature.sm_37),
.llvm_name = "sm_37",
.description = "Target SM 3.7",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sm_50)] = .{
.index = @enumToInt(Feature.sm_50),
.name = @tagName(Feature.sm_50),
.llvm_name = "sm_50",
.description = "Target SM 5.0",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sm_52)] = .{
.index = @enumToInt(Feature.sm_52),
.name = @tagName(Feature.sm_52),
.llvm_name = "sm_52",
.description = "Target SM 5.2",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sm_53)] = .{
.index = @enumToInt(Feature.sm_53),
.name = @tagName(Feature.sm_53),
.llvm_name = "sm_53",
.description = "Target SM 5.3",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sm_60)] = .{
.index = @enumToInt(Feature.sm_60),
.name = @tagName(Feature.sm_60),
.llvm_name = "sm_60",
.description = "Target SM 6.0",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sm_61)] = .{
.index = @enumToInt(Feature.sm_61),
.name = @tagName(Feature.sm_61),
.llvm_name = "sm_61",
.description = "Target SM 6.1",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sm_62)] = .{
.index = @enumToInt(Feature.sm_62),
.name = @tagName(Feature.sm_62),
.llvm_name = "sm_62",
.description = "Target SM 6.2",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sm_70)] = .{
.index = @enumToInt(Feature.sm_70),
.name = @tagName(Feature.sm_70),
.llvm_name = "sm_70",
.description = "Target SM 7.0",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sm_72)] = .{
.index = @enumToInt(Feature.sm_72),
.name = @tagName(Feature.sm_72),
.llvm_name = "sm_72",
.description = "Target SM 7.2",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sm_75)] = .{
.index = @enumToInt(Feature.sm_75),
.name = @tagName(Feature.sm_75),
.llvm_name = "sm_75",
.description = "Target SM 7.5",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
break :blk result;
};

View File

@ -59,21 +59,21 @@ pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= @typeInfo(Cpu.Feature.Set).Int.bits);
std.debug.assert(len <= Cpu.Feature.Set.bit_count);
var result: [len]Cpu.Feature = undefined;
result[@enumToInt(Feature.@"64bit")] = .{
.index = @enumToInt(Feature.@"64bit"),
.name = @tagName(Feature.@"64bit"),
.llvm_name = "64bit",
.description = "Enable 64-bit instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.@"64bitregs")] = .{
.index = @enumToInt(Feature.@"64bitregs"),
.name = @tagName(Feature.@"64bitregs"),
.llvm_name = "64bitregs",
.description = "Enable 64-bit registers usage for ppc32 [beta]",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.altivec)] = .{
.index = @enumToInt(Feature.altivec),
@ -98,21 +98,21 @@ pub const all_features = blk: {
.name = @tagName(Feature.bpermd),
.llvm_name = "bpermd",
.description = "Enable the bpermd instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.cmpb)] = .{
.index = @enumToInt(Feature.cmpb),
.name = @tagName(Feature.cmpb),
.llvm_name = "cmpb",
.description = "Enable the cmpb instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.crbits)] = .{
.index = @enumToInt(Feature.crbits),
.name = @tagName(Feature.crbits),
.llvm_name = "crbits",
.description = "Use condition-register bits individually",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.crypto)] = .{
.index = @enumToInt(Feature.crypto),
@ -137,14 +137,14 @@ pub const all_features = blk: {
.name = @tagName(Feature.e500),
.llvm_name = "e500",
.description = "Enable E500/E500mc instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.extdiv)] = .{
.index = @enumToInt(Feature.extdiv),
.name = @tagName(Feature.extdiv),
.llvm_name = "extdiv",
.description = "Enable extended divide instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fcpsgn)] = .{
.index = @enumToInt(Feature.fcpsgn),
@ -241,49 +241,49 @@ pub const all_features = blk: {
.name = @tagName(Feature.hard_float),
.llvm_name = "hard-float",
.description = "Enable floating-point instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.htm)] = .{
.index = @enumToInt(Feature.htm),
.name = @tagName(Feature.htm),
.llvm_name = "htm",
.description = "Enable Hardware Transactional Memory instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.icbt)] = .{
.index = @enumToInt(Feature.icbt),
.name = @tagName(Feature.icbt),
.llvm_name = "icbt",
.description = "Enable icbt instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.invariant_function_descriptors)] = .{
.index = @enumToInt(Feature.invariant_function_descriptors),
.name = @tagName(Feature.invariant_function_descriptors),
.llvm_name = "invariant-function-descriptors",
.description = "Assume function descriptors are invariant",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.isa_v30_instructions)] = .{
.index = @enumToInt(Feature.isa_v30_instructions),
.name = @tagName(Feature.isa_v30_instructions),
.llvm_name = "isa-v30-instructions",
.description = "Enable instructions added in ISA 3.0.",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.isel)] = .{
.index = @enumToInt(Feature.isel),
.name = @tagName(Feature.isel),
.llvm_name = "isel",
.description = "Enable the isel instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ldbrx)] = .{
.index = @enumToInt(Feature.ldbrx),
.name = @tagName(Feature.ldbrx),
.llvm_name = "ldbrx",
.description = "Enable the ldbrx instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.lfiwax)] = .{
.index = @enumToInt(Feature.lfiwax),
@ -299,14 +299,14 @@ pub const all_features = blk: {
.name = @tagName(Feature.longcall),
.llvm_name = "longcall",
.description = "Always use indirect calls",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.mfocrf)] = .{
.index = @enumToInt(Feature.mfocrf),
.name = @tagName(Feature.mfocrf),
.llvm_name = "mfocrf",
.description = "Enable the MFOCRF instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.msync)] = .{
.index = @enumToInt(Feature.msync),
@ -322,14 +322,14 @@ pub const all_features = blk: {
.name = @tagName(Feature.partword_atomics),
.llvm_name = "partword-atomics",
.description = "Enable l[bh]arx and st[bh]cx.",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.popcntd)] = .{
.index = @enumToInt(Feature.popcntd),
.name = @tagName(Feature.popcntd),
.llvm_name = "popcntd",
.description = "Enable the popcnt[dw] instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.power8_altivec)] = .{
.index = @enumToInt(Feature.power8_altivec),
@ -376,28 +376,28 @@ pub const all_features = blk: {
.name = @tagName(Feature.ppc_postra_sched),
.llvm_name = "ppc-postra-sched",
.description = "Use PowerPC post-RA scheduling strategy",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ppc_prera_sched)] = .{
.index = @enumToInt(Feature.ppc_prera_sched),
.name = @tagName(Feature.ppc_prera_sched),
.llvm_name = "ppc-prera-sched",
.description = "Use PowerPC pre-RA scheduling strategy",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ppc4xx)] = .{
.index = @enumToInt(Feature.ppc4xx),
.name = @tagName(Feature.ppc4xx),
.llvm_name = "ppc4xx",
.description = "Enable PPC 4xx instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ppc6xx)] = .{
.index = @enumToInt(Feature.ppc6xx),
.name = @tagName(Feature.ppc6xx),
.llvm_name = "ppc6xx",
.description = "Enable PPC 6xx instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.qpx)] = .{
.index = @enumToInt(Feature.qpx),
@ -413,21 +413,21 @@ pub const all_features = blk: {
.name = @tagName(Feature.recipprec),
.llvm_name = "recipprec",
.description = "Assume higher precision reciprocal estimates",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.secure_plt)] = .{
.index = @enumToInt(Feature.secure_plt),
.name = @tagName(Feature.secure_plt),
.llvm_name = "secure-plt",
.description = "Enable secure plt mode",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.slow_popcntd)] = .{
.index = @enumToInt(Feature.slow_popcntd),
.name = @tagName(Feature.slow_popcntd),
.llvm_name = "slow-popcntd",
.description = "Has slow popcnt[dw] instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.spe)] = .{
.index = @enumToInt(Feature.spe),
@ -452,14 +452,14 @@ pub const all_features = blk: {
.name = @tagName(Feature.two_const_nr),
.llvm_name = "two-const-nr",
.description = "Requires two constant Newton-Raphson computation",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.vectors_use_two_units)] = .{
.index = @enumToInt(Feature.vectors_use_two_units),
.name = @tagName(Feature.vectors_use_two_units),
.llvm_name = "vectors-use-two-units",
.description = "Vectors use two units",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.vsx)] = .{
.index = @enumToInt(Feature.vsx),
@ -475,7 +475,7 @@ pub const all_features = blk: {
pub const cpu = struct {
pub const @"440" = Cpu{
.name = "@"440"",
.name = "440",
.llvm_name = "440",
.features = featureSet(&[_]Feature{
.booke,
@ -487,7 +487,7 @@ pub const cpu = struct {
}),
};
pub const @"450" = Cpu{
.name = "@"450"",
.name = "450",
.llvm_name = "450",
.features = featureSet(&[_]Feature{
.booke,
@ -499,21 +499,21 @@ pub const cpu = struct {
}),
};
pub const @"601" = Cpu{
.name = "@"601"",
.name = "601",
.llvm_name = "601",
.features = featureSet(&[_]Feature{
.fpu,
}),
};
pub const @"602" = Cpu{
.name = "@"602"",
.name = "602",
.llvm_name = "602",
.features = featureSet(&[_]Feature{
.fpu,
}),
};
pub const @"603" = Cpu{
.name = "@"603"",
.name = "603",
.llvm_name = "603",
.features = featureSet(&[_]Feature{
.fres,
@ -521,7 +521,7 @@ pub const cpu = struct {
}),
};
pub const @"603e" = Cpu{
.name = "@"603e"",
.name = "603e",
.llvm_name = "603e",
.features = featureSet(&[_]Feature{
.fres,
@ -529,7 +529,7 @@ pub const cpu = struct {
}),
};
pub const @"603ev" = Cpu{
.name = "@"603ev"",
.name = "603ev",
.llvm_name = "603ev",
.features = featureSet(&[_]Feature{
.fres,
@ -537,7 +537,7 @@ pub const cpu = struct {
}),
};
pub const @"604" = Cpu{
.name = "@"604"",
.name = "604",
.llvm_name = "604",
.features = featureSet(&[_]Feature{
.fres,
@ -545,7 +545,7 @@ pub const cpu = struct {
}),
};
pub const @"604e" = Cpu{
.name = "@"604e"",
.name = "604e",
.llvm_name = "604e",
.features = featureSet(&[_]Feature{
.fres,
@ -553,7 +553,7 @@ pub const cpu = struct {
}),
};
pub const @"620" = Cpu{
.name = "@"620"",
.name = "620",
.llvm_name = "620",
.features = featureSet(&[_]Feature{
.fres,
@ -561,7 +561,7 @@ pub const cpu = struct {
}),
};
pub const @"7400" = Cpu{
.name = "@"7400"",
.name = "7400",
.llvm_name = "7400",
.features = featureSet(&[_]Feature{
.altivec,
@ -570,7 +570,7 @@ pub const cpu = struct {
}),
};
pub const @"7450" = Cpu{
.name = "@"7450"",
.name = "7450",
.llvm_name = "7450",
.features = featureSet(&[_]Feature{
.altivec,
@ -579,7 +579,7 @@ pub const cpu = struct {
}),
};
pub const @"750" = Cpu{
.name = "@"750"",
.name = "750",
.llvm_name = "750",
.features = featureSet(&[_]Feature{
.fres,
@ -587,7 +587,7 @@ pub const cpu = struct {
}),
};
pub const @"970" = Cpu{
.name = "@"970"",
.name = "970",
.llvm_name = "970",
.features = featureSet(&[_]Feature{
.@"64bit",
@ -698,7 +698,7 @@ pub const cpu = struct {
.frsqrte,
}),
};
pub const g4+ = Cpu{
pub const @"g4+" = Cpu{
.name = "g4+",
.llvm_name = "g4+",
.features = featureSet(&[_]Feature{
@ -1016,7 +1016,7 @@ pub const all_cpus = &[_]*const Cpu{
&cpu.e5500,
&cpu.g3,
&cpu.g4,
&cpu.g4+,
&cpu.@"g4+",
&cpu.g5,
&cpu.generic,
&cpu.ppc,

View File

@ -16,28 +16,28 @@ pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= @typeInfo(Cpu.Feature.Set).Int.bits);
std.debug.assert(len <= Cpu.Feature.Set.bit_count);
var result: [len]Cpu.Feature = undefined;
result[@enumToInt(Feature.@"64bit")] = .{
.index = @enumToInt(Feature.@"64bit"),
.name = @tagName(Feature.@"64bit"),
.llvm_name = "64bit",
.description = "Implements RV64",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.a)] = .{
.index = @enumToInt(Feature.a),
.name = @tagName(Feature.a),
.llvm_name = "a",
.description = "'A' (Atomic Instructions)",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.c)] = .{
.index = @enumToInt(Feature.c),
.name = @tagName(Feature.c),
.llvm_name = "c",
.description = "'C' (Compressed Instructions)",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.d)] = .{
.index = @enumToInt(Feature.d),
@ -53,28 +53,28 @@ pub const all_features = blk: {
.name = @tagName(Feature.e),
.llvm_name = "e",
.description = "Implements RV32E (provides 16 rather than 32 GPRs)",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.f)] = .{
.index = @enumToInt(Feature.f),
.name = @tagName(Feature.f),
.llvm_name = "f",
.description = "'F' (Single-Precision Floating-Point)",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.m)] = .{
.index = @enumToInt(Feature.m),
.name = @tagName(Feature.m),
.llvm_name = "m",
.description = "'M' (Integer Multiplication and Division)",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.relax)] = .{
.index = @enumToInt(Feature.relax),
.name = @tagName(Feature.relax),
.llvm_name = "relax",
.description = "Enable Linker relaxation.",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
break :blk result;
};
@ -83,7 +83,7 @@ pub const cpu = struct {
pub const generic_rv32 = Cpu{
.name = "generic_rv32",
.llvm_name = "generic-rv32",
.features = 0,
.features = featureSet(&[_]Feature{}),
};
pub const generic_rv64 = Cpu{
.name = "generic_rv64",

View File

@ -27,140 +27,140 @@ pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= @typeInfo(Cpu.Feature.Set).Int.bits);
std.debug.assert(len <= Cpu.Feature.Set.bit_count);
var result: [len]Cpu.Feature = undefined;
result[@enumToInt(Feature.deprecated_v8)] = .{
.index = @enumToInt(Feature.deprecated_v8),
.name = @tagName(Feature.deprecated_v8),
.llvm_name = "deprecated-v8",
.description = "Enable deprecated V8 instructions in V9 mode",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.detectroundchange)] = .{
.index = @enumToInt(Feature.detectroundchange),
.name = @tagName(Feature.detectroundchange),
.llvm_name = "detectroundchange",
.description = "LEON3 erratum detection: Detects any rounding mode change request: use only the round-to-nearest rounding mode",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fixallfdivsqrt)] = .{
.index = @enumToInt(Feature.fixallfdivsqrt),
.name = @tagName(Feature.fixallfdivsqrt),
.llvm_name = "fixallfdivsqrt",
.description = "LEON erratum fix: Fix FDIVS/FDIVD/FSQRTS/FSQRTD instructions with NOPs and floating-point store",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.hard_quad_float)] = .{
.index = @enumToInt(Feature.hard_quad_float),
.name = @tagName(Feature.hard_quad_float),
.llvm_name = "hard-quad-float",
.description = "Enable quad-word floating point instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.hasleoncasa)] = .{
.index = @enumToInt(Feature.hasleoncasa),
.name = @tagName(Feature.hasleoncasa),
.llvm_name = "hasleoncasa",
.description = "Enable CASA instruction for LEON3 and LEON4 processors",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.hasumacsmac)] = .{
.index = @enumToInt(Feature.hasumacsmac),
.name = @tagName(Feature.hasumacsmac),
.llvm_name = "hasumacsmac",
.description = "Enable UMAC and SMAC for LEON3 and LEON4 processors",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.insertnopload)] = .{
.index = @enumToInt(Feature.insertnopload),
.name = @tagName(Feature.insertnopload),
.llvm_name = "insertnopload",
.description = "LEON3 erratum fix: Insert a NOP instruction after every single-cycle load instruction when the next instruction is another load/store instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.leon)] = .{
.index = @enumToInt(Feature.leon),
.name = @tagName(Feature.leon),
.llvm_name = "leon",
.description = "Enable LEON extensions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.leoncyclecounter)] = .{
.index = @enumToInt(Feature.leoncyclecounter),
.name = @tagName(Feature.leoncyclecounter),
.llvm_name = "leoncyclecounter",
.description = "Use the Leon cycle counter register",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.leonpwrpsr)] = .{
.index = @enumToInt(Feature.leonpwrpsr),
.name = @tagName(Feature.leonpwrpsr),
.llvm_name = "leonpwrpsr",
.description = "Enable the PWRPSR instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.no_fmuls)] = .{
.index = @enumToInt(Feature.no_fmuls),
.name = @tagName(Feature.no_fmuls),
.llvm_name = "no-fmuls",
.description = "Disable the fmuls instruction.",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.no_fsmuld)] = .{
.index = @enumToInt(Feature.no_fsmuld),
.name = @tagName(Feature.no_fsmuld),
.llvm_name = "no-fsmuld",
.description = "Disable the fsmuld instruction.",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.popc)] = .{
.index = @enumToInt(Feature.popc),
.name = @tagName(Feature.popc),
.llvm_name = "popc",
.description = "Use the popc (population count) instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.soft_float)] = .{
.index = @enumToInt(Feature.soft_float),
.name = @tagName(Feature.soft_float),
.llvm_name = "soft-float",
.description = "Use software emulation for floating point",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.soft_mul_div)] = .{
.index = @enumToInt(Feature.soft_mul_div),
.name = @tagName(Feature.soft_mul_div),
.llvm_name = "soft-mul-div",
.description = "Use software emulation for integer multiply and divide",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.v9)] = .{
.index = @enumToInt(Feature.v9),
.name = @tagName(Feature.v9),
.llvm_name = "v9",
.description = "Enable SPARC-V9 instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.vis)] = .{
.index = @enumToInt(Feature.vis),
.name = @tagName(Feature.vis),
.llvm_name = "vis",
.description = "Enable UltraSPARC Visual Instruction Set extensions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.vis2)] = .{
.index = @enumToInt(Feature.vis2),
.name = @tagName(Feature.vis2),
.llvm_name = "vis2",
.description = "Enable Visual Instruction Set extensions II",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.vis3)] = .{
.index = @enumToInt(Feature.vis3),
.name = @tagName(Feature.vis3),
.llvm_name = "vis3",
.description = "Enable Visual Instruction Set extensions III",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
break :blk result;
};
@ -185,12 +185,12 @@ pub const cpu = struct {
pub const f934 = Cpu{
.name = "f934",
.llvm_name = "f934",
.features = 0,
.features = featureSet(&[_]Feature{}),
};
pub const generic = Cpu{
.name = "generic",
.llvm_name = "generic",
.features = 0,
.features = featureSet(&[_]Feature{}),
};
pub const gr712rc = Cpu{
.name = "gr712rc",
@ -214,7 +214,7 @@ pub const cpu = struct {
pub const hypersparc = Cpu{
.name = "hypersparc",
.llvm_name = "hypersparc",
.features = 0,
.features = featureSet(&[_]Feature{}),
};
pub const leon2 = Cpu{
.name = "leon2",
@ -407,27 +407,27 @@ pub const cpu = struct {
pub const sparclet = Cpu{
.name = "sparclet",
.llvm_name = "sparclet",
.features = 0,
.features = featureSet(&[_]Feature{}),
};
pub const sparclite = Cpu{
.name = "sparclite",
.llvm_name = "sparclite",
.features = 0,
.features = featureSet(&[_]Feature{}),
};
pub const sparclite86x = Cpu{
.name = "sparclite86x",
.llvm_name = "sparclite86x",
.features = 0,
.features = featureSet(&[_]Feature{}),
};
pub const supersparc = Cpu{
.name = "supersparc",
.llvm_name = "supersparc",
.features = 0,
.features = featureSet(&[_]Feature{}),
};
pub const tsc701 = Cpu{
.name = "tsc701",
.llvm_name = "tsc701",
.features = 0,
.features = featureSet(&[_]Feature{}),
};
pub const ultrasparc = Cpu{
.name = "ultrasparc",
@ -470,7 +470,7 @@ pub const cpu = struct {
pub const v8 = Cpu{
.name = "v8",
.llvm_name = "v8",
.features = 0,
.features = featureSet(&[_]Feature{}),
};
pub const v9 = Cpu{
.name = "v9",

View File

@ -43,252 +43,252 @@ pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= @typeInfo(Cpu.Feature.Set).Int.bits);
std.debug.assert(len <= Cpu.Feature.Set.bit_count);
var result: [len]Cpu.Feature = undefined;
result[@enumToInt(Feature.deflate_conversion)] = .{
.index = @enumToInt(Feature.deflate_conversion),
.name = @tagName(Feature.deflate_conversion),
.llvm_name = "deflate-conversion",
.description = "Assume that the deflate-conversion facility is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.dfp_packed_conversion)] = .{
.index = @enumToInt(Feature.dfp_packed_conversion),
.name = @tagName(Feature.dfp_packed_conversion),
.llvm_name = "dfp-packed-conversion",
.description = "Assume that the DFP packed-conversion facility is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.dfp_zoned_conversion)] = .{
.index = @enumToInt(Feature.dfp_zoned_conversion),
.name = @tagName(Feature.dfp_zoned_conversion),
.llvm_name = "dfp-zoned-conversion",
.description = "Assume that the DFP zoned-conversion facility is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.distinct_ops)] = .{
.index = @enumToInt(Feature.distinct_ops),
.name = @tagName(Feature.distinct_ops),
.llvm_name = "distinct-ops",
.description = "Assume that the distinct-operands facility is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.enhanced_dat_2)] = .{
.index = @enumToInt(Feature.enhanced_dat_2),
.name = @tagName(Feature.enhanced_dat_2),
.llvm_name = "enhanced-dat-2",
.description = "Assume that the enhanced-DAT facility 2 is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.enhanced_sort)] = .{
.index = @enumToInt(Feature.enhanced_sort),
.name = @tagName(Feature.enhanced_sort),
.llvm_name = "enhanced-sort",
.description = "Assume that the enhanced-sort facility is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.execution_hint)] = .{
.index = @enumToInt(Feature.execution_hint),
.name = @tagName(Feature.execution_hint),
.llvm_name = "execution-hint",
.description = "Assume that the execution-hint facility is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fast_serialization)] = .{
.index = @enumToInt(Feature.fast_serialization),
.name = @tagName(Feature.fast_serialization),
.llvm_name = "fast-serialization",
.description = "Assume that the fast-serialization facility is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fp_extension)] = .{
.index = @enumToInt(Feature.fp_extension),
.name = @tagName(Feature.fp_extension),
.llvm_name = "fp-extension",
.description = "Assume that the floating-point extension facility is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.guarded_storage)] = .{
.index = @enumToInt(Feature.guarded_storage),
.name = @tagName(Feature.guarded_storage),
.llvm_name = "guarded-storage",
.description = "Assume that the guarded-storage facility is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.high_word)] = .{
.index = @enumToInt(Feature.high_word),
.name = @tagName(Feature.high_word),
.llvm_name = "high-word",
.description = "Assume that the high-word facility is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.insert_reference_bits_multiple)] = .{
.index = @enumToInt(Feature.insert_reference_bits_multiple),
.name = @tagName(Feature.insert_reference_bits_multiple),
.llvm_name = "insert-reference-bits-multiple",
.description = "Assume that the insert-reference-bits-multiple facility is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.interlocked_access1)] = .{
.index = @enumToInt(Feature.interlocked_access1),
.name = @tagName(Feature.interlocked_access1),
.llvm_name = "interlocked-access1",
.description = "Assume that interlocked-access facility 1 is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.load_and_trap)] = .{
.index = @enumToInt(Feature.load_and_trap),
.name = @tagName(Feature.load_and_trap),
.llvm_name = "load-and-trap",
.description = "Assume that the load-and-trap facility is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.load_and_zero_rightmost_byte)] = .{
.index = @enumToInt(Feature.load_and_zero_rightmost_byte),
.name = @tagName(Feature.load_and_zero_rightmost_byte),
.llvm_name = "load-and-zero-rightmost-byte",
.description = "Assume that the load-and-zero-rightmost-byte facility is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.load_store_on_cond)] = .{
.index = @enumToInt(Feature.load_store_on_cond),
.name = @tagName(Feature.load_store_on_cond),
.llvm_name = "load-store-on-cond",
.description = "Assume that the load/store-on-condition facility is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.load_store_on_cond_2)] = .{
.index = @enumToInt(Feature.load_store_on_cond_2),
.name = @tagName(Feature.load_store_on_cond_2),
.llvm_name = "load-store-on-cond-2",
.description = "Assume that the load/store-on-condition facility 2 is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.message_security_assist_extension3)] = .{
.index = @enumToInt(Feature.message_security_assist_extension3),
.name = @tagName(Feature.message_security_assist_extension3),
.llvm_name = "message-security-assist-extension3",
.description = "Assume that the message-security-assist extension facility 3 is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.message_security_assist_extension4)] = .{
.index = @enumToInt(Feature.message_security_assist_extension4),
.name = @tagName(Feature.message_security_assist_extension4),
.llvm_name = "message-security-assist-extension4",
.description = "Assume that the message-security-assist extension facility 4 is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.message_security_assist_extension5)] = .{
.index = @enumToInt(Feature.message_security_assist_extension5),
.name = @tagName(Feature.message_security_assist_extension5),
.llvm_name = "message-security-assist-extension5",
.description = "Assume that the message-security-assist extension facility 5 is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.message_security_assist_extension7)] = .{
.index = @enumToInt(Feature.message_security_assist_extension7),
.name = @tagName(Feature.message_security_assist_extension7),
.llvm_name = "message-security-assist-extension7",
.description = "Assume that the message-security-assist extension facility 7 is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.message_security_assist_extension8)] = .{
.index = @enumToInt(Feature.message_security_assist_extension8),
.name = @tagName(Feature.message_security_assist_extension8),
.llvm_name = "message-security-assist-extension8",
.description = "Assume that the message-security-assist extension facility 8 is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.message_security_assist_extension9)] = .{
.index = @enumToInt(Feature.message_security_assist_extension9),
.name = @tagName(Feature.message_security_assist_extension9),
.llvm_name = "message-security-assist-extension9",
.description = "Assume that the message-security-assist extension facility 9 is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.miscellaneous_extensions)] = .{
.index = @enumToInt(Feature.miscellaneous_extensions),
.name = @tagName(Feature.miscellaneous_extensions),
.llvm_name = "miscellaneous-extensions",
.description = "Assume that the miscellaneous-extensions facility is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.miscellaneous_extensions_2)] = .{
.index = @enumToInt(Feature.miscellaneous_extensions_2),
.name = @tagName(Feature.miscellaneous_extensions_2),
.llvm_name = "miscellaneous-extensions-2",
.description = "Assume that the miscellaneous-extensions facility 2 is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.miscellaneous_extensions_3)] = .{
.index = @enumToInt(Feature.miscellaneous_extensions_3),
.name = @tagName(Feature.miscellaneous_extensions_3),
.llvm_name = "miscellaneous-extensions-3",
.description = "Assume that the miscellaneous-extensions facility 3 is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.population_count)] = .{
.index = @enumToInt(Feature.population_count),
.name = @tagName(Feature.population_count),
.llvm_name = "population-count",
.description = "Assume that the population-count facility is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.processor_assist)] = .{
.index = @enumToInt(Feature.processor_assist),
.name = @tagName(Feature.processor_assist),
.llvm_name = "processor-assist",
.description = "Assume that the processor-assist facility is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.reset_reference_bits_multiple)] = .{
.index = @enumToInt(Feature.reset_reference_bits_multiple),
.name = @tagName(Feature.reset_reference_bits_multiple),
.llvm_name = "reset-reference-bits-multiple",
.description = "Assume that the reset-reference-bits-multiple facility is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.transactional_execution)] = .{
.index = @enumToInt(Feature.transactional_execution),
.name = @tagName(Feature.transactional_execution),
.llvm_name = "transactional-execution",
.description = "Assume that the transactional-execution facility is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.vector)] = .{
.index = @enumToInt(Feature.vector),
.name = @tagName(Feature.vector),
.llvm_name = "vector",
.description = "Assume that the vectory facility is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.vector_enhancements_1)] = .{
.index = @enumToInt(Feature.vector_enhancements_1),
.name = @tagName(Feature.vector_enhancements_1),
.llvm_name = "vector-enhancements-1",
.description = "Assume that the vector enhancements facility 1 is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.vector_enhancements_2)] = .{
.index = @enumToInt(Feature.vector_enhancements_2),
.name = @tagName(Feature.vector_enhancements_2),
.llvm_name = "vector-enhancements-2",
.description = "Assume that the vector enhancements facility 2 is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.vector_packed_decimal)] = .{
.index = @enumToInt(Feature.vector_packed_decimal),
.name = @tagName(Feature.vector_packed_decimal),
.llvm_name = "vector-packed-decimal",
.description = "Assume that the vector packed decimal facility is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.vector_packed_decimal_enhancement)] = .{
.index = @enumToInt(Feature.vector_packed_decimal_enhancement),
.name = @tagName(Feature.vector_packed_decimal_enhancement),
.llvm_name = "vector-packed-decimal-enhancement",
.description = "Assume that the vector packed decimal enhancement facility is installed",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
break :blk result;
};
@ -424,7 +424,7 @@ pub const cpu = struct {
pub const arch8 = Cpu{
.name = "arch8",
.llvm_name = "arch8",
.features = 0,
.features = featureSet(&[_]Feature{}),
};
pub const arch9 = Cpu{
.name = "arch9",
@ -445,12 +445,12 @@ pub const cpu = struct {
pub const generic = Cpu{
.name = "generic",
.llvm_name = "generic",
.features = 0,
.features = featureSet(&[_]Feature{}),
};
pub const z10 = Cpu{
.name = "z10",
.llvm_name = "z10",
.features = 0,
.features = featureSet(&[_]Feature{}),
};
pub const z13 = Cpu{
.name = "z13",

View File

@ -18,70 +18,70 @@ pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= @typeInfo(Cpu.Feature.Set).Int.bits);
std.debug.assert(len <= Cpu.Feature.Set.bit_count);
var result: [len]Cpu.Feature = undefined;
result[@enumToInt(Feature.atomics)] = .{
.index = @enumToInt(Feature.atomics),
.name = @tagName(Feature.atomics),
.llvm_name = "atomics",
.description = "Enable Atomics",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.bulk_memory)] = .{
.index = @enumToInt(Feature.bulk_memory),
.name = @tagName(Feature.bulk_memory),
.llvm_name = "bulk-memory",
.description = "Enable bulk memory operations",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.exception_handling)] = .{
.index = @enumToInt(Feature.exception_handling),
.name = @tagName(Feature.exception_handling),
.llvm_name = "exception-handling",
.description = "Enable Wasm exception handling",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.multivalue)] = .{
.index = @enumToInt(Feature.multivalue),
.name = @tagName(Feature.multivalue),
.llvm_name = "multivalue",
.description = "Enable multivalue blocks, instructions, and functions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.mutable_globals)] = .{
.index = @enumToInt(Feature.mutable_globals),
.name = @tagName(Feature.mutable_globals),
.llvm_name = "mutable-globals",
.description = "Enable mutable globals",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.nontrapping_fptoint)] = .{
.index = @enumToInt(Feature.nontrapping_fptoint),
.name = @tagName(Feature.nontrapping_fptoint),
.llvm_name = "nontrapping-fptoint",
.description = "Enable non-trapping float-to-int conversion operators",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sign_ext)] = .{
.index = @enumToInt(Feature.sign_ext),
.name = @tagName(Feature.sign_ext),
.llvm_name = "sign-ext",
.description = "Enable sign extension operators",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.simd128)] = .{
.index = @enumToInt(Feature.simd128),
.name = @tagName(Feature.simd128),
.llvm_name = "simd128",
.description = "Enable 128-bit SIMD",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.tail_call)] = .{
.index = @enumToInt(Feature.tail_call),
.name = @tagName(Feature.tail_call),
.llvm_name = "tail-call",
.description = "Enable tail call instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.unimplemented_simd128)] = .{
.index = @enumToInt(Feature.unimplemented_simd128),
@ -110,12 +110,12 @@ pub const cpu = struct {
pub const generic = Cpu{
.name = "generic",
.llvm_name = "generic",
.features = 0,
.features = featureSet(&[_]Feature{}),
};
pub const mvp = Cpu{
.name = "mvp",
.llvm_name = "mvp",
.features = 0,
.features = featureSet(&[_]Feature{}),
};
};

View File

@ -132,21 +132,21 @@ pub usingnamespace Cpu.Feature.feature_set_fns(Feature);
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= @typeInfo(Cpu.Feature.Set).Int.bits);
std.debug.assert(len <= Cpu.Feature.Set.bit_count);
var result: [len]Cpu.Feature = undefined;
result[@enumToInt(Feature.@"16bit_mode")] = .{
.index = @enumToInt(Feature.@"16bit_mode"),
.name = @tagName(Feature.@"16bit_mode"),
.llvm_name = "16bit-mode",
.description = "16-bit mode (i8086)",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.@"32bit_mode")] = .{
.index = @enumToInt(Feature.@"32bit_mode"),
.name = @tagName(Feature.@"32bit_mode"),
.llvm_name = "32bit-mode",
.description = "32-bit mode (80386)",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.@"3dnow")] = .{
.index = @enumToInt(Feature.@"3dnow"),
@ -171,21 +171,21 @@ pub const all_features = blk: {
.name = @tagName(Feature.@"64bit"),
.llvm_name = "64bit",
.description = "Support 64-bit instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.@"64bit_mode")] = .{
.index = @enumToInt(Feature.@"64bit_mode"),
.name = @tagName(Feature.@"64bit_mode"),
.llvm_name = "64bit-mode",
.description = "64-bit mode (x86_64)",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.adx)] = .{
.index = @enumToInt(Feature.adx),
.name = @tagName(Feature.adx),
.llvm_name = "adx",
.description = "Support ADX instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.aes)] = .{
.index = @enumToInt(Feature.aes),
@ -356,56 +356,56 @@ pub const all_features = blk: {
.name = @tagName(Feature.bmi),
.llvm_name = "bmi",
.description = "Support BMI instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.bmi2)] = .{
.index = @enumToInt(Feature.bmi2),
.name = @tagName(Feature.bmi2),
.llvm_name = "bmi2",
.description = "Support BMI2 instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.branchfusion)] = .{
.index = @enumToInt(Feature.branchfusion),
.name = @tagName(Feature.branchfusion),
.llvm_name = "branchfusion",
.description = "CMP/TEST can be fused with conditional branches",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.cldemote)] = .{
.index = @enumToInt(Feature.cldemote),
.name = @tagName(Feature.cldemote),
.llvm_name = "cldemote",
.description = "Enable Cache Demote",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.clflushopt)] = .{
.index = @enumToInt(Feature.clflushopt),
.name = @tagName(Feature.clflushopt),
.llvm_name = "clflushopt",
.description = "Flush A Cache Line Optimized",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.clwb)] = .{
.index = @enumToInt(Feature.clwb),
.name = @tagName(Feature.clwb),
.llvm_name = "clwb",
.description = "Cache Line Write Back",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.clzero)] = .{
.index = @enumToInt(Feature.clzero),
.name = @tagName(Feature.clzero),
.llvm_name = "clzero",
.description = "Enable Cache Line Zero",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.cmov)] = .{
.index = @enumToInt(Feature.cmov),
.name = @tagName(Feature.cmov),
.llvm_name = "cmov",
.description = "Enable conditional move instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.cx16)] = .{
.index = @enumToInt(Feature.cx16),
@ -421,21 +421,21 @@ pub const all_features = blk: {
.name = @tagName(Feature.cx8),
.llvm_name = "cx8",
.description = "Support CMPXCHG8B instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.enqcmd)] = .{
.index = @enumToInt(Feature.enqcmd),
.name = @tagName(Feature.enqcmd),
.llvm_name = "enqcmd",
.description = "Has ENQCMD instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ermsb)] = .{
.index = @enumToInt(Feature.ermsb),
.name = @tagName(Feature.ermsb),
.llvm_name = "ermsb",
.description = "REP MOVS/STOS are fast",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.f16c)] = .{
.index = @enumToInt(Feature.f16c),
@ -451,42 +451,42 @@ pub const all_features = blk: {
.name = @tagName(Feature.false_deps_lzcnt_tzcnt),
.llvm_name = "false-deps-lzcnt-tzcnt",
.description = "LZCNT/TZCNT have a false dependency on dest register",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.false_deps_popcnt)] = .{
.index = @enumToInt(Feature.false_deps_popcnt),
.name = @tagName(Feature.false_deps_popcnt),
.llvm_name = "false-deps-popcnt",
.description = "POPCNT has a false dependency on dest register",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fast_11bytenop)] = .{
.index = @enumToInt(Feature.fast_11bytenop),
.name = @tagName(Feature.fast_11bytenop),
.llvm_name = "fast-11bytenop",
.description = "Target can quickly decode up to 11 byte NOPs",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fast_15bytenop)] = .{
.index = @enumToInt(Feature.fast_15bytenop),
.name = @tagName(Feature.fast_15bytenop),
.llvm_name = "fast-15bytenop",
.description = "Target can quickly decode up to 15 byte NOPs",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fast_bextr)] = .{
.index = @enumToInt(Feature.fast_bextr),
.name = @tagName(Feature.fast_bextr),
.llvm_name = "fast-bextr",
.description = "Indicates that the BEXTR instruction is implemented as a single uop with good throughput",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fast_gather)] = .{
.index = @enumToInt(Feature.fast_gather),
.name = @tagName(Feature.fast_gather),
.llvm_name = "fast-gather",
.description = "Indicates if gather is reasonably fast",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fast_hops)] = .{
.index = @enumToInt(Feature.fast_hops),
@ -502,56 +502,56 @@ pub const all_features = blk: {
.name = @tagName(Feature.fast_lzcnt),
.llvm_name = "fast-lzcnt",
.description = "LZCNT instructions are as fast as most simple integer ops",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fast_partial_ymm_or_zmm_write)] = .{
.index = @enumToInt(Feature.fast_partial_ymm_or_zmm_write),
.name = @tagName(Feature.fast_partial_ymm_or_zmm_write),
.llvm_name = "fast-partial-ymm-or-zmm-write",
.description = "Partial writes to YMM/ZMM registers are fast",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fast_scalar_fsqrt)] = .{
.index = @enumToInt(Feature.fast_scalar_fsqrt),
.name = @tagName(Feature.fast_scalar_fsqrt),
.llvm_name = "fast-scalar-fsqrt",
.description = "Scalar SQRT is fast (disable Newton-Raphson)",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fast_scalar_shift_masks)] = .{
.index = @enumToInt(Feature.fast_scalar_shift_masks),
.name = @tagName(Feature.fast_scalar_shift_masks),
.llvm_name = "fast-scalar-shift-masks",
.description = "Prefer a left/right scalar logical shift pair over a shift+and pair",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fast_shld_rotate)] = .{
.index = @enumToInt(Feature.fast_shld_rotate),
.name = @tagName(Feature.fast_shld_rotate),
.llvm_name = "fast-shld-rotate",
.description = "SHLD can be used as a faster rotate",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fast_variable_shuffle)] = .{
.index = @enumToInt(Feature.fast_variable_shuffle),
.name = @tagName(Feature.fast_variable_shuffle),
.llvm_name = "fast-variable-shuffle",
.description = "Shuffles with variable masks are fast",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fast_vector_fsqrt)] = .{
.index = @enumToInt(Feature.fast_vector_fsqrt),
.name = @tagName(Feature.fast_vector_fsqrt),
.llvm_name = "fast-vector-fsqrt",
.description = "Vector SQRT is fast (disable Newton-Raphson)",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fast_vector_shift_masks)] = .{
.index = @enumToInt(Feature.fast_vector_shift_masks),
.name = @tagName(Feature.fast_vector_shift_masks),
.llvm_name = "fast-vector-shift-masks",
.description = "Prefer a left/right vector logical shift pair over a shift+and pair",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fma)] = .{
.index = @enumToInt(Feature.fma),
@ -577,14 +577,14 @@ pub const all_features = blk: {
.name = @tagName(Feature.fsgsbase),
.llvm_name = "fsgsbase",
.description = "Support FS/GS Base instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.fxsr)] = .{
.index = @enumToInt(Feature.fxsr),
.name = @tagName(Feature.fxsr),
.llvm_name = "fxsr",
.description = "Support fxsave/fxrestore instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.gfni)] = .{
.index = @enumToInt(Feature.gfni),
@ -600,119 +600,119 @@ pub const all_features = blk: {
.name = @tagName(Feature.idivl_to_divb),
.llvm_name = "idivl-to-divb",
.description = "Use 8-bit divide for positive values less than 256",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.idivq_to_divl)] = .{
.index = @enumToInt(Feature.idivq_to_divl),
.name = @tagName(Feature.idivq_to_divl),
.llvm_name = "idivq-to-divl",
.description = "Use 32-bit divide for positive values less than 2^32",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.invpcid)] = .{
.index = @enumToInt(Feature.invpcid),
.name = @tagName(Feature.invpcid),
.llvm_name = "invpcid",
.description = "Invalidate Process-Context Identifier",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.lea_sp)] = .{
.index = @enumToInt(Feature.lea_sp),
.name = @tagName(Feature.lea_sp),
.llvm_name = "lea-sp",
.description = "Use LEA for adjusting the stack pointer",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.lea_uses_ag)] = .{
.index = @enumToInt(Feature.lea_uses_ag),
.name = @tagName(Feature.lea_uses_ag),
.llvm_name = "lea-uses-ag",
.description = "LEA instruction needs inputs at AG stage",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.lwp)] = .{
.index = @enumToInt(Feature.lwp),
.name = @tagName(Feature.lwp),
.llvm_name = "lwp",
.description = "Enable LWP instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.lzcnt)] = .{
.index = @enumToInt(Feature.lzcnt),
.name = @tagName(Feature.lzcnt),
.llvm_name = "lzcnt",
.description = "Support LZCNT instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.macrofusion)] = .{
.index = @enumToInt(Feature.macrofusion),
.name = @tagName(Feature.macrofusion),
.llvm_name = "macrofusion",
.description = "Various instructions can be fused with conditional branches",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.merge_to_threeway_branch)] = .{
.index = @enumToInt(Feature.merge_to_threeway_branch),
.name = @tagName(Feature.merge_to_threeway_branch),
.llvm_name = "merge-to-threeway-branch",
.description = "Merge branches to a three-way conditional branch",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.mmx)] = .{
.index = @enumToInt(Feature.mmx),
.name = @tagName(Feature.mmx),
.llvm_name = "mmx",
.description = "Enable MMX instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.movbe)] = .{
.index = @enumToInt(Feature.movbe),
.name = @tagName(Feature.movbe),
.llvm_name = "movbe",
.description = "Support MOVBE instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.movdir64b)] = .{
.index = @enumToInt(Feature.movdir64b),
.name = @tagName(Feature.movdir64b),
.llvm_name = "movdir64b",
.description = "Support movdir64b instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.movdiri)] = .{
.index = @enumToInt(Feature.movdiri),
.name = @tagName(Feature.movdiri),
.llvm_name = "movdiri",
.description = "Support movdiri instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.mpx)] = .{
.index = @enumToInt(Feature.mpx),
.name = @tagName(Feature.mpx),
.llvm_name = "mpx",
.description = "Support MPX instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.mwaitx)] = .{
.index = @enumToInt(Feature.mwaitx),
.name = @tagName(Feature.mwaitx),
.llvm_name = "mwaitx",
.description = "Enable MONITORX/MWAITX timer functionality",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.nopl)] = .{
.index = @enumToInt(Feature.nopl),
.name = @tagName(Feature.nopl),
.llvm_name = "nopl",
.description = "Enable NOPL instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.pad_short_functions)] = .{
.index = @enumToInt(Feature.pad_short_functions),
.name = @tagName(Feature.pad_short_functions),
.llvm_name = "pad-short-functions",
.description = "Pad short functions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.pclmul)] = .{
.index = @enumToInt(Feature.pclmul),
@ -728,70 +728,70 @@ pub const all_features = blk: {
.name = @tagName(Feature.pconfig),
.llvm_name = "pconfig",
.description = "platform configuration instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.pku)] = .{
.index = @enumToInt(Feature.pku),
.name = @tagName(Feature.pku),
.llvm_name = "pku",
.description = "Enable protection keys",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.popcnt)] = .{
.index = @enumToInt(Feature.popcnt),
.name = @tagName(Feature.popcnt),
.llvm_name = "popcnt",
.description = "Support POPCNT instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.prefer_256_bit)] = .{
.index = @enumToInt(Feature.prefer_256_bit),
.name = @tagName(Feature.prefer_256_bit),
.llvm_name = "prefer-256-bit",
.description = "Prefer 256-bit AVX instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.prefetchwt1)] = .{
.index = @enumToInt(Feature.prefetchwt1),
.name = @tagName(Feature.prefetchwt1),
.llvm_name = "prefetchwt1",
.description = "Prefetch with Intent to Write and T1 Hint",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.prfchw)] = .{
.index = @enumToInt(Feature.prfchw),
.name = @tagName(Feature.prfchw),
.llvm_name = "prfchw",
.description = "Support PRFCHW instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.ptwrite)] = .{
.index = @enumToInt(Feature.ptwrite),
.name = @tagName(Feature.ptwrite),
.llvm_name = "ptwrite",
.description = "Support ptwrite instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.rdpid)] = .{
.index = @enumToInt(Feature.rdpid),
.name = @tagName(Feature.rdpid),
.llvm_name = "rdpid",
.description = "Support RDPID instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.rdrnd)] = .{
.index = @enumToInt(Feature.rdrnd),
.name = @tagName(Feature.rdrnd),
.llvm_name = "rdrnd",
.description = "Support RDRAND instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.rdseed)] = .{
.index = @enumToInt(Feature.rdseed),
.name = @tagName(Feature.rdseed),
.llvm_name = "rdseed",
.description = "Support RDSEED instruction",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.retpoline)] = .{
.index = @enumToInt(Feature.retpoline),
@ -817,35 +817,35 @@ pub const all_features = blk: {
.name = @tagName(Feature.retpoline_indirect_branches),
.llvm_name = "retpoline-indirect-branches",
.description = "Remove speculation of indirect branches from the generated code",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.retpoline_indirect_calls)] = .{
.index = @enumToInt(Feature.retpoline_indirect_calls),
.name = @tagName(Feature.retpoline_indirect_calls),
.llvm_name = "retpoline-indirect-calls",
.description = "Remove speculation of indirect calls from the generated code",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.rtm)] = .{
.index = @enumToInt(Feature.rtm),
.name = @tagName(Feature.rtm),
.llvm_name = "rtm",
.description = "Support RTM instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sahf)] = .{
.index = @enumToInt(Feature.sahf),
.name = @tagName(Feature.sahf),
.llvm_name = "sahf",
.description = "Support LAHF and SAHF instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sgx)] = .{
.index = @enumToInt(Feature.sgx),
.name = @tagName(Feature.sgx),
.llvm_name = "sgx",
.description = "Enable Software Guard Extensions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sha)] = .{
.index = @enumToInt(Feature.sha),
@ -861,91 +861,91 @@ pub const all_features = blk: {
.name = @tagName(Feature.shstk),
.llvm_name = "shstk",
.description = "Support CET Shadow-Stack instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.slow_3ops_lea)] = .{
.index = @enumToInt(Feature.slow_3ops_lea),
.name = @tagName(Feature.slow_3ops_lea),
.llvm_name = "slow-3ops-lea",
.description = "LEA instruction with 3 ops or certain registers is slow",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.slow_incdec)] = .{
.index = @enumToInt(Feature.slow_incdec),
.name = @tagName(Feature.slow_incdec),
.llvm_name = "slow-incdec",
.description = "INC and DEC instructions are slower than ADD and SUB",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.slow_lea)] = .{
.index = @enumToInt(Feature.slow_lea),
.name = @tagName(Feature.slow_lea),
.llvm_name = "slow-lea",
.description = "LEA instruction with certain arguments is slow",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.slow_pmaddwd)] = .{
.index = @enumToInt(Feature.slow_pmaddwd),
.name = @tagName(Feature.slow_pmaddwd),
.llvm_name = "slow-pmaddwd",
.description = "PMADDWD is slower than PMULLD",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.slow_pmulld)] = .{
.index = @enumToInt(Feature.slow_pmulld),
.name = @tagName(Feature.slow_pmulld),
.llvm_name = "slow-pmulld",
.description = "PMULLD instruction is slow",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.slow_shld)] = .{
.index = @enumToInt(Feature.slow_shld),
.name = @tagName(Feature.slow_shld),
.llvm_name = "slow-shld",
.description = "SHLD instruction is slow",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.slow_two_mem_ops)] = .{
.index = @enumToInt(Feature.slow_two_mem_ops),
.name = @tagName(Feature.slow_two_mem_ops),
.llvm_name = "slow-two-mem-ops",
.description = "Two memory operand instructions are slow",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.slow_unaligned_mem_16)] = .{
.index = @enumToInt(Feature.slow_unaligned_mem_16),
.name = @tagName(Feature.slow_unaligned_mem_16),
.llvm_name = "slow-unaligned-mem-16",
.description = "Slow unaligned 16-byte memory access",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.slow_unaligned_mem_32)] = .{
.index = @enumToInt(Feature.slow_unaligned_mem_32),
.name = @tagName(Feature.slow_unaligned_mem_32),
.llvm_name = "slow-unaligned-mem-32",
.description = "Slow unaligned 32-byte memory access",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.soft_float)] = .{
.index = @enumToInt(Feature.soft_float),
.name = @tagName(Feature.soft_float),
.llvm_name = "soft-float",
.description = "Use software floating point features",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sse)] = .{
.index = @enumToInt(Feature.sse),
.name = @tagName(Feature.sse),
.llvm_name = "sse",
.description = "Enable SSE instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sse_unaligned_mem)] = .{
.index = @enumToInt(Feature.sse_unaligned_mem),
.name = @tagName(Feature.sse_unaligned_mem),
.llvm_name = "sse-unaligned-mem",
.description = "Allow unaligned memory operands with SSE instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.sse2)] = .{
.index = @enumToInt(Feature.sse2),
@ -1006,7 +1006,7 @@ pub const all_features = blk: {
.name = @tagName(Feature.tbm),
.llvm_name = "tbm",
.description = "Enable TBM instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.vaes)] = .{
.index = @enumToInt(Feature.vaes),
@ -1033,21 +1033,21 @@ pub const all_features = blk: {
.name = @tagName(Feature.waitpkg),
.llvm_name = "waitpkg",
.description = "Wait and pause enhancements",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.wbnoinvd)] = .{
.index = @enumToInt(Feature.wbnoinvd),
.name = @tagName(Feature.wbnoinvd),
.llvm_name = "wbnoinvd",
.description = "Write Back No Invalidate",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.x87)] = .{
.index = @enumToInt(Feature.x87),
.name = @tagName(Feature.x87),
.llvm_name = "x87",
.description = "Enable X87 float instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.xop)] = .{
.index = @enumToInt(Feature.xop),
@ -1063,28 +1063,28 @@ pub const all_features = blk: {
.name = @tagName(Feature.xsave),
.llvm_name = "xsave",
.description = "Support xsave instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.xsavec)] = .{
.index = @enumToInt(Feature.xsavec),
.name = @tagName(Feature.xsavec),
.llvm_name = "xsavec",
.description = "Support xsavec instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.xsaveopt)] = .{
.index = @enumToInt(Feature.xsaveopt),
.name = @tagName(Feature.xsaveopt),
.llvm_name = "xsaveopt",
.description = "Support xsaveopt instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
result[@enumToInt(Feature.xsaves)] = .{
.index = @enumToInt(Feature.xsaves),
.name = @tagName(Feature.xsaves),
.llvm_name = "xsaves",
.description = "Support xsaves instructions",
.dependencies = 0,
.dependencies = featureSet(&[_]Feature{}),
};
break :blk result;
};
@ -2365,7 +2365,7 @@ pub const cpu = struct {
pub const lakemont = Cpu{
.name = "lakemont",
.llvm_name = "lakemont",
.features = 0,
.features = featureSet(&[_]Feature{}),
};
pub const nehalem = Cpu{
.name = "nehalem",

View File

@ -64,6 +64,7 @@ const Error = extern enum {
CacheUnavailable,
PathTooLong,
CCompilerCannotFindFile,
NoCCompilerInstalled,
ReadingDepFile,
InvalidDepFile,
MissingArchitecture,
@ -89,6 +90,7 @@ const Error = extern enum {
UnknownCpuFeature,
InvalidCpuFeatures,
InvalidLlvmCpuFeaturesFormat,
UnknownApplicationBinaryInterface,
};
const FILE = std.c.FILE;
@ -585,11 +587,12 @@ const Stage2CpuFeatures = struct {
fn createFromLLVM(
allocator: *mem.Allocator,
arch_name: [*:0]const u8,
zig_triple: [*:0]const u8,
llvm_cpu_name_z: [*:0]const u8,
llvm_cpu_features: [*:0]const u8,
) !*Self {
const arch = try Target.parseArchSub(mem.toSliceConst(u8, arch_name));
const target = try Target.parse(mem.toSliceConst(u8, zig_triple));
const arch = target.Cross.arch;
const llvm_cpu_name = mem.toSliceConst(u8, llvm_cpu_name_z);
for (arch.allCpus()) |cpu| {
@ -620,8 +623,8 @@ const Stage2CpuFeatures = struct {
const this_llvm_name = feature.llvm_name orelse continue;
if (mem.eql(u8, llvm_feat, this_llvm_name)) {
switch (op) {
.add => set |= @as(Target.Cpu.Feature.Set, 1) << @intCast(u7, index),
.sub => set &= ~(@as(Target.Cpu.Feature.Set, 1) << @intCast(u7, index)),
.add => set.addFeature(@intCast(u8, index)),
.sub => set.removeFeature(@intCast(u8, index)),
}
break;
}
@ -691,7 +694,7 @@ const Stage2CpuFeatures = struct {
}
for (all_features) |feature, index| {
if (!Target.Cpu.Feature.isEnabled(feature_set, @intCast(u7, index))) continue;
if (!feature_set.isEnabled(@intCast(u8, index))) continue;
if (feature.llvm_name) |llvm_name| {
try llvm_features_buffer.append("+");
@ -736,43 +739,75 @@ const Stage2CpuFeatures = struct {
// ABI warning
export fn stage2_cpu_features_parse_cpu(
result: **Stage2CpuFeatures,
arch_name: [*:0]const u8,
zig_triple: [*:0]const u8,
cpu_name: [*:0]const u8,
) Error {
result.* = parseCpu(arch_name, cpu_name) catch |err| switch (err) {
result.* = parseCpu(zig_triple, cpu_name) catch |err| switch (err) {
error.OutOfMemory => return .OutOfMemory,
error.UnknownCpu => return .UnknownCpu,
error.UnknownArchitecture => return .UnknownArchitecture,
error.UnknownSubArchitecture => return .UnknownSubArchitecture,
error.UnknownOperatingSystem => return .UnknownOperatingSystem,
error.UnknownApplicationBinaryInterface => return .UnknownApplicationBinaryInterface,
error.MissingOperatingSystem => return .MissingOperatingSystem,
error.MissingArchitecture => return .MissingArchitecture,
};
return .None;
}
fn parseCpu(arch_name: [*:0]const u8, cpu_name: [*:0]const u8) !*Stage2CpuFeatures {
const arch = try Target.parseArchSub(mem.toSliceConst(u8, arch_name));
const cpu = try arch.parseCpu(mem.toSliceConst(u8, cpu_name));
fn parseCpu(zig_triple: [*:0]const u8, cpu_name_z: [*:0]const u8) !*Stage2CpuFeatures {
const cpu_name = mem.toSliceConst(u8, cpu_name_z);
const target = try Target.parse(mem.toSliceConst(u8, zig_triple));
const arch = target.Cross.arch;
const cpu = arch.parseCpu(cpu_name) catch |err| switch (err) {
error.UnknownCpu => {
std.debug.warn("Unknown CPU: '{}'\nAvailable CPUs for architecture '{}':\n", .{
cpu_name,
@tagName(arch),
});
for (arch.allCpus()) |cpu| {
std.debug.warn(" {}\n", .{cpu.name});
}
process.exit(1);
},
else => |e| return e,
};
return Stage2CpuFeatures.createFromCpu(std.heap.c_allocator, arch, cpu);
}
// ABI warning
export fn stage2_cpu_features_parse_features(
result: **Stage2CpuFeatures,
arch_name: [*:0]const u8,
zig_triple: [*:0]const u8,
features_text: [*:0]const u8,
) Error {
result.* = parseFeatures(arch_name, features_text) catch |err| switch (err) {
result.* = parseFeatures(zig_triple, features_text) catch |err| switch (err) {
error.OutOfMemory => return .OutOfMemory,
error.UnknownCpuFeature => return .UnknownCpuFeature,
error.InvalidCpuFeatures => return .InvalidCpuFeatures,
error.UnknownArchitecture => return .UnknownArchitecture,
error.UnknownSubArchitecture => return .UnknownSubArchitecture,
error.UnknownOperatingSystem => return .UnknownOperatingSystem,
error.UnknownApplicationBinaryInterface => return .UnknownApplicationBinaryInterface,
error.MissingOperatingSystem => return .MissingOperatingSystem,
error.MissingArchitecture => return .MissingArchitecture,
};
return .None;
}
fn parseFeatures(arch_name: [*:0]const u8, features_text: [*:0]const u8) !*Stage2CpuFeatures {
const arch = try Target.parseArchSub(mem.toSliceConst(u8, arch_name));
const set = try arch.parseCpuFeatureSet(mem.toSliceConst(u8, features_text));
fn parseFeatures(zig_triple: [*:0]const u8, features_text: [*:0]const u8) !*Stage2CpuFeatures {
const target = try Target.parse(mem.toSliceConst(u8, zig_triple));
const arch = target.Cross.arch;
const set = arch.parseCpuFeatureSet(mem.toSliceConst(u8, features_text)) catch |err| switch (err) {
error.UnknownCpuFeature => {
std.debug.warn("Unknown CPU features specified.\nAvailable CPU features for architecture '{}':\n", .{
@tagName(arch),
});
for (arch.allFeaturesList()) |feature| {
std.debug.warn(" {}\n", .{feature.name});
}
process.exit(1);
},
else => |e| return e,
};
return Stage2CpuFeatures.createFromCpuFeatures(std.heap.c_allocator, arch, set);
}
@ -787,13 +822,13 @@ export fn stage2_cpu_features_baseline(result: **Stage2CpuFeatures) Error {
// ABI warning
export fn stage2_cpu_features_llvm(
result: **Stage2CpuFeatures,
arch_name: [*:0]const u8,
zig_triple: [*:0]const u8,
llvm_cpu_name: [*:0]const u8,
llvm_cpu_features: [*:0]const u8,
) Error {
result.* = Stage2CpuFeatures.createFromLLVM(
std.heap.c_allocator,
arch_name,
zig_triple,
llvm_cpu_name,
llvm_cpu_features,
) catch |err| switch (err) {
@ -801,6 +836,10 @@ export fn stage2_cpu_features_llvm(
error.UnknownArchitecture => return .UnknownArchitecture,
error.UnknownSubArchitecture => return .UnknownSubArchitecture,
error.InvalidLlvmCpuFeaturesFormat => return .InvalidLlvmCpuFeaturesFormat,
error.UnknownOperatingSystem => return .UnknownOperatingSystem,
error.UnknownApplicationBinaryInterface => return .UnknownApplicationBinaryInterface,
error.MissingOperatingSystem => return .MissingOperatingSystem,
error.MissingArchitecture => return .MissingArchitecture,
};
return .None;
}

View File

@ -63,6 +63,7 @@ const char *err_str(Error err) {
case ErrorUnknownCpuFeature: return "unknown CPU feature";
case ErrorInvalidCpuFeatures: return "invalid CPU features";
case ErrorInvalidLlvmCpuFeaturesFormat: return "invalid LLVM CPU features format";
case ErrorUnknownApplicationBinaryInterface: return "unknown application binary interface";
}
return "(invalid error)";
}

View File

@ -977,16 +977,19 @@ int main(int argc, char **argv) {
}
}
Buf zig_triple_buf = BUF_INIT;
target_triple_zig(&zig_triple_buf, &target);
if (cpu && features) {
fprintf(stderr, "-target-cpu and -target-feature options not allowed together\n");
return main_exit(root_progress_node, EXIT_FAILURE);
} else if (cpu) {
if ((err = stage2_cpu_features_parse_cpu(&target.cpu_features, target_arch_name(target.arch), cpu))) {
if ((err = stage2_cpu_features_parse_cpu(&target.cpu_features, buf_ptr(&zig_triple_buf), cpu))) {
fprintf(stderr, "-target-cpu error: %s\n", err_str(err));
return main_exit(root_progress_node, EXIT_FAILURE);
}
} else if (features) {
if ((err = stage2_cpu_features_parse_features(&target.cpu_features, target_arch_name(target.arch),
if ((err = stage2_cpu_features_parse_features(&target.cpu_features, buf_ptr(&zig_triple_buf),
features)))
{
fprintf(stderr, "-target-feature error: %s\n", err_str(err));
@ -995,7 +998,7 @@ int main(int argc, char **argv) {
} else if (target.is_native) {
const char *cpu_name = ZigLLVMGetHostCPUName();
const char *cpu_features = ZigLLVMGetNativeFeatures();
if ((err = stage2_cpu_features_llvm(&target.cpu_features, target_arch_name(target.arch),
if ((err = stage2_cpu_features_llvm(&target.cpu_features, buf_ptr(&zig_triple_buf),
cpu_name, cpu_features)))
{
fprintf(stderr, "unable to determine native CPU features: %s\n", err_str(err));
@ -1014,9 +1017,7 @@ int main(int argc, char **argv) {
}
if (target_requires_pic(&target, have_libc) && want_pic == WantPICDisabled) {
Buf triple_buf = BUF_INIT;
target_triple_zig(&triple_buf, &target);
fprintf(stderr, "`--disable-pic` is incompatible with target '%s'\n", buf_ptr(&triple_buf));
fprintf(stderr, "`--disable-pic` is incompatible with target '%s'\n", buf_ptr(&zig_triple_buf));
return print_error_usage(arg0);
}

View File

@ -96,11 +96,11 @@ struct Stage2CpuFeatures {
const char *cache_hash;
};
Error stage2_cpu_features_parse_cpu(Stage2CpuFeatures **out, const char *arch, const char *str) {
Error stage2_cpu_features_parse_cpu(Stage2CpuFeatures **out, const char *zig_triple, const char *str) {
const char *msg = "stage0 called stage2_cpu_features_parse_cpu";
stage2_panic(msg, strlen(msg));
}
Error stage2_cpu_features_parse_features(Stage2CpuFeatures **out, const char *arch, const char *str) {
Error stage2_cpu_features_parse_features(Stage2CpuFeatures **out, const char *zig_triple, const char *str) {
const char *msg = "stage0 called stage2_cpu_features_parse_features";
stage2_panic(msg, strlen(msg));
}
@ -111,7 +111,7 @@ Error stage2_cpu_features_baseline(Stage2CpuFeatures **out) {
*out = result;
return ErrorNone;
}
Error stage2_cpu_features_llvm(Stage2CpuFeatures **out, const char *arch,
Error stage2_cpu_features_llvm(Stage2CpuFeatures **out, const char *zig_triple,
const char *llvm_cpu_name, const char *llvm_features)
{
Stage2CpuFeatures *result = allocate<Stage2CpuFeatures>(1, "Stage2CpuFeatures");

View File

@ -83,6 +83,7 @@ enum Error {
ErrorUnknownCpuFeature,
ErrorInvalidCpuFeatures,
ErrorInvalidLlvmCpuFeaturesFormat,
ErrorUnknownApplicationBinaryInterface,
};
// ABI warning
@ -184,18 +185,18 @@ struct Stage2CpuFeatures;
// ABI warning
ZIG_EXTERN_C Error stage2_cpu_features_parse_cpu(struct Stage2CpuFeatures **result,
const char *arch, const char *cpu_name);
const char *zig_triple, const char *cpu_name);
// ABI warning
ZIG_EXTERN_C Error stage2_cpu_features_parse_features(struct Stage2CpuFeatures **result,
const char *arch, const char *features);
const char *zig_triple, const char *features);
// ABI warning
ZIG_EXTERN_C Error stage2_cpu_features_baseline(struct Stage2CpuFeatures **result);
// ABI warning
ZIG_EXTERN_C Error stage2_cpu_features_llvm(struct Stage2CpuFeatures **result,
const char *arch, const char *llvm_cpu_name, const char *llvm_features);
const char *zig_triple, const char *llvm_cpu_name, const char *llvm_features);
// ABI warning
ZIG_EXTERN_C const char *stage2_cpu_features_get_llvm_cpu(const struct Stage2CpuFeatures *cpu_features);