diff --git a/lib/std/target.zig b/lib/std/target.zig index f1a3f85891..22f0d00f17 100644 --- a/lib/std/target.zig +++ b/lib/std/target.zig @@ -260,6 +260,7 @@ pub const Target = struct { .emscripten, .driverkit, .shadermodel, + .liteos, .uefi, .opencl, // TODO: OpenCL versions .glsl450, // TODO: GLSL versions @@ -396,7 +397,7 @@ pub const Target = struct { /// On Darwin, we always link libSystem which contains libc. /// Similarly on FreeBSD and NetBSD we always link system libc /// since this is the stable syscall interface. - pub inline fn requiresLibC(os: Os) bool { + pub fn requiresLibC(os: Os) bool { return switch (os.tag) { .freebsd, .netbsd, @@ -438,6 +439,7 @@ pub const Target = struct { .emscripten, .driverkit, .shadermodel, + .liteos, .uefi, .opencl, .glsl450, @@ -566,6 +568,7 @@ pub const Target = struct { .watchos, .driverkit, .shadermodel, + .liteos, // TODO: audit this => return .none, } } @@ -976,7 +979,7 @@ pub const Target = struct { return error.UnknownCpuModel; } - pub inline fn toElfMachine(arch: Arch) std.elf.EM { + pub fn toElfMachine(arch: Arch) std.elf.EM { return switch (arch) { .avr => .AVR, .msp430 => .MSP430, @@ -1041,7 +1044,7 @@ pub const Target = struct { }; } - pub inline fn toCoffMachine(arch: Arch) std.coff.MachineType { + pub fn toCoffMachine(arch: Arch) std.coff.MachineType { return switch (arch) { .avr => .Unknown, .msp430 => .Unknown, @@ -1106,7 +1109,7 @@ pub const Target = struct { }; } - pub inline fn endian(arch: Arch) std.builtin.Endian { + pub fn endian(arch: Arch) std.builtin.Endian { return switch (arch) { .avr, .arm, @@ -1177,7 +1180,7 @@ pub const Target = struct { } /// Returns whether this architecture supports the address space - pub inline fn supportsAddressSpace(arch: Arch, address_space: std.builtin.AddressSpace) bool { + pub fn supportsAddressSpace(arch: Arch, address_space: std.builtin.AddressSpace) bool { const is_nvptx = arch == .nvptx or arch == .nvptx64; const is_spirv = arch == .spirv32 or arch == .spirv64; const is_gpu = is_nvptx or is_spirv or arch == .amdgcn; @@ -1715,6 +1718,7 @@ pub const Target = struct { .hurd, .driverkit, .shadermodel, + .liteos, => return result, } } @@ -1743,7 +1747,7 @@ pub const Target = struct { }; } - pub inline fn maxIntAlignment(target: Target) u16 { + pub fn maxIntAlignment(target: Target) u16 { return switch (target.cpu.arch) { .avr => 1, .msp430 => 2, @@ -1833,7 +1837,7 @@ pub const Target = struct { }; } - pub inline fn ptrBitWidth(target: Target) u16 { + pub fn ptrBitWidth(target: Target) u16 { switch (target.abi) { .gnux32, .muslx32, .gnuabin32, .gnuilp32 => return 32, .gnuabi64 => return 64, @@ -1910,7 +1914,7 @@ pub const Target = struct { } } - pub inline fn stackAlignment(target: Target) u16 { + pub fn stackAlignment(target: Target) u16 { return switch (target.cpu.arch) { .m68k => 2, .amdgcn => 4, @@ -1955,7 +1959,7 @@ pub const Target = struct { /// Default signedness of `char` for the native C compiler for this target /// Note that char signedness is implementation-defined and many compilers provide /// an option to override the default signedness e.g. GCC's -funsigned-char / -fsigned-char - pub inline fn charSignedness(target: Target) std.builtin.Signedness { + pub fn charSignedness(target: Target) std.builtin.Signedness { switch (target.cpu.arch) { .aarch64, .aarch64_32, @@ -1994,7 +1998,7 @@ pub const Target = struct { longdouble, }; - pub inline fn c_type_byte_size(t: Target, c_type: CType) u16 { + pub fn c_type_byte_size(t: Target, c_type: CType) u16 { return switch (c_type) { .char, .short, @@ -2020,7 +2024,7 @@ pub const Target = struct { }; } - pub inline fn c_type_bit_size(target: Target, c_type: CType) u16 { + pub fn c_type_bit_size(target: Target, c_type: CType) u16 { switch (target.os.tag) { .freestanding, .other => switch (target.cpu.arch) { .msp430 => switch (c_type) { @@ -2330,11 +2334,12 @@ pub const Target = struct { .vulkan, .driverkit, .shadermodel, + .liteos, => @panic("TODO specify the C integer and float type sizes for this OS"), } } - pub inline fn c_type_alignment(target: Target, c_type: CType) u16 { + pub fn c_type_alignment(target: Target, c_type: CType) u16 { // Overrides for unusual alignments switch (target.cpu.arch) { .avr => return 1, @@ -2441,7 +2446,7 @@ pub const Target = struct { ); } - pub inline fn c_type_preferred_alignment(target: Target, c_type: CType) u16 { + pub fn c_type_preferred_alignment(target: Target, c_type: CType) u16 { // Overrides for unusual alignments switch (target.cpu.arch) { .arm, .armeb, .thumb, .thumbeb => switch (target.os.tag) { diff --git a/lib/std/target/csky.zig b/lib/std/target/csky.zig index 3f41fa886d..331e8057bf 100644 --- a/lib/std/target/csky.zig +++ b/lib/std/target/csky.zig @@ -3079,7 +3079,7 @@ pub const cpu = struct { .btst16, }), }; - pub const i805 = CpuModel{ + pub const @"i805" = CpuModel{ .name = "i805", .llvm_name = "i805", .features = featureSet(&[_]Feature{ diff --git a/lib/std/target/nvptx.zig b/lib/std/target/nvptx.zig index fa2ea2e549..754000da3c 100644 --- a/lib/std/target/nvptx.zig +++ b/lib/std/target/nvptx.zig @@ -47,7 +47,7 @@ pub const Feature = enum { sm_87, sm_89, sm_90, - sm_90, + sm_90a, }; pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet; @@ -269,9 +269,9 @@ pub const all_features = blk: { .description = "Target SM 90", .dependencies = featureSet(&[_]Feature{}), }; - result[@intFromEnum(Feature.sm_90)] = .{ - .llvm_name = "sm_90", - .description = "Target SM 90", + result[@intFromEnum(Feature.sm_90a)] = .{ + .llvm_name = "sm_90a", + .description = "Target SM 90a", .dependencies = featureSet(&[_]Feature{}), }; const ti = @typeInfo(Feature); @@ -447,7 +447,7 @@ pub const cpu = struct { .llvm_name = "sm_90a", .features = featureSet(&[_]Feature{ .ptx80, - .sm_90, + .sm_90a, }), }; }; diff --git a/lib/std/target/x86.zig b/lib/std/target/x86.zig index 34334acf86..43ec04f41c 100644 --- a/lib/std/target/x86.zig +++ b/lib/std/target/x86.zig @@ -3569,6 +3569,64 @@ pub const cpu = struct { .xsaves, }), }; + pub const skylake_avx512 = CpuModel{ + .name = "skylake_avx512", + .llvm_name = "skylake-avx512", + .features = featureSet(&[_]Feature{ + .@"64bit", + .adx, + .aes, + .allow_light_256_bit, + .avx512bw, + .avx512cd, + .avx512dq, + .avx512vl, + .bmi, + .bmi2, + .clflushopt, + .clwb, + .cmov, + .crc32, + .cx16, + .ermsb, + .false_deps_popcnt, + .fast_15bytenop, + .fast_gather, + .fast_scalar_fsqrt, + .fast_shld_rotate, + .fast_variable_crosslane_shuffle, + .fast_variable_perlane_shuffle, + .fast_vector_fsqrt, + .faster_shift_than_shuffle, + .fsgsbase, + .fxsr, + .idivq_to_divl, + .invpcid, + .lzcnt, + .macrofusion, + .mmx, + .movbe, + .no_bypass_delay_blend, + .no_bypass_delay_mov, + .no_bypass_delay_shuffle, + .nopl, + .pclmul, + .pku, + .popcnt, + .prefer_256_bit, + .prfchw, + .rdrnd, + .rdseed, + .sahf, + .slow_3ops_lea, + .tuning_fast_imm_vector_shift, + .vzeroupper, + .x87, + .xsavec, + .xsaveopt, + .xsaves, + }), + }; pub const slm = CpuModel{ .name = "slm", .llvm_name = "slm", diff --git a/lib/std/zig/CrossTarget.zig b/lib/std/zig/CrossTarget.zig index d42b02d931..61195758ce 100644 --- a/lib/std/zig/CrossTarget.zig +++ b/lib/std/zig/CrossTarget.zig @@ -132,6 +132,7 @@ fn updateOsVersionRange(self: *CrossTarget, os: Target.Os) void { .emscripten, .driverkit, .shadermodel, + .liteos, .uefi, .opencl, .glsl450, @@ -734,6 +735,7 @@ fn parseOs(result: *CrossTarget, diags: *ParseOptions.Diagnostics, text: []const .plan9, .driverkit, .shadermodel, + .liteos, .other, => return error.InvalidOperatingSystemVersion, diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 2e61356b3a..c16e07ab6b 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -148,6 +148,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 { .watchos => "watchos", .driverkit => "driverkit", .shadermodel => "shadermodel", + .liteos => "liteos", .opencl, .glsl450, .vulkan, @@ -254,6 +255,7 @@ pub fn targetOs(os_tag: std.Target.Os.Tag) llvm.OSType { .emscripten => .Emscripten, .driverkit => .DriverKit, .shadermodel => .ShaderModel, + .liteos => .LiteOS, }; } diff --git a/tools/update_cpu_features.zig b/tools/update_cpu_features.zig index 805fe17747..610c113c98 100644 --- a/tools/update_cpu_features.zig +++ b/tools/update_cpu_features.zig @@ -945,7 +945,6 @@ const llvm_targets = [_]LlvmTarget{ "core_5th_gen_avx_tsx", "mic_avx512", "skylake_avx512", - "skylake-avx512", "icelake_client", "icelake_server", "graniterapids_d",