| author | |
| committer | |
| log | d34fae26d5bb556debf6b0a1d570ae936331a74b |
| tree | 6ffd356e09537093b381f0c130fcc66b1fd46fb9 |
| parent | 109ec729247443200c2ba614f6acb0b991e44b4d |
* some manual fixes to generated CPU features code. In the future it
would be nice to make the script do those automatically.
* add to various target OS switches. Some of the values I was unsure of
and added TODO panics, for example in the case of spirv CPU arch.6 files changed, 56 insertions(+), 94 deletions(-)
lib/std/Target.zig+23-1| ... | ... | @@ -169,6 +169,7 @@ pub const Os = struct { |
| 169 | 169 | .vulkan, |
| 170 | 170 | .plan9, |
| 171 | 171 | .illumos, |
| 172 | .serenity, | |
| 172 | 173 | .other, |
| 173 | 174 | => .none, |
| 174 | 175 | |
| ... | ... | @@ -177,6 +178,7 @@ pub const Os = struct { |
| 177 | 178 | .ios, |
| 178 | 179 | .tvos, |
| 179 | 180 | .watchos, |
| 181 | .xros, | |
| 180 | 182 | .netbsd, |
| 181 | 183 | .openbsd, |
| 182 | 184 | .dragonfly, |
| ... | ... | @@ -389,6 +391,7 @@ pub const Os = struct { |
| 389 | 391 | .vulkan, |
| 390 | 392 | .plan9, |
| 391 | 393 | .illumos, |
| 394 | .serenity, | |
| 392 | 395 | .other, |
| 393 | 396 | => .{ .none = {} }, |
| 394 | 397 | |
| ... | ... | @@ -431,6 +434,7 @@ pub const Os = struct { |
| 431 | 434 | .max = .{ .major = 17, .minor = 1, .patch = 0 }, |
| 432 | 435 | }, |
| 433 | 436 | }, |
| 437 | .xros => @panic("TODO what version is xros on right now?"), | |
| 434 | 438 | .netbsd => .{ |
| 435 | 439 | .semver = .{ |
| 436 | 440 | .min = .{ .major = 8, .minor = 0, .patch = 0 }, |
| ... | ... | @@ -527,11 +531,13 @@ pub const Os = struct { |
| 527 | 531 | .ios, |
| 528 | 532 | .tvos, |
| 529 | 533 | .watchos, |
| 534 | .xros, | |
| 530 | 535 | .dragonfly, |
| 531 | 536 | .openbsd, |
| 532 | 537 | .haiku, |
| 533 | 538 | .solaris, |
| 534 | 539 | .illumos, |
| 540 | .serenity, | |
| 535 | 541 | => true, |
| 536 | 542 | |
| 537 | 543 | .linux, |
| ... | ... | @@ -685,11 +691,13 @@ pub const Abi = enum { |
| 685 | 691 | .ios, |
| 686 | 692 | .tvos, |
| 687 | 693 | .watchos, |
| 694 | .xros, | |
| 688 | 695 | .driverkit, |
| 689 | 696 | .shadermodel, |
| 690 | 697 | .liteos, // TODO: audit this |
| 691 | 698 | .solaris, |
| 692 | 699 | .illumos, |
| 700 | .serenity, | |
| 693 | 701 | => .none, |
| 694 | 702 | }; |
| 695 | 703 | } |
| ... | ... | @@ -1179,6 +1187,7 @@ pub const Cpu = struct { |
| 1179 | 1187 | .s390x => .S390, |
| 1180 | 1188 | .ve => .NONE, |
| 1181 | 1189 | .spu_2 => .SPU_2, |
| 1190 | .spirv => .NONE, | |
| 1182 | 1191 | .spirv32 => .NONE, |
| 1183 | 1192 | .spirv64 => .NONE, |
| 1184 | 1193 | .loongarch32 => .NONE, |
| ... | ... | @@ -1295,6 +1304,7 @@ pub const Cpu = struct { |
| 1295 | 1304 | .ve, |
| 1296 | 1305 | .spu_2, |
| 1297 | 1306 | // GPU bitness is opaque. For now, assume little endian. |
| 1307 | .spirv, | |
| 1298 | 1308 | .spirv32, |
| 1299 | 1309 | .spirv64, |
| 1300 | 1310 | .dxil, |
| ... | ... | @@ -1419,6 +1429,7 @@ pub const Cpu = struct { |
| 1419 | 1429 | } |
| 1420 | 1430 | |
| 1421 | 1431 | fn allCpusFromDecls(comptime cpus: type) []const *const Cpu.Model { |
| 1432 | @setEvalBranchQuota(2000); | |
| 1422 | 1433 | const decls = @typeInfo(cpus).Struct.decls; |
| 1423 | 1434 | var array: [decls.len]*const Cpu.Model = undefined; |
| 1424 | 1435 | for (decls, 0..) |decl, i| { |
| ... | ... | @@ -1753,6 +1764,7 @@ pub const DynamicLinker = struct { |
| 1753 | 1764 | .nvptx64, |
| 1754 | 1765 | .spu_2, |
| 1755 | 1766 | .avr, |
| 1767 | .spirv, | |
| 1756 | 1768 | .spirv32, |
| 1757 | 1769 | .spirv64, |
| 1758 | 1770 | => none, |
| ... | ... | @@ -1794,6 +1806,7 @@ pub const DynamicLinker = struct { |
| 1794 | 1806 | .tvos, |
| 1795 | 1807 | .watchos, |
| 1796 | 1808 | .macos, |
| 1809 | .xros, | |
| 1797 | 1810 | => init("/usr/lib/dyld"), |
| 1798 | 1811 | |
| 1799 | 1812 | // Operating systems in this list have been verified as not having a standard |
| ... | ... | @@ -1808,6 +1821,7 @@ pub const DynamicLinker = struct { |
| 1808 | 1821 | .vulkan, |
| 1809 | 1822 | .other, |
| 1810 | 1823 | .plan9, |
| 1824 | .serenity, | |
| 1811 | 1825 | => none, |
| 1812 | 1826 | |
| 1813 | 1827 | // TODO revisit when multi-arch for Haiku is available |
| ... | ... | @@ -1921,6 +1935,7 @@ pub fn maxIntAlignment(target: Target) u16 { |
| 1921 | 1935 | .spir, |
| 1922 | 1936 | .kalimba, |
| 1923 | 1937 | .renderscript32, |
| 1938 | .spirv, | |
| 1924 | 1939 | .spirv32, |
| 1925 | 1940 | .shave, |
| 1926 | 1941 | .le64, |
| ... | ... | @@ -2012,6 +2027,8 @@ pub fn ptrBitWidth_cpu_abi(cpu: Cpu, abi: Abi) u16 { |
| 2012 | 2027 | => 64, |
| 2013 | 2028 | |
| 2014 | 2029 | .sparc => if (std.Target.sparc.featureSetHas(cpu.features, .v9)) 64 else 32, |
| 2030 | ||
| 2031 | .spirv => @panic("TODO what should this value be?"), | |
| 2015 | 2032 | }; |
| 2016 | 2033 | } |
| 2017 | 2034 | |
| ... | ... | @@ -2360,7 +2377,7 @@ pub fn c_type_bit_size(target: Target, c_type: CType) u16 { |
| 2360 | 2377 | }, |
| 2361 | 2378 | }, |
| 2362 | 2379 | |
| 2363 | .macos, .ios, .tvos, .watchos => switch (c_type) { | |
| 2380 | .macos, .ios, .tvos, .watchos, .xros => switch (c_type) { | |
| 2364 | 2381 | .char => return 8, |
| 2365 | 2382 | .short, .ushort => return 16, |
| 2366 | 2383 | .int, .uint, .float => return 32, |
| ... | ... | @@ -2440,6 +2457,7 @@ pub fn c_type_bit_size(target: Target, c_type: CType) u16 { |
| 2440 | 2457 | .driverkit, |
| 2441 | 2458 | .shadermodel, |
| 2442 | 2459 | .liteos, |
| 2460 | .serenity, | |
| 2443 | 2461 | => @panic("TODO specify the C integer and float type sizes for this OS"), |
| 2444 | 2462 | } |
| 2445 | 2463 | } |
| ... | ... | @@ -2547,6 +2565,8 @@ pub fn c_type_alignment(target: Target, c_type: CType) u16 { |
| 2547 | 2565 | .wasm32, |
| 2548 | 2566 | .wasm64, |
| 2549 | 2567 | => 16, |
| 2568 | ||
| 2569 | .spirv => @panic("TODO what should this value be?"), | |
| 2550 | 2570 | }), |
| 2551 | 2571 | ); |
| 2552 | 2572 | } |
| ... | ... | @@ -2673,6 +2693,8 @@ pub fn c_type_preferred_alignment(target: Target, c_type: CType) u16 { |
| 2673 | 2693 | .wasm32, |
| 2674 | 2694 | .wasm64, |
| 2675 | 2695 | => 16, |
| 2696 | ||
| 2697 | .spirv => @panic("TODO what should this value be?"), | |
| 2676 | 2698 | }), |
| 2677 | 2699 | ); |
| 2678 | 2700 | } |
lib/std/Target/arm.zig-1| ... | ... | @@ -187,7 +187,6 @@ pub const Feature = enum { |
| 187 | 187 | v9_3a, |
| 188 | 188 | v9_4a, |
| 189 | 189 | v9_5a, |
| 190 | v9_5a, | |
| 191 | 190 | v9a, |
| 192 | 191 | vfp2, |
| 193 | 192 | vfp2sp, |
lib/std/Target/x86.zig-79| ... | ... | @@ -1523,85 +1523,6 @@ pub const cpu = struct { |
| 1523 | 1523 | .xsaves, |
| 1524 | 1524 | }), |
| 1525 | 1525 | }; |
| 1526 | pub const arrowlake_s = CpuModel{ | |
| 1527 | .name = "arrowlake_s", | |
| 1528 | .llvm_name = "arrowlake_s", | |
| 1529 | .features = featureSet(&[_]Feature{ | |
| 1530 | .@"64bit", | |
| 1531 | .adx, | |
| 1532 | .allow_light_256_bit, | |
| 1533 | .avxifma, | |
| 1534 | .avxneconvert, | |
| 1535 | .avxvnni, | |
| 1536 | .avxvnniint16, | |
| 1537 | .avxvnniint8, | |
| 1538 | .bmi, | |
| 1539 | .bmi2, | |
| 1540 | .cldemote, | |
| 1541 | .clflushopt, | |
| 1542 | .clwb, | |
| 1543 | .cmov, | |
| 1544 | .cmpccxadd, | |
| 1545 | .crc32, | |
| 1546 | .cx16, | |
| 1547 | .enqcmd, | |
| 1548 | .f16c, | |
| 1549 | .false_deps_perm, | |
| 1550 | .false_deps_popcnt, | |
| 1551 | .fast_15bytenop, | |
| 1552 | .fast_gather, | |
| 1553 | .fast_scalar_fsqrt, | |
| 1554 | .fast_shld_rotate, | |
| 1555 | .fast_variable_crosslane_shuffle, | |
| 1556 | .fast_variable_perlane_shuffle, | |
| 1557 | .fast_vector_fsqrt, | |
| 1558 | .fma, | |
| 1559 | .fsgsbase, | |
| 1560 | .fxsr, | |
| 1561 | .gfni, | |
| 1562 | .hreset, | |
| 1563 | .idivq_to_divl, | |
| 1564 | .invpcid, | |
| 1565 | .lzcnt, | |
| 1566 | .macrofusion, | |
| 1567 | .mmx, | |
| 1568 | .movbe, | |
| 1569 | .movdir64b, | |
| 1570 | .movdiri, | |
| 1571 | .no_bypass_delay_blend, | |
| 1572 | .no_bypass_delay_mov, | |
| 1573 | .no_bypass_delay_shuffle, | |
| 1574 | .nopl, | |
| 1575 | .pconfig, | |
| 1576 | .pku, | |
| 1577 | .popcnt, | |
| 1578 | .prefer_movmsk_over_vtest, | |
| 1579 | .prfchw, | |
| 1580 | .ptwrite, | |
| 1581 | .rdpid, | |
| 1582 | .rdrnd, | |
| 1583 | .rdseed, | |
| 1584 | .sahf, | |
| 1585 | .serialize, | |
| 1586 | .sha, | |
| 1587 | .sha512, | |
| 1588 | .shstk, | |
| 1589 | .slow_3ops_lea, | |
| 1590 | .sm3, | |
| 1591 | .sm4, | |
| 1592 | .tuning_fast_imm_vector_shift, | |
| 1593 | .uintr, | |
| 1594 | .vaes, | |
| 1595 | .vpclmulqdq, | |
| 1596 | .vzeroupper, | |
| 1597 | .waitpkg, | |
| 1598 | .widekl, | |
| 1599 | .x87, | |
| 1600 | .xsavec, | |
| 1601 | .xsaveopt, | |
| 1602 | .xsaves, | |
| 1603 | }), | |
| 1604 | }; | |
| 1605 | 1526 | pub const athlon = CpuModel{ |
| 1606 | 1527 | .name = "athlon", |
| 1607 | 1528 | .llvm_name = "athlon", |
src/Module.zig+2| ... | ... | @@ -5976,6 +5976,8 @@ pub fn atomicPtrAlignment( |
| 5976 | 5976 | => 128, |
| 5977 | 5977 | |
| 5978 | 5978 | .x86_64 => if (std.Target.x86.featureSetHas(target.cpu.features, .cx16)) 128 else 64, |
| 5979 | ||
| 5980 | .spirv => @panic("TODO what should this value be?"), | |
| 5979 | 5981 | }; |
| 5980 | 5982 | |
| 5981 | 5983 | const int_ty = switch (ty.zigTypeTag(mod)) { |
src/codegen/llvm.zig+30-13| ... | ... | @@ -92,6 +92,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 { |
| 92 | 92 | .hsail64 => "hsail64", |
| 93 | 93 | .spir => "spir", |
| 94 | 94 | .spir64 => "spir64", |
| 95 | .spirv => "spirv", | |
| 95 | 96 | .spirv32 => "spirv32", |
| 96 | 97 | .spirv64 => "spirv64", |
| 97 | 98 | .kalimba => "kalimba", |
| ... | ... | @@ -109,8 +110,6 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 { |
| 109 | 110 | |
| 110 | 111 | const llvm_os = switch (target.os.tag) { |
| 111 | 112 | .freestanding => "unknown", |
| 112 | .ananas => "ananas", | |
| 113 | .cloudabi => "cloudabi", | |
| 114 | 113 | .dragonfly => "dragonfly", |
| 115 | 114 | .freebsd => "freebsd", |
| 116 | 115 | .fuchsia => "fuchsia", |
| ... | ... | @@ -123,7 +122,6 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 { |
| 123 | 122 | .windows => "windows", |
| 124 | 123 | .zos => "zos", |
| 125 | 124 | .haiku => "haiku", |
| 126 | .minix => "minix", | |
| 127 | 125 | .rtems => "rtems", |
| 128 | 126 | .nacl => "nacl", |
| 129 | 127 | .aix => "aix", |
| ... | ... | @@ -134,7 +132,6 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 { |
| 134 | 132 | .ps5 => "ps5", |
| 135 | 133 | .elfiamcu => "elfiamcu", |
| 136 | 134 | .mesa3d => "mesa3d", |
| 137 | .contiki => "contiki", | |
| 138 | 135 | .amdpal => "amdpal", |
| 139 | 136 | .hermit => "hermit", |
| 140 | 137 | .hurd => "hurd", |
| ... | ... | @@ -148,10 +145,17 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 { |
| 148 | 145 | .driverkit => "driverkit", |
| 149 | 146 | .shadermodel => "shadermodel", |
| 150 | 147 | .liteos => "liteos", |
| 148 | .xros => "xros", | |
| 149 | .serenity => "serenity", | |
| 150 | .vulkan => "vulkan", | |
| 151 | ||
| 151 | 152 | .opencl, |
| 152 | 153 | .glsl450, |
| 153 | .vulkan, | |
| 154 | 154 | .plan9, |
| 155 | .ananas, | |
| 156 | .cloudabi, | |
| 157 | .minix, | |
| 158 | .contiki, | |
| 155 | 159 | .other, |
| 156 | 160 | => "unknown", |
| 157 | 161 | }; |
| ... | ... | @@ -216,10 +220,18 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 { |
| 216 | 220 | |
| 217 | 221 | pub fn targetOs(os_tag: std.Target.Os.Tag) llvm.OSType { |
| 218 | 222 | return switch (os_tag) { |
| 219 | .freestanding, .other, .opencl, .glsl450, .vulkan, .plan9 => .UnknownOS, | |
| 223 | .freestanding, | |
| 224 | .other, | |
| 225 | .opencl, | |
| 226 | .glsl450, | |
| 227 | .plan9, | |
| 228 | .ananas, | |
| 229 | .cloudabi, | |
| 230 | .minix, | |
| 231 | .contiki, | |
| 232 | => .UnknownOS, | |
| 233 | ||
| 220 | 234 | .windows, .uefi => .Win32, |
| 221 | .ananas => .Ananas, | |
| 222 | .cloudabi => .CloudABI, | |
| 223 | 235 | .dragonfly => .DragonFly, |
| 224 | 236 | .freebsd => .FreeBSD, |
| 225 | 237 | .fuchsia => .Fuchsia, |
| ... | ... | @@ -233,7 +245,6 @@ pub fn targetOs(os_tag: std.Target.Os.Tag) llvm.OSType { |
| 233 | 245 | .solaris, .illumos => .Solaris, |
| 234 | 246 | .zos => .ZOS, |
| 235 | 247 | .haiku => .Haiku, |
| 236 | .minix => .Minix, | |
| 237 | 248 | .rtems => .RTEMS, |
| 238 | 249 | .nacl => .NaCl, |
| 239 | 250 | .aix => .AIX, |
| ... | ... | @@ -245,8 +256,8 @@ pub fn targetOs(os_tag: std.Target.Os.Tag) llvm.OSType { |
| 245 | 256 | .elfiamcu => .ELFIAMCU, |
| 246 | 257 | .tvos => .TvOS, |
| 247 | 258 | .watchos => .WatchOS, |
| 259 | .xros => .XROS, | |
| 248 | 260 | .mesa3d => .Mesa3D, |
| 249 | .contiki => .Contiki, | |
| 250 | 261 | .amdpal => .AMDPAL, |
| 251 | 262 | .hermit => .HermitCore, |
| 252 | 263 | .hurd => .Hurd, |
| ... | ... | @@ -255,6 +266,8 @@ pub fn targetOs(os_tag: std.Target.Os.Tag) llvm.OSType { |
| 255 | 266 | .driverkit => .DriverKit, |
| 256 | 267 | .shadermodel => .ShaderModel, |
| 257 | 268 | .liteos => .LiteOS, |
| 269 | .vulkan => .Vulkan, | |
| 270 | .serenity => .Serenity, | |
| 258 | 271 | }; |
| 259 | 272 | } |
| 260 | 273 | |
| ... | ... | @@ -310,6 +323,9 @@ pub fn targetArch(arch_tag: std.Target.Cpu.Arch) llvm.ArchType { |
| 310 | 323 | .hsail64 => .hsail64, |
| 311 | 324 | .spir => .spir, |
| 312 | 325 | .spir64 => .spir64, |
| 326 | .spirv => .spirv, | |
| 327 | .spirv32 => .spirv32, | |
| 328 | .spirv64 => .spirv64, | |
| 313 | 329 | .kalimba => .kalimba, |
| 314 | 330 | .shave => .shave, |
| 315 | 331 | .lanai => .lanai, |
| ... | ... | @@ -318,7 +334,7 @@ pub fn targetArch(arch_tag: std.Target.Cpu.Arch) llvm.ArchType { |
| 318 | 334 | .renderscript32 => .renderscript32, |
| 319 | 335 | .renderscript64 => .renderscript64, |
| 320 | 336 | .ve => .ve, |
| 321 | .spu_2, .spirv32, .spirv64 => .UnknownArch, | |
| 337 | .spu_2 => .UnknownArch, | |
| 322 | 338 | }; |
| 323 | 339 | } |
| 324 | 340 | |
| ... | ... | @@ -11969,6 +11985,9 @@ pub fn initializeLLVMTarget(arch: std.Target.Cpu.Arch) void { |
| 11969 | 11985 | .shave, |
| 11970 | 11986 | .spir, |
| 11971 | 11987 | .spir64, |
| 11988 | .spirv, | |
| 11989 | .spirv32, | |
| 11990 | .spirv64, | |
| 11972 | 11991 | .kalimba, |
| 11973 | 11992 | .renderscript32, |
| 11974 | 11993 | .renderscript64, |
| ... | ... | @@ -11978,7 +11997,5 @@ pub fn initializeLLVMTarget(arch: std.Target.Cpu.Arch) void { |
| 11978 | 11997 | => {}, |
| 11979 | 11998 | |
| 11980 | 11999 | .spu_2 => unreachable, // LLVM does not support this backend |
| 11981 | .spirv32 => unreachable, // LLVM does not support this backend | |
| 11982 | .spirv64 => unreachable, // LLVM does not support this backend | |
| 11983 | 12000 | } |
| 11984 | 12001 | } |
src/target.zig+1| ... | ... | @@ -159,6 +159,7 @@ pub fn hasLlvmSupport(target: std.Target, ofmt: std.Target.ObjectFormat) bool { |
| 159 | 159 | .hsail64, |
| 160 | 160 | .spir, |
| 161 | 161 | .spir64, |
| 162 | .spirv, | |
| 162 | 163 | .spirv32, |
| 163 | 164 | .spirv64, |
| 164 | 165 | .kalimba, |